Skip to content

Missing description on $ref #4829

New issue

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

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

Already on GitHub? Sign in to your account

Closed
RobertPaasche opened this issue Aug 23, 2018 · 2 comments
Closed

Missing description on $ref #4829

RobertPaasche opened this issue Aug 23, 2018 · 2 comments

Comments

@RobertPaasche
Copy link

RobertPaasche commented Aug 23, 2018

Q&A (please complete the following information)

  • OS: macOS, Windows, Linux
  • Browser: Any
  • Version: any
  • Swagger-UI version: 3.18.1]
  • Swagger/OpenAPI version: Swagger 2.0

Content & configuration

Example Swagger/OpenAPI definition:

"PersonDto": {
			"type": "object",
			"properties": {
				"salutation": {
					"description": "The selected salutation with all available translations.",
					"$ref": "#/definitions/LabelSetDto"
				},
				"position": {
					"description": "The selected position with all available translations.",
					"$ref": "#/definitions/LabelSetDto"
				}
			},
			"description": "Person data for a specific charset."
		}
  PersonDto:
    type: "object"
    properties:
      salutation:
        description: "The selected salutation with all available translations."
        $ref: "#/definitions/LabelSetDto"
      position:
        description: "The selected position with all available translations.",
        $ref: "#/definitions/LabelSetDto"

Describe the bug you're encountering

The description provided for salutation is not rendered at the response body.
image

@hkosova
Copy link
Contributor

hkosova commented Aug 23, 2018

Any keywords alongside $ref are ignored - that's how $ref works.

You need to wrap the $ref into allOf in order for the description to have effect:

  PersonDto:
    type: "object"
    properties:
      salutation:
        description: "The selected salutation with all available translations."
        allOf:
          - $ref: "#/definitions/LabelSetDto"
      position:
        description: "The selected position with all available translations.",
        allOf:
          - $ref: "#/definitions/LabelSetDto"

@RobertPaasche
Copy link
Author

Ok I had to create empty sub classes like the samples of swagger-api/swagger-core#1549 .

@lock lock bot locked and limited conversation to collaborators Aug 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants