swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

$ref doesn't work

Open mategvo opened this issue 10 years ago • 5 comments

Hey, first of all, great theme!

We have a fairly complex JSON file so we've created lots of smaller $ref reusable bits but they don't seem to load properly. The sample data is empty and parameters aren't loaded neither. Do you know how we can fix this?

Note that the final .json file is completely self-contained. The _$ref_s only refer to other parts of the .json file, not outside documents

mategvo avatar Nov 23 '15 17:11 mategvo

Following up to @mateuszgwozdz comment (we're working on the same project), I think it might be related to definitions that use allOf, for example:

  "definitions": {
    "Category": {
      "description": "A complete category model",
      "type": "object",
      "allOf": [
        {
          "$ref": "#/definitions/CategoryId"
        },
        {
          "$ref": "#/definitions/CategoryBase"
        },
        {
          "$ref": "#/definitions/CategoryImage"
        }
      ]
    },
    ...
  }

Could it be that your fork is behind the master source, and that it doesn't support parsing allOf entries?

cviebrock avatar Nov 23 '15 18:11 cviebrock

Seems that I've fixed the issue, copied the Resolution part of new swagger-ui.js and replaced in this one.

mategvo avatar Nov 23 '15 18:11 mategvo

could you elaborate on how you fixed this issue I'm getting the same problem when using allOf

davidyin1212 avatar Jun 07 '16 16:06 davidyin1212

I'm also wondering if you could elaborate on how you resolved this issue? I'm seeing the same problem when using allOf

jeremy-skelton-hs avatar Aug 08 '16 17:08 jeremy-skelton-hs

@mateuszgwozdz could you explain what you did or upload your fix somehow?

blockloop avatar Sep 22 '16 02:09 blockloop