Reputation: 10300
I am trying to generate a Spring Boot project using Swagger code generator. I use the following command:
swagger-codegen generate \
-i myapp.yaml \
-l spring \
-o myapp-api
--api-package com.myapp.controllers \
--model-package com.myapp.model \
--invoker-package com.myapp \
--group-id com.myapp \
--artifact-id myapp \
--artifact-version 0.0.1-SNAPSHOT
Problem: All classes are properly generated but the configuration classes. They are put to io.swagger.configuration
package instead of my own package.
Question: How to make swagger generate configuration classes to a proper package?
Upvotes: 1
Views: 2143
Reputation: 97609
Spring generator has the configPackage
option to override the io.swagger.configuration
package name.
swagger-codegen config-help -l spring
CONFIG OPTIONS
...
configPackage
configuration package for generated code
When running Swagger Codegen from the command line, you can specify language-specific configs as -Doption=value
, in this case as -DconfigPackage=your_package
:
swagger-codegen generate \
...
-DconfigPackage=com.myapp.configuration
Upvotes: 1