Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in definition of callbacks #1856

Closed
ThomasR opened this issue Mar 2, 2019 · 2 comments
Closed

Bug in definition of callbacks #1856

ThomasR opened this issue Mar 2, 2019 · 2 comments
Labels

Comments

@ThomasR
Copy link

ThomasR commented Mar 2, 2019

I'm talking about the callbacks field callbacks :== Map[string, Callback Object | Reference Object]

The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

both defined in
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#operationObject
and
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#callbackObject

This means that this is a valid callbacks map:

callbacks:
  "$request.query.queryUrl": # key value used to identify the callback object
    <CallbackObject>
  "$url":  # key value used to identify the callback object
    <CallbackObject>

Now, by definition of a Callback Object:

The key that identifies the Path Item Object is a runtime expression that can be evaluated in the context of a runtime HTTP request/response to identify the URL to be used for the callback request.

https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#key-expression

so we end up with some mess like this:

callbacks:
  "$request.query.queryUrl": # key value used to identify the callback object
    "$request.query.queryUrl": # key that identifies the Path Item Object
      <PathItemObject>
    "$url": # key that identifies the Path Item Object
      <PathItemObject>
  "$url":  # key value used to identify the callback object
    "$request.query.queryUrl":  # key that identifies the Path Item Object
      <PathItemObject>
    "$url": # key that identifies the Path Item Object
      <PathItemObject>

This makes no sense to me and I'm assuming it's a bug. Reading through #1141, I think that the intention was to make this example valid

callbacks:
  "foo":
    <CallbackObject>
  "bar":
    <CallbackObject>

but it's not, because the literals "foo", "bar" are not runtime expressions.

ahl pushed a commit to ahl/OpenAPI-Specification that referenced this issue Apr 19, 2019
@ahl
Copy link

ahl commented Apr 19, 2019

You might check out these docs:
https://swagger.io/docs/specification/callbacks/

@MikeRalphson
Copy link
Member

Think this can be closed as #1899 was merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants