swagger-maven-plugin: Wrong class in documentation generation
Hello,
I might be missing something, but in one of API endpoints, I implemented a PATCH operation, which takes a DocumentType
as parameter. This is however one of our custom models, and not the DocumentType defined in several namespaces.
The import
statements etc are all correct, as is the annotations.
When running the maven build, my documentation get’s generated, however the output contains the wrong DocumentType
class. It’s as if the plugin seems to take the first matching class, and not the one I specified.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (6 by maintainers)
not getting much difference unfortunately.
So it simply exposes hidden APIs when it’s used, otherwise relies on the standard implementation. Swagger still seems to be using some kind of different class for the example unfortunately:
I have no idea to what this is being mapped, but it doesn’t resemble a single class we have in use for our code.
Tried setting the
springmvc
configuration to false, did not seem to have any direct result/difference on the generated documentation.Here’s a link to the gist for the fully generated swagger file: https://gist.github.com/coding-bunny/56a586d425846faaea74817dca398fe5
Okay,
I’ve updated the plugin to 3.1.7, which took quite some effort due dependency conflicts I had to resolve on our side, but I succeeded. So now I’ve regenerated the swagger documentation on the 3.1.7.
This is the model that I have created:
The model inherits from a few classes that simply add more properties to it. There’s really nothing special about this class, as it’s just a data-container. In the upper classes a few properties are marked with
@XmlElement
to get the correct output generated etc.The endpoint has been defined as follows:
Basic Resource class that listen to incoming PATCH requests. Everything work perfectly when using the endpoint, so that’s not the problem. However when I look at the generated Swagger documentation, the following class is generated instead:
Which is a completely different class than the one I have defined. My guess is that the code is simply picking the first matching class based on name, completely ignoring the package.
Things I’ve tried: