forked from loafle/openapi-generator-original
[dart] Rename dart-dio-next to dart-dio and make it stable (#12258)
This commit is contained in:
parent
2ca6cf7d62
commit
89d17e2845
@ -1,5 +1,5 @@
|
||||
generatorName: dart-dio-next
|
||||
outputDir: samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake-json_serializable
|
||||
generatorName: dart-dio
|
||||
outputDir: samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio
|
||||
typeMappings:
|
||||
|
@ -1,5 +1,5 @@
|
||||
generatorName: dart-dio-next
|
||||
outputDir: samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake
|
||||
generatorName: dart-dio
|
||||
outputDir: samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio
|
||||
typeMappings:
|
||||
|
@ -22,7 +22,7 @@ The following generators are available:
|
||||
* [csharp-dotnet2 (deprecated)](generators/csharp-dotnet2.md)
|
||||
* [csharp-netcore](generators/csharp-netcore.md)
|
||||
* [dart](generators/dart.md)
|
||||
* [dart-dio-next (experimental)](generators/dart-dio-next.md)
|
||||
* [dart-dio](generators/dart-dio.md)
|
||||
* [eiffel](generators/eiffel.md)
|
||||
* [elixir](generators/elixir.md)
|
||||
* [elm](generators/elm.md)
|
||||
|
@ -1,13 +1,13 @@
|
||||
---
|
||||
title: Documentation for the dart-dio-next Generator
|
||||
title: Documentation for the dart-dio Generator
|
||||
---
|
||||
|
||||
## METADATA
|
||||
|
||||
| Property | Value | Notes |
|
||||
| -------- | ----- | ----- |
|
||||
| generator name | dart-dio-next | pass this to the generate command after -g |
|
||||
| generator stability | EXPERIMENTAL | |
|
||||
| generator name | dart-dio | pass this to the generate command after -g |
|
||||
| generator stability | STABLE | |
|
||||
| generator type | CLIENT | |
|
||||
| generator language | Dart | |
|
||||
| generator default templating engine | mustache | |
|
@ -46,9 +46,9 @@ import java.util.stream.Collectors;
|
||||
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
public class DartDioNextClientCodegen extends AbstractDartCodegen {
|
||||
public class DartDioClientCodegen extends AbstractDartCodegen {
|
||||
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(DartDioNextClientCodegen.class);
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(DartDioClientCodegen.class);
|
||||
|
||||
public static final String DATE_LIBRARY = "dateLibrary";
|
||||
public static final String DATE_LIBRARY_CORE = "core";
|
||||
@ -71,7 +71,7 @@ public class DartDioNextClientCodegen extends AbstractDartCodegen {
|
||||
|
||||
private TemplateManager templateManager;
|
||||
|
||||
public DartDioNextClientCodegen() {
|
||||
public DartDioClientCodegen() {
|
||||
super();
|
||||
|
||||
modifyFeatureSet(features -> features
|
||||
@ -81,10 +81,10 @@ public class DartDioNextClientCodegen extends AbstractDartCodegen {
|
||||
)
|
||||
);
|
||||
generatorMetadata = GeneratorMetadata.newBuilder()
|
||||
.stability(Stability.EXPERIMENTAL)
|
||||
.stability(Stability.STABLE)
|
||||
.build();
|
||||
|
||||
outputFolder = "generated-code/dart-dio-next";
|
||||
outputFolder = "generated-code/dart-dio";
|
||||
embeddedTemplateDir = "dart/libraries/dio";
|
||||
this.setTemplateDir(embeddedTemplateDir);
|
||||
|
||||
@ -128,7 +128,7 @@ public class DartDioNextClientCodegen extends AbstractDartCodegen {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "dart-dio-next";
|
||||
return "dart-dio";
|
||||
}
|
||||
|
||||
@Override
|
@ -24,7 +24,7 @@ org.openapitools.codegen.languages.CSharpNetCoreClientCodegen
|
||||
org.openapitools.codegen.languages.CSharpDotNet2ClientCodegen
|
||||
org.openapitools.codegen.languages.CsharpNetcoreFunctionsServerCodegen
|
||||
org.openapitools.codegen.languages.DartClientCodegen
|
||||
org.openapitools.codegen.languages.DartDioNextClientCodegen
|
||||
org.openapitools.codegen.languages.DartDioClientCodegen
|
||||
org.openapitools.codegen.languages.EiffelClientCodegen
|
||||
org.openapitools.codegen.languages.ElixirClientCodegen
|
||||
org.openapitools.codegen.languages.ElmClientCodegen
|
||||
|
@ -17,7 +17,7 @@
|
||||
package org.openapitools.codegen.dart.dio;
|
||||
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.languages.DartDioNextClientCodegen;
|
||||
import org.openapitools.codegen.languages.DartDioClientCodegen;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@ -29,11 +29,11 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class DartDioNextClientCodegenTest {
|
||||
public class DartDioClientCodegenTest {
|
||||
|
||||
@Test
|
||||
public void testInitialConfigValues() throws Exception {
|
||||
final DartDioNextClientCodegen codegen = new DartDioNextClientCodegen();
|
||||
final DartDioClientCodegen codegen = new DartDioClientCodegen();
|
||||
codegen.processOpts();
|
||||
|
||||
Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE);
|
||||
@ -42,7 +42,7 @@ public class DartDioNextClientCodegenTest {
|
||||
|
||||
@Test
|
||||
public void testSettersForConfigValues() throws Exception {
|
||||
final DartDioNextClientCodegen codegen = new DartDioNextClientCodegen();
|
||||
final DartDioClientCodegen codegen = new DartDioClientCodegen();
|
||||
codegen.setHideGenerationTimestamp(false);
|
||||
codegen.processOpts();
|
||||
|
||||
@ -52,7 +52,7 @@ public class DartDioNextClientCodegenTest {
|
||||
|
||||
@Test
|
||||
public void testAdditionalPropertiesPutForConfigValues() throws Exception {
|
||||
final DartDioNextClientCodegen codegen = new DartDioNextClientCodegen();
|
||||
final DartDioClientCodegen codegen = new DartDioClientCodegen();
|
||||
codegen.additionalProperties().put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, false);
|
||||
codegen.processOpts();
|
||||
|
||||
@ -62,7 +62,7 @@ public class DartDioNextClientCodegenTest {
|
||||
|
||||
@Test
|
||||
public void testKeywords() {
|
||||
final DartDioNextClientCodegen codegen = new DartDioNextClientCodegen();
|
||||
final DartDioClientCodegen codegen = new DartDioClientCodegen();
|
||||
|
||||
List<String> reservedWordsList = new ArrayList<>();
|
||||
try {
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright 2021 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openapitools.codegen.dart.dio;
|
||||
|
||||
import org.openapitools.codegen.AbstractOptionsTest;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.languages.DartDioClientCodegen;
|
||||
import org.openapitools.codegen.options.DartDioClientOptionsProvider;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
public class DartDioClientOptionsTest extends AbstractOptionsTest {
|
||||
private DartDioClientCodegen clientCodegen = mock(DartDioClientCodegen.class, mockSettings);
|
||||
|
||||
public DartDioClientOptionsTest() {
|
||||
super(new DartDioClientOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Override
|
||||
protected void verifyOptions() {
|
||||
verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(DartDioClientOptionsProvider.SORT_PARAMS_VALUE));
|
||||
verify(clientCodegen).setPubLibrary(DartDioClientOptionsProvider.PUB_LIBRARY_VALUE);
|
||||
verify(clientCodegen).setPubName(DartDioClientOptionsProvider.PUB_NAME_VALUE);
|
||||
verify(clientCodegen).setPubVersion(DartDioClientOptionsProvider.PUB_VERSION_VALUE);
|
||||
verify(clientCodegen).setPubDescription(DartDioClientOptionsProvider.PUB_DESCRIPTION_VALUE);
|
||||
verify(clientCodegen).setPubAuthor(DartDioClientOptionsProvider.PUB_AUTHOR_VALUE);
|
||||
verify(clientCodegen).setPubAuthorEmail(DartDioClientOptionsProvider.PUB_AUTHOR_EMAIL_VALUE);
|
||||
verify(clientCodegen).setPubHomepage(DartDioClientOptionsProvider.PUB_HOMEPAGE_VALUE);
|
||||
verify(clientCodegen).setSourceFolder(DartDioClientOptionsProvider.SOURCE_FOLDER_VALUE);
|
||||
verify(clientCodegen).setUseEnumExtension(Boolean.parseBoolean(DartDioClientOptionsProvider.USE_ENUM_EXTENSION));
|
||||
verify(clientCodegen).setDateLibrary(DartDioClientCodegen.DATE_LIBRARY_DEFAULT);
|
||||
verify(clientCodegen).setLibrary(DartDioClientCodegen.SERIALIZATION_LIBRARY_DEFAULT);
|
||||
verify(clientCodegen).setEnumUnknownDefaultCase(Boolean.parseBoolean(DartDioClientOptionsProvider.ENUM_UNKNOWN_DEFAULT_CASE_VALUE));
|
||||
}
|
||||
}
|
@ -19,13 +19,13 @@ package org.openapitools.codegen.dart.dio;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.DartDioNextClientCodegen;
|
||||
import org.openapitools.codegen.languages.DartDioClientCodegen;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@SuppressWarnings("static-method")
|
||||
public class DartDioNextModelTest {
|
||||
public class DartDioModelTest {
|
||||
|
||||
@Test(description = "convert a simple model")
|
||||
public void simpleModelTest() {
|
||||
@ -36,7 +36,7 @@ public class DartDioNextModelTest {
|
||||
.addProperties("createdAt", new DateTimeSchema())
|
||||
.addRequiredItem("id")
|
||||
.addRequiredItem("name");
|
||||
final DefaultCodegen codegen = new DartDioNextClientCodegen();
|
||||
final DefaultCodegen codegen = new DartDioClientCodegen();
|
||||
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
|
||||
codegen.setOpenAPI(openAPI);
|
||||
final CodegenModel cm = codegen.fromModel("sample", model);
|
||||
@ -90,8 +90,8 @@ public class DartDioNextModelTest {
|
||||
.addRequiredItem("id")
|
||||
.addRequiredItem("name");
|
||||
|
||||
final DartDioNextClientCodegen codegen = new DartDioNextClientCodegen();
|
||||
codegen.additionalProperties().put(DartDioNextClientCodegen.DATE_LIBRARY, DartDioNextClientCodegen.DATE_LIBRARY_TIME_MACHINE);
|
||||
final DartDioClientCodegen codegen = new DartDioClientCodegen();
|
||||
codegen.additionalProperties().put(DartDioClientCodegen.DATE_LIBRARY, DartDioClientCodegen.DATE_LIBRARY_TIME_MACHINE);
|
||||
codegen.processOpts();
|
||||
|
||||
codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model));
|
||||
@ -155,8 +155,8 @@ public class DartDioNextModelTest {
|
||||
.items(new StringSchema()))
|
||||
.addRequiredItem("id");
|
||||
|
||||
final DefaultCodegen codegen = new DartDioNextClientCodegen();
|
||||
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
|
||||
final DefaultCodegen codegen = new DartDioClientCodegen();
|
||||
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
|
||||
codegen.processOpts();
|
||||
|
||||
codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model));
|
||||
@ -197,8 +197,8 @@ public class DartDioNextModelTest {
|
||||
.addProperties("urls", new ArraySchema().items(new StringSchema()).uniqueItems(true))
|
||||
.addRequiredItem("id");
|
||||
|
||||
final DefaultCodegen codegen = new DartDioNextClientCodegen();
|
||||
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
|
||||
final DefaultCodegen codegen = new DartDioClientCodegen();
|
||||
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
|
||||
codegen.processOpts();
|
||||
|
||||
codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model));
|
||||
@ -239,8 +239,8 @@ public class DartDioNextModelTest {
|
||||
.additionalProperties(new StringSchema()))
|
||||
.addRequiredItem("id");
|
||||
|
||||
final DefaultCodegen codegen = new DartDioNextClientCodegen();
|
||||
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
|
||||
final DefaultCodegen codegen = new DartDioClientCodegen();
|
||||
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
|
||||
codegen.processOpts();
|
||||
|
||||
codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model));
|
||||
@ -269,8 +269,8 @@ public class DartDioNextModelTest {
|
||||
.description("a sample model")
|
||||
.addProperties("children", new Schema().$ref("#/definitions/Children"));
|
||||
|
||||
final DefaultCodegen codegen = new DartDioNextClientCodegen();
|
||||
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
|
||||
final DefaultCodegen codegen = new DartDioClientCodegen();
|
||||
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
|
||||
codegen.processOpts();
|
||||
|
||||
codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model));
|
||||
@ -298,8 +298,8 @@ public class DartDioNextModelTest {
|
||||
.addProperties("children", new ArraySchema()
|
||||
.items(new Schema().$ref("#/definitions/Children")));
|
||||
|
||||
final DefaultCodegen codegen = new DartDioNextClientCodegen();
|
||||
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
|
||||
final DefaultCodegen codegen = new DartDioClientCodegen();
|
||||
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
|
||||
codegen.processOpts();
|
||||
|
||||
codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model));
|
||||
@ -328,8 +328,8 @@ public class DartDioNextModelTest {
|
||||
.addProperties("children", new MapSchema()
|
||||
.additionalProperties(new Schema().$ref("#/definitions/Children")));
|
||||
|
||||
final DefaultCodegen codegen = new DartDioNextClientCodegen();
|
||||
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
|
||||
final DefaultCodegen codegen = new DartDioClientCodegen();
|
||||
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
|
||||
codegen.processOpts();
|
||||
|
||||
codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model));
|
||||
@ -357,7 +357,7 @@ public class DartDioNextModelTest {
|
||||
final Schema model = new ArraySchema()
|
||||
.items(new Schema().$ref("#/definitions/Children"))
|
||||
.description("an array model");
|
||||
final DefaultCodegen codegen = new DartDioNextClientCodegen();
|
||||
final DefaultCodegen codegen = new DartDioClientCodegen();
|
||||
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
|
||||
codegen.setOpenAPI(openAPI);
|
||||
final CodegenModel cm = codegen.fromModel("sample", model);
|
||||
@ -376,7 +376,7 @@ public class DartDioNextModelTest {
|
||||
final Schema model = new Schema()
|
||||
.description("a map model")
|
||||
.additionalProperties(new Schema().$ref("#/definitions/Children"));
|
||||
final DefaultCodegen codegen = new DartDioNextClientCodegen();
|
||||
final DefaultCodegen codegen = new DartDioClientCodegen();
|
||||
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
|
||||
codegen.setOpenAPI(openAPI);
|
||||
final CodegenModel cm = codegen.fromModel("sample", model);
|
||||
@ -400,8 +400,8 @@ public class DartDioNextModelTest {
|
||||
OpenAPI openAPI = TestUtils.createOpenAPI();
|
||||
final Schema model = new Schema();
|
||||
|
||||
final DefaultCodegen codegen = new DartDioNextClientCodegen();
|
||||
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
|
||||
final DefaultCodegen codegen = new DartDioClientCodegen();
|
||||
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
|
||||
codegen.processOpts();
|
||||
codegen.typeMapping().put("EnumClass", "TestModelEnumClass");
|
||||
codegen.typeMapping().put("JsonObject", "TestModelJsonObject");
|
||||
@ -426,8 +426,8 @@ public class DartDioNextModelTest {
|
||||
public void modelNameTestTimemachine(String name, String expectedName) {
|
||||
OpenAPI openAPI = TestUtils.createOpenAPI();
|
||||
final Schema model = new Schema();
|
||||
final DartDioNextClientCodegen codegen = new DartDioNextClientCodegen();
|
||||
codegen.additionalProperties().put(DartDioNextClientCodegen.DATE_LIBRARY, DartDioNextClientCodegen.DATE_LIBRARY_TIME_MACHINE);
|
||||
final DartDioClientCodegen codegen = new DartDioClientCodegen();
|
||||
codegen.additionalProperties().put(DartDioClientCodegen.DATE_LIBRARY, DartDioClientCodegen.DATE_LIBRARY_TIME_MACHINE);
|
||||
codegen.processOpts();
|
||||
codegen.typeMapping().put("EnumClass", "TestModelEnumClass");
|
||||
codegen.typeMapping().put("JsonObject", "TestModelJsonObject");
|
||||
@ -449,8 +449,8 @@ public class DartDioNextModelTest {
|
||||
.addProperties("arrayNoDefault", new ArraySchema())
|
||||
.addProperties("arrayEmptyDefault", array)
|
||||
.addProperties("mapNoDefault", new MapSchema());
|
||||
final DefaultCodegen codegen = new DartDioNextClientCodegen();
|
||||
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
|
||||
final DefaultCodegen codegen = new DartDioClientCodegen();
|
||||
codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE);
|
||||
codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model));
|
||||
codegen.processOpts();
|
||||
final CodegenModel cm = codegen.fromModel("sample", model);
|
||||
@ -479,7 +479,7 @@ public class DartDioNextModelTest {
|
||||
.addProperties("date", date)
|
||||
.addProperties("dateTime", dateTime)
|
||||
.addProperties("mapNoDefault", new MapSchema());
|
||||
final DefaultCodegen codegen = new DartDioNextClientCodegen();
|
||||
final DefaultCodegen codegen = new DartDioClientCodegen();
|
||||
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
|
||||
codegen.setOpenAPI(openAPI);
|
||||
final CodegenModel cm = codegen.fromModel("sample", model);
|
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright 2021 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openapitools.codegen.dart.dio;
|
||||
|
||||
import org.openapitools.codegen.AbstractOptionsTest;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
import org.openapitools.codegen.languages.DartDioNextClientCodegen;
|
||||
import org.openapitools.codegen.options.DartDioNextClientOptionsProvider;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
public class DartDioNextClientOptionsTest extends AbstractOptionsTest {
|
||||
private DartDioNextClientCodegen clientCodegen = mock(DartDioNextClientCodegen.class, mockSettings);
|
||||
|
||||
public DartDioNextClientOptionsTest() {
|
||||
super(new DartDioNextClientOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Override
|
||||
protected void verifyOptions() {
|
||||
verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(DartDioNextClientOptionsProvider.SORT_PARAMS_VALUE));
|
||||
verify(clientCodegen).setPubLibrary(DartDioNextClientOptionsProvider.PUB_LIBRARY_VALUE);
|
||||
verify(clientCodegen).setPubName(DartDioNextClientOptionsProvider.PUB_NAME_VALUE);
|
||||
verify(clientCodegen).setPubVersion(DartDioNextClientOptionsProvider.PUB_VERSION_VALUE);
|
||||
verify(clientCodegen).setPubDescription(DartDioNextClientOptionsProvider.PUB_DESCRIPTION_VALUE);
|
||||
verify(clientCodegen).setPubAuthor(DartDioNextClientOptionsProvider.PUB_AUTHOR_VALUE);
|
||||
verify(clientCodegen).setPubAuthorEmail(DartDioNextClientOptionsProvider.PUB_AUTHOR_EMAIL_VALUE);
|
||||
verify(clientCodegen).setPubHomepage(DartDioNextClientOptionsProvider.PUB_HOMEPAGE_VALUE);
|
||||
verify(clientCodegen).setSourceFolder(DartDioNextClientOptionsProvider.SOURCE_FOLDER_VALUE);
|
||||
verify(clientCodegen).setUseEnumExtension(Boolean.parseBoolean(DartDioNextClientOptionsProvider.USE_ENUM_EXTENSION));
|
||||
verify(clientCodegen).setDateLibrary(DartDioNextClientCodegen.DATE_LIBRARY_DEFAULT);
|
||||
verify(clientCodegen).setLibrary(DartDioNextClientCodegen.SERIALIZATION_LIBRARY_DEFAULT);
|
||||
verify(clientCodegen).setEnumUnknownDefaultCase(Boolean.parseBoolean(DartDioNextClientOptionsProvider.ENUM_UNKNOWN_DEFAULT_CASE_VALUE));
|
||||
}
|
||||
}
|
@ -18,11 +18,11 @@ package org.openapitools.codegen.options;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.openapitools.codegen.CodegenConstants;
|
||||
import org.openapitools.codegen.languages.DartDioNextClientCodegen;
|
||||
import org.openapitools.codegen.languages.DartDioClientCodegen;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class DartDioNextClientOptionsProvider implements OptionsProvider {
|
||||
public class DartDioClientOptionsProvider implements OptionsProvider {
|
||||
public static final String SORT_PARAMS_VALUE = "true";
|
||||
public static final String SORT_MODEL_PROPERTIES_VALUE = "false";
|
||||
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
|
||||
@ -41,7 +41,7 @@ public class DartDioNextClientOptionsProvider implements OptionsProvider {
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "dart-dio-next";
|
||||
return "dart-dio";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -50,18 +50,18 @@ public class DartDioNextClientOptionsProvider implements OptionsProvider {
|
||||
return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.put(CodegenConstants.SORT_MODEL_PROPERTIES_BY_REQUIRED_FLAG, SORT_MODEL_PROPERTIES_VALUE)
|
||||
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
|
||||
.put(DartDioNextClientCodegen.PUB_LIBRARY, PUB_LIBRARY_VALUE)
|
||||
.put(DartDioNextClientCodegen.PUB_NAME, PUB_NAME_VALUE)
|
||||
.put(DartDioNextClientCodegen.PUB_VERSION, PUB_VERSION_VALUE)
|
||||
.put(DartDioNextClientCodegen.PUB_DESCRIPTION, PUB_DESCRIPTION_VALUE)
|
||||
.put(DartDioNextClientCodegen.PUB_AUTHOR, PUB_AUTHOR_VALUE)
|
||||
.put(DartDioNextClientCodegen.PUB_AUTHOR_EMAIL, PUB_AUTHOR_EMAIL_VALUE)
|
||||
.put(DartDioNextClientCodegen.PUB_HOMEPAGE, PUB_HOMEPAGE_VALUE)
|
||||
.put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_DEFAULT)
|
||||
.put(DartDioNextClientCodegen.DATE_LIBRARY, DartDioNextClientCodegen.DATE_LIBRARY_DEFAULT)
|
||||
.put(DartDioNextClientCodegen.FINAL_PROPERTIES, DartDioNextClientCodegen.FINAL_PROPERTIES_DEFAULT_VALUE)
|
||||
.put(DartDioClientCodegen.PUB_LIBRARY, PUB_LIBRARY_VALUE)
|
||||
.put(DartDioClientCodegen.PUB_NAME, PUB_NAME_VALUE)
|
||||
.put(DartDioClientCodegen.PUB_VERSION, PUB_VERSION_VALUE)
|
||||
.put(DartDioClientCodegen.PUB_DESCRIPTION, PUB_DESCRIPTION_VALUE)
|
||||
.put(DartDioClientCodegen.PUB_AUTHOR, PUB_AUTHOR_VALUE)
|
||||
.put(DartDioClientCodegen.PUB_AUTHOR_EMAIL, PUB_AUTHOR_EMAIL_VALUE)
|
||||
.put(DartDioClientCodegen.PUB_HOMEPAGE, PUB_HOMEPAGE_VALUE)
|
||||
.put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioClientCodegen.SERIALIZATION_LIBRARY_DEFAULT)
|
||||
.put(DartDioClientCodegen.DATE_LIBRARY, DartDioClientCodegen.DATE_LIBRARY_DEFAULT)
|
||||
.put(DartDioClientCodegen.FINAL_PROPERTIES, DartDioClientCodegen.FINAL_PROPERTIES_DEFAULT_VALUE)
|
||||
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
|
||||
.put(DartDioNextClientCodegen.USE_ENUM_EXTENSION, USE_ENUM_EXTENSION)
|
||||
.put(DartDioClientCodegen.USE_ENUM_EXTENSION, USE_ENUM_EXTENSION)
|
||||
.put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE)
|
||||
.put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)
|
||||
.put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true")
|
4
pom.xml
4
pom.xml
@ -1322,8 +1322,8 @@
|
||||
</activation>
|
||||
<modules>
|
||||
<module>samples/openapi3/client/petstore/dart2/petstore_client_lib</module>
|
||||
<module>samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake</module>
|
||||
<module>samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake-json_serializable</module>
|
||||
<module>samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake</module>
|
||||
<module>samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
|
@ -1,418 +0,0 @@
|
||||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
_fe_analyzer_shared:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: _fe_analyzer_shared
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "22.0.0"
|
||||
analyzer:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: analyzer
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.7.2"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: args
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.3.0"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.9.0"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: boolean_selector
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
build:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
built_collection:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: built_collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.1.0"
|
||||
built_value:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: built_value
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "8.1.0"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: charcode
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.1"
|
||||
cli_util:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cli_util
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.5"
|
||||
code_builder:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: code_builder
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.1.0"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.16.0"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: convert
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
coverage:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: coverage
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: crypto
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
dart_style:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dart_style
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
dio:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: dio
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.1.2"
|
||||
fixnum:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fixnum
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
frontend_server_client:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: frontend_server_client
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
glob:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: glob
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.2"
|
||||
http_mock_adapter:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: http_mock_adapter
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.2"
|
||||
http_multi_server:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http_multi_server
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.2.0"
|
||||
http_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http_parser
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
io:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: io
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: js
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.6.4"
|
||||
logging:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: logging
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: matcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.10"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.7.0"
|
||||
mime:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: mime
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
mockito:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: mockito
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.0.11"
|
||||
node_preamble:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: node_preamble
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
openapi:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
path: "../petstore_client_lib_fake"
|
||||
relative: true
|
||||
source: path
|
||||
version: "1.0.0"
|
||||
package_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: package_config
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.2"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.1"
|
||||
pedantic:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.11.1"
|
||||
pool:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pool
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.5.0"
|
||||
pub_semver:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pub_semver
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
shelf:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
shelf_packages_handler:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf_packages_handler
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
shelf_static:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf_static
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
shelf_web_socket:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf_web_socket
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
source_gen:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_gen
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
source_map_stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_map_stack_trace
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
source_maps:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_maps
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.10.10"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.2"
|
||||
stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stack_trace
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.10.0"
|
||||
stream_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_channel
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: string_scanner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
term_glyph:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: term_glyph
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
test:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: test
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.17.4"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.0"
|
||||
test_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_core
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.24"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
vm_service:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.2.0"
|
||||
watcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: watcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
web_socket_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web_socket_channel
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
webkit_inspection_protocol:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: webkit_inspection_protocol
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: yaml
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.1.0"
|
||||
sdks:
|
||||
dart: ">=2.16.0 <3.0.0"
|
@ -4,7 +4,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod
|
||||
This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
||||
|
||||
- API version: 1.0.0
|
||||
- Build package: org.openapitools.codegen.languages.DartDioNextClientCodegen
|
||||
- Build package: org.openapitools.codegen.languages.DartDioClientCodegen
|
||||
|
||||
## Requirements
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user