fern icon indicating copy to clipboard operation
fern copied to clipboard

[Feature] Wildcard path variable support

Open mmadson opened this issue 1 year ago • 2 comments

Not sure if this is already supported -- if it is I suppose this is a docs improvement request. If not I suppose it's a feature request.

We have an api of the form /someRootPathSegment/{wildcardPathVar}

For example a request to:

/someRootPathSegment/foo/bar/baz

should be valid and the value of wildcardPathVar should be foo/bar/baz

To date, the openapi spec doesn't support these kinds of path variables, though some frameworks on top of openapi do support it like Connexion.

See: https://stackoverflow.com/questions/42335178/swagger-wildcard-path-parameters

Curious if Fern supports these kinds of path variables and if so an example of defining them and if not, hoping you might consider supporting it in your fern spec definition files as an improvement over openapi.

Thanks and keep up the great work.

mmadson avatar Jul 26 '24 07:07 mmadson

@mmadson interesting -- it would be valuable to understand what you are planning to use Fern for and why this would be important? For example, if you are using Fern for SDK generation that would mean a user would need to pass in /a/b/c into the SDK for that path parameter

dsinghvi avatar Aug 01 '24 07:08 dsinghvi

@dsinghvi thanks for the response -- we're primarily considering Fern as an api documentation generation tool for our existing APIs. We might consider sdk generation in the future though. And your example of passing in "/a/b/c" or more accurately "a/b/c" given my previous example, is correct. Our api takes in file-path like variables as wildcard path params. Thanks for your consideration.

mmadson avatar Aug 01 '24 12:08 mmadson

@mmadson are you still considering an API Docs tool? We're working on improvements to our OpenAPI parsing logic and this could be in scope.

dannysheridan avatar Dec 14 '24 19:12 dannysheridan

@mmadson are you still considering an API Docs tool? We're working on improvements to our OpenAPI parsing logic and this could be in scope.

Hey @dannysheridan , thanks for following up. We're using a combination of tools at the moment and don't think we've found the holy grail API doc tool, this feature would definitely be on our list and would make fern much more appealing. Looking forward to seeing what y'all cook up and hope you consider adding support for this.

Thanks

mmadson avatar Dec 15 '24 08:12 mmadson

@mmadson working with users to figure out that holy grail experience is the most fun part of my job.

We can support this feature in a first-class way within the Fern Definition. The only downside on my mind is that you wouldn't be able to use our OpenAPI Exporter for routes that have a wildcard path variable (as OpenAPI doesn't support it.) Up to schedule time for us to go over requirements? https://buildwithfern.com/contact

dannysheridan avatar Dec 17 '24 15:12 dannysheridan

@mmadson working with users to figure out that holy grail experience is the most fun part of my job.

We can support this feature in a first-class way within the Fern Definition. The only downside on my mind is that you wouldn't be able to use our OpenAPI Exporter for routes that have a wildcard path variable (as OpenAPI doesn't support it.) Up to schedule time for us to go over requirements? https://buildwithfern.com/contact

Happy to jump on a call, will reach out soon. In the meantime you might consider having your openapi exporter support generating the openapi spec syntax that connexion adopted for specifying wildcard path params, as it looks pretty reasonable to me. If enough tools adopt it, perhaps the tail can wag the dog and it eventually winds up as part of the spec.

For details see this stack overflow answer describing the openapi spec example that connexion uses to represent wildcard path params.

https://stackoverflow.com/a/69200581

mmadson avatar Dec 17 '24 17:12 mmadson

Closing as this hasn't come up again. Can re-engage if it is an ongoing issue!

dannysheridan avatar Mar 03 '25 20:03 dannysheridan

@mmadson would this feature be valuable for you? (Dropped you a DM as well)

dannysheridan avatar Jul 08 '25 15:07 dannysheridan