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

what method to use when link objects use operationRef #1688

Closed
dret opened this issue Sep 15, 2018 · 7 comments
Closed

what method to use when link objects use operationRef #1688

dret opened this issue Sep 15, 2018 · 7 comments

Comments

@dret
Copy link
Contributor

dret commented Sep 15, 2018

i may just not be able to find it, but it seems to me that when link objects use operationRef (instead of operationId), it is not specified which method to use for the request? i am looking at the examples ar https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#operationref-examples and wonder how an actual request would look like. i don't know how to figure out which method to use.

@MikeRalphson
Copy link
Member

The operationRef is a reference into an OAS document which points at an operation object. The key of that object (the last component of the operationRef) is the HTTP method to use.

links:
  UserRepositories:
    # returns array of '#/components/schemas/repository'
    operationRef: '#/paths/~12.0~1repositories~1{username}/get'
    parameters:
      username: $response.body#/username

here the method is get.

@MikeRalphson
Copy link
Member

@dret does this answer your query?

@dret
Copy link
Contributor Author

dret commented Oct 27, 2018

not quite, but thanks for looking into this. i am still wondering: clients are expected to parse the URI and extract the last component of the path in the fragment identifier? if that's the logic they're supposed to use, that should be documented. if there's a different way (this way seems sort of brittle and not easy to implement, in particular given that the URI syntax has no concept of paths in fragments identifiers, and thus URI parsers wouldn't help with implementing this), that should be documented instead.

@MikeRalphson
Copy link
Member

It's not the URI format which dictates the way fragments are interpreted. As I'm lead to understand, it is the mediatype. Here that is (effectively) application/json so JSON reference rules are used.

It is the tooling interpreting the OAS document which needs to parse and follow the operationRef (not a runtime client interpreting a response), so it is relatively simple for that tool to recognise it has reached an operation object where (in this case) get is the last component of the ref - and thus the method to use.

@dret
Copy link
Contributor Author

dret commented Oct 27, 2018 via email

@MikeRalphson
Copy link
Member

Thanks for the PR!

@handrews
Copy link
Member

Sounds like there was a PR and this was resolved - closing.

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

No branches or pull requests

3 participants