Skip to content

$ref in response example #544

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

Closed
paulprogrammer opened this issue Jan 18, 2016 · 6 comments
Closed

$ref in response example #544

paulprogrammer opened this issue Jan 18, 2016 · 6 comments

Comments

@paulprogrammer
Copy link

I would like to use $ref in the response example in order to break up my specification into more readily manageable chunks. Examples also benefit from being externalized because they can be easily revisioned, and included verbatim in reference implementations.

desired structure:

      responses:
        200:
          description: Success
          schema:
            $ref: 'profile-models.yaml#/ProfileSearchResponse'
          examples:
            application/json:
              $ref: 'ProfileExample.yaml#/ProfileSearchResponseExample'

Today, the children of examples are included directly, meaning the example itself using this example is:

{
  "$ref": "ProfileExample.yaml#/ProfileSearchResponseExample"
}
@paulprogrammer
Copy link
Author

This issue arose from a discussion on swagger-ui:

swagger-api/swagger-ui#1882

@crankydillo
Copy link

Hi,

Does this same issue exist for the example field within the schema object? If so, will that be addressed as well?

Basically, we'd like the option to $ref in examples everywhere an example can be specified.

Thanks!

@jharmn
Copy link
Contributor

jharmn commented Jan 25, 2016

The revised guidelines for external file usage should help clarify this once merged: #535

@fehguy
Copy link
Contributor

fehguy commented Mar 1, 2016

Parent issue #560

@paulprogrammer
Copy link
Author

We resolved this during build process by using the json-refs tool to resolve references before delivery of the final artifacts.

@webron
Copy link
Member

webron commented Mar 3, 2017

You can do that now! 😱

@webron webron closed this as completed Mar 3, 2017
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

5 participants