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
operationId is an optional unique string used to identify an operation. If provided, these IDs must be unique among all operations described in your API.
This is important because things downstream of the spec (such as generated clients) may use the operationId (e.g. to code-generate methods) in such a way that depends on unique operationIds.
However, it looks like Rebar's OpenAPI spec generation uses the function name to generate operationIds, which need not be unique:
This may not be a terribly big deal in practice, since the moment you try to use such a registry with a Flask app, Flask's own duplication checking (of endpoint names) prevents you from doing so:
However, it still seems preferable to make Rebar's OpenAPI spec generation smart enough to not generate invalid specs in this way. I think Rebar should instead raise an error telling the user to provide a unique function name to avoid generating duplicate operationIds, or perhaps better yet, the @registry.handles() decorators (and so forth) could accept an operation_id param that allows the user to explicitly set the associated operationId that gets generated into the spec, making the operationId no longer tied to the Python function name 1-to-1. (A non-option, IMO, would be for Rebar to silently append some number to deduplicate what would otherwise be a duplicate operationId, which I've seen some Swagger tooling do, and it causes all kinds of madness.)
The text was updated successfully, but these errors were encountered:
https://swagger.io/docs/specification/paths-and-operations/#operationid
This is important because things downstream of the spec (such as generated clients) may use the
operationId
(e.g. to code-generate methods) in such a way that depends on uniqueoperationId
s.However, it looks like Rebar's OpenAPI spec generation uses the function name to generate
operationId
s, which need not be unique:(Click for full spec output)
This may not be a terribly big deal in practice, since the moment you try to use such a registry with a Flask app, Flask's own duplication checking (of endpoint names) prevents you from doing so:
However, it still seems preferable to make Rebar's OpenAPI spec generation smart enough to not generate invalid specs in this way. I think Rebar should instead raise an error telling the user to provide a unique function name to avoid generating duplicate
operationId
s, or perhaps better yet, the@registry.handles()
decorators (and so forth) could accept anoperation_id
param that allows the user to explicitly set the associatedoperationId
that gets generated into the spec, making theoperationId
no longer tied to the Python function name 1-to-1. (A non-option, IMO, would be for Rebar to silently append some number to deduplicate what would otherwise be a duplicateoperationId
, which I've seen some Swagger tooling do, and it causes all kinds of madness.)The text was updated successfully, but these errors were encountered: