Skip to content
New issue

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

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

Already on GitHub? # to your account

Definitions 'ref' is injected, not referenced #1

Closed
NadavK opened this issue Aug 9, 2015 · 6 comments
Closed

Definitions 'ref' is injected, not referenced #1

NadavK opened this issue Aug 9, 2015 · 6 comments

Comments

@NadavK
Copy link

NadavK commented Aug 9, 2015

In your example, foo.yaml contains a reference to the user definition:

ref: '#/definitions/User'

but this gets resolved to the actual object definition

swagger: '2.0'
  /bar:
    get:
      responses:
        '200':
          description: OK
          schema:
            type: object
            properties:
              name:
                type: string
definitions:
  User:
    type: object
    properties:
      name:
        type: string

instead of just including the ref as I would expect (is my expectation erroneous?)

swagger: '2.0'
  /bar:
    get:
      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/User'
definitions:
  User:
    type: object
    properties:
      name:
        type: string
@mohsen1
Copy link
Owner

mohsen1 commented Aug 9, 2015

It's a limitation of json-refs. Please follow whitlockjc/json-refs#27

@dylan-colaco
Copy link

Can this be done now?

@dylan-colaco
Copy link

It looks like json-refs can do it: whitlockjc/json-refs#125

@ClaudioConsolmagno
Copy link
Contributor

Reviving this somewhat old thread. What would it take to update the lib to the latest json-refs version? I could create a pull request to just update the version but is that going to be accepted?

@mohsen1
Copy link
Owner

mohsen1 commented Oct 8, 2018

@ClaudioConsolmagno I'll happily a PR doing that!

@ClaudioConsolmagno
Copy link
Contributor

@mohsen1 Took me a while but I finally created that PR (#21). Didn't want to simply update the versions in case it broke other functionality so also added a lightweight regression test as well.

@mohsen1 mohsen1 closed this as completed Mar 11, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants