-
Notifications
You must be signed in to change notification settings - Fork 283
Open
Labels
status:waiting-for-author-feedbackIssue that we've responded but needs author feedback to closeIssue that we've responded but needs author feedback to closetype:questionAn issue that's a questionAn issue that's a question
Description
Description
The Microsoft.OpenApi library allows setting Description on OpenApiSchemaReference, which results in serialized output containing both $ref and description.
However, according to OpenAPI 3.0.x specification:
When a
$refis used, all other properties SHALL be ignored.
This makes $ref effectively a replacement, meaning sibling keywords like description should not appear.
Example
Code
var schema = new OpenApiSchema
{
Reference = new OpenApiReference
{
Type = ReferenceType.Schema,
Id = "Pet"
},
Description = "Local description"
};Output
$ref: '#/components/schemas/Pet'
description: Local descriptionExpected behavior
One of:
- Serializer wraps in
allOf
allOf:
- $ref: '#/components/schemas/Pet'
description: Local description-
Description ignored when targeting OAS 3.0
-
Validation warning
Notes
- In OAS 3.1 sibling keywords are allowed due to JSON Schema alignment
- Behavior difference between 3.0 and 3.1 is currently unclear
- This can lead to portability issues across tooling
Question
What is the intended behavior when serializing references with annotations for OAS 3.0 vs 3.1?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
status:waiting-for-author-feedbackIssue that we've responded but needs author feedback to closeIssue that we've responded but needs author feedback to closetype:questionAn issue that's a questionAn issue that's a question