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

Add examples to XML params #1629

Merged
merged 3 commits into from
Apr 20, 2020
Merged

Add examples to XML params #1629

merged 3 commits into from
Apr 20, 2020

Conversation

mattfrear
Copy link
Contributor

@mattfrear mattfrear commented Apr 19, 2020

Fixes #1628.
I ensure the example type is the correct type and not always a string.
Includes unit tests and updated Readme.

test/WebSites/CliExampleWithFactory/wwwroot/api-docs/v1/*.json
*ncrunch*
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I use the NCrunch test runner so I added this. I can remove it if you prefer.

@domaindrivendev
Copy link
Owner

👍 @mattfrear

@Ben230
Copy link

Ben230 commented May 1, 2020

Hi @mattfrear, when do you think it would be possible to accept other datatypes e.g. guids rather than just primitive data types? Love the work you are doing btw!

@foriequal0
Copy link

Hi. Would you mind if I ask why did you put examples under the parameter's schema? I think it would've generated a more concise document if you put it parameter.Example in XmlCommentsParameterFilter.

@mattfrear
Copy link
Contributor Author

Hi. Would you mind if I ask why did you put examples under the parameter's schema? I think it would've generated a more concise document if you put it parameter.Example in XmlCommentsParameterFilter.

That's a good question. I didn't know that XmlCommentsParameterFilter exists. I added it to the schema.Example because I was copying the existing logic which sets schema examples from XML comments.
I think you are correct - the XmlCommentsParameterFilter is the more correct place to set this.

@foriequal0
Copy link

@mattfrear Thank you for the clarification 👍

@gohawks3
Copy link

gohawks3 commented Sep 8, 2021

Hi Matt, love your work! would you please add an example for IList param type? Is it supported?

@mattfrear
Copy link
Contributor Author

Hi Matt, love your work! would you please add an example for IList param type? Is it supported?

Yes @gohawks3, lists are supported, see this comment:

#1676 (comment)

brendasmith8 pushed a commit to brendasmith8/Swash-buckle-AspNetCore-repository that referenced this pull request Sep 22, 2022
onlinehub0808 added a commit to onlinehub0808/Swashbuckle.AspNetCore that referenced this pull request Jun 2, 2023
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.

Add example to XML param
5 participants