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
  • !2421

New generator - Scala Play Framework

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/adigerber/generator-scala-play into master Mar 15, 2019
  • Overview 0
  • Commits 16
  • Pipelines 0
  • Changes 59

Created by: adigerber

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh, ./bin/security/{LANG}-petstore.sh and ./bin/openapi3/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.4.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

This is work in progress!

This PR introduces a new generator definition - Scala Play Framework.

Features

  • Models (including JSON formats)
    • Basic properties (primitives)
    • Container properties (map/list)
    • Marking properties as required (by default properties are generated using Scala's Option)
    • Objects with additionalProperties
    • Definitions declared with type: array
    • Date/time properties
    • File properties (might skip in this PR) Edit: operations support files, models do not
  • API
    • Base traits
    • Stubs
    • Controllers - Done, but needs to be tested in runtime for correctness
    • Default module (for DI)
    • Routes
    • Error handler
  • Support files
    • Minimal SBT
    • README
    • LICENSE removed
    • Logging
    • Application configuration (including Play configuration)
    • API docs
  • Generation flags/additional properties
    • Generate Skip generation of stubs
    • Generate async API
    • Generate API docs
    • Skip routes generation Edit: since routes are essential for Play apps I chose not to implement this.
    • Set routes file name
    • Anything else I might've forgotten
  • Tests

CC (technical committee): @clasnake, @jimschubert, @shijinkui, @ramzimaalej

Migrated from swagger-codegen

Note this was originally written for swagger-codegen so there may be some remnants around in the code before this is fully complete.

Some issues that need attention:

  • Default values for stubs - check if given schema/property is required
  • When generating against modules/openapi-generator/src/test/resources/3_0/petstore.yaml, models InlineObject and InlineObject1 are generated but are not used anywhere at the moment Edit: removed these files by running the generator with -DskipFormModel=true
  • Enums are generated inside their parent object (e.g. Pet.Status), but there is no context of the parent object in the API operations so enumName and datatypeWithEnum do not reference the enum (e.g. Status instead of Pet.Status). Couldn't find a way to inject the parent model name anywhere. Edit: since java-play-framework does not convert enum params in operations this will not be done here either.
  • Friendly output of JsResultException (https://github.com/OpenAPITools/openapi-generator/pull/2421#issuecomment-476435770)
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/adigerber/generator-scala-play