-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Java][jersey2] Fix generated client code for oneOf models if datatyp…
…e includes arrays (#18042) * Add java-jersey2 sample with mixed oneOf * [java][jersey2]Fix client generation if oneOf contains an array type Changes: * Change jersey2/oneof_model template to use composed schema data * Change adding of imports in AbstractJavaCodegen to use composed schema data * Add escapedDataType property to CodegenProperty so that the data type may be part of identifiers (e.g. in getters) * Update samples * Add sample for multiple array in oneOf * Fix generation of constructors with same erasures * Update samples again * Version bump * Add new sample folders to CI * Make primitive handling more explicit * Replace escapedDataType property with Mustache lambda * Update samples with new primitive handling and sanitization lambda
- Loading branch information
Showing
107 changed files
with
8,636 additions
and
366 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
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,7 @@ | ||
generatorName: java | ||
outputDir: samples/client/others/java/jersey2-oneOf-duplicates | ||
library: jersey2 | ||
inputSpec: modules/openapi-generator/src/test/resources/3_0/oneOf_duplicateArray.yaml | ||
templateDir: modules/openapi-generator/src/main/resources/Java | ||
additionalProperties: | ||
hideGenerationTimestamp: "true" |
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,7 @@ | ||
generatorName: java | ||
outputDir: samples/client/others/java/jersey2-oneOf-Mixed | ||
library: jersey2 | ||
inputSpec: modules/openapi-generator/src/test/resources/3_0/oneOf_primitiveAndArray.yaml | ||
templateDir: modules/openapi-generator/src/main/resources/Java | ||
additionalProperties: | ||
hideGenerationTimestamp: "true" |
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
29 changes: 29 additions & 0 deletions
29
modules/openapi-generator/src/test/resources/3_0/oneOf_duplicateArray.yaml
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,29 @@ | ||
openapi: 3.0.1 | ||
info: | ||
version: 1.0.0 | ||
title: Example - oneOf data type | ||
license: | ||
name: MIT | ||
servers: | ||
- url: http://api.example.xyz/v1 | ||
paths: | ||
/example: | ||
get: | ||
operationId: list | ||
responses: | ||
"200": | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/Example" | ||
components: | ||
schemas: | ||
Example: | ||
oneOf: | ||
- type: array | ||
items: | ||
type: number | ||
- type: array | ||
items: | ||
type: integer |
28 changes: 28 additions & 0 deletions
28
modules/openapi-generator/src/test/resources/3_0/oneOf_primitiveAndArray.yaml
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,28 @@ | ||
openapi: 3.0.1 | ||
info: | ||
version: 1.0.0 | ||
title: Example - oneOf data type | ||
license: | ||
name: MIT | ||
servers: | ||
- url: http://api.example.xyz/v1 | ||
paths: | ||
/example: | ||
get: | ||
operationId: list | ||
responses: | ||
"200": | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/Example" | ||
components: | ||
schemas: | ||
Example: | ||
oneOf: | ||
- type: string | ||
format: uuid | ||
- type: array | ||
items: | ||
type: integer |
Oops, something went wrong.