Skip to content

pass through descriptions alongside interfaces #4

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

Merged
merged 2 commits into from
Apr 12, 2022

Conversation

hanakslr
Copy link
Contributor

@hanakslr hanakslr commented Apr 12, 2022

ReadMe and the OpenApi spec as well as a maintainer all say that as of 3.1 it is supported to provide a description alongside a $ref.

Additionally, as of OpenAPI 3.1, you can include summary and description fields in addition to the $ref pointer, which will override the summary and description fields of the referenced component. Everything else will be fully deferenced.

I modified the code to pass through the description field for interfaces. Any other fields will be rejected and error. This enables use to just use a description field instead of the union workaround below, which was causing issues with the generated client library.

schema:
     allOf:              
              - $interface: "IdentitySets#SameAsInterface"
              - type: "object"
                description: "test ref description"

can now be:

schema:
     $interface: "IdentitySets#SameAsInterface"
     description: "test ref description"

I verified that the generated code renders as expected in Readme and plays nicely with openapi-typescript. This resolves these two issues that Blake reported: #3 #2

@hanakslr hanakslr requested a review from emk April 12, 2022 16:46
Copy link
Contributor

@emk emk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@hanakslr hanakslr merged commit 13fcb2a into main Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants