IdoPesok / zsa

https://zsa.vercel.app
MIT License
763 stars 23 forks source link

Use different path param name #65

Closed blechatellier closed 4 months ago

blechatellier commented 4 months ago

Would you consider changing the path param name in routes to use : instead of {} which is consistent with nextjs and other framework naming convention?

/api/:organizationId instead of /api/{organizationId}

IdoPesok commented 4 months ago

Hi, I actually initially had it that way -- but realized that is not the OpenAPI standard.

Path templating refers to the usage of template expressions, delimited by curly braces ({}), to mark a section of a URL path as replaceable using path parameters.

Source: https://swagger.io/specification/#path-templating

That being said, I think it is reasonable to support both. I concur with the point that : is what people coming from nextjs are used to so it would cause less friction. What I am thinking of doing is when you add a path, a small regex that will convert all the :organizationId to {organizationId} and that should be enough to support both.

IdoPesok commented 4 months ago

Give it a shot! Just released zsa-openapi@0.0.7

blechatellier commented 4 months ago

@IdoPesok you are machine, thanks for that - happy to contribute too.