jensoleg / swagger-ui

Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
http://swagger.io
Other
1.13k stars 310 forks source link

Deeper reference does not work #82

Open piotrjozwiak opened 7 years ago

piotrjozwiak commented 7 years ago

Hi guys I have litte problem with references, which are working fine on swaggerhub editor.

When I do reference somenthing like this:

definitions:

  my_response:
    description: Successful response schema
    properties:
      result:
        type: string
        example: 1
      err_code:
        $ref: "#/definitions/my_error_codes"

it works but when I try to reference to exact property of other definiton like this:

 my_response:
    description: Successful response schema
    properties:
      result:
        type: string
        example: 1
      err_code:
        $ref: "#/definitions/my_error_codes/properties/err_code"

I have got error in google chrome browser:

Uncaught TypeError: Cannot read property 'definition' of undefined
    at addReference (operation.js:314)
    at primitiveToHTML (operation.js:334)
    at operation.js:550
    at createHybridWrapper.js:71
    at initCloneByTag.js:18
    at baseForOwn (composeArgs.js:19)
    at initCloneArray.js:12
    at baseMap (createHybridWrapper.js:70)
    at Object.map (baseIndexOf.js:26)
    at processModel (operation.js:527)

Can you fix this?