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

$ref external yaml file does not work

Open zcb22000 opened this issue 9 years ago • 6 comments

When reporting a bug, please provide the following details:

  • swagger-ui master version
  • a swagger file reproducing the issue I use the dist folder files in master, and use $ref to reference external yaml file, but it can't resolved. my yaml format is :
  parameters:
    -
      name: request
      in: body
      required: true
      schema:
        $ref: './deviceManageDF.yaml#/definitions/AddDeviceDTONA2Cloud'

even modified with full acess path as:

  parameters:
    -
      name: request
      in: body
      required: true
      schema:
        $ref: 'http://localhost:8080/swagger-ui/deviceManageDF.yaml#/definitions/AddDeviceDTONA2Cloud'

It displayed: http://localhost:8080/swagger-ui/deviceManageDF.yaml#/definitions/AddDeviceDTOCloud2NA is not defined!

zcb22000 avatar Feb 25 '17 08:02 zcb22000

are you hosting your swagger-ui or running it simply by opening the index.html?

webron avatar Feb 26 '17 21:02 webron

Thanks. I am hosting my swagger-ui in my project with restful api services.

zcb22000 avatar Feb 27 '17 00:02 zcb22000

When running the hosted app, do you get the file when you open http://localhost:8080/swagger-ui/deviceManageDF.yaml in your browser or use curl?

webron avatar Feb 27 '17 01:02 webron

Yes, I can open http://localhost:8080/swagger-ui/deviceManageDF.yaml in my brower

zcb22000 avatar Feb 27 '17 01:02 zcb22000

There is several REST interfaces in my index yaml file, and $ref to muti definition files. the ref to appSecurityDF.yaml#/definitions/RefreshTokenDTONA2Cloud is fine resolved, but ref to deviceManageDF.yaml#/definitions/AddDeviceDTONA2Cloud can't resoved.

zcb22000 avatar Feb 27 '17 02:02 zcb22000

It is the reason of https://github.com/swagger-api/swagger-ui/issues/2697

zcb22000 avatar Feb 27 '17 10:02 zcb22000