Allow for custom types in path params serialization (and maybe other places serialization too) #1660
Labels
enhancement
New feature or request
openapi-fetch
Relevant to the openapi-fetch library
PRs welcome
PRs are welcome to solve this issue!
Description
In an OpenAPI spec we have some type that are annotated with a specific format:
You can also imagine having other format for the same JS primitive (emails, for example).
We want to leverage this format to enforce some checks on the format, and build "safe value".
To do so:
The problem lies in the usage with the fetch api:
Proposal
In the method
defaultPathSerializer
, the path parameters value's are tested in this order:If changed to the following it would allow custom string formats.
Another possibility would be to allow passing a custom path serializer in the api builder, as the query and the body serializers.
Checklist
The text was updated successfully, but these errors were encountered: