Custom parameter mapping types
northys opened this issue · comments
When I saw this part of documentation about overriding mapping datatypes I immediately created my own UuidTypeMapper
and registered it like
api:
plugins:
Apitte\Core\DI\Plugin\CoreMappingPlugin:
types:
uuid: App\Api\Mapping\Parameter\UuidTypeMapper
This is not supported though. Is there any way to add custom parameter mapping types? I'm not yet much familiar with the library codebase but from what I already saw it shouldn't be hard to implement. Maybe I could take a look at it but not this month. I have to finish something before deadline :D
Now I'm confused about dupllication of checks in multiple plugin and I think this must be fixed to implement this. Validation in CoreSchemaPlugin raises exception https://github.com/apitte/core/blob/c99c923ba006896a685a5d5b27fcdcc7d9432e49/src/Schema/Validation/RequestParameterValidation.php#L48 using in_array check inside array of hardcoded types. While CoreMappingPlugin does the actual mapping and is the one who registers the mappers. This array of mappers (their keys respectively) must be somehow passed to RequestParameterValidation
inside CoreSchemaPlugin
.
I see. Validation is a problem here. Great report.
@f3l1x Is there any work done on this already? In one of our apps it would be very useful to define custom types. I can try to prepare PR
Just btw - I'm no longer a programmer so I can't check it nor test it...
Done in #187