Conversation
98b777f to
e4ad0c9
Compare
| ->booleanNode('hydra')->defaultNull()->info('Include this parameter in Hydra documentation.')->end() | ||
| ->variableNode('constraints')->defaultNull()->info('Validation constraints.')->end() | ||
| ->scalarNode('security')->defaultNull()->info('The security expression.')->end() | ||
| ->scalarNode('security_message')->defaultNull()->info('The security message.')->end() |
There was a problem hiding this comment.
Couldn't you use the defineDefault method of this class? It makes this automatic.
soyuka
left a comment
There was a problem hiding this comment.
Could you use the automatic method for configuration? the rest is awesome!
e4ad0c9 to
f41ef4c
Compare
1da905e to
88619ac
Compare
|
Also changed the priority of Currently, when changing the priority of |
|
It's a hard problem + there's no bc-layer on priorities... I suggest to merge the code of your default factory to the one handling parameters. I know it'll be more code in a class but it keeps a better responsibility over this in my opinion. |
bfab314 to
2d31329
Compare
| return new $parameterClass( | ||
| key: $config['key'] ?? null, | ||
| schema: $config['schema'] ?? null, | ||
| openApi: null, | ||
| provider: null, | ||
| filter: $config['filter'] ?? null, | ||
| property: $config['property'] ?? null, | ||
| description: $config['description'] ?? null, | ||
| properties: null, | ||
| required: $config['required'] ?? false, | ||
| priority: $config['priority'] ?? null, | ||
| hydra: $config['hydra'] ?? null, | ||
| constraints: $config['constraints'] ?? null, | ||
| security: $config['security'] ?? null, | ||
| securityMessage: $config['security_message'] ?? null, | ||
| extraProperties: $config['extra_properties'] ?? [], | ||
| filterContext: null, | ||
| nativeType: null, | ||
| castToArray: null, | ||
| castToNativeType: null, | ||
| castFn: null, | ||
| default: $config['default'] ?? null, | ||
| filterClass: $config['filter_class'] ?? null, | ||
| ); |
There was a problem hiding this comment.
create a an array and name convert all the keys so that you can call __construct with arguments (programatically) we know they match as the configuration does it the other way around
2d31329 to
87829ee
Compare
…to ParameterValidationResourceMetadataCollectionFactory
3e4abbb to
12fb7fb
Compare
Description
This PR allows to define global default parameters that are applied to all resources instead of configuring the parameter individually on each resource.
Before
#[ApiResource( operations: [ new GetCollection( parameters: [ new HeaderParameter( key: 'X-API-Token', required: true, description: 'API Token', ), ], ), ], )] class Book { }#[ApiResource( operations: [ new GetCollection( parameters: [ new HeaderParameter( key: 'X-API-Token', required: true, description: 'API Token', ), ], ), ], )] class Author { }After
Other exemple with two Parameter