-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Scala-cask improvements: * fixe for grouped methods which have routes containing dashes. Previously our OperationGroup work-around would potentially Create methods like ‘foo-bar’, which isn’t a valid function name * Fix to not import some.package.Array[Byte] when binary format is specified * Fix for grouped operations which contain duplicate query parameters * Fix for binary response fields. This can come up with the following example "responses" : { "200" : { "content" : { "application/json" : { "schema" : { "format" : "binary", "type" : "string" } } }, "description" : "data" }, * Fix for enum model classes Extracted complex logic for ‘asData’ and ‘asModel’ transformations for properties * Introduced a generic effect F[_] for services This was done to support composable services (Service A calls Service B) by using monadic Effect types (ones which can flatMap) * Fixed unique union types for responses, asModel and asData fixes for non-model types * scala-cask: regenerated samples * Fix for reserved-word properties in the API * Fix for null imports and reserved-word enum types * Fixes for api methods with backticked params * Fix for duplicate (by name) grouped params * small syntax fix * logging response type * Regenerated samples * String.format fix
- Loading branch information
Showing
41 changed files
with
1,725 additions
and
821 deletions.
There are no files selected for viewing
347 changes: 307 additions & 40 deletions
347
...pi-generator/src/main/java/org/openapitools/codegen/languages/ScalaCaskServerCodegen.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
modules/openapi-generator/src/main/resources/scala-cask/modelClass.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
case class {{classname}}( | ||
{{#vars}} | ||
{{#description}} | ||
/* {{{description}}} */ | ||
{{/description}} | ||
{{name}}: {{#isEnum}}{{^required}}Option[{{/required}}{{classname}}.{{datatypeWithEnum}}{{^required}}]{{/required}}{{/isEnum}}{{^isEnum}}{{{vendorExtensions.x-datatype-model}}}{{/isEnum}}{{^required}} = {{{vendorExtensions.x-defaultValue-model}}} {{/required}}{{^-last}},{{/-last}} | ||
{{/vars}} | ||
|
||
{{#isAdditionalPropertiesTrue}}, additionalProperties : ujson.Value = ujson.Null{{/isAdditionalPropertiesTrue}} | ||
) { | ||
def asJsonString: String = asData.asJsonString | ||
def asJson: ujson.Value = asData.asJson | ||
def asData : {{classname}}Data = { | ||
{{classname}}Data( | ||
{{#vars}} | ||
{{name}} = {{{vendorExtensions.x-asData}}}{{^-last}},{{/-last}} | ||
{{/vars}} | ||
{{#isAdditionalPropertiesTrue}}, additionalProperties{{/isAdditionalPropertiesTrue}} | ||
) | ||
} | ||
} | ||
|
||
object {{classname}} { | ||
given RW[{{classname}}] = summon[RW[ujson.Value]].bimap[{{classname}}](_.asJson, json => read[{{classname}}Data](json).asModel) | ||
|
||
enum Fields(val fieldName : String) extends Field(fieldName) { | ||
{{#vars}} | ||
case {{name}} extends Fields("{{name}}") | ||
{{/vars}} | ||
} | ||
|
||
{{#vars}} | ||
{{#isEnum}} | ||
// baseName={{{baseName}}} | ||
// nameInCamelCase = {{{nameInCamelCase}}} | ||
enum {{datatypeWithEnum}} derives ReadWriter { | ||
{{#_enum}} | ||
case {{.}} | ||
{{/_enum}} | ||
} | ||
{{/isEnum}} | ||
{{/vars}} | ||
|
||
} |
Oops, something went wrong.