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

Description and summary properties support for referenceObject

Open yehor-manzhula opened this issue 3 years ago • 9 comments

Open Api Specification 3.1.0 allows description and summary properties for referenceObject, so schema like in example is valid:

Home:
      type: object
      properties:
        home_address:
                 description: "its the home address"
                 $ref: '#/components/schemas/Address'
Office:
      type: object
      properties:
        office_address:
                 description: "its the office address"
                 $ref: '#/components/schemas/Address'

But it is not supported either by swagger-ui nor swagger-edior.

yehor-manzhula avatar Sep 07 '21 13:09 yehor-manzhula

Is this issue fixed? I do not see any pull request reference in any of the issues #3419 or #4013

avantipande1 avatar Oct 04 '21 06:10 avantipande1

@avantipande1 No it is not

yehor-manzhula avatar Oct 04 '21 12:10 yehor-manzhula

Still not fixed I guess, I would like to have a look. @frantuma which is the branch developing OAS3.1 compatibility?

gcatanese avatar Apr 21 '22 07:04 gcatanese

@gcatanese swagger-core oas 3.1 effort has been merged into master branch (and is part of latest release). This means that a ref with description and/or summary siblings (for non JSON Schema constructs) or any sibling field (for JSON Schema) will be supported in serialization/deserialization and representation. Effort to support parsing/validaton/resolving of OAS 3.1 in swagger-parser is still ongoing.

However the original question refer to swagger-ui and swagger-editor, so possibly this ticket is misplaced, as both are javascript projects not depenent on swagger-core (this repo). Effort for OAS 3.1 support in UI and Editor is ongoing but no ETA yet.

frantuma avatar Apr 21 '22 13:04 frantuma

@frantuma Thanks for letting me know, I am happy to help if there are open issues (core, parser) and you would like some help. Great effort so far!

gcatanese avatar Apr 22 '22 08:04 gcatanese

I'm still under the impression that we can not generate $refs with descriptions using 2.2.7. I'm trying to get the swagger-gradle-plugin to generate 3.1 specs by calling ResolveTask#setOpenAPI31() but that isn't working for me. Is there a README or instructions on how to generate these if this feature is indeed supported?

jackoneall avatar Jan 03 '23 21:01 jackoneall

@jackoneall have you found a way to generate a description as sibling for $refs?

jdmmnn avatar Apr 27 '23 07:04 jdmmnn

@jackoneall have you found a way to generate a description as sibling for $refs?

No, I have not. I've given up on the prospect so the answer won't be coming from me.

jackoneall avatar May 01 '23 19:05 jackoneall

Maybe we should also wait for https://github.com/swagger-api/swagger-core/issues/4398

Not only description field, but also deprecated field, x-* extension field should be allowed in it.

xiaoxiangmoe avatar May 07 '23 16:05 xiaoxiangmoe