Proposal: Generate path templating with colons instead of curly braces #1371
christoph-fricke
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Thanks for the kind words! Proposal-wise, this whole library is dependent upon OpenAPI’s conventions and standards. You’ve given an example of tools that use different standards from OpenAPI, but I’m not entirely sure how that applies because users are always starting from their schema when consuming this library. Could you maybe give a code example of what you’re proposing? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First of all, thank you for this awesome library! Generating lightweight type definitions and feeding them into a lightweight api-client is a breeze of fresh air compared to other open-api generators. Working with it is a real joy!
I have started to think about this library and how it can interact with other tooling. While thinking about it, I have noticed a gap between generated path string literals and the rest of the JavaScript ecosystem.
OpenAPI defines path templates as segments that are wrapped in curly braces, e.g.
/users/{id}
. This format is also used in the generated path literals. However, most (if not all) JavaScript libraries and proposals use colons for path templates, e.g./users/:id
. Some examples:Generating paths literals with colons could make it easier to combine the generated path types with these libraries, thus increasing the compatibility with the JS ecosystem.
I have been wondering if it is worth switching to a colon based path format. I would love to hear your thoughts and opinions about this. Have you thought about it before already?
Beta Was this translation helpful? Give feedback.
All reactions