forked from OpenAPITools/openapi-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Don't use property initializers The ES6 Javascript generator used property initializers, as described [here](https://tc39.github.io/proposal-class-public-fields/). This is not standard ES6. In particular, create-react-app chokes on it (see [this issue](swagger-api/swagger-codegen#8024), which is fixed by this commit). This commit instead reverts back to using prototypes, as in the non-es6 JS generator. 2. Add missing pom.xml files This allows us to run `mvn integration-test` in these folders. 3. Add missing double-quotes around enum field names. This avoids errors due to fields that contain illegal characters. 4. Fix support for multiple inheritance The previous implementation was broken. I added static "initialize" methods, which supports multiple inheritance. 5. Comment out some broken tests. There were tests for OuterBoolean etc, which are not generated as part of index.js in the generated petstore clients. Hence, these tests threw an error. The actual tests were already commented out anyway. I just commented out one more line to avoid an error. 6. Remove some empty lines in generates JS files.
- Loading branch information
Showing
92 changed files
with
3,107 additions
and
4,038 deletions.
There are no files selected for viewing
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
7 changes: 1 addition & 6 deletions
7
modules/openapi-generator/src/main/resources/Javascript/es6/model.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 |
---|---|---|
@@ -1,9 +1,4 @@ | ||
{{>licenseInfo}} | ||
|
||
import ApiClient from '../ApiClient'; | ||
{{#imports}}import {{import}} from './{{import}}'; | ||
{{/imports}} | ||
|
||
{{#models}}{{#model}} | ||
{{#isEnum}}{{>partial_model_enum_class}}{{/isEnum}}{{^isEnum}}{{>partial_model_generic}}{{/isEnum}} | ||
{{/model}}{{/models}} | ||
{{/imports}}{{#models}}{{#model}}{{#isEnum}}{{>partial_model_enum_class}}{{/isEnum}}{{^isEnum}}{{>partial_model_generic}}{{/isEnum}}{{/model}}{{/models}} |
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
28 changes: 14 additions & 14 deletions
28
...les/openapi-generator/src/main/resources/Javascript/es6/partial_model_inner_enum.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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
{{#emitJSDoc}}/** | ||
* Allowed values for the <code>{{baseName}}</code> property. | ||
* @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%> | ||
* @readonly | ||
*/{{/emitJSDoc}} | ||
{{classname}}['{{datatypeWithEnum}}'] = { | ||
{{#allowableValues}}{{#enumVars}} | ||
{{#emitJSDoc}}/** | ||
* Allowed values for the <code>{{baseName}}</code> property. | ||
* @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%> | ||
* @readonly | ||
*/{{/emitJSDoc}} | ||
static {{datatypeWithEnum}} = { | ||
{{#allowableValues}}{{#enumVars}} | ||
{{#emitJSDoc}}/** | ||
* value: {{{value}}} | ||
* @const | ||
*/{{/emitJSDoc}} | ||
"{{name}}": {{{value}}}{{^-last}}, | ||
{{/-last}} | ||
{{/enumVars}}{{/allowableValues}} | ||
}; | ||
* value: {{{value}}} | ||
* @const | ||
*/{{/emitJSDoc}} | ||
"{{name}}": {{{value}}}{{^-last}}, | ||
{{/-last}} | ||
{{/enumVars}}{{/allowableValues}} | ||
}; |
2 changes: 1 addition & 1 deletion
2
samples/client/petstore/javascript-es6/.openapi-generator/VERSION
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 |
---|---|---|
@@ -1 +1 @@ | ||
3.0.2-SNAPSHOT | ||
3.0.0-SNAPSHOT |
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,45 @@ | ||
<project> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.openapitools</groupId> | ||
<artifactId>openapi-petstore-javascript-es6</artifactId> | ||
<packaging>pom</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>OpenAPI Petstore JS Client</name> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>1.2.1</version> | ||
<executions> | ||
<execution> | ||
<id>npm-install</id> | ||
<phase>pre-integration-test</phase> | ||
<goals> | ||
<goal>exec</goal> | ||
</goals> | ||
<configuration> | ||
<executable>npm</executable> | ||
<arguments> | ||
<argument>install</argument> | ||
</arguments> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>mocha</id> | ||
<phase>integration-test</phase> | ||
<goals> | ||
<goal>exec</goal> | ||
</goals> | ||
<configuration> | ||
<executable>npm</executable> | ||
<arguments> | ||
<argument>test</argument> | ||
</arguments> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
Oops, something went wrong.