It is very easy for Swagger annotations to drift away from the actual code.
E.g.
I could change the return from Response.ok
to Response.created
and easily forget to update the annotations from 200 to 201.
Or I could change what is valid as null or not null and the end user will get confusing rejection messages even though their payload matches exactly what the documentation says.
How do I test that my swagger documentation matches what my code is doing?
- A test that uses selenium and phantomjs to parse the swagger-ui web page?
- Reflection to parse the annotations?
- Get the generated swagger.json and parse it?
- Something else?
Unfortunately I can't switch to Spring REST Docs.