swagger-ui: Relative references (still) don't work?
Hi,
Question: I see that issue #1093, as well as the issue 417 on swagger.js are marked as closed. But it still does not seem to work for me. Am I doing something wrong? Am I missing some configurations?
The API shows, but the reference is not resolved. It displays an empty model for the reference:
Dog {
name (string, optional),
owner (people.yml#/Owner, optional)
}
people.yml#/Owner {
}
The following test files were used to get to this result. These three yml files are placed in the root of the swagger-ui directory. Swagger-ui is loaded via http://localhost/swagger/. I’ve updated index.html accordingly.
dog.yml is the API entry point and contains:
swagger: '2.0'
info:
version: '1'
title: Reference check
basePath: /api
definitions:
Dog:
title: "Dog"
properties:
name:
type: string
owner:
$ref: 'people.yml#/Owner'
paths:
/Dogs:
get:
summary: Gets an 'A'
parameters:
- name: name
in: query
type: string
responses:
200:
description: Found!
schema:
$ref: '#/definitions/Dog'
people.yml contains:
Owner:
title: "A Dog owner"
properties:
person:
$ref: "#/Person"
since:
type: string
format: date-time
Person:
title: "Somebody"
properties:
name:
type: string
address:
$ref: 'address.yml'
and finally address.yml contains:
Address:
title: An address
properties:
street:
type: string
number:
type: int
What do I need to do to make this work? I’ve tried this with the latest develop_20 version (using the dist folder contents)
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 17 (3 by maintainers)
Commits related to this issue
- Initial Gruntfile * Only `grunt test` works right now, testing for https://github.com/swagger-api/swagger-ui/issues/1456 — committed to ex-nerd/swagger-example by ex-nerd 9 years ago
@dtoro which version of swagger-ui are you testing?