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
,. Default:3.4.x
,4.0.x
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 -
LICENSEremoved -
Logging -
Application configuration (including Play configuration) -
API docs
-
-
Generation flags/additional properties -
GenerateSkip generation of stubs -
Generate async API -
Generate API docs -
Skip routes generationEdit: 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
, modelsInlineObject
andInlineObject1
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 soenumName
anddatatypeWithEnum
do not reference the enum (e.g.Status
instead ofPet.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)