Skip to content

Commit 92b403d

Browse files
committed
Merge branch 'master' into bugfix/4999
* master: (345 commits) [kotlin][spring] Fix ApiUtil compilation (#6084) update python samples [Python] Fixed docstrings in api.mustache (#6391) [BUG][python] Support named arrays (#6493) [Go] whitelist AdditionalProperties in the field name (#6543) [kotlin][client] remove tabs usage (#6526) [PS] automatically derive discriminator mapping for oneOf/anyOf (#6542) [C++][Ue4] various bus fixes (#6539) Fix incorrect npx command (#6537) update pester to 5.x (#6536) comment out openapi3 java jersey2-java8 tests add additional properties support to powershell client generator (#6528) [Go][Experimental] Support additionalProperties (#6525) #5476 [kotlin] [spring] fix swagger and spring annotation for defaultValue (#6101) [samples] regenerate (#6533) [python] Fix date-time parsing (#6458) Register OAuth2ClientContext as bean (#6172) [Go][Experimental] Fix discriminator lookup (#6521) Typescript-rxjs: print param name (#6368) add oneof discrimistrator lookup to go experimental (#6517) ...
2 parents ba03875 + 388218b commit 92b403d

File tree

10,251 files changed

+253716
-471040
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

10,251 files changed

+253716
-471040
lines changed

.travis.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ before_install:
6565
- gem install bundler
6666
- npm install -g typescript
6767
- npm install -g npm
68-
#- npm install -g elm@0.18.0-exp5
6968
- npm config set registry http://registry.npmjs.org/
7069
# set python 3.6.3 as default
7170
- source ~/virtualenv/python3.6/bin/activate
@@ -102,6 +101,9 @@ before_install:
102101
# install Qt5
103102
- sudo apt install -y --no-install-recommends qt5-default
104103
- cmake --version
104+
# perl dep
105+
- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
106+
- cpanm --quiet --no-interactive Test::Exception Test::More Log::Any LWP::UserAgent URI::Query Module::Runtime DateTime Module::Find Moose::Role JSON || echo "Igorned failure from cpanm"
105107
# show host table to confirm petstore.swagger.io is mapped to localhost
106108
- cat /etc/hosts
107109
# show java version
@@ -136,13 +138,13 @@ script:
136138
- /bin/bash ./bin/utils/detect_tab_in_java_class.sh
137139
# run integration tests defined in maven pom.xml
138140
# WARN: Travis will timeout after 10 minutes of no stdout/stderr activity, which is problematic with mvn --quiet.
139-
- mvn --quiet --batch-mode --show-version clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
140-
- mvn --quiet --batch-mode --show-version verify -Psamples -Dorg.slf4j.simpleLogger.defaultLogLevel=error
141+
- mvn --no-snapshot-updates --quiet --batch-mode --show-version clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
142+
- mvn --no-snapshot-updates --quiet --batch-mode --show-version verify -Psamples -Dorg.slf4j.simpleLogger.defaultLogLevel=error
141143
# test maven plugin
142-
- mvn --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/java-client.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
143-
- mvn --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
144-
- mvn --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/kotlin.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
145-
- mvn --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/spring.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
144+
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/java-client.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
145+
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
146+
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/kotlin.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
147+
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/spring.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
146148
# test gradle plugin
147149
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew buildGoSdk)
148150
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew openApiGenerate)

CI/.drone.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ kind: pipeline
22
name: default
33

44
steps:
5+
# test aspnetcore 3.x
6+
- name: aspnetcore-test
7+
image: mcr.microsoft.com/dotnet/core/sdk:3.1
8+
commands:
9+
- (cd samples/server/petstore/aspnetcore-3.1/ && /bin/sh build.sh)
10+
- (cd samples/server/petstore/aspnetcore-3.0/ && /bin/sh build.sh)
511
# test ocaml petstore client
612
- name: ocaml-test
713
image: ocaml/opam2:4.07
@@ -18,20 +24,15 @@ steps:
1824
image: haskell:8.6.5
1925
commands:
2026
- (cd samples/client/petstore/haskell-http-client/ && stack --install-ghc --no-haddock-deps haddock --fast && stack test --fast)
21-
# below dart tests moved to circle ci
22-
# test Dart 2.x petstore client
23-
#- name: dart2x-test
24-
# image: google/dart
25-
# commands:
26-
# - (cd samples/client/petstore/dart-jaguar/openapi && pub get && pub run build_runner build --delete-conflicting-outputs)
27-
# - (cd samples/client/petstore/dart-jaguar/flutter_petstore/openapi && pub get && pub run build_runner build --delete-conflicting-outputs)
28-
# - (cd samples/client/petstore/dart2/petstore && pub get && pub run test)
2927
# test Java 11 HTTP client
3028
- name: java11-test
3129
image: openjdk:11.0
3230
commands:
3331
- ./mvnw -quiet clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
3432
- ./mvnw --quiet verify -Psamples.droneio -Dorg.slf4j.simpleLogger.defaultLogLevel=error
33+
# test java native client
34+
- ./mvnw clean test -f samples/client/petstore/java/native/pom.xml
35+
- ./mvnw clean test -f samples/client/petstore/java/native-async/pom.xml
3536
# test all generators with fake petstore spec (2.0, 3.0)
3637
- /bin/bash bin/utils/test-fake-petstore-for-all.sh
3738
# generate test scripts

CI/.travis.yml.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ script:
3434
- set -e
3535
# run integration tests defined in maven pom.xml
3636
- cp pom.xml.bash pom.xml
37-
- mvn --batch-mode verify -Psamples
37+
- mvn --no-snapshot-updates --batch-mode verify -Psamples

CI/.travis.yml.ios

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ before_install:
3434

3535
script:
3636
# run integration tests defined in maven pom.xml
37-
- mvn -q --batch-mode verify -Psamples.ios -Dmaven.javadoc.skip=true
37+
- mvn --no-snapshot-updates -q --batch-mode verify -Psamples.ios -Dmaven.javadoc.skip=true

CI/bitrise.yml

+1-12
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ workflows:
2828
2929
set -e
3030
31-
mvn package -Dorg.slf4j.simpleLogger.defaultLogLevel=error
31+
mvn --no-snapshot-updates package -Dorg.slf4j.simpleLogger.defaultLogLevel=error
3232
title: Build openapi-generator
3333
- script@1.1.5:
3434
title: Update Swift samples
@@ -38,18 +38,7 @@ workflows:
3838
3939
set -e
4040
41-
sh bin/swift4-all.sh
4241
sh bin/swift5-all.sh
43-
- script@1.1.5:
44-
title: Run Swift4 tests
45-
inputs:
46-
- content: |
47-
#!/usr/bin/env bash
48-
49-
set -e
50-
51-
./samples/client/petstore/swift4/swift4_test_all.sh
52-
./samples/client/test/swift4/swift4_test_all.sh
5342
- script@1.1.5:
5443
title: Run Swift5 tests
5544
inputs:

CI/circle_parallel.sh

+4-7
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ if [ "$NODE_INDEX" = "1" ]; then
2424
export PATH="/usr/local/go1.14/go/bin:$PATH"
2525
go version
2626

27-
mvn --quiet verify -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
28-
mvn --quiet javadoc:javadoc -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
27+
mvn --no-snapshot-updates --quiet verify -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
28+
mvn --no-snapshot-updates --quiet javadoc:javadoc -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
2929

3030
elif [ "$NODE_INDEX" = "2" ]; then
3131
# run ensure-up-to-date sample script on SNAPSHOT version only
@@ -34,9 +34,6 @@ elif [ "$NODE_INDEX" = "2" ]; then
3434
echo "Running node $NODE_INDEX to test ensure-up-to-date"
3535
java -version
3636

37-
# install elm-format
38-
npm install -g elm-format
39-
4037
# clear any changes to the samples
4138
git checkout -- .
4239

@@ -61,7 +58,7 @@ elif [ "$NODE_INDEX" = "2" ]; then
6158
sudo apt-get -y install libcurl4-gnutls-dev
6259

6360
# run integration tests
64-
mvn --quiet verify -Psamples.misc -Dorg.slf4j.simpleLogger.defaultLogLevel=error
61+
mvn --no-snapshot-updates --quiet verify -Psamples.misc -Dorg.slf4j.simpleLogger.defaultLogLevel=error
6562
else
6663
echo "Running node $NODE_INDEX to test 'samples.circleci.jdk7' defined in pom.xml ..."
6764
sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
@@ -76,7 +73,7 @@ else
7673
sudo apt-get install dart
7774
export PATH="$PATH:/usr/lib/dart/bin"
7875

79-
mvn --quiet verify -Psamples.circleci.jdk7 -Dorg.slf4j.simpleLogger.defaultLogLevel=error
76+
mvn --no-snapshot-updates --quiet verify -Psamples.circleci.jdk7 -Dorg.slf4j.simpleLogger.defaultLogLevel=error
8077
fi
8178

8279

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by a tool.
4+
// Runtime Version:4.0.30319.42000
5+
//
6+
// Changes to this file may cause incorrect behavior and will be lost if
7+
// the code is regenerated.
8+
// </auto-generated>
9+
//------------------------------------------------------------------------------
10+
11+
using System;
12+
using System.Reflection;
13+
14+
[assembly: System.Reflection.AssemblyCompanyAttribute("Org.OpenAPITools.Test")]
15+
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
16+
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
17+
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
18+
[assembly: System.Reflection.AssemblyProductAttribute("Org.OpenAPITools.Test")]
19+
[assembly: System.Reflection.AssemblyTitleAttribute("Org.OpenAPITools.Test")]
20+
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
21+
22+
// Generated by the MSBuild WriteCodeFragment class.
23+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
19e887ae0fddb9fd03c4341951ee9077703a652f
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by a tool.
4+
// Runtime Version:4.0.30319.42000
5+
//
6+
// Changes to this file may cause incorrect behavior and will be lost if
7+
// the code is regenerated.
8+
// </auto-generated>
9+
//------------------------------------------------------------------------------
10+
11+
using System;
12+
using System.Reflection;
13+
14+
[assembly: System.Reflection.AssemblyCompanyAttribute("Org.OpenAPITools.Test")]
15+
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
16+
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
17+
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
18+
[assembly: System.Reflection.AssemblyProductAttribute("Org.OpenAPITools.Test")]
19+
[assembly: System.Reflection.AssemblyTitleAttribute("Org.OpenAPITools.Test")]
20+
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
21+
22+
// Generated by the MSBuild WriteCodeFragment class.
23+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
19e887ae0fddb9fd03c4341951ee9077703a652f

CI/samples.ci/client/petstore/java/test-manual/jersey1/ApiClientTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ public void testGetAuthentications() {
122122
}
123123
}
124124

125-
@Ignore("There is no more basic auth in petstore security definitions")
126125
@Test
127126
public void testSetUsernameAndPassword() {
128127
HttpBasicAuth auth = null;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package org.openapitools.client;
2+
3+
import org.openapitools.client.model.Mammal;
4+
import org.openapitools.client.model.AppleReq;
5+
import org.openapitools.client.model.BananaReq;
6+
import org.openapitools.client.model.FruitReq;
7+
import org.openapitools.client.model.BasquePig;
8+
import org.openapitools.client.model.Pig;
9+
import org.openapitools.client.model.Whale;
10+
import org.openapitools.client.model.Zebra;
11+
import java.lang.Exception;
12+
13+
import org.junit.*;
14+
import static org.junit.Assert.*;
15+
16+
17+
public class JSONComposedSchemaTest {
18+
JSON json = null;
19+
Mammal mammal = null;
20+
21+
@Before
22+
public void setup() {
23+
json = new JSON();
24+
mammal = new Mammal();
25+
}
26+
27+
/**
28+
* Validate a oneOf schema can be deserialized into the expected class.
29+
* The oneOf schema does not have a discriminator.
30+
*/
31+
@Test
32+
public void testOneOfSchemaWithoutDiscriminator() throws Exception {
33+
// BananaReq and AppleReq have explicitly defined properties that are different by name.
34+
// There is no discriminator property.
35+
String str = "{ \"cultivar\": \"golden delicious\", \"mealy\": false }";
36+
FruitReq o = json.getContext(null).readValue(str, FruitReq.class);
37+
assertTrue(o.getActualInstance() instanceof AppleReq);
38+
}
39+
40+
/**
41+
* Validate a oneOf schema can be deserialized into the expected class.
42+
* The oneOf schema has a discriminator.
43+
*/
44+
@Test
45+
public void testOneOfSchemaWithDiscriminator() throws Exception {
46+
// Mammal can be one of whale, pig and zebra.
47+
// pig has sub-classes.
48+
String str = "{ \"className\": \"whale\", \"hasBaleen\": true, \"hasTeeth\": false }";
49+
/*
50+
DISABLING unit test for now until ambiguity of discriminator is resolved.
51+
52+
// Note that the 'zebra' schema does not have any explicit property defined AND
53+
// it has additionalProperties: true. Hence without a discriminator the above
54+
// JSON payload would match both 'whale' and 'zebra'. This is because the 'hasBaleen'
55+
// and 'hasTeeth' would be considered additional (undeclared) properties for 'zebra'.
56+
Mammal o = json.getContext(null).readValue(str, Mammal.class);
57+
assertTrue(o.getActualInstance() instanceof Whale);
58+
59+
str = "{ \"className\": \"zebra\" }";
60+
o = json.getContext(null).readValue(str, Mammal.class);
61+
assertTrue(o.getActualInstance() instanceof Zebra);
62+
63+
str = "{ \"className\": \"BasquePig\" }";
64+
o = json.getContext(null).readValue(str, Mammal.class);
65+
assertTrue(o.getActualInstance() instanceof BasquePig);
66+
*/
67+
}
68+
}

CI/samples.ci/client/petstore/java/test-manual/jersey2/ApiClientTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ public void testGetAuthentications() {
122122
}
123123
}
124124

125-
@Ignore("There is no more basic auth in petstore security definitions")
126125
@Test
127126
public void testSetUsernameAndPassword() {
128127
HttpBasicAuth auth = null;

CI/samples.ci/client/petstore/java/test-manual/jersey2/auth/ApiKeyAuthTest.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,22 @@
55
import java.util.Map;
66
import java.util.List;
77

8+
import org.openapitools.client.ApiException;
89
import org.openapitools.client.Pair;
910
import org.junit.*;
1011
import static org.junit.Assert.*;
1112

1213

1314
public class ApiKeyAuthTest {
1415
@Test
15-
public void testApplyToParamsInQuery() {
16+
public void testApplyToParamsInQuery() throws ApiException {
1617
List<Pair> queryParams = new ArrayList<Pair>();
1718
Map<String, String> headerParams = new HashMap<String, String>();
1819
Map<String, String> cookieParams = new HashMap<String, String>();
1920

2021
ApiKeyAuth auth = new ApiKeyAuth("query", "api_key");
2122
auth.setApiKey("my-api-key");
22-
auth.applyToParams(queryParams, headerParams, cookieParams);
23+
auth.applyToParams(queryParams, headerParams, cookieParams, null, null, null);
2324

2425
assertEquals(1, queryParams.size());
2526
for (Pair queryParam : queryParams) {
@@ -32,15 +33,15 @@ public void testApplyToParamsInQuery() {
3233
}
3334

3435
@Test
35-
public void testApplyToParamsInHeaderWithPrefix() {
36+
public void testApplyToParamsInHeaderWithPrefix() throws ApiException {
3637
List<Pair> queryParams = new ArrayList<Pair>();
3738
Map<String, String> headerParams = new HashMap<String, String>();
3839
Map<String, String> cookieParams = new HashMap<String, String>();
3940

4041
ApiKeyAuth auth = new ApiKeyAuth("header", "X-API-TOKEN");
4142
auth.setApiKey("my-api-token");
4243
auth.setApiKeyPrefix("Token");
43-
auth.applyToParams(queryParams, headerParams, cookieParams);
44+
auth.applyToParams(queryParams, headerParams, cookieParams, null, null, null);
4445

4546
// no changes to query parameters
4647
assertEquals(0, queryParams.size());
@@ -50,15 +51,15 @@ public void testApplyToParamsInHeaderWithPrefix() {
5051
}
5152

5253
@Test
53-
public void testApplyToParamsInCookieWithPrefix() {
54+
public void testApplyToParamsInCookieWithPrefix() throws ApiException {
5455
List<Pair> queryParams = new ArrayList<Pair>();
5556
Map<String, String> headerParams = new HashMap<String, String>();
5657
Map<String, String> cookieParams = new HashMap<String, String>();
5758

5859
ApiKeyAuth auth = new ApiKeyAuth("cookie", "X-API-TOKEN");
5960
auth.setApiKey("my-api-token");
6061
auth.setApiKeyPrefix("Token");
61-
auth.applyToParams(queryParams, headerParams, cookieParams);
62+
auth.applyToParams(queryParams, headerParams, cookieParams, null, null, null);
6263

6364
// no changes to query or header parameters
6465
assertEquals(0, queryParams.size());

CI/samples.ci/client/petstore/java/test-manual/jersey2/auth/HttpBasicAuthTest.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.util.Map;
66
import java.util.List;
77

8+
import org.openapitools.client.ApiException;
89
import org.openapitools.client.Pair;
910
import org.junit.*;
1011
import static org.junit.Assert.*;
@@ -19,14 +20,14 @@ public void setup() {
1920
}
2021

2122
@Test
22-
public void testApplyToParams() {
23+
public void testApplyToParams() throws ApiException {
2324
List<Pair> queryParams = new ArrayList<Pair>();
2425
Map<String, String> headerParams = new HashMap<String, String>();
2526
Map<String, String> cookieParams = new HashMap<String, String>();
2627

2728
auth.setUsername("my-username");
2829
auth.setPassword("my-password");
29-
auth.applyToParams(queryParams, headerParams, cookieParams);
30+
auth.applyToParams(queryParams, headerParams, cookieParams, null, null, null);
3031

3132
// no changes to query parameters
3233
assertEquals(0, queryParams.size());
@@ -37,15 +38,15 @@ public void testApplyToParams() {
3738

3839
// null username should be treated as empty string
3940
auth.setUsername(null);
40-
auth.applyToParams(queryParams, headerParams, cookieParams);
41+
auth.applyToParams(queryParams, headerParams, cookieParams, null, null, null);
4142
// the string below is base64-encoded result of ":my-password" with the "Basic " prefix
4243
expected = "Basic Om15LXBhc3N3b3Jk";
4344
assertEquals(expected, headerParams.get("Authorization"));
4445

4546
// null password should be treated as empty string
4647
auth.setUsername("my-username");
4748
auth.setPassword(null);
48-
auth.applyToParams(queryParams, headerParams, cookieParams);
49+
auth.applyToParams(queryParams, headerParams, cookieParams, null, null, null);
4950
// the string below is base64-encoded result of "my-username:" with the "Basic " prefix
5051
expected = "Basic bXktdXNlcm5hbWU6";
5152
assertEquals(expected, headerParams.get("Authorization"));

0 commit comments

Comments
 (0)