-
Notifications
You must be signed in to change notification settings - Fork 218
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
open-api plugin does not obey "effective documentation" precedence for member structures #2400
Comments
The example from https://smithy.io/2.0/spec/documentation-traits.html#effective-documentation works correctly. This appears to specifically affect |
milesziemer
added a commit
to milesziemer/smithy
that referenced
this issue
Sep 23, 2024
Fixes smithy-lang#2400. When a member targets a structure, it becomes a schema reference when converted to JSON Schema. Previously, we didn't add member docs to the converted object, possibly because earlier versions of open api or JSON Schema did not support it. Reading through [this issue](OAI/OpenAPI-Specification#1514) the [OAI spec](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#reference-object), and the [JSON Schema Spec](https://json-schema.org/draft/2020-12/json-schema-core#section-8.2.3), it seems that OpenAPI 3.1 and JSON Schema 2020-12 support the `description` property alongside `$ref`. I wasn't able to find anything about whether it is supported in [JSON Schema 07](https://json-schema.org/draft-07/json-schema-release-notes). This commit adds a new config option, `addReferenceDescriptions` that will add the `description` property alongside `$ref` when the member has documentation. I made it opt-in through the config option so we don't cause any existing documentation to be changed unexpectedly.
milesziemer
added a commit
to milesziemer/smithy
that referenced
this issue
Sep 23, 2024
Fixes smithy-lang#2400. When a member targets a structure, it becomes a schema reference when converted to JSON Schema. Previously, we didn't add member docs to the converted object, possibly because earlier versions of open api or JSON Schema did not support it. Reading through [this issue](OAI/OpenAPI-Specification#1514) the [OAI spec](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#reference-object), and the [JSON Schema Spec](https://json-schema.org/draft/2020-12/json-schema-core#section-8.2.3), it seems that OpenAPI 3.1 and JSON Schema 2020-12 support the `description` property alongside `$ref`. I wasn't able to find anything about whether it is supported in [JSON Schema 07](https://json-schema.org/draft-07/json-schema-release-notes). This commit adds a new config option, `addReferenceDescriptions` that will add the `description` property alongside `$ref` when the member has documentation. I made it opt-in through the config option so we don't cause any existing documentation to be changed unexpectedly.
With #2402 you are able to add |
Awesome, thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There appears to be a bug in the
open-api
plugin that leads to incorrectly applied documentation. This is causing some friction for us, requiring refactoring of our model to display documentation correctly. If the plugin behaved according to the documentation here: Effective documentation, we would not have any issue.To repro:
model.smithy
smithy-build.json
This produces a
model.json
that correctly contains"It's a Bar"
for the member's documentation:however, the generated
FooService.openapi.json
contains a schema that looks like this:I expect to see:
The text was updated successfully, but these errors were encountered: