-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Feature Request: Swagger Maven Plugin should be able to read Swagger config #3133
Comments
This sounds very good indeed, and it is for sure interesting, possibly applicable also to gradle-plugin. Maybe the config name could be |
Alright, then Id prepare the PR in the next couple of days. I would start with the maven plugin. When we agree on the exact requirement and behaviour, this can then be ported to the Gradle plugin.
You are right, this is probably better. |
excellent thx! |
Currently the maven plugin only accepted OpenAPI files. This adds the option to provide a swagger configuration (e.g. prettyPrint), so if you already have a config file for say, serving a life api doc, you don't have to define it twice. This heavily refactors the maven plugin and adds a bunch of tests. Also the readme is extended to reflect the new parameter. The error handling for file reading was changed to fail-fast, meaning, if a user provides the config, the file must exist and must be readable, otherwise an error is thrown. This makes it easier to correctly set the plugin up.
Currently the maven plugin only accepted OpenAPI files. This adds the option to provide a swagger configuration (e.g. prettyPrint), so if you already have a config file for say, serving a life api doc, you don't have to define it twice. This heavily refactors the maven plugin and adds a bunch of tests. Also the readme is extended to reflect the new parameter. The error handling for file reading was changed to fail-fast, meaning, if a user provides the config, the file must exist and must be readable, otherwise an error is thrown. This makes it easier to correctly set the plugin up.
Currently the maven plugin only accepted OpenAPI files. This adds the option to provide a swagger configuration (e.g. prettyPrint), so if you already have a config file for say, serving a life api doc, you don't have to define it twice. This heavily refactors the maven plugin and adds a bunch of tests. Also the readme is extended to reflect the new parameter. The error handling for file reading was changed to fail-fast, meaning, if a user provides the config, the file must exist and must be readable, otherwise an error is thrown. This makes it easier to correctly set the plugin up.
Add swagger config file option to maven plugin (#3133)
#3150 merged, thanks! |
Currently the maven plugin allows for reading a
openapiFilePath
which expects the file to have theopenApi
element as root, like so:However, if one already uses Swagger to dynamically serve the doc over a e.g. Servlet, one usually has a Swagger configuration file with this scheme:
As there is no trivial way to include yaml in yaml, I now would have to maintain 2 openApi configs.
My suggestion is therefore this:
Provide a new config named
configurationFilePath
swaggerConfigurationFilePathwhich accepts a path to a configuration file as described in https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Integration-and-Configuration#configuration-file. This file would be parsed before the other configs and has less precedence as a maven plugin defined config. E.g. if provided aresourcePackages
defined config in maven pom would have higher precedence of the same config defined in the swagger yaml config.Is the team interested in such a feature? I am willing to provide a PR for this.
The text was updated successfully, but these errors were encountered: