[scala-akka-http-server] allows generation of managed sources only #9012
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When the official OpenAPITools / sbt-openapi-generator sbt plugin is used to generate a scala-akka-http-server stub, the resulting files are a project in their own right, including:
The problem is that it can be interesting not to generate a project, but just the source files needed to compile a project.
By generating just scala files, which are placed in the managedSources of sbt, one can automate the generation of models and APIs within a project, without having to filter unnecessary files that prevent compilation.
This is what this modification allows.
By adding the asManagedSources parameter in the additional properties of the generator, the build.sbt, README.md and controller.scala files will be ignored.
It is then possible, in the build file of the project, to simply define sbt-openapi-generator as a source generator:
By doing that, not a single manual operation is needed when openapi specification changes.
Just by recompiling the project, the developer will see the templates and APIs updated and compiled at the same time.
Btw, syntax is far from perfect, due to the usage of a string to express the Boolean, but this is all due to sbt-openapi-generator...