Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
a7bae4e
TAP-232 OneOf fixes
Aug 30, 2021
51e9815
TAP-232 Added tests for issues 2906 and 8647
Sep 10, 2021
302da03
Merge branch 'master' into feature/TAP-232/oneof-fixes
Orachigami Sep 13, 2021
dd6e399
Fix ci again (#10388)
MartinDelille Sep 14, 2021
29f3869
Fix installation script (#10378)
Sep 14, 2021
0211f7b
[kotlin][client] add support for okhttp requests with empty body (#10…
4brunu Sep 14, 2021
27727ac
[swift5][client] Fix issue 9953 (#10387)
4brunu Sep 14, 2021
084e093
[kotlin][client] fix warning (#10390)
4brunu Sep 14, 2021
9479d35
Python client docstring (#10339)
bflaton Sep 14, 2021
df877a8
[haskell-http-client] fixes for GHC 9 (#10400)
jonschoning Sep 14, 2021
340eb7d
udates to kotlin 1.3.30 (#10389)
benzvan Sep 15, 2021
aac9aa6
fix not type found ByteArray (#10166)
bgong-mdsol Sep 16, 2021
f9320ca
[typescript-axios] Upgrade axios from 0.21.1 to 0.21.4 (#10381)
Foorack Sep 16, 2021
0936b43
[Kotlin] Fix default value for kotlin class (#10407)
Fs02 Sep 16, 2021
fdb13c3
add the correct import of enum (#10412)
bgong-mdsol Sep 17, 2021
2979c38
TAP-232 Fixed inline OneOf, added tests for the majority of cases, ad…
Sep 17, 2021
a463c11
10408: made Validate public. (#10413)
GregorLamche Sep 19, 2021
80fb9e9
Use 'this' to assign to class field. (#10417)
thomasleplus Sep 19, 2021
2bd20a0
fix(rust,client): use local_var prefix for configuration (#10419)
PiDelport Sep 19, 2021
1028839
fix(RustServerCodegen): fix reserved word model rename log message (#…
PiDelport Sep 19, 2021
b13e378
fixes OpenAPITools#10403 (#10404)
poisonedvk Sep 19, 2021
e3b558c
update samples
wing328 Sep 19, 2021
14758db
Merge branch 'master' of https://github.com/openapitools/openapi-gene…
wing328 Sep 19, 2021
f2cc234
regen samples (#10425)
jonschoning Sep 19, 2021
1247e77
[haskell-http-client] add ability to choose additional characters in …
jonschoning Sep 19, 2021
7358de9
TAP-232 Restart CI builds
Sep 20, 2021
8a1cf1e
TAP-232 Removed unused imports, fixed OneOf generation in response sc…
Sep 20, 2021
790771e
Merge branch 'jburgess-spring_fix_5381_jb' into feature/TAP-232/oneof…
Orachigami Sep 20, 2021
5c45465
ci(drone): use parallel pipelines (#10423)
PiDelport Sep 21, 2021
ce30a3f
fix(rust,client): convert form isArray values to string (#10420)
PiDelport Sep 21, 2021
04e67ac
Fix issue 8352: [Java][RestTemplate][WebClient] Incorrect handling of…
RomainPruvostMHH Sep 21, 2021
1a48c5f
[Wsdl] Handle schema property of type array with oneOf items and othe…
adessoDpd Sep 21, 2021
1947f13
update doc, samples
wing328 Sep 21, 2021
a939676
fix: expose allowed values of the enum (#10386)
wtrocki Sep 21, 2021
61852a0
[go]: fix anyOf compilation error (#10431)
andrewkav Sep 21, 2021
18301d0
Accept header forces application/json type even if server (#10337)
wtrocki Sep 21, 2021
ef0186c
[scala] Fix Array[Byte] type for Openapi type string format byte (#10…
chameleon82 Sep 21, 2021
a1cac51
TAP-232 Removed code duplicate
Sep 21, 2021
acdf357
Revert "Accept header forces application/json type even if server (#…
wing328 Sep 21, 2021
def7ca4
Merge branch 'master' into feature/TAP-232/oneof-fixes
Orachigami Sep 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 11 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,17 @@ samples/server-generator/node/output/node_modules
samples/server/petstore/nodejs/node_modules
samples/server/petstore/nodejs-server/node_modules

# qt5 cpp
*.pro.user
samples/client/petstore/qt5cpp/PetStore/moc_*
samples/client/petstore/qt5cpp/PetStore/*.o
samples/client/petstore/qt5cpp/build-*
samples/client/petstore/qt5cpp/PetStore/PetStore
samples/client/petstore/qt5cpp/PetStore/Makefile
samples/client/petstore/qt5cpp/PetStore/PetStore.pro.user
# qt cpp
samples/client/build
samples/client/petstore/build
samples/client/petstore/cpp-qt/PetStore/moc_*
samples/client/petstore/cpp-qt/PetStore/*.o
samples/client/petstore/cpp-qt/build-*
samples/client/petstore/cpp-qt/build-*
samples/client/petstore/cpp-qt/PetStore/PetStore
samples/client/petstore/cpp-qt/PetStore/Makefile
samples/client/petstore/cpp-qt/PetStore/PetStore.pro.user
samples/client/petstore/cpp-qt/CMakeLists.txt.user

# cpprestsdk
samples/client/petstore/cpp-restsdk/CMakeCache.txt
Expand Down
39 changes: 38 additions & 1 deletion CI/.drone.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
kind: pipeline
type: docker
name: default
steps:
# test Java 11 HTTP client
Expand All @@ -15,11 +16,23 @@ steps:
- /bin/bash bin/utils/test-fake-petstore-for-all.sh
# generate test scripts
- /bin/bash bin/tests/run-all-test

---
kind: pipeline
type: docker
name: default
steps:
# test nim client
- name: nim-client-test
image: nimlang/nim
commands:
- (cd samples/client/petstore/nim/ && nim c sample_client.nim)

---
kind: pipeline
type: docker
name: default
steps:
# test protobuf schema generator
- name: protobuf-schema-test
image: nanoservice/protobuf-go
Expand All @@ -29,12 +42,24 @@ steps:
- cd samples/config/petstore/protobuf-schema
- protoc --go_out=/var/tmp/go/ services/*
- protoc --go_out=/var/tmp/go/ models/*

---
kind: pipeline
type: docker
name: default
steps:
# test aspnetcore 3.x
- name: aspnetcore-test
image: mcr.microsoft.com/dotnet/core/sdk:3.1
commands:
- (cd samples/server/petstore/aspnetcore-3.1/ && /bin/sh build.sh)
- (cd samples/server/petstore/aspnetcore-3.0/ && /bin/sh build.sh)

---
kind: pipeline
type: docker
name: default
steps:
# test ocaml petstore client
- name: ocaml-test
image: ocaml/opam2:4.07
Expand All @@ -46,11 +71,23 @@ steps:
- eval $(opam env)
- sudo chmod -R 777 .
- dune build --build-dir=./_build

---
kind: pipeline
type: docker
name: default
steps:
# test haskell client
- name: haskell-client-test
image: haskell:8.6.5
image: haskell:8.10.4
commands:
- (cd samples/client/petstore/haskell-http-client/ && stack --allow-different-user --install-ghc --no-haddock-deps haddock --fast && stack --allow-different-user test --fast)

---
kind: pipeline
type: docker
name: default
steps:
# test erlang client and server
- name: erlang
image: erlang:alpine
Expand Down
2 changes: 2 additions & 0 deletions bin/configs/haskell-http-client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ generatorName: haskell-http-client
outputDir: samples/client/petstore/haskell-http-client
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/haskell-http-client
additionalProperties:
queryExtraUnreserved: ''
1 change: 1 addition & 0 deletions bin/configs/swift5-resultLibrary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ additionalProperties:
podSummary: PetstoreClient
projectName: PetstoreClient
podHomepage: https://github.com/openapitools/openapi-generator
removeMigrationProjectNameClass: true
1 change: 1 addition & 0 deletions docs/generators/haskell-http-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
|modelDeriving|Additional classes to include in the deriving() clause of Models| |null|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|queryExtraUnreserved|Configures additional querystring characters which must not be URI encoded, e.g. '+' or ':'| |null|
|requestType|Set the name of the type used to generate requests| |null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
Expand Down
1 change: 1 addition & 0 deletions docs/generators/scala-akka-http-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>Any</li>
<li>Array</li>
<li>Boolean</li>
<li>Byte</li>
<li>Double</li>
<li>Float</li>
<li>Int</li>
Expand Down
1 change: 1 addition & 0 deletions docs/generators/scala-akka.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>Any</li>
<li>Array</li>
<li>Boolean</li>
<li>Byte</li>
<li>Double</li>
<li>Float</li>
<li>Int</li>
Expand Down
1 change: 1 addition & 0 deletions docs/generators/scala-gatling.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>Any</li>
<li>Array</li>
<li>Boolean</li>
<li>Byte</li>
<li>Double</li>
<li>Float</li>
<li>Int</li>
Expand Down
1 change: 1 addition & 0 deletions docs/generators/scala-httpclient-deprecated.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>Any</li>
<li>Array</li>
<li>Boolean</li>
<li>Byte</li>
<li>Double</li>
<li>Float</li>
<li>Int</li>
Expand Down
1 change: 1 addition & 0 deletions docs/generators/scala-lagom-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>Any</li>
<li>Array</li>
<li>Boolean</li>
<li>Byte</li>
<li>Double</li>
<li>Float</li>
<li>Int</li>
Expand Down
1 change: 1 addition & 0 deletions docs/generators/scala-play-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>Any</li>
<li>Array</li>
<li>Boolean</li>
<li>Byte</li>
<li>Double</li>
<li>Float</li>
<li>Int</li>
Expand Down
1 change: 1 addition & 0 deletions docs/generators/scala-sttp.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>Any</li>
<li>Array</li>
<li>Boolean</li>
<li>Byte</li>
<li>Double</li>
<li>Float</li>
<li>Int</li>
Expand Down
1 change: 1 addition & 0 deletions docs/generators/scalatra.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>Any</li>
<li>Array</li>
<li>Boolean</li>
<li>Byte</li>
<li>Double</li>
<li>Float</li>
<li>Int</li>
Expand Down
1 change: 1 addition & 0 deletions docs/generators/scalaz.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<li>Any</li>
<li>Array</li>
<li>Boolean</li>
<li>Byte</li>
<li>Double</li>
<li>Float</li>
<li>Int</li>
Expand Down
1 change: 1 addition & 0 deletions docs/generators/swift5.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
|projectName|Project name in Xcode| |null|
|readonlyProperties|Make properties readonly (default: false)| |null|
|removeMigrationProjectNameClass|Make properties removeMigrationProjectNameClass (default: false)| |null|
|responseAs|Optionally use libraries to manage response. Currently PromiseKit, RxSwift, Result, Combine are available.| |null|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
Expand Down
2 changes: 1 addition & 1 deletion modules/openapi-generator-gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.3.20'
ext.kotlin_version = '1.3.30'
repositories {
mavenLocal()
maven { url "https://repo1.maven.org/maven2" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
import java.util.Set;

public interface CodegenConfig {
String getFilesMetadataFilename();

String getVersionMetadataFilename();

GeneratorMetadata getGeneratorMetadata();

CodegenType getTag();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ public class DefaultCodegen implements CodegenConfig {
protected String modelNamePrefix = "", modelNameSuffix = "";
protected String apiNamePrefix = "", apiNameSuffix = "Api";
protected String testPackage = "";
protected String filesMetadataFilename = "FILES";
protected String versionMetadataFilename = "VERSION";
/*
apiTemplateFiles are for API outputs only (controllers/handlers).
API templates may be written multiple times; APIs are grouped by tag and the file is written once per tag group.
Expand Down Expand Up @@ -1177,6 +1179,24 @@ public void setInputSpec(String inputSpec) {
this.inputSpec = inputSpec;
}

@Override
public String getFilesMetadataFilename() {
return filesMetadataFilename;
}

public void setFilesMetadataFilename(String filesMetadataFilename) {
this.filesMetadataFilename = filesMetadataFilename;
}

@Override
public String getVersionMetadataFilename() {
return versionMetadataFilename;
}

public void setVersionMetadataFilename(String versionMetadataFilename) {
this.versionMetadataFilename = versionMetadataFilename;
}

public void setTemplateDir(String templateDir) {
this.templateDir = templateDir;
}
Expand Down Expand Up @@ -1560,6 +1580,7 @@ public DefaultCodegen() {
typeMapping.put("char", "String");
typeMapping.put("object", "Object");
typeMapping.put("integer", "Integer");
// FIXME: java specific type should be in Java Based Abstract Impl's
typeMapping.put("ByteArray", "byte[]");
typeMapping.put("binary", "File");
typeMapping.put("file", "File");
Expand Down Expand Up @@ -2403,6 +2424,18 @@ public CodegenModel fromModel(String name, Schema schema) {
m.isAlias = (typeAliases.containsKey(name)
|| isAliasOfSimpleTypes(schema)); // check if the unaliased schema is an alias of simple OAS types
m.setDiscriminator(createDiscriminator(name, schema, this.openAPI));
if (ModelUtils.isComposedSchema(schema)
&& m.discriminator == null
&& schema.getExtensions() != null
&& schema.getExtensions().containsKey("x-one-of-name")) {
m.vendorExtensions.put("x-deduction", true);
List<String> deductionModelNames = new ArrayList<>();
((ComposedSchema) schema).getOneOf().forEach(model -> {
String modelName = ModelUtils.getSimpleRef(model.get$ref());
deductionModelNames.add(toModelName(modelName));
});
m.vendorExtensions.put("x-deduction-model-names", deductionModelNames);
}
if (!this.getLegacyDiscriminatorBehavior()) {
m.addDiscriminatorMappedModelsImports();
}
Expand Down Expand Up @@ -3144,7 +3177,7 @@ protected CodegenDiscriminator createDiscriminator(String schemaName, Schema sch
}
}
// if there are composed oneOf/anyOf schemas, add them to this discriminator
if (ModelUtils.isComposedSchema(schema) && !this.getLegacyDiscriminatorBehavior()) {
if (ModelUtils.isComposedSchema(schema)) {
List<MappedModel> otherDescendants = getOneOfAnyOfDescendants(schemaName, discPropName, (ComposedSchema) schema, openAPI);
for (MappedModel otherDescendant : otherDescendants) {
if (!uniqueDescendants.contains(otherDescendant)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,7 @@ private List<CodegenSecurity> filterAuthMethods(List<CodegenSecurity> authMethod
* @param files The list tracking generated files
*/
private void generateVersionMetadata(List<File> files) {
String versionMetadata = config.outputFolder() + File.separator + METADATA_DIR + File.separator + "VERSION";
String versionMetadata = config.outputFolder() + File.separator + METADATA_DIR + File.separator + config.getVersionMetadataFilename();
if (generateMetadata) {
File versionMetadataFile = new File(versionMetadata);
try {
Expand Down Expand Up @@ -1495,7 +1495,7 @@ private void generateFilesMetadata(List<File> files) {
}
});

String targetFile = config.outputFolder() + File.separator + METADATA_DIR + File.separator + "FILES";
String targetFile = config.outputFolder() + File.separator + METADATA_DIR + File.separator + config.getFilesMetadataFilename();

File filesFile = this.templateProcessor.writeToFile(targetFile, sb.toString().getBytes(StandardCharsets.UTF_8));
if (filesFile != null) {
Expand Down
Loading