Skip to content

Commit 89d17e2

Browse files
authored
[dart] Rename dart-dio-next to dart-dio and make it stable (#12258)
1 parent 2ca6cf7 commit 89d17e2

File tree

390 files changed

+125
-543
lines changed

Some content is hidden

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

390 files changed

+125
-543
lines changed

bin/configs/dart-dio-next-petstore-client-lib-fake-json_serializable.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
generatorName: dart-dio-next
2-
outputDir: samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake-json_serializable
1+
generatorName: dart-dio
2+
outputDir: samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable
33
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
44
templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio
55
typeMappings:

bin/configs/dart-dio-next-petstore-client-lib-fake.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
generatorName: dart-dio-next
2-
outputDir: samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake
1+
generatorName: dart-dio
2+
outputDir: samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake
33
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
44
templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio
55
typeMappings:

docs/generators.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The following generators are available:
2222
* [csharp-dotnet2 (deprecated)](generators/csharp-dotnet2.md)
2323
* [csharp-netcore](generators/csharp-netcore.md)
2424
* [dart](generators/dart.md)
25-
* [dart-dio-next (experimental)](generators/dart-dio-next.md)
25+
* [dart-dio](generators/dart-dio.md)
2626
* [eiffel](generators/eiffel.md)
2727
* [elixir](generators/elixir.md)
2828
* [elm](generators/elm.md)

docs/generators/dart-dio-next.md renamed to docs/generators/dart-dio.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2-
title: Documentation for the dart-dio-next Generator
2+
title: Documentation for the dart-dio Generator
33
---
44

55
## METADATA
66

77
| Property | Value | Notes |
88
| -------- | ----- | ----- |
9-
| generator name | dart-dio-next | pass this to the generate command after -g |
10-
| generator stability | EXPERIMENTAL | |
9+
| generator name | dart-dio | pass this to the generate command after -g |
10+
| generator stability | STABLE | |
1111
| generator type | CLIENT | |
1212
| generator language | Dart | |
1313
| generator default templating engine | mustache | |
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646

4747
import static org.openapitools.codegen.utils.StringUtils.underscore;
4848

49-
public class DartDioNextClientCodegen extends AbstractDartCodegen {
49+
public class DartDioClientCodegen extends AbstractDartCodegen {
5050

51-
private final Logger LOGGER = LoggerFactory.getLogger(DartDioNextClientCodegen.class);
51+
private final Logger LOGGER = LoggerFactory.getLogger(DartDioClientCodegen.class);
5252

5353
public static final String DATE_LIBRARY = "dateLibrary";
5454
public static final String DATE_LIBRARY_CORE = "core";
@@ -71,7 +71,7 @@ public class DartDioNextClientCodegen extends AbstractDartCodegen {
7171

7272
private TemplateManager templateManager;
7373

74-
public DartDioNextClientCodegen() {
74+
public DartDioClientCodegen() {
7575
super();
7676

7777
modifyFeatureSet(features -> features
@@ -81,10 +81,10 @@ public DartDioNextClientCodegen() {
8181
)
8282
);
8383
generatorMetadata = GeneratorMetadata.newBuilder()
84-
.stability(Stability.EXPERIMENTAL)
84+
.stability(Stability.STABLE)
8585
.build();
8686

87-
outputFolder = "generated-code/dart-dio-next";
87+
outputFolder = "generated-code/dart-dio";
8888
embeddedTemplateDir = "dart/libraries/dio";
8989
this.setTemplateDir(embeddedTemplateDir);
9090

@@ -128,7 +128,7 @@ public void setClientName(String clientName) {
128128

129129
@Override
130130
public String getName() {
131-
return "dart-dio-next";
131+
return "dart-dio";
132132
}
133133

134134
@Override

modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ org.openapitools.codegen.languages.CSharpNetCoreClientCodegen
2424
org.openapitools.codegen.languages.CSharpDotNet2ClientCodegen
2525
org.openapitools.codegen.languages.CsharpNetcoreFunctionsServerCodegen
2626
org.openapitools.codegen.languages.DartClientCodegen
27-
org.openapitools.codegen.languages.DartDioNextClientCodegen
27+
org.openapitools.codegen.languages.DartDioClientCodegen
2828
org.openapitools.codegen.languages.EiffelClientCodegen
2929
org.openapitools.codegen.languages.ElixirClientCodegen
3030
org.openapitools.codegen.languages.ElmClientCodegen
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package org.openapitools.codegen.dart.dio;
1818

1919
import org.openapitools.codegen.CodegenConstants;
20-
import org.openapitools.codegen.languages.DartDioNextClientCodegen;
20+
import org.openapitools.codegen.languages.DartDioClientCodegen;
2121
import org.testng.Assert;
2222
import org.testng.annotations.Test;
2323

@@ -29,11 +29,11 @@
2929
import java.util.List;
3030
import java.util.Locale;
3131

32-
public class DartDioNextClientCodegenTest {
32+
public class DartDioClientCodegenTest {
3333

3434
@Test
3535
public void testInitialConfigValues() throws Exception {
36-
final DartDioNextClientCodegen codegen = new DartDioNextClientCodegen();
36+
final DartDioClientCodegen codegen = new DartDioClientCodegen();
3737
codegen.processOpts();
3838

3939
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE);
@@ -42,7 +42,7 @@ public void testInitialConfigValues() throws Exception {
4242

4343
@Test
4444
public void testSettersForConfigValues() throws Exception {
45-
final DartDioNextClientCodegen codegen = new DartDioNextClientCodegen();
45+
final DartDioClientCodegen codegen = new DartDioClientCodegen();
4646
codegen.setHideGenerationTimestamp(false);
4747
codegen.processOpts();
4848

@@ -52,7 +52,7 @@ public void testSettersForConfigValues() throws Exception {
5252

5353
@Test
5454
public void testAdditionalPropertiesPutForConfigValues() throws Exception {
55-
final DartDioNextClientCodegen codegen = new DartDioNextClientCodegen();
55+
final DartDioClientCodegen codegen = new DartDioClientCodegen();
5656
codegen.additionalProperties().put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, false);
5757
codegen.processOpts();
5858

@@ -62,7 +62,7 @@ public void testAdditionalPropertiesPutForConfigValues() throws Exception {
6262

6363
@Test
6464
public void testKeywords() {
65-
final DartDioNextClientCodegen codegen = new DartDioNextClientCodegen();
65+
final DartDioClientCodegen codegen = new DartDioClientCodegen();
6666

6767
List<String> reservedWordsList = new ArrayList<>();
6868
try {
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright 2021 OpenAPI-Generator Contributors (https://openapi-generator.tech)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.openapitools.codegen.dart.dio;
18+
19+
import org.openapitools.codegen.AbstractOptionsTest;
20+
import org.openapitools.codegen.CodegenConfig;
21+
import org.openapitools.codegen.languages.DartDioClientCodegen;
22+
import org.openapitools.codegen.options.DartDioClientOptionsProvider;
23+
24+
import static org.mockito.Mockito.mock;
25+
import static org.mockito.Mockito.verify;
26+
27+
public class DartDioClientOptionsTest extends AbstractOptionsTest {
28+
private DartDioClientCodegen clientCodegen = mock(DartDioClientCodegen.class, mockSettings);
29+
30+
public DartDioClientOptionsTest() {
31+
super(new DartDioClientOptionsProvider());
32+
}
33+
34+
@Override
35+
protected CodegenConfig getCodegenConfig() {
36+
return clientCodegen;
37+
}
38+
39+
@SuppressWarnings("unused")
40+
@Override
41+
protected void verifyOptions() {
42+
verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(DartDioClientOptionsProvider.SORT_PARAMS_VALUE));
43+
verify(clientCodegen).setPubLibrary(DartDioClientOptionsProvider.PUB_LIBRARY_VALUE);
44+
verify(clientCodegen).setPubName(DartDioClientOptionsProvider.PUB_NAME_VALUE);
45+
verify(clientCodegen).setPubVersion(DartDioClientOptionsProvider.PUB_VERSION_VALUE);
46+
verify(clientCodegen).setPubDescription(DartDioClientOptionsProvider.PUB_DESCRIPTION_VALUE);
47+
verify(clientCodegen).setPubAuthor(DartDioClientOptionsProvider.PUB_AUTHOR_VALUE);
48+
verify(clientCodegen).setPubAuthorEmail(DartDioClientOptionsProvider.PUB_AUTHOR_EMAIL_VALUE);
49+
verify(clientCodegen).setPubHomepage(DartDioClientOptionsProvider.PUB_HOMEPAGE_VALUE);
50+
verify(clientCodegen).setSourceFolder(DartDioClientOptionsProvider.SOURCE_FOLDER_VALUE);
51+
verify(clientCodegen).setUseEnumExtension(Boolean.parseBoolean(DartDioClientOptionsProvider.USE_ENUM_EXTENSION));
52+
verify(clientCodegen).setDateLibrary(DartDioClientCodegen.DATE_LIBRARY_DEFAULT);
53+
verify(clientCodegen).setLibrary(DartDioClientCodegen.SERIALIZATION_LIBRARY_DEFAULT);
54+
verify(clientCodegen).setEnumUnknownDefaultCase(Boolean.parseBoolean(DartDioClientOptionsProvider.ENUM_UNKNOWN_DEFAULT_CASE_VALUE));
55+
}
56+
}
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
import io.swagger.v3.oas.models.OpenAPI;
2020
import io.swagger.v3.oas.models.media.*;
2121
import org.openapitools.codegen.*;
22-
import org.openapitools.codegen.languages.DartDioNextClientCodegen;
22+
import org.openapitools.codegen.languages.DartDioClientCodegen;
2323
import org.testng.Assert;
2424
import org.testng.annotations.DataProvider;
2525
import org.testng.annotations.Test;
2626

2727
@SuppressWarnings("static-method")
28-
public class DartDioNextModelTest {
28+
public class DartDioModelTest {
2929

3030
@Test(description = "convert a simple model")
3131
public void simpleModelTest() {
@@ -36,7 +36,7 @@ public void simpleModelTest() {
3636
.addProperties("createdAt", new DateTimeSchema())
3737
.addRequiredItem("id")
3838
.addRequiredItem("name");
39-
final DefaultCodegen codegen = new DartDioNextClientCodegen();
39+
final DefaultCodegen codegen = new DartDioClientCodegen();
4040
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
4141
codegen.setOpenAPI(openAPI);
4242
final CodegenModel cm = codegen.fromModel("sample", model);
@@ -90,8 +90,8 @@ public void simpleModelWithTimeMachineTest() {
9090
.addRequiredItem("id")
9191
.addRequiredItem("name");
9292

93-
final DartDioNextClientCodegen codegen = new DartDioNextClientCodegen();
94-
codegen.additionalProperties().put(DartDioNextClientCodegen.DATE_LIBRARY, DartDioNextClientCodegen.DATE_LIBRARY_TIME_MACHINE);
93+
final DartDioClientCodegen codegen = new DartDioClientCodegen();
94+
codegen.additionalProperties().put(DartDioClientCodegen.DATE_LIBRARY, DartDioClientCodegen.DATE_LIBRARY_TIME_MACHINE);
9595
codegen.processOpts();
9696

9797
codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model));
@@ -155,8 +155,8 @@ public void listPropertyTest() {
155155
.items(new StringSchema()))
156156
.addRequiredItem("id");
157157

158-
final DefaultCodegen codegen = new DartDioNextClientCodegen();
159-
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
158+
final DefaultCodegen codegen = new DartDioClientCodegen();
159+
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
160160
codegen.processOpts();
161161

162162
codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model));
@@ -197,8 +197,8 @@ public void setPropertyTest() {
197197
.addProperties("urls", new ArraySchema().items(new StringSchema()).uniqueItems(true))
198198
.addRequiredItem("id");
199199

200-
final DefaultCodegen codegen = new DartDioNextClientCodegen();
201-
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
200+
final DefaultCodegen codegen = new DartDioClientCodegen();
201+
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
202202
codegen.processOpts();
203203

204204
codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model));
@@ -239,8 +239,8 @@ public void mapPropertyTest() {
239239
.additionalProperties(new StringSchema()))
240240
.addRequiredItem("id");
241241

242-
final DefaultCodegen codegen = new DartDioNextClientCodegen();
243-
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
242+
final DefaultCodegen codegen = new DartDioClientCodegen();
243+
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
244244
codegen.processOpts();
245245

246246
codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model));
@@ -269,8 +269,8 @@ public void complexPropertyTest() {
269269
.description("a sample model")
270270
.addProperties("children", new Schema().$ref("#/definitions/Children"));
271271

272-
final DefaultCodegen codegen = new DartDioNextClientCodegen();
273-
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
272+
final DefaultCodegen codegen = new DartDioClientCodegen();
273+
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
274274
codegen.processOpts();
275275

276276
codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model));
@@ -298,8 +298,8 @@ public void complexListProperty() {
298298
.addProperties("children", new ArraySchema()
299299
.items(new Schema().$ref("#/definitions/Children")));
300300

301-
final DefaultCodegen codegen = new DartDioNextClientCodegen();
302-
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
301+
final DefaultCodegen codegen = new DartDioClientCodegen();
302+
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
303303
codegen.processOpts();
304304

305305
codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model));
@@ -328,8 +328,8 @@ public void complexMapSchema() {
328328
.addProperties("children", new MapSchema()
329329
.additionalProperties(new Schema().$ref("#/definitions/Children")));
330330

331-
final DefaultCodegen codegen = new DartDioNextClientCodegen();
332-
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
331+
final DefaultCodegen codegen = new DartDioClientCodegen();
332+
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
333333
codegen.processOpts();
334334

335335
codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model));
@@ -357,7 +357,7 @@ public void arrayModelTest() {
357357
final Schema model = new ArraySchema()
358358
.items(new Schema().$ref("#/definitions/Children"))
359359
.description("an array model");
360-
final DefaultCodegen codegen = new DartDioNextClientCodegen();
360+
final DefaultCodegen codegen = new DartDioClientCodegen();
361361
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
362362
codegen.setOpenAPI(openAPI);
363363
final CodegenModel cm = codegen.fromModel("sample", model);
@@ -376,7 +376,7 @@ public void mapModelTest() {
376376
final Schema model = new Schema()
377377
.description("a map model")
378378
.additionalProperties(new Schema().$ref("#/definitions/Children"));
379-
final DefaultCodegen codegen = new DartDioNextClientCodegen();
379+
final DefaultCodegen codegen = new DartDioClientCodegen();
380380
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
381381
codegen.setOpenAPI(openAPI);
382382
final CodegenModel cm = codegen.fromModel("sample", model);
@@ -400,8 +400,8 @@ public void modelNameTest(String name, String expectedName) {
400400
OpenAPI openAPI = TestUtils.createOpenAPI();
401401
final Schema model = new Schema();
402402

403-
final DefaultCodegen codegen = new DartDioNextClientCodegen();
404-
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
403+
final DefaultCodegen codegen = new DartDioClientCodegen();
404+
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
405405
codegen.processOpts();
406406
codegen.typeMapping().put("EnumClass", "TestModelEnumClass");
407407
codegen.typeMapping().put("JsonObject", "TestModelJsonObject");
@@ -426,8 +426,8 @@ public static Object[][] modelNamesTimemachine() {
426426
public void modelNameTestTimemachine(String name, String expectedName) {
427427
OpenAPI openAPI = TestUtils.createOpenAPI();
428428
final Schema model = new Schema();
429-
final DartDioNextClientCodegen codegen = new DartDioNextClientCodegen();
430-
codegen.additionalProperties().put(DartDioNextClientCodegen.DATE_LIBRARY, DartDioNextClientCodegen.DATE_LIBRARY_TIME_MACHINE);
429+
final DartDioClientCodegen codegen = new DartDioClientCodegen();
430+
codegen.additionalProperties().put(DartDioClientCodegen.DATE_LIBRARY, DartDioClientCodegen.DATE_LIBRARY_TIME_MACHINE);
431431
codegen.processOpts();
432432
codegen.typeMapping().put("EnumClass", "TestModelEnumClass");
433433
codegen.typeMapping().put("JsonObject", "TestModelJsonObject");
@@ -449,8 +449,8 @@ public void collectionDefaultValues() {
449449
.addProperties("arrayNoDefault", new ArraySchema())
450450
.addProperties("arrayEmptyDefault", array)
451451
.addProperties("mapNoDefault", new MapSchema());
452-
final DefaultCodegen codegen = new DartDioNextClientCodegen();
453-
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
452+
final DefaultCodegen codegen = new DartDioClientCodegen();
453+
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
454454
codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model));
455455
codegen.processOpts();
456456
final CodegenModel cm = codegen.fromModel("sample", model);
@@ -479,7 +479,7 @@ public void dateDefaultValues() {
479479
.addProperties("date", date)
480480
.addProperties("dateTime", dateTime)
481481
.addProperties("mapNoDefault", new MapSchema());
482-
final DefaultCodegen codegen = new DartDioNextClientCodegen();
482+
final DefaultCodegen codegen = new DartDioClientCodegen();
483483
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
484484
codegen.setOpenAPI(openAPI);
485485
final CodegenModel cm = codegen.fromModel("sample", model);

0 commit comments

Comments
 (0)