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

@mattfrear mattfrear Apr 19, 2020

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 domaindrivendev merged commit 343a65b into domaindrivendev:master Apr 20, 2020
1 check passed
@domaindrivendev
Copy link
Owner

@domaindrivendev domaindrivendev commented Apr 20, 2020

👍 @mattfrear

@Ben230
Copy link

@Ben230 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

@foriequal0 foriequal0 commented May 25, 2020

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

@mattfrear mattfrear commented May 29, 2020

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

@foriequal0 foriequal0 commented May 29, 2020

@mattfrear Thank you for the clarification 👍

@gohawks3
Copy link

@gohawks3 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

@mattfrear mattfrear commented Sep 10, 2021

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)

mattfrear added a commit to mattfrear/Swashbuckle.AspNetCore that referenced this issue Sep 10, 2021
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.

5 participants