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

Parser ignore the description if it's a $ref

Open albator1932 opened this issue 5 years ago • 3 comments

As said in the title, latest stable release ignores the description if it's a $ref. It looks like a regression to me because it was working properly a few versions back (can't be sure when, I found at using a code generator).

[main] INFO  o.o.codegen.DefaultCodegen - debugging Cateogry: class Schema {
    type: null
    format: null
    $ref: #/components/schemas/Category
    description: null
    title: null
    multipleOf: null
    maximum: null
    exclusiveMaximum: null
    minimum: null
    exclusiveMinimum: null
    maxLength: null
    minLength: null
    pattern: null
    maxItems: null
    minItems: null
    uniqueItems: null
    maxProperties: null
    minProperties: null
    required: null
    not: null
    properties: null
    additionalProperties: null
    nullable: null
    readOnly: null
    writeOnly: null
    example: null
    externalDocs: null
    deprecated: null
    discriminator: null
    xml: null
}

description is null even though I put down something as follows:

       category:
         $ref: '#/definitions/Category'
        description: "description testing"

albator1932 avatar May 03 '19 15:05 albator1932

For info: Having any property set next to $ref is not a valid OpenAPI document. See https://github.com/OAI/OpenAPI-Specification/issues/556 for details. (you will see my comments and a lot of other telling that $ref+ description would make sense)

jmini avatar May 04 '19 09:05 jmini

Hi, please check https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#reference-object

This object cannot be extended with additional properties and any properties added SHALL be ignored.

gracekarina avatar May 04 '19 21:05 gracekarina

I have the same problem, how can I get the description?

michaelwangwangwang avatar Jul 05 '22 11:07 michaelwangwangwang