Skip to content
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

Support new UseInlineDefinitionsForObjects flag #2384

Closed
wants to merge 0 commits into from

Conversation

sol-wasserman
Copy link

Problem

When a request/response has a nested object, there are two pieces of information missing from the generated doc file:

  1. The property's summary is not displayed.
  2. The Nullable marker is not shown for nullable properties.

Here's a screenshot of what it looks like now:

image

Here's a screenshot of the source code for the above:

image

As you can see, this property has a nice summary, and is nullable.

Here's a screenshot of what it I would expect:

image

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 $refs:

This object cannot be extended with additional properties and any properties added SHALL be ignored.

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 the Nullable marker accordingly.

This PR adds a similar UseInlineDefinitionsForObjects option. When enabled, it'll inline the whole schema, and will properly show the summary and whether it's nullable:

image

@sol-wasserman
Copy link
Author

@domaindrivendev Just checking in whether you got a chance to look at this.

Is there a better approach to achieving this? Or is there anything else I can improve in this PR?

Thanks in advance.

@xinge-shizhiqiang
Copy link

我也遇到了这个问题 这个问题解决了吗

@sol-wasserman
Copy link
Author

This issue was accidentally closed. I've reopened it here: #2533.

@xinge-shizhiqiang
Copy link

xinge-shizhiqiang commented Jan 29, 2023 via email

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.

None yet

2 participants