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

Investigate the feasibility of unit testing swagger spec generation #527

Open
myssto opened this issue Nov 7, 2024 · 2 comments
Open

Investigate the feasibility of unit testing swagger spec generation #527

myssto opened this issue Nov 7, 2024 · 2 comments
Labels
project:API Items related to the API project proposal type:testing

Comments

@myssto
Copy link
Contributor

myssto commented Nov 7, 2024

As we have started to heavily rely on swagger / swashbuckle for cross-project compatibility in our ecosystem, it is becoming more and more tedious to manually inspect the json content of the swagger spec every time changes are made to the document generator. It would be very useful to have a unit testing framework in place that can validate the content programmatically.

Hopefully through this we can achieve a setup that can completely mock the swagger generation for the API so that we can confidently unit test changes to the generator (for example the custom document filters in API.SwaggerGen). This will greatly improve testing coverage, code quality, efficiency, and most importantly my sanity!

@github-project-automation github-project-automation bot moved this to Backlog in otr-beta-v2 Nov 7, 2024
@myssto myssto added type:testing proposal project:API Items related to the API project labels Nov 7, 2024
@majorro
Copy link
Contributor

majorro commented Dec 13, 2024

Why would some framework be needed? It can be done in some way like this, just make some dummy controller with test cases or mock contexts with moq

@myssto
Copy link
Contributor Author

myssto commented Dec 14, 2024

As written I use 'framework' as sort of a catch-all when really I'm just meaning to say any solution that will work. My initial thought is that it will take a lot more effort than the code you linked. There are more things that augment the ApiExplorer and SwaggerGen in our project than I can name off the top of my head, and all of them have some significance on the outputted swagger spec.

@hburn7 hburn7 removed this from otr-beta-v2 Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project:API Items related to the API project proposal type:testing
Projects
None yet
Development

No branches or pull requests

2 participants