Support new UseInlineDefinitionsForObjects
flag
#2384
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
When a request/response has a nested object, there are two pieces of information missing from the generated doc file:
summary
is not displayed.Nullable
marker is not shown fornullable
properties.Here's a screenshot of what it looks like now:
Here's a screenshot of the source code for the above:
As you can see, this property has a nice
summary
, and isnullable
.Here's a screenshot of what it I would expect:
Underlying Cause
It looks to me like the reason it's not generating that properly is because the object is only a reference, and Swagger doesn't support these on references. As the Swagger specification says, regarding
$ref
s:Proposed Solution
We have previously introduced an option to
UseInlineDefinitionsForEnums
. Among other things, this will show the summary of a property that is an enum, and will also show theNullable
marker accordingly.This PR adds a similar
UseInlineDefinitionsForObjects
option. When enabled, it'll inline the whole schema, and will properly show thesummary
and whether it'snullable
: