You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The actual path of the endpoints that we define is only used in the comment or documentation of the operations. It would be useful to have the string of the path, /greet and /count in the above example, available in the Swift code as well.
One use case that I encountered was when I was making a request to a third-party API. I provide a webhook URL, meaning when the third party finishes, they will call back my endpoint that I defined in my OpenAPI YAML file for the webhook requests. In this case, I need to pass this path to this third-party provider. It would be nice to have it type-safe from changes in the OpenAPI path namings.
Proposed solution
For the simple paths this can be straightforward a constant in the Operations enum. But for the paths that have parameters in them, we might use a simple function with path parameters as its arguments.
this is an interesting use case, I agree that for webhooks, this could be useful.
I wonder if a function wouldn't work better here, as it'd allow us to express all the parameters to the path, including future defaulted ones, consistently:
but it is fileprivate and UniversalServer is not directly used. We simply conform to APIProtocol, and registerHandlers of APIProtocol has an instance of UniversalServer.
Motivation
The actual path of the endpoints that we define is only used in the comment or documentation of the operations. It would be useful to have the string of the path,
/greet
and/count
in the above example, available in the Swift code as well.One use case that I encountered was when I was making a request to a third-party API. I provide a webhook URL, meaning when the third party finishes, they will call back my endpoint that I defined in my OpenAPI YAML file for the webhook requests. In this case, I need to pass this path to this third-party provider. It would be nice to have it type-safe from changes in the OpenAPI path namings.
Proposed solution
For the simple paths this can be straightforward a constant in the Operations enum. But for the paths that have parameters in them, we might use a simple function with path parameters as its arguments.
If we have a yaml like
then
we can make use of the type of the path parameter
Alternatives considered
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: