Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !9012

[scala-akka-http-server] allows generation of managed sources only

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/Ankama/generates-managed-sources into master Mar 19, 2021
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 2

Created by: cchafer

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:

  • a build file
  • a README.md file
  • a default controller (controller.scala)

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:

openApiAdditionalProperties := Map("asManagedSources" -> "true")
Compile / sourceGenerators += openApiGenerate

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...

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/Ankama/generates-managed-sources