Skip to content

Commit ba64e08

Browse files
committed
Merge branch 'master' into batch-ci
* master: [csharp-netcore] Propagate raw content to the ApiException error content. (#4381) Remove path relative to my home dir. (#4470) Avoid generating uncompilable response body in Spring's API template (#2903) cpp-qt5-client: remove host since it is not well handled (#4429) [Java] Refactor webClient generator to use URI templates to capture correct metrics (#4314) [Java]: Client resttemplate and webclient: array parameters of type integer in path badly generated (#4379) Dart generate keywords (#4449) [core] Fix system properties being immutable (#4447) [Kotlin][Client] minor improvements (#4419) [typescript-rxjs]: Add support for nullable (#4438) [asciidoc] fix names of parameters (#4440)
2 parents 2777d54 + 4494bf1 commit ba64e08

File tree

141 files changed

+3425
-830
lines changed

Some content is hidden

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

141 files changed

+3425
-830
lines changed

bin/ci/php-symfony-petstore.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"generatorName": "php-symfony",
3-
"inputSpec": "/Users/jim/projects/openapi-generator/bin/../modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
4-
"outputDir": "/Users/jim/projects/openapi-generator/bin/../samples/server/petstore/php-symfony/SymfonyBundle-php",
5-
"templateDir": "/Users/jim/projects/openapi-generator/bin/../modules/openapi-generator/src/main/resources/php-symfony"
3+
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
4+
"outputDir": "samples/server/petstore/php-symfony/SymfonyBundle-php",
5+
"templateDir": "modules/openapi-generator/src/main/resources/php-symfony"
66
}

bin/utils/dart-keywords/README.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
## What is the purpose?
3+
4+
Running `./save_dart_keywords.sh` from this directory will generate `dart-keywords.txt` which contains the current Dart keywords and is used by the dart generator as a set of reserved words.
5+
6+
## When should the keywords be generated?
7+
8+
`save_dart_keywords.sh` should be run when a new version of Dart is release to update the keywords file.
9+
10+
The last Dart version that was used to generate the keywords can be found in `dart-version.txt`.
11+
12+
## What does the shellscript do?
13+
14+
1. compile a dart app
15+
- `dart2native save-dart-keywords.dart`
16+
17+
1. run the dart app
18+
- `./save-dart-keywords.exe`
19+
20+
1. the ouput is `dart-keywords.txt` and `dart-version.txt`
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dart VM version: 2.7.0-dev.0.0 (Tue Nov 5 12:57:33 2019 +0100) on "macos_x64"

bin/utils/dart-keywords/pubspec.lock

+194
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# Generated by pub
2+
# See https://dart.dev/tools/pub/glossary#lockfile
3+
packages:
4+
_fe_analyzer_shared:
5+
dependency: transitive
6+
description:
7+
name: _fe_analyzer_shared
8+
url: "https://pub.dartlang.org"
9+
source: hosted
10+
version: "1.0.0"
11+
analyzer:
12+
dependency: "direct main"
13+
description:
14+
name: analyzer
15+
url: "https://pub.dartlang.org"
16+
source: hosted
17+
version: "0.39.1"
18+
args:
19+
dependency: transitive
20+
description:
21+
name: args
22+
url: "https://pub.dartlang.org"
23+
source: hosted
24+
version: "1.5.2"
25+
async:
26+
dependency: transitive
27+
description:
28+
name: async
29+
url: "https://pub.dartlang.org"
30+
source: hosted
31+
version: "2.4.0"
32+
charcode:
33+
dependency: transitive
34+
description:
35+
name: charcode
36+
url: "https://pub.dartlang.org"
37+
source: hosted
38+
version: "1.1.2"
39+
collection:
40+
dependency: transitive
41+
description:
42+
name: collection
43+
url: "https://pub.dartlang.org"
44+
source: hosted
45+
version: "1.14.12"
46+
convert:
47+
dependency: transitive
48+
description:
49+
name: convert
50+
url: "https://pub.dartlang.org"
51+
source: hosted
52+
version: "2.1.1"
53+
crypto:
54+
dependency: transitive
55+
description:
56+
name: crypto
57+
url: "https://pub.dartlang.org"
58+
source: hosted
59+
version: "2.1.3"
60+
csslib:
61+
dependency: transitive
62+
description:
63+
name: csslib
64+
url: "https://pub.dartlang.org"
65+
source: hosted
66+
version: "0.16.1"
67+
front_end:
68+
dependency: transitive
69+
description:
70+
name: front_end
71+
url: "https://pub.dartlang.org"
72+
source: hosted
73+
version: "0.1.29"
74+
glob:
75+
dependency: transitive
76+
description:
77+
name: glob
78+
url: "https://pub.dartlang.org"
79+
source: hosted
80+
version: "1.2.0"
81+
html:
82+
dependency: transitive
83+
description:
84+
name: html
85+
url: "https://pub.dartlang.org"
86+
source: hosted
87+
version: "0.14.0+3"
88+
js:
89+
dependency: transitive
90+
description:
91+
name: js
92+
url: "https://pub.dartlang.org"
93+
source: hosted
94+
version: "0.6.1+1"
95+
kernel:
96+
dependency: transitive
97+
description:
98+
name: kernel
99+
url: "https://pub.dartlang.org"
100+
source: hosted
101+
version: "0.3.29"
102+
meta:
103+
dependency: transitive
104+
description:
105+
name: meta
106+
url: "https://pub.dartlang.org"
107+
source: hosted
108+
version: "1.1.8"
109+
node_interop:
110+
dependency: transitive
111+
description:
112+
name: node_interop
113+
url: "https://pub.dartlang.org"
114+
source: hosted
115+
version: "1.0.3"
116+
node_io:
117+
dependency: transitive
118+
description:
119+
name: node_io
120+
url: "https://pub.dartlang.org"
121+
source: hosted
122+
version: "1.0.1+2"
123+
package_config:
124+
dependency: transitive
125+
description:
126+
name: package_config
127+
url: "https://pub.dartlang.org"
128+
source: hosted
129+
version: "1.1.0"
130+
path:
131+
dependency: transitive
132+
description:
133+
name: path
134+
url: "https://pub.dartlang.org"
135+
source: hosted
136+
version: "1.6.4"
137+
pedantic:
138+
dependency: transitive
139+
description:
140+
name: pedantic
141+
url: "https://pub.dartlang.org"
142+
source: hosted
143+
version: "1.8.0+1"
144+
pub_semver:
145+
dependency: transitive
146+
description:
147+
name: pub_semver
148+
url: "https://pub.dartlang.org"
149+
source: hosted
150+
version: "1.4.2"
151+
source_span:
152+
dependency: transitive
153+
description:
154+
name: source_span
155+
url: "https://pub.dartlang.org"
156+
source: hosted
157+
version: "1.5.5"
158+
string_scanner:
159+
dependency: transitive
160+
description:
161+
name: string_scanner
162+
url: "https://pub.dartlang.org"
163+
source: hosted
164+
version: "1.0.5"
165+
term_glyph:
166+
dependency: transitive
167+
description:
168+
name: term_glyph
169+
url: "https://pub.dartlang.org"
170+
source: hosted
171+
version: "1.1.0"
172+
typed_data:
173+
dependency: transitive
174+
description:
175+
name: typed_data
176+
url: "https://pub.dartlang.org"
177+
source: hosted
178+
version: "1.1.6"
179+
watcher:
180+
dependency: transitive
181+
description:
182+
name: watcher
183+
url: "https://pub.dartlang.org"
184+
source: hosted
185+
version: "0.9.7+12"
186+
yaml:
187+
dependency: transitive
188+
description:
189+
name: yaml
190+
url: "https://pub.dartlang.org"
191+
source: hosted
192+
version: "2.2.0"
193+
sdks:
194+
dart: ">=2.6.0 <3.0.0"

bin/utils/dart-keywords/pubspec.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: dart_keywords
2+
description: Use the Dart SDK to generate Dart keywords.
3+
4+
version: 1.0.0+1
5+
6+
environment:
7+
sdk: ">=2.6.0 <3.0.0"
8+
9+
dependencies:
10+
analyzer:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import 'dart:io';
2+
3+
import 'package:analyzer/dart/ast/token.dart';
4+
5+
main() {
6+
// save keywords to a text file
7+
final txtFile = File(
8+
'../../../modules/openapi-generator/src/main/resources/dart/dart-keywords.txt');
9+
String txtString = '';
10+
for (String keyword in Keyword.keywords.keys.toList()) {
11+
txtString += keyword + '\n';
12+
}
13+
txtString =
14+
txtString.substring(0, txtString.length - 1); // remove last newline
15+
txtFile.writeAsStringSync(txtString);
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dart2native save-dart-keywords.dart
2+
./save-dart-keywords.exe
3+
dart --version &> dart-version.txt

bin/utils/ensure-up-to-date

+1-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ declare root="$(cd "$cwd" && cd ../../ && pwd)"
88
declare executable="${root}/modules/openapi-generator-cli/target/openapi-generator-cli.jar"
99
declare batch_mode="false"
1010

11-
1211
echo "# START SCRIPT: $0"
1312

1413
echo "IMPORTANT: this script should be run by the CI (e.g. Shippable) to ensure that the 'samples/' folder is up to date."
@@ -29,17 +28,13 @@ declare -a scripts=(
2928
"${root}/bin/ruby-client-petstore-faraday.sh"
3029
"${root}/bin/openapi3/ruby-client-petstore.sh"
3130
"${root}/bin/openapi3/ruby-client-faraday-petstore.sh"
32-
3331
"${root}/bin/java-petstore-all.sh"
3432
"${root}/bin/java-jaxrs-petstore-server-all.sh"
3533
"${root}/bin/java-msf4j-petstore-server.sh"
3634
"${root}/bin/openapi3/jaxrs-jersey-petstore.sh"
3735
"${root}/bin/spring-all-petstore.sh"
3836
"${root}/bin/javascript-petstore-all.sh"
39-
"${root}/bin/kotlin-client-petstore-multiplatform.sh"
40-
"${root}/bin/kotlin-client-petstore.sh"
41-
"${root}/bin/kotlin-client-string.sh"
42-
"${root}/bin/kotlin-client-threetenbp.sh"
37+
"${root}/bin/kotlin-client-all.sh"
4338
"${root}/bin/kotlin-server-petstore.sh"
4439
"${root}/bin/kotlin-springboot-petstore-server.sh"
4540
"${root}/bin/kotlin-springboot-petstore-server-reactive.sh"

bin/windows/kotlin-client-gson.bat

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
2+
3+
If Not Exist %executable% (
4+
mvn clean package
5+
)
6+
7+
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
8+
set ags=generate --artifact-id "kotlin-petstore-gson" -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g kotlin --additional-properties serializationLibrary=gson -o samples\client\petstore\kotlin-gson
9+
10+
java %JAVA_OPTS% -jar %executable% %ags%
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
2+
3+
If Not Exist %executable% (
4+
mvn clean package
5+
)
6+
7+
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
8+
set ags=generate --artifact-id "kotlin-petstore-nonpublic" -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g kotlin --additional-properties nonPublicApi=true -o samples\client\petstore\kotlin-nonpublic
9+
10+
java %JAVA_OPTS% -jar %executable% %ags%

bin/windows/kotlin-client-okhttp3.bat

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
2+
3+
If Not Exist %executable% (
4+
mvn clean package
5+
)
6+
7+
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
8+
set ags=generate --artifact-id "kotlin-petstore-okhttp3" -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g kotlin --library jvm-okhttp3 -o samples\client\petstore\kotlin-okhttp3
9+
10+
java %JAVA_OPTS% -jar %executable% %ags%

modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/WorkflowSettings.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ public static Builder newBuilder(WorkflowSettings copy) {
103103
builder.strictSpecBehavior = copy.isStrictSpecBehavior();
104104
builder.templatingEngineName = copy.getTemplatingEngineName();
105105
builder.ignoreFileOverride = copy.getIgnoreFileOverride();
106-
builder.systemProperties = ImmutableMap.copyOf(copy.getSystemProperties());
106+
107+
// this, and any other collections, must be mutable in the builder.
108+
builder.systemProperties = new HashMap<>(copy.getSystemProperties());
107109

108110
// force builder "with" methods to invoke side effects
109111
builder.withTemplateDir(copy.getTemplateDir());
@@ -272,6 +274,8 @@ public static final class Builder {
272274
private String templateDir;
273275
private String templatingEngineName = DEFAULT_TEMPLATING_ENGINE_NAME;
274276
private String ignoreFileOverride;
277+
278+
// NOTE: All collections must be mutable in the builder, and copied to a new immutable collection in .build()
275279
private Map<String, String> systemProperties = new HashMap<>();;
276280

277281
private Builder() {

modules/openapi-generator-core/src/test/java/org/openapitools/codegen/config/WorkflowSettingsTest.java

+20
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.testng.annotations.Test;
2020

2121
import java.nio.file.Paths;
22+
import java.util.Map;
2223

2324
import static org.testng.Assert.*;
2425

@@ -48,6 +49,25 @@ public void defaultValuesNotOverriddenByNulls(){
4849
assertTrue(settings.isStrictSpecBehavior());
4950
}
5051

52+
@Test
53+
public void newBuilderFromCopyShouldMutateSystemProperties(){
54+
WorkflowSettings original = WorkflowSettings.newBuilder()
55+
.withOutputDir("output")
56+
.withVerbose(true)
57+
.withSkipOverwrite(false)
58+
.withSystemProperty("first", "1st")
59+
.build();
60+
61+
WorkflowSettings modified = WorkflowSettings.newBuilder(original)
62+
.withSystemProperty("second", "2nd")
63+
.build();
64+
65+
Map<String, String> properties = modified.getSystemProperties();
66+
assertEquals(properties.size(), 2, "System Properties map should allow mutation when invoked via copy constructor");
67+
assertEquals(properties.getOrDefault("first", ""), "1st");
68+
assertEquals(properties.getOrDefault("second", ""), "2nd");
69+
}
70+
5171
private void assertOnChangesToDefaults(WorkflowSettings defaults) {
5272
WorkflowSettings settings = WorkflowSettings.newBuilder()
5373
.withOutputDir("output")

modules/openapi-generator-gradle-plugin/samples/local-spec/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ gradle openApiGenerate
1111
gradle openApiMeta
1212
gradle openApiValidate
1313
gradle buildGoSdk
14+
gradle buildDotnetSdk
1415
gradle generateGoWithInvalidSpec
1516
```
1617

0 commit comments

Comments
 (0)