diff --git a/.github/.test/samples.json b/.github/.test/samples.json
index 471241ab9c8..6272fb28cc6 100644
--- a/.github/.test/samples.json
+++ b/.github/.test/samples.json
@@ -145,12 +145,6 @@
"Documentation: Cwiki"
]
},
- {
- "input": "dart-jaguar-petstore.sh",
- "matches": [
- "Client: Dart"
- ]
- },
{
"input": "dart-dio-petstore.sh",
"matches": [
@@ -223,12 +217,6 @@
"Server: Scala"
]
},
- {
- "input": "flash-petstore.sh",
- "matches": [
- "Client: Flash/ActionScript"
- ]
- },
{
"input": "go-gin-petstore-server.sh",
"matches": [
diff --git a/.github/auto-labeler.yml b/.github/auto-labeler.yml
index 2bb9a71d44e..6a4f6a18ce0 100644
--- a/.github/auto-labeler.yml
+++ b/.github/auto-labeler.yml
@@ -62,9 +62,6 @@ labels:
- '\s*?-[gl] erlang(-.*)?-client\s*?'
- '\s*?\[erlang-proper\]\s*?'
- '\s*?-[gl] erlang-proper\s*?'
- 'Client: Flash/ActionScript':
- - '\s*?\[flash\]\s*?'
- - '\s*?-[gl] flash(?!-)\b'
'Client: Go':
- '\s*?\[go\]\s*?'
- '\s*?-[gl] go(?!-)\b'
diff --git a/.gitignore b/.gitignore
index f04e4e087bf..f7a20948546 100644
--- a/.gitignore
+++ b/.gitignore
@@ -245,9 +245,6 @@ samples/server/petstore/erlang-server/rebar.lock
**/dart*/**/pubspec.lock
# Dart dio
**/dart*/**/*.g.dart
-# Dart jaguar
-**/dart*/**/*.jser.dart
-**/dart*/**/*.jretro.dart
# JS
samples/client/petstore/javascript-es6/package-lock.json
diff --git a/bin/configs/other/openapi3/flash.yaml b/bin/configs/other/openapi3/flash.yaml
deleted file mode 100644
index 52ed771332d..00000000000
--- a/bin/configs/other/openapi3/flash.yaml
+++ /dev/null
@@ -1,7 +0,0 @@
-generatorName: flash
-outputDir: samples/client/petstore/flash
-inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
-templateDir: modules/openapi-generator/src/main/resources/flash
-additionalProperties:
- invokerPackage: org.openapitools
- packageName: org.openapitools
diff --git a/docs/generators.md b/docs/generators.md
index 0ec7569496c..595a9e804af 100644
--- a/docs/generators.md
+++ b/docs/generators.md
@@ -24,13 +24,11 @@ The following generators are available:
* [dart](generators/dart.md)
* [dart-dio](generators/dart-dio.md)
* [dart-dio-next (experimental)](generators/dart-dio-next.md)
-* [dart-jaguar (deprecated)](generators/dart-jaguar.md)
* [eiffel](generators/eiffel.md)
* [elixir](generators/elixir.md)
* [elm](generators/elm.md)
* [erlang-client](generators/erlang-client.md)
* [erlang-proper](generators/erlang-proper.md)
-* [flash-deprecated (deprecated)](generators/flash-deprecated.md)
* [go](generators/go.md)
* [go-deprecated (deprecated)](generators/go-deprecated.md)
* [groovy](generators/groovy.md)
@@ -67,7 +65,6 @@ The following generators are available:
* [swift5](generators/swift5.md)
* [typescript (experimental)](generators/typescript.md)
* [typescript-angular](generators/typescript-angular.md)
-* [typescript-angularjs-deprecated (deprecated)](generators/typescript-angularjs-deprecated.md)
* [typescript-aurelia](generators/typescript-aurelia.md)
* [typescript-axios](generators/typescript-axios.md)
* [typescript-fetch](generators/typescript-fetch.md)
@@ -113,14 +110,12 @@ The following generators are available:
* [jaxrs-resteasy-eap](generators/jaxrs-resteasy-eap.md)
* [jaxrs-spec](generators/jaxrs-spec.md)
* [kotlin-server](generators/kotlin-server.md)
-* [kotlin-server-deprecated (deprecated)](generators/kotlin-server-deprecated.md)
* [kotlin-spring](generators/kotlin-spring.md)
* [kotlin-vertx (beta)](generators/kotlin-vertx.md)
* [nodejs-express-server (beta)](generators/nodejs-express-server.md)
* [php-laravel](generators/php-laravel.md)
* [php-lumen](generators/php-lumen.md)
* [php-mezzio-ph](generators/php-mezzio-ph.md)
-* [php-silex-deprecated (deprecated)](generators/php-silex-deprecated.md)
* [php-slim-deprecated (deprecated)](generators/php-slim-deprecated.md)
* [php-slim4](generators/php-slim4.md)
* [php-symfony](generators/php-symfony.md)
diff --git a/docs/generators/README.md b/docs/generators/README.md
index b9e8926f664..8f6ee8a7f15 100644
--- a/docs/generators/README.md
+++ b/docs/generators/README.md
@@ -15,13 +15,11 @@ The following generators are available:
* [csharp-netcore](csharp-netcore.md)
* [dart](dart.md)
* [dart-dio](dart-dio.md)
-* [dart-jaguar](dart-jaguar.md)
* [eiffel](eiffel.md)
* [elixir](elixir.md)
* [elm](elm.md)
* [erlang-client](erlang-client.md)
* [erlang-proper](erlang-proper.md)
-* [flash](flash.md)
* [go](go.md)
* [go-experimental (experimental)](go-experimental.md)
* [groovy](groovy.md)
@@ -92,7 +90,6 @@ The following generators are available:
* [jaxrs-resteasy-eap](jaxrs-resteasy-eap.md)
* [jaxrs-spec](jaxrs-spec.md)
* [kotlin-server](kotlin-server.md)
-* [kotlin-server-deprecated](kotlin-server-deprecated.md)
* [kotlin-spring](kotlin-spring.md)
* [kotlin-vertx (beta)](kotlin-vertx.md)
* [nodejs-express-server (beta)](nodejs-express-server.md)
diff --git a/modules/openapi-generator-cli/pom.xml b/modules/openapi-generator-cli/pom.xml
index 9fbea46fac5..f3a3e13d60e 100644
--- a/modules/openapi-generator-cli/pom.xml
+++ b/modules/openapi-generator-cli/pom.xml
@@ -4,7 +4,7 @@
org.openapitools
openapi-generator-project
- 5.4.0
+ 6.0.0-SNAPSHOT
../..
diff --git a/modules/openapi-generator-core/pom.xml b/modules/openapi-generator-core/pom.xml
index 475a367e563..506951cddba 100644
--- a/modules/openapi-generator-core/pom.xml
+++ b/modules/openapi-generator-core/pom.xml
@@ -6,7 +6,7 @@
openapi-generator-project
org.openapitools
- 5.4.0
+ 6.0.0-SNAPSHOT
../..
diff --git a/modules/openapi-generator-gradle-plugin/gradle.properties b/modules/openapi-generator-gradle-plugin/gradle.properties
index ecebe5a44cd..aa47d751bc5 100644
--- a/modules/openapi-generator-gradle-plugin/gradle.properties
+++ b/modules/openapi-generator-gradle-plugin/gradle.properties
@@ -1,5 +1,5 @@
# RELEASE_VERSION
-openApiGeneratorVersion=5.4.0
+openApiGeneratorVersion=6.0.0-SNAPSHOT
# /RELEASE_VERSION
# BEGIN placeholders
diff --git a/modules/openapi-generator-gradle-plugin/pom.xml b/modules/openapi-generator-gradle-plugin/pom.xml
index 1a06b8ea407..f782c3d8331 100644
--- a/modules/openapi-generator-gradle-plugin/pom.xml
+++ b/modules/openapi-generator-gradle-plugin/pom.xml
@@ -4,7 +4,7 @@
org.openapitools
openapi-generator-project
- 5.4.0
+ 6.0.0-SNAPSHOT
../..
diff --git a/modules/openapi-generator-maven-plugin/examples/java-client.xml b/modules/openapi-generator-maven-plugin/examples/java-client.xml
index 4aff956dba9..50d9c62076d 100644
--- a/modules/openapi-generator-maven-plugin/examples/java-client.xml
+++ b/modules/openapi-generator-maven-plugin/examples/java-client.xml
@@ -13,7 +13,7 @@
org.openapitools
openapi-generator-maven-plugin
- 5.4.0
+ 6.0.0-SNAPSHOT
diff --git a/modules/openapi-generator-maven-plugin/examples/kotlin.xml b/modules/openapi-generator-maven-plugin/examples/kotlin.xml
index c057233bd1e..2a9a73bd456 100644
--- a/modules/openapi-generator-maven-plugin/examples/kotlin.xml
+++ b/modules/openapi-generator-maven-plugin/examples/kotlin.xml
@@ -15,7 +15,7 @@
org.openapitools
openapi-generator-maven-plugin
- 5.4.0
+ 6.0.0-SNAPSHOT
diff --git a/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml b/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml
index e1f49c69457..c39e3434325 100644
--- a/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml
+++ b/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml
@@ -19,7 +19,7 @@
org.openapitools
openapi-generator-maven-plugin
- 5.4.0
+ 6.0.0-SNAPSHOT
diff --git a/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml b/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml
index 7f1c7656455..9c99f1d674e 100644
--- a/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml
+++ b/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml
@@ -13,7 +13,7 @@
org.openapitools
openapi-generator-maven-plugin
- 5.4.0
+ 6.0.0-SNAPSHOT
diff --git a/modules/openapi-generator-maven-plugin/examples/non-java.xml b/modules/openapi-generator-maven-plugin/examples/non-java.xml
index 6a89de73dd8..6af688a0032 100644
--- a/modules/openapi-generator-maven-plugin/examples/non-java.xml
+++ b/modules/openapi-generator-maven-plugin/examples/non-java.xml
@@ -13,7 +13,7 @@
org.openapitools
openapi-generator-maven-plugin
- 5.4.0
+ 6.0.0-SNAPSHOT
diff --git a/modules/openapi-generator-maven-plugin/examples/spring.xml b/modules/openapi-generator-maven-plugin/examples/spring.xml
index d4338d0d946..d824117438e 100644
--- a/modules/openapi-generator-maven-plugin/examples/spring.xml
+++ b/modules/openapi-generator-maven-plugin/examples/spring.xml
@@ -20,7 +20,7 @@
org.openapitools
openapi-generator-maven-plugin
- 5.4.0
+ 6.0.0-SNAPSHOT
diff --git a/modules/openapi-generator-maven-plugin/pom.xml b/modules/openapi-generator-maven-plugin/pom.xml
index 8383f001d2e..ffbcf5077bf 100644
--- a/modules/openapi-generator-maven-plugin/pom.xml
+++ b/modules/openapi-generator-maven-plugin/pom.xml
@@ -5,7 +5,7 @@
org.openapitools
openapi-generator-project
- 5.4.0
+ 6.0.0-SNAPSHOT
../..
diff --git a/modules/openapi-generator-online/pom.xml b/modules/openapi-generator-online/pom.xml
index 12ca1e1dbd4..644104a13e8 100644
--- a/modules/openapi-generator-online/pom.xml
+++ b/modules/openapi-generator-online/pom.xml
@@ -4,7 +4,7 @@
org.openapitools
openapi-generator-project
- 5.4.0
+ 6.0.0-SNAPSHOT
../..
diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml
index 0a6c94cda8e..b637e18870e 100644
--- a/modules/openapi-generator/pom.xml
+++ b/modules/openapi-generator/pom.xml
@@ -4,7 +4,7 @@
org.openapitools
openapi-generator-project
- 5.4.0
+ 6.0.0-SNAPSHOT
../..
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java
index 00fa3cf7a5e..960011d0618 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java
@@ -64,7 +64,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public String defaultValue;
public String arrayModelType;
public boolean isAlias; // Is this effectively an alias of another simple type
- public boolean isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble, isDate, isDateTime, isDecimal, isShort, isUnboundedInteger, isBoolean;
+ public boolean isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble, isDate, isDateTime, isDecimal, isShort, isUnboundedInteger, isPrimitiveType, isBoolean;
private boolean additionalPropertiesIsAnyType;
public List vars = new ArrayList<>(); // all properties (without parent's properties)
public List allVars = new ArrayList<>(); // all properties (with parent's properties)
@@ -637,6 +637,14 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
this.isUnboundedInteger = isUnboundedInteger;
}
+ @Override
+ public boolean getIsPrimitiveType() { return isPrimitiveType; }
+
+ @Override
+ public void setIsPrimitiveType(boolean isPrimitiveType) {
+ this.isPrimitiveType = isPrimitiveType;
+ }
+
@Override
public CodegenProperty getAdditionalProperties() { return additionalProperties; }
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java
index 6d00e02103e..8a848eaf9ac 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenParameter.java
@@ -623,6 +623,14 @@ public class CodegenParameter implements IJsonSchemaValidationProperties {
this.isUnboundedInteger = isUnboundedInteger;
}
+ @Override
+ public boolean getIsPrimitiveType() { return isPrimitiveType; }
+
+ @Override
+ public void setIsPrimitiveType(boolean isPrimitiveType) {
+ this.isPrimitiveType = isPrimitiveType;
+ }
+
@Override
public CodegenProperty getAdditionalProperties() { return additionalProperties; }
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java
index 7c2430f4714..8c1bdeb57dc 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenProperty.java
@@ -536,6 +536,14 @@ public class CodegenProperty implements Cloneable, IJsonSchemaValidationProperti
this.isUnboundedInteger = isUnboundedInteger;
}
+ @Override
+ public boolean getIsPrimitiveType() { return isPrimitiveType; }
+
+ @Override
+ public void setIsPrimitiveType(boolean isPrimitiveType) {
+ this.isPrimitiveType = isPrimitiveType;
+ }
+
public Map getVendorExtensions() {
return vendorExtensions;
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java
index 33fcf0afa52..0f7b111bcab 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenResponse.java
@@ -371,6 +371,14 @@ public class CodegenResponse implements IJsonSchemaValidationProperties {
this.isUnboundedInteger = isUnboundedInteger;
}
+ @Override
+ public boolean getIsPrimitiveType() { return primitiveType; }
+
+ @Override
+ public void setIsPrimitiveType(boolean isPrimitiveType) {
+ this.primitiveType = isPrimitiveType;
+ }
+
@Override
public void setIsModel(boolean isModel) {
this.isModel = isModel;
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java
index 187e3f5a14a..d0ce99e5423 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/IJsonSchemaValidationProperties.java
@@ -99,6 +99,10 @@ public interface IJsonSchemaValidationProperties {
void setIsUnboundedInteger(boolean isUnboundedInteger);
+ boolean getIsPrimitiveType();
+
+ void setIsPrimitiveType(boolean isPrimitiveType);
+
CodegenProperty getAdditionalProperties();
void setAdditionalProperties(CodegenProperty additionalProperties);
@@ -264,4 +268,4 @@ public interface IJsonSchemaValidationProperties {
}
return imports;
}
-}
\ No newline at end of file
+}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java
index bb8f9901765..f0874648f65 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java
@@ -281,6 +281,9 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
// {{sourceFolder}}
if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) {
setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER));
+
+ // TODO: Move to its own option when a parameter for 'testFolder' is added.
+ setTestFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER));
} else {
additionalProperties.put(CodegenConstants.SOURCE_FOLDER, this.sourceFolder);
}
@@ -1151,6 +1154,10 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
public void setSourceFolder(String sourceFolder) {
this.sourceFolder = sourceFolder;
}
+
+ public void setTestFolder(String testFolder) {
+ this.testFolder = testFolder;
+ }
public String getInterfacePrefix() {
return interfacePrefix;
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java
index 92c7fef7470..7f509f60e5d 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java
@@ -1,5 +1,7 @@
package org.openapitools.codegen.languages;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.Schema;
@@ -112,12 +114,13 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
setReservedWordsLowerCase(reservedWordsList);
// These types return isPrimitive=true in templates
- languageSpecificPrimitives = new HashSet<>(5);
- languageSpecificPrimitives.add("String");
- languageSpecificPrimitives.add("bool");
- languageSpecificPrimitives.add("int");
- languageSpecificPrimitives.add("num");
- languageSpecificPrimitives.add("double");
+ languageSpecificPrimitives = Sets.newHashSet(
+ "String",
+ "bool",
+ "int",
+ "num",
+ "double"
+ );
typeMapping = new HashMap<>();
typeMapping.put("Array", "List");
@@ -148,17 +151,18 @@ public abstract class AbstractDartCodegen extends DefaultCodegen {
typeMapping.put("AnyType", "Object");
// Data types of the above values which are automatically imported
- defaultIncludes = new HashSet<>();
- defaultIncludes.add("String");
- defaultIncludes.add("bool");
- defaultIncludes.add("int");
- defaultIncludes.add("num");
- defaultIncludes.add("double");
- defaultIncludes.add("List");
- defaultIncludes.add("Set");
- defaultIncludes.add("Map");
- defaultIncludes.add("DateTime");
- defaultIncludes.add("Object");
+ defaultIncludes = Sets.newHashSet(
+ "String",
+ "bool",
+ "int",
+ "num",
+ "double",
+ "List",
+ "Set",
+ "Map",
+ "DateTime",
+ "Object"
+ );
imports.put("String", "dart:core");
imports.put("bool", "dart:core");
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java
index 25853e0b254..5693d19265c 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java
@@ -36,6 +36,7 @@ public class DartClientCodegen extends AbstractDartCodegen {
public DartClientCodegen() {
super();
+
final CliOption serializationLibrary = CliOption.newString(CodegenConstants.SERIALIZATION_LIBRARY,
"Specify serialization library");
serializationLibrary.setDefault(SERIALIZATION_LIBRARY_NATIVE);
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularJsClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularJsClientCodegen.java
deleted file mode 100644
index e342d985e42..00000000000
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularJsClientCodegen.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
- * Copyright 2018 SmartBear Software
- *
- * 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.languages;
-
-import io.swagger.v3.oas.models.media.Schema;
-import org.openapitools.codegen.CodegenParameter;
-import org.openapitools.codegen.SupportingFile;
-import org.openapitools.codegen.meta.GeneratorMetadata;
-import org.openapitools.codegen.meta.Stability;
-
-import java.io.File;
-
-public class TypeScriptAngularJsClientCodegen extends AbstractTypeScriptClientCodegen {
-
- public TypeScriptAngularJsClientCodegen() {
- super();
- outputFolder = "generated-code/typescript-angularjs";
- modelTemplateFiles.put("model.mustache", ".ts");
- apiTemplateFiles.put("api.mustache", ".ts");
- embeddedTemplateDir = templateDir = "typescript-angularjs";
- apiPackage = "api";
- modelPackage = "model";
-
- removeOption(NPM_NAME);
- removeOption(NPM_VERSION);
- removeOption(SNAPSHOT);
-
- generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
- .stability(Stability.DEPRECATED)
- .build();
- }
-
- @Override
- public String getName() {
- return "typescript-angularjs-deprecated";
- }
-
- @Override
- public String getHelp() {
- return "Generates a TypeScript AngularJS client library. This generator has been deprecated and will be removed in the future release.";
- }
-
- @Override
- public void processOpts() {
- super.processOpts();
-
- supportingFiles.add(new SupportingFile("models.mustache", modelPackage().replace('.', File.separatorChar), "models.ts"));
- supportingFiles.add(new SupportingFile("apis.mustache", apiPackage().replace('.', File.separatorChar), "api.ts"));
- supportingFiles.add(new SupportingFile("index.mustache", getIndexDirectory(), "index.ts"));
- supportingFiles.add(new SupportingFile("api.module.mustache", getIndexDirectory(), "api.module.ts"));
- supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
- supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore"));
-
- }
-
- @Override
- public String getSchemaType(Schema p) {
- String openAPIType = super.getSchemaType(p);
- if (isLanguagePrimitive(openAPIType) || isLanguageGenericType(openAPIType)) {
- return openAPIType;
- }
- return addModelPrefix(openAPIType);
- }
-
- @Override
- public String getTypeDeclaration(String name) {
- return addModelPrefix(name);
- }
-
- @Override
- public void postProcessParameter(CodegenParameter parameter) {
- super.postProcessParameter(parameter);
- // parameter.dataType = addModelPrefix(parameter.dataType);
- }
-
- private String getIndexDirectory() {
- String indexPackage = modelPackage.substring(0, Math.max(0, modelPackage.lastIndexOf('.')));
- return indexPackage.replace('.', File.separatorChar);
- }
-
- private String addModelPrefix(String openAPIType) {
- String type = null;
- if (typeMapping.containsKey(openAPIType)) {
- type = typeMapping.get(openAPIType);
- } else {
- type = openAPIType;
- }
-
- if (!isLanguagePrimitive(type) && !isLanguageGenericType(type)) {
- type = "models." + openAPIType;
- }
- return type;
- }
-
- private boolean isLanguagePrimitive(String type) {
- return languageSpecificPrimitives.contains(type);
- }
-
- private boolean isLanguageGenericType(String type) {
- for (String genericType : languageGenericTypes) {
- if (type.startsWith(genericType + "<")) {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/modules/openapi-generator/src/main/resources/Java/ServerConfiguration.mustache b/modules/openapi-generator/src/main/resources/Java/ServerConfiguration.mustache
index e21b63391e2..7f640ba7475 100644
--- a/modules/openapi-generator/src/main/resources/Java/ServerConfiguration.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/ServerConfiguration.mustache
@@ -39,7 +39,7 @@ public class ServerConfiguration {
if (variables != null && variables.containsKey(name)) {
value = variables.get(name);
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
- throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
+ throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + ".");
}
}
url = url.replaceAll("\\{" + name + "\\}", value);
diff --git a/modules/openapi-generator/src/main/resources/Java/auth/OAuthFlow.mustache b/modules/openapi-generator/src/main/resources/Java/auth/OAuthFlow.mustache
index 05bbf28dd3b..7a4252662f5 100644
--- a/modules/openapi-generator/src/main/resources/Java/auth/OAuthFlow.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/auth/OAuthFlow.mustache
@@ -2,10 +2,13 @@
package {{invokerPackage}}.auth;
+/**
+ * OAuth flows that are supported by this client
+ */
{{>generatedAnnotation}}
public enum OAuthFlow {
- accessCode, //called authorizationCode in OpenAPI 3.0
- implicit,
- password,
- application //called clientCredentials in OpenAPI 3.0
+ ACCESS_CODE, //called authorizationCode in OpenAPI 3.0
+ IMPLICIT,
+ PASSWORD,
+ APPLICATION //called clientCredentials in OpenAPI 3.0
}
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache
index 5c4e78970ea..ed8f2302eb8 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/ApiClient.mustache
@@ -91,7 +91,7 @@ public class ApiClient {
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}");
{{/isApiKey}}
{{#isOAuth}}
- auth = buildOauthRequestInterceptor(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}");
+ auth = buildOauthRequestInterceptor(OAuthFlow.{{#lambda.uppercase}}{{#lambda.snakecase}}{{flow}}{{/lambda.snakecase}}{{/lambda.uppercase}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}");
{{/isOAuth}}
} else {{/authMethods}}{
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
@@ -179,9 +179,9 @@ public class ApiClient {
{{#hasOAuthMethods}}
private RequestInterceptor buildOauthRequestInterceptor(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) {
switch (flow) {
- case password:
+ case PASSWORD:
return new OauthPasswordGrant(tokenUrl, scopes);
- case application:
+ case APPLICATION:
return new OauthClientCredentialsGrant(authorizationUrl, tokenUrl, scopes);
default:
throw new RuntimeException("Oauth flow \"" + flow + "\" is not implemented");
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OauthClientCredentialsGrant.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OauthClientCredentialsGrant.mustache
index ef22c211637..2180273d0e9 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OauthClientCredentialsGrant.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OauthClientCredentialsGrant.mustache
@@ -21,7 +21,7 @@ public class OauthClientCredentialsGrant extends OAuth {
@Override
protected OAuthFlow getFlow() {
- return OAuthFlow.application;
+ return OAuthFlow.APPLICATION;
}
/**
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OauthPasswordGrant.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OauthPasswordGrant.mustache
index 870c3755a8b..522afa08ead 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OauthPasswordGrant.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OauthPasswordGrant.mustache
@@ -24,7 +24,7 @@ public class OauthPasswordGrant extends OAuth {
@Override
protected OAuthFlow getFlow() {
- return OAuthFlow.password;
+ return OAuthFlow.PASSWORD;
}
/**
@@ -45,4 +45,4 @@ public class OauthPasswordGrant extends OAuth {
.defaultScope(scopes)
.build(new DefaultApi20Impl(authorizationUrl, tokenUrl));
}
-}
\ No newline at end of file
+}
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/auth/OAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/auth/OAuth.mustache
index 62b573a66c0..30060cc2701 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/auth/OAuth.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/auth/OAuth.mustache
@@ -26,7 +26,7 @@ public class OAuth implements Authentication {
private String tokenUrl;
private String absoluteTokenUrl;
- private OAuthFlow flow = OAuthFlow.application;
+ private OAuthFlow flow = OAuthFlow.APPLICATION;
private OAuth20Service service;
private DefaultApi20 authApi;
private String scope;
@@ -103,18 +103,18 @@ public class OAuth implements Authentication {
}
try {
switch (flow) {
- case password:
+ case PASSWORD:
if (username != null && password != null) {
accessToken = service.getAccessTokenPasswordGrant(username, password, scope);
}
break;
- case accessCode:
+ case ACCESS_CODE:
if (code != null) {
accessToken = service.getAccessToken(code);
code = null;
}
break;
- case application:
+ case APPLICATION:
accessToken = service.getAccessTokenClientCredentialsGrant(scope);
break;
default:
@@ -159,14 +159,14 @@ public class OAuth implements Authentication {
}
public OAuth usePasswordFlow(String username, String password) {
- this.flow = OAuthFlow.password;
+ this.flow = OAuthFlow.PASSWORD;
this.username = username;
this.password = password;
return this;
}
public OAuth useAuthorizationCodeFlow(String code) {
- this.flow = OAuthFlow.accessCode;
+ this.flow = OAuthFlow.ACCESS_CODE;
this.code = code;
return this;
}
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/auth/OAuthFlow.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/auth/OAuthFlow.mustache
index 002e9572f33..190781fb126 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/auth/OAuthFlow.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/auth/OAuthFlow.mustache
@@ -2,6 +2,12 @@
package {{invokerPackage}}.auth;
+/**
+ * OAuth flows that are supported by this client
+ */
public enum OAuthFlow {
- accessCode, implicit, password, application
+ ACCESS_CODE,
+ IMPLICIT,
+ PASSWORD,
+ APPLICATION
}
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/ApiClient.mustache
index de8ac2527be..ce5e4bf4848 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/ApiClient.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/ApiClient.mustache
@@ -197,7 +197,7 @@ public class ApiClient {
throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL");
}
}
- RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.{{flow}}, clientSecret, parameters);
+ RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.{{#lambda.uppercase}}{{#lambda.snakecase}}{{flow}}{{/lambda.snakecase}}{{/lambda.uppercase}}, clientSecret, parameters);
authentications.put(
"{{name}}",
retryingOAuth
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/auth/RetryingOAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/auth/RetryingOAuth.mustache
index 43d58ce8804..49f3d0ccc30 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/auth/RetryingOAuth.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson-nextgen/auth/RetryingOAuth.mustache
@@ -79,16 +79,16 @@ public class RetryingOAuth extends OAuth implements Interceptor {
*/
public void setFlow(OAuthFlow flow) {
switch(flow) {
- case accessCode:
+ case ACCESS_CODE:
tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE);
break;
- case implicit:
+ case IMPLICIT:
tokenRequestBuilder.setGrantType(GrantType.IMPLICIT);
break;
- case password:
+ case PASSWORD:
tokenRequestBuilder.setGrantType(GrantType.PASSWORD);
break;
- case application:
+ case APPLICATION:
tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS);
break;
default:
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache
index 421b7782ebe..52fc1c5492d 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache
@@ -197,7 +197,7 @@ public class ApiClient {
throw new IllegalArgumentException("OAuth2 token URL must be an absolute URL");
}
}
- RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.{{flow}}, clientSecret, parameters);
+ RetryingOAuth retryingOAuth = new RetryingOAuth(tokenUrl, clientId, OAuthFlow.{{#lambda.uppercase}}{{#lambda.snakecase}}{{flow}}{{/lambda.snakecase}}{{/lambda.uppercase}}, clientSecret, parameters);
authentications.put(
"{{name}}",
retryingOAuth
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/RetryingOAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/RetryingOAuth.mustache
index 137e266b5a2..7b09aa700d6 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/RetryingOAuth.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/RetryingOAuth.mustache
@@ -65,16 +65,16 @@ public class RetryingOAuth extends OAuth implements Interceptor {
public void setFlow(OAuthFlow flow) {
switch(flow) {
- case accessCode:
+ case ACCESS_CODE:
tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE);
break;
- case implicit:
+ case IMPLICIT:
tokenRequestBuilder.setGrantType(GrantType.IMPLICIT);
break;
- case password:
+ case PASSWORD:
tokenRequestBuilder.setGrantType(GrantType.PASSWORD);
break;
- case application:
+ case APPLICATION:
tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS);
break;
default:
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/auth/OAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/auth/OAuth.mustache
index 57bfd3df238..bc0bad71144 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/auth/OAuth.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/auth/OAuth.mustache
@@ -54,14 +54,14 @@ public class OAuth implements Interceptor {
public void setFlow(OAuthFlow flow) {
switch(flow) {
- case accessCode:
- case implicit:
+ case ACCESS_CODE:
+ case IMPLICIT:
tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE);
break;
- case password:
+ case PASSWORD:
tokenRequestBuilder.setGrantType(GrantType.PASSWORD);
break;
- case application:
+ case APPLICATION:
tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS);
break;
default:
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache
index 57c97726344..55294cc3856 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache
@@ -82,7 +82,7 @@ public class ApiClient {
auth = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}}{{#isKeyInCookie}}"cookie"{{/isKeyInCookie}}, "{{keyParamName}}");
{{/isApiKey}}
{{#isOAuth}}
- auth = new OAuth(OAuthFlow.{{flow}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}");
+ auth = new OAuth(OAuthFlow.{{#lambda.uppercase}}{{#lambda.snakecase}}{{flow}}{{/lambda.snakecase}}{{/lambda.uppercase}}, "{{authorizationUrl}}", "{{tokenUrl}}", "{{#scopes}}{{scope}}{{^-last}}, {{/-last}}{{/scopes}}");
{{/isOAuth}}
} else {{/authMethods}}{
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/auth/OAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/auth/OAuth.mustache
index 88e4e62bf85..212763dd97c 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/auth/OAuth.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/auth/OAuth.mustache
@@ -54,14 +54,14 @@ public class OAuth implements Interceptor {
public void setFlow(OAuthFlow flow) {
switch(flow) {
- case accessCode:
- case implicit:
+ case ACCESS_CODE:
+ case IMPLICIT:
tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE);
break;
- case password:
+ case PASSWORD:
tokenRequestBuilder.setGrantType(GrantType.PASSWORD);
break;
- case application:
+ case APPLICATION:
tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS);
break;
default:
diff --git a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig
index 43071dd2f03..daa315be174 100644
--- a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig
+++ b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig
@@ -27,14 +27,12 @@ org.openapitools.codegen.languages.CsharpNetcoreFunctionsServerCodegen
org.openapitools.codegen.languages.DartClientCodegen
org.openapitools.codegen.languages.DartDioClientCodegen
org.openapitools.codegen.languages.DartDioNextClientCodegen
-org.openapitools.codegen.languages.DartJaguarClientCodegen
org.openapitools.codegen.languages.EiffelClientCodegen
org.openapitools.codegen.languages.ElixirClientCodegen
org.openapitools.codegen.languages.ElmClientCodegen
org.openapitools.codegen.languages.ErlangClientCodegen
org.openapitools.codegen.languages.ErlangProperCodegen
org.openapitools.codegen.languages.ErlangServerCodegen
-org.openapitools.codegen.languages.FlashClientCodegen
org.openapitools.codegen.languages.FsharpFunctionsServerCodegen
org.openapitools.codegen.languages.FsharpGiraffeServerCodegen
org.openapitools.codegen.languages.GoClientCodegen
@@ -47,7 +45,6 @@ org.openapitools.codegen.languages.GraphQLNodeJSExpressServerCodegen
org.openapitools.codegen.languages.GroovyClientCodegen
org.openapitools.codegen.languages.KotlinClientCodegen
org.openapitools.codegen.languages.KotlinServerCodegen
-org.openapitools.codegen.languages.KotlinServerDeprecatedCodegen
org.openapitools.codegen.languages.KotlinSpringServerCodegen
org.openapitools.codegen.languages.KotlinVertxServerCodegen
org.openapitools.codegen.languages.KtormSchemaCodegen
@@ -95,7 +92,6 @@ org.openapitools.codegen.languages.PhpLaravelServerCodegen
org.openapitools.codegen.languages.PhpLumenServerCodegen
org.openapitools.codegen.languages.PhpSlimServerCodegen
org.openapitools.codegen.languages.PhpSlim4ServerCodegen
-org.openapitools.codegen.languages.PhpSilexServerCodegen
org.openapitools.codegen.languages.PhpSymfonyServerCodegen
org.openapitools.codegen.languages.PhpMezzioPathHandlerServerCodegen
org.openapitools.codegen.languages.PhpDataTransferClientCodegen
@@ -131,7 +127,6 @@ org.openapitools.codegen.languages.StaticHtml2Generator
org.openapitools.codegen.languages.Swift5ClientCodegen
org.openapitools.codegen.languages.TypeScriptClientCodegen
org.openapitools.codegen.languages.TypeScriptAngularClientCodegen
-org.openapitools.codegen.languages.TypeScriptAngularJsClientCodegen
org.openapitools.codegen.languages.TypeScriptAureliaClientCodegen
org.openapitools.codegen.languages.TypeScriptAxiosClientCodegen
org.openapitools.codegen.languages.TypeScriptFetchClientCodegen
diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/README.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/README.mustache
deleted file mode 100644
index 9296cc85904..00000000000
--- a/modules/openapi-generator/src/main/resources/dart-jaguar/README.mustache
+++ /dev/null
@@ -1,141 +0,0 @@
-# {{pubName}}
-{{#appDescriptionWithNewLines}}
-{{{.}}}
-{{/appDescriptionWithNewLines}}
-
-This Dart package is automatically generated by the [Open API Codegen](https://github.com/OpenAPITools/openapi-generator) project:
-
-- API version: {{appVersion}}
-{{#artifactVersion}}
-- Package version: {{.}}
-{{/artifactVersion}}
-{{^hideGenerationTimestamp}}
-- Build date: {{generatedDate}}
-{{/hideGenerationTimestamp}}
-- Build package: {{generatorClass}}
-{{#infoUrl}}
-For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
-{{/infoUrl}}
-
-## Requirements
-
-Dart 2 or later OR Flutter 0.7.0 or later.
-
-Once your code is generated, you need to run the build_runner command to let Jaguar implement your API:
-
-```sh
-flutter packages pub run build_runner build
-or
-pub run build_runner build
-```
-
-## Installation & Usage
-
-### Github
-If this Dart package is published to Github, please include the following in pubspec.yaml
-```
-name: {{pubName}}
-version: {{pubVersion}}
-description: {{pubDescription}}
-dependencies:
- {{pubName}}:
- git: https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}.git
- version: 'any'
-```
-
-### Local
-To use the package in your local drive, please include the following in pubspec.yaml
-```
-dependencies:
- {{pubName}}:
- path: /path/to/{{pubName}}
-```
-
-## Tests
-
-TODO
-
-## Getting Started
-
-Please follow the [installation procedure](#installation--usage) and then run the following:
-
-```dart
-import 'package:{{pubName}}/api.dart';
-{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
-{{#hasAuthMethods}}
-{{#authMethods}}
-{{#isBasic}}
-// TODO Configure HTTP basic authorization: {{{name}}}
-//{{pubName}}.api.Configuration.username = 'YOUR_USERNAME';
-//{{pubName}}.api.Configuration.password = 'YOUR_PASSWORD';
-{{/isBasic}}
-{{#isApiKey}}
-// TODO Configure API key authorization: {{{name}}}
-//{{pubName}}.api.Configuration.apiKey{'{{{keyParamName}}}'} = 'YOUR_API_KEY';
-// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
-//{{pubName}}.api.Configuration.apiKeyPrefix{'{{{keyParamName}}}'} = "Bearer";
-{{/isApiKey}}
-{{#isOAuth}}
-// TODO Configure OAuth2 access token for authorization: {{{name}}}
-//{{pubName}}.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
-{{/isOAuth}}
-{{/authMethods}}
-{{/hasAuthMethods}}
-
-final jaguarApiGen = {{clientName}}();
-var api_instance = jaguarApiGen.get{{classname}}();
-{{#allParams}}
-var {{paramName}} = {{#isArray}}[{{/isArray}}{{#isBodyParam}}new {{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isArray}}]{{/isArray}}; // {{{dataType}}} | {{{description}}}
-{{/allParams}}
-
-try {
- {{#returnType}}var result = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
- {{#returnType}}
- print(result);
- {{/returnType}}
-} catch (e) {
- print("Exception when calling {{classname}}->{{operationId}}: $e\n");
-}
-{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
-```
-
-## Documentation for API Endpoints
-
-All URIs are relative to *{{basePath}}*
-
-Class | Method | HTTP request | Description
------------- | ------------- | ------------- | -------------
-{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}}
-{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
-
-## Documentation For Models
-
-{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md)
-{{/model}}{{/models}}
-
-## Documentation For Authorization
-
-{{^authMethods}} All endpoints do not require authorization.
-{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
-{{#authMethods}}## {{{name}}}
-
-{{#isApiKey}}- **Type**: API key
-- **API key parameter name**: {{{keyParamName}}}
-- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
-{{/isApiKey}}
-{{#isBasic}}- **Type**: HTTP basic authentication
-{{/isBasic}}
-{{#isOAuth}}- **Type**: OAuth
-- **Flow**: {{{flow}}}
-- **Authorization URL**: {{{authorizationUrl}}}
-- **Scopes**: {{^scopes}}N/A{{/scopes}}
-{{#scopes}} - **{{{scope}}}**: {{{description}}}
-{{/scopes}}
-{{/isOAuth}}
-
-{{/authMethods}}
-
-## Author
-
-{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}}
-{{/-last}}{{/apis}}{{/apiInfo}}
diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/analysis_options.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/analysis_options.mustache
deleted file mode 100644
index 655cb67bd88..00000000000
--- a/modules/openapi-generator/src/main/resources/dart-jaguar/analysis_options.mustache
+++ /dev/null
@@ -1 +0,0 @@
-analyzer:
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/api.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/api.mustache
deleted file mode 100644
index 7aef336eda4..00000000000
--- a/modules/openapi-generator/src/main/resources/dart-jaguar/api.mustache
+++ /dev/null
@@ -1,78 +0,0 @@
-import 'package:jaguar_retrofit/annotations/annotations.dart';
-import 'package:jaguar_retrofit/jaguar_retrofit.dart';
-import 'package:jaguar_serializer/jaguar_serializer.dart';
-import 'package:jaguar_mimetype/jaguar_mimetype.dart';
-import 'dart:async';
-
-{{#operations}}
-{{#modelImports}}import 'package:{{pubName}}/model/{{.}}{{#protoFormat}}.pb{{/protoFormat}}.dart';
-{{/modelImports}}
-{{#fullImports}}import '{{.}}';
-{{/fullImports}}
-
-part '{{classFilename}}.jretro.dart';
-
-@GenApiClient()
-class {{classname}} extends ApiClient with _${{classname}}Client {
- final Route base;
- final Map converters;
- final Duration timeout;
-
- {{classname}}({this.base, this.converters, this.timeout = const Duration(minutes: 2)});
-
- {{#operation}}
- /// {{summary}}
- ///
- /// {{notes}}
- @{{httpMethod}}Req(path: "{{path}}"{{#hasAuthMethods}}, metadata: {"auth": [{{#authMethods}} {"type": "{{type}}", "name": "{{name}}"{{#isApiKey}}, "keyName": "{{keyParamName}}", "where": "{{#isKeyInQuery}}query{{/isKeyInQuery}}{{#isKeyInHeader}}header{{/isKeyInHeader}}"{{/isApiKey}} }{{^-last}}, {{/-last}}{{/authMethods}}]}{{/hasAuthMethods}})
- Future<{{{returnType}}}{{^returnType}}void{{/returnType}}> {{nickname}}(
- {{#pathParams}}
- @PathParam("{{baseName}}") {{dataType}} {{paramName}}{{^-last}}, {{/-last}}
- {{/pathParams}}
- {{#headerParams}}
- {{#-first}}{{#hasPathParams}},{{/hasPathParams}}{{/-first}}
- @Header("{{baseName}}") {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}
- {{/headerParams}}
- {{#queryParams}}
- {{#-first}}{{#hasHeaderParams}},{{/hasHeaderParams}}{{^hasHeaderParams}}{{#hasPathParams}},{{/hasPathParams}}{{/hasHeaderParams}}{{/-first}}
- @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}
- {{/queryParams}}
- {{#vendorExtensions}}
- {{#formParams}}
- {{#-first}}{{#hasQueryParams}},{{/hasQueryParams}}{{^hasQueryParams}}{{#hasHeaderParams}},{{/hasHeaderParams}}{{/hasQueryParams}}{{^hasQueryParams}}{{^hasHeaderParams}}{{#hasPathParams}},{{/hasPathParams}}{{/hasHeaderParams}}{{/hasQueryParams}}{{/-first}}
- {{#x-is-json}}@AsJson() {{/x-is-json}}{{#x-is-form}}@AsFormField() {{/x-is-form}}{{#x-is-multipart}}@AsMultipartField() {{/x-is-multipart}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}
- {{/formParams}}
- {{#bodyParam}}
- {{#hasFormParams}},{{/hasFormParams}}{{^hasFormParams}}{{#hasQueryParams}},{{/hasQueryParams}}{{/hasFormParams}}{{^hasFormParams}}{{^hasQueryParams}}{{#hasHeaderParams}},{{/hasHeaderParams}}{{/hasQueryParams}}{{/hasFormParams}}{{^hasFormParams}}{{^hasQueryParams}}{{^hasHeaderParams}}{{#hasPathParams}},{{/hasPathParams}}{{/hasHeaderParams}}{{/hasQueryParams}}{{/hasFormParams}}
- {{^x-is-proto}}{{^x-is-json}}{{^x-is-form}}{{^x-is-multipart}}@AsBody(){{/x-is-multipart}}{{/x-is-form}}{{/x-is-json}}{{/x-is-proto}} {{#x-is-proto}}@Serialized(MimeTypes.binary) {{/x-is-proto}}{{#x-is-json}}@AsJson() {{/x-is-json}}{{#x-is-form}}@AsForm() {{/x-is-form}}{{#x-is-multipart}}@AsMultipart() {{/x-is-multipart}}{{{dataType}}} {{paramName}}
- {{/bodyParam}}
- {{/vendorExtensions}}
- ) {
- return super.{{nickname}}(
- {{#pathParams}}
- {{paramName}}{{^-last}}, {{/-last}}
- {{/pathParams}}
- {{#headerParams}}
- {{#-first}}{{#hasPathParams}},{{/hasPathParams}}{{/-first}}
- {{paramName}}{{^-last}}, {{/-last}}
- {{/headerParams}}
- {{#queryParams}}
- {{#-first}}{{#hasHeaderParams}},{{/hasHeaderParams}}{{^hasHeaderParams}}{{#hasPathParams}},{{/hasPathParams}}{{/hasHeaderParams}}{{/-first}}
- {{paramName}}{{^-last}}, {{/-last}}
- {{/queryParams}}
-
- {{#formParams}}
- {{#-first}}{{#hasQueryParams}},{{/hasQueryParams}}{{^hasQueryParams}}{{#hasHeaderParams}},{{/hasHeaderParams}}{{/hasQueryParams}}{{^hasQueryParams}}{{^hasHeaderParams}}{{#hasPathParams}},{{/hasPathParams}}{{/hasHeaderParams}}{{/hasQueryParams}}{{/-first}}
- {{paramName}}{{^-last}}, {{/-last}}
- {{/formParams}}
- {{#bodyParam}}
- {{#hasFormParams}},{{/hasFormParams}}{{^hasFormParams}}{{#hasQueryParams}},{{/hasQueryParams}}{{/hasFormParams}}{{^hasFormParams}}{{^hasQueryParams}}{{#hasHeaderParams}},{{/hasHeaderParams}}{{/hasQueryParams}}{{/hasFormParams}}{{^hasFormParams}}{{^hasQueryParams}}{{^hasHeaderParams}}{{#hasPathParams}},{{/hasPathParams}}{{/hasHeaderParams}}{{/hasQueryParams}}{{/hasFormParams}}
- {{paramName}}
- {{/bodyParam}}
- ).timeout(timeout);
- }
-
- {{/operation}}
-
-}
-{{/operations}}
diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/api_doc.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/api_doc.mustache
deleted file mode 100644
index ad0c61a6673..00000000000
--- a/modules/openapi-generator/src/main/resources/dart-jaguar/api_doc.mustache
+++ /dev/null
@@ -1,86 +0,0 @@
-# {{pubName}}.api.{{classname}}{{#description}}
-{{.}}{{/description}}
-
-## Load the API package
-```dart
-import 'package:{{pubName}}/api.dart';
-```
-
-All URIs are relative to *{{basePath}}*
-
-Method | HTTP request | Description
-------------- | ------------- | -------------
-{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}}
-{{/operation}}{{/operations}}
-
-{{#operations}}
-{{#operation}}
-# **{{{operationId}}}**
-> {{#returnType}}{{{.}}} {{/returnType}}{{{operationId}}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}})
-
-{{{summary}}}{{#notes}}
-
-{{{.}}}{{/notes}}
-
-### Example
-```dart
-import 'package:{{pubName}}/api.dart';
-{{#hasAuthMethods}}
-{{#authMethods}}
-{{#isBasic}}
-// TODO Configure HTTP basic authorization: {{{name}}}
-//{{pubName}}.api.Configuration.username = 'YOUR_USERNAME';
-//{{pubName}}.api.Configuration.password = 'YOUR_PASSWORD';
-{{/isBasic}}
-{{#isApiKey}}
-// TODO Configure API key authorization: {{{name}}}
-//{{pubName}}.api.Configuration.apiKey{'{{{keyParamName}}}'} = 'YOUR_API_KEY';
-// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
-//{{pubName}}.api.Configuration.apiKeyPrefix{'{{{keyParamName}}}'} = "Bearer";
-{{/isApiKey}}
-{{#isOAuth}}
-// TODO Configure OAuth2 access token for authorization: {{{name}}}
-//{{pubName}}.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN';
-{{/isOAuth}}
-{{/authMethods}}
-{{/hasAuthMethods}}
-
-var api_instance = new {{classname}}();
-{{#allParams}}
-var {{paramName}} = {{#isArray}}[{{/isArray}}{{#isBodyParam}}new {{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isArray}}]{{/isArray}}; // {{{dataType}}} | {{{description}}}
-{{/allParams}}
-
-try {
- {{#returnType}}var result = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
- {{#returnType}}
- print(result);
- {{/returnType}}
-} catch (e) {
- print("Exception when calling {{classname}}->{{operationId}}: $e\n");
-}
-```
-
-### Parameters
-{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
-Name | Type | Description | Notes
-------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
-{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{.}}]{{/defaultValue}}
-{{/allParams}}
-
-### Return type
-
-{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}}
-
-### Authorization
-
-{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
-
-### HTTP request headers
-
- - **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
- - **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}}
-
-[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
-
-{{/operation}}
-{{/operations}}
diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/api_test.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/api_test.mustache
deleted file mode 100644
index d44b5bdef2f..00000000000
--- a/modules/openapi-generator/src/main/resources/dart-jaguar/api_test.mustache
+++ /dev/null
@@ -1,28 +0,0 @@
-import 'package:{{pubName}}/api.dart';
-import 'package:test/test.dart';
-
-{{#operations}}
-
-/// tests for {{classname}}
-void main() {
- var instance = new {{classname}}();
-
- group('tests for {{classname}}', () {
- {{#operation}}
- {{#summary}}
- // {{{.}}}
- //
- {{/summary}}
- {{#notes}}
- // {{{.}}}
- //
- {{/notes}}
- //{{#returnType}}Future<{{{.}}}> {{/returnType}}{{^returnType}}Future {{/returnType}}{{operationId}}({{#allParams}}{{#required}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async
- test('test {{operationId}}', () async {
- // TODO
- });
-
- {{/operation}}
- });
-}
-{{/operations}}
diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/apilib.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/apilib.mustache
deleted file mode 100644
index b162a53ad4b..00000000000
--- a/modules/openapi-generator/src/main/resources/dart-jaguar/apilib.mustache
+++ /dev/null
@@ -1,100 +0,0 @@
-library {{pubName}}.api;
-
-import 'package:http/http.dart' as http;
-import 'package:jaguar_serializer/jaguar_serializer.dart';
-{{#protoFormat}}
-import 'package:jaguar_serializer_protobuf/proto_repo.dart';
-{{/protoFormat}}
-import 'package:jaguar_retrofit/jaguar_retrofit.dart';
-import 'package:{{pubName}}/auth/api_key_auth.dart';
-import 'package:{{pubName}}/auth/basic_auth.dart';
-import 'package:{{pubName}}/auth/oauth.dart';
-import 'package:jaguar_mimetype/jaguar_mimetype.dart';
-
-{{#apiInfo}}{{#apis}}import 'package:{{pubName}}/api/{{classFilename}}.dart';
-{{/apis}}{{/apiInfo}}
-{{#models}}{{#model}}import 'package:{{pubName}}/model/{{classFilename}}{{#protoFormat}}.pb{{/protoFormat}}.dart';
-{{/model}}{{/models}}
-
-
-{{#jsonFormat}}
-final _jsonJaguarRepo = JsonRepo()
-{{#models}}{{#model}}{{^isEnum}}..add({{classname}}Serializer()){{/isEnum}}
-{{/model}}{{/models}};
-final Map defaultConverters = {
- MimeTypes.json: _jsonJaguarRepo,
-};
-{{/jsonFormat}}
-
-{{#protoFormat}}
-final _protoJaguarRepo = ProtoCodecRepo()
-{{#models}}{{#model}}..add((data) => {{classname}}.fromBuffer(List.from(data)))
-{{/model}}{{/models}};
-final _jsonJaguarRepo = ProtoCodecRepo(isJsonFormatEnabled: true)
-{{#models}}{{#model}}..add((data) => {{classname}}.fromBuffer(List.from(data)))
-{{/model}}{{/models}};
-final Map defaultConverters = {
- MimeTypes.json: _jsonJaguarRepo,
- MimeTypes.binary: _protoJaguarRepo,
-};
-{{/protoFormat}}
-
-
-final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()];
-
-class {{clientName}} {
- List interceptors;
- String basePath = "{{basePath}}";
- Route _baseRoute;
- final Duration timeout;
-
- /**
- * Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added)
- */
- {{clientName}}({List interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) {
- _baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? http.Client());
- if(interceptors == null) {
- this.interceptors = _defaultInterceptors;
- }
- else if(overrideInterceptors){
- this.interceptors = interceptors;
- }
- else {
- this.interceptors = List.from(_defaultInterceptors)..addAll(interceptors);
- }
-
- this.interceptors.forEach((interceptor) {
- _baseRoute.before(interceptor.before);
- _baseRoute.after(interceptor.after);
- });
- }
-
- void setOAuthToken(String name, String token) {
- (_defaultInterceptors[0] as OAuthInterceptor).tokens[name] = token;
- }
-
- void setBasicAuth(String name, String username, String password) {
- (_defaultInterceptors[1] as BasicAuthInterceptor).authInfo[name] = BasicAuthInfo(username, password);
- }
-
- void setApiKey(String name, String apiKey) {
- (_defaultInterceptors[2] as ApiKeyAuthInterceptor).apiKeys[name] = apiKey;
- }
-
- {{#apiInfo}}{{#apis}}
- /**
- * Get {{classname}} instance, base route and serializer can be overridden by a given but be careful,
- * by doing that all interceptors will not be executed
- */
- {{classname}} get{{classname}}({Route base, Map converters}) {
- if(base == null) {
- base = _baseRoute;
- }
- if(converters == null) {
- converters = defaultConverters;
- }
- return {{classname}}(base: base, converters: converters, timeout: timeout);
- }
-
- {{/apis}}{{/apiInfo}}
-}
diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/auth/api_key_auth.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/auth/api_key_auth.mustache
deleted file mode 100644
index feb0ba65712..00000000000
--- a/modules/openapi-generator/src/main/resources/dart-jaguar/auth/api_key_auth.mustache
+++ /dev/null
@@ -1,33 +0,0 @@
-import 'dart:async';
-import 'package:{{pubName}}/auth/auth.dart';
-import 'package:jaguar_retrofit/jaguar_retrofit.dart';
-
-class ApiKeyAuthInterceptor extends AuthInterceptor {
- Map apiKeys = {};
-
- @override
- FutureOr before(RouteBase route) {
- final authInfo = getAuthInfo(route, "apiKey");
- for (var info in authInfo) {
- final authName = info["name"];
- final authKeyName = info["keyName"];
- final authWhere = info["where"];
- final apiKey = apiKeys[authName];
- if(apiKey != null) {
- if(authWhere == 'query'){
- route.query(authKeyName, apiKey);
- }
- else {
- route.header(authKeyName, apiKey);
- }
- break;
- }
- }
- return super.before(route);
- }
-
- @override
- FutureOr after(StringResponse response) {
- return Future.value(response);
- }
-}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/auth/auth.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/auth/auth.mustache
deleted file mode 100644
index 477fbbf8374..00000000000
--- a/modules/openapi-generator/src/main/resources/dart-jaguar/auth/auth.mustache
+++ /dev/null
@@ -1,23 +0,0 @@
-import 'dart:async';
-
-import 'package:jaguar_retrofit/jaguar_retrofit.dart';
-
-abstract class AuthInterceptor extends Interceptor {
- /*
- * Get auth information on given route for the given type
- * Can return null if type is not present on auth data or if route doesn't need authentication
- */
- List
UTF-8
- 5.4.0
+ 6.0.0-SNAPSHOT
1.0.0
4.13.2
diff --git a/samples/meta-codegen/usage/.openapi-generator/VERSION b/samples/meta-codegen/usage/.openapi-generator/VERSION
index 1e20ec35c64..5f68295fc19 100644
--- a/samples/meta-codegen/usage/.openapi-generator/VERSION
+++ b/samples/meta-codegen/usage/.openapi-generator/VERSION
@@ -1 +1 @@
-5.4.0
\ No newline at end of file
+6.0.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/openapi3/client/elm/.openapi-generator/VERSION b/samples/openapi3/client/elm/.openapi-generator/VERSION
index 1e20ec35c64..5f68295fc19 100644
--- a/samples/openapi3/client/elm/.openapi-generator/VERSION
+++ b/samples/openapi3/client/elm/.openapi-generator/VERSION
@@ -1 +1 @@
-5.4.0
\ No newline at end of file
+6.0.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/.openapi-generator/VERSION b/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/.openapi-generator/VERSION
index 1e20ec35c64..5f68295fc19 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/.openapi-generator/VERSION
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/.openapi-generator/VERSION
@@ -1 +1 @@
-5.4.0
\ No newline at end of file
+6.0.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/.openapi-generator/VERSION b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/.openapi-generator/VERSION
index 1e20ec35c64..5f68295fc19 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/.openapi-generator/VERSION
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/.openapi-generator/VERSION
@@ -1 +1 @@
-5.4.0
\ No newline at end of file
+6.0.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/ServerConfiguration.java
index e08da9aac7d..ca5c1187edf 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/ServerConfiguration.java
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/java/jersey2-java8/src/main/java/org/openapitools/client/ServerConfiguration.java
@@ -39,7 +39,7 @@ public class ServerConfiguration {
if (variables != null && variables.containsKey(name)) {
value = variables.get(name);
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
- throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + ".");
+ throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + ".");
}
}
url = url.replaceAll("\\{" + name + "\\}", value);
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/python/.openapi-generator/VERSION b/samples/openapi3/client/extensions/x-auth-id-alias/python/.openapi-generator/VERSION
index 1e20ec35c64..5f68295fc19 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/python/.openapi-generator/VERSION
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/python/.openapi-generator/VERSION
@@ -1 +1 @@
-5.4.0
\ No newline at end of file
+6.0.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/.openapi-generator/VERSION b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/.openapi-generator/VERSION
index 1e20ec35c64..5f68295fc19 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/.openapi-generator/VERSION
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/.openapi-generator/VERSION
@@ -1 +1 @@
-5.4.0
\ No newline at end of file
+6.0.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias.rb b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias.rb
index 6031bc71e1d..6d6964932aa 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias.rb
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api/usage_api.rb b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api/usage_api.rb
index ce8c0333d16..4dc01f94637 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api/usage_api.rb
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api/usage_api.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_client.rb b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_client.rb
index 8c30a9e346a..39b60ce5a00 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_client.rb
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_client.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_error.rb b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_error.rb
index 7cb5adf4a7d..90a45186eea 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_error.rb
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/api_error.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/configuration.rb b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/configuration.rb
index 00c4b481e79..de03d94f734 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/configuration.rb
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/configuration.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/version.rb b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/version.rb
index 58e635a87bc..66381103e77 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/version.rb
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/lib/x_auth_id_alias/version.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/spec/api_client_spec.rb b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/spec/api_client_spec.rb
index 2d1379cbd13..af90810b78a 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/spec/api_client_spec.rb
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/spec/api_client_spec.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/spec/configuration_spec.rb b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/spec/configuration_spec.rb
index 4e7afa028c8..c011e31b222 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/spec/configuration_spec.rb
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/spec/configuration_spec.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/spec/spec_helper.rb b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/spec/spec_helper.rb
index 989d2726dba..1f191e8eb0e 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/spec/spec_helper.rb
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/spec/spec_helper.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/x_auth_id_alias.gemspec b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/x_auth_id_alias.gemspec
index da4955b049f..007ed603179 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/x_auth_id_alias.gemspec
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/ruby-client/x_auth_id_alias.gemspec
@@ -8,7 +8,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/dynamic-servers/python/.openapi-generator/VERSION b/samples/openapi3/client/features/dynamic-servers/python/.openapi-generator/VERSION
index 1e20ec35c64..5f68295fc19 100644
--- a/samples/openapi3/client/features/dynamic-servers/python/.openapi-generator/VERSION
+++ b/samples/openapi3/client/features/dynamic-servers/python/.openapi-generator/VERSION
@@ -1 +1 @@
-5.4.0
\ No newline at end of file
+6.0.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/openapi3/client/features/dynamic-servers/ruby/.openapi-generator/VERSION b/samples/openapi3/client/features/dynamic-servers/ruby/.openapi-generator/VERSION
index 1e20ec35c64..5f68295fc19 100644
--- a/samples/openapi3/client/features/dynamic-servers/ruby/.openapi-generator/VERSION
+++ b/samples/openapi3/client/features/dynamic-servers/ruby/.openapi-generator/VERSION
@@ -1 +1 @@
-5.4.0
\ No newline at end of file
+6.0.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/openapi3/client/features/dynamic-servers/ruby/dynamic_servers.gemspec b/samples/openapi3/client/features/dynamic-servers/ruby/dynamic_servers.gemspec
index 29d527ac348..dfe7d45dedc 100644
--- a/samples/openapi3/client/features/dynamic-servers/ruby/dynamic_servers.gemspec
+++ b/samples/openapi3/client/features/dynamic-servers/ruby/dynamic_servers.gemspec
@@ -8,7 +8,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers.rb b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers.rb
index 3e592b7a5fa..ac81bc65875 100644
--- a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers.rb
+++ b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api/usage_api.rb b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api/usage_api.rb
index 4fb4a27003e..44ad371b1df 100644
--- a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api/usage_api.rb
+++ b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api/usage_api.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_client.rb b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_client.rb
index eee542b2e6a..e961dfec106 100644
--- a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_client.rb
+++ b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_client.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_error.rb b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_error.rb
index 65d8be5dbc7..42728038602 100644
--- a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_error.rb
+++ b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/api_error.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/configuration.rb b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/configuration.rb
index cf447f6eb72..fd4209a89ae 100644
--- a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/configuration.rb
+++ b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/configuration.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/version.rb b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/version.rb
index e4aa32beb11..0498388e6c2 100644
--- a/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/version.rb
+++ b/samples/openapi3/client/features/dynamic-servers/ruby/lib/dynamic_servers/version.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/dynamic-servers/ruby/spec/api_client_spec.rb b/samples/openapi3/client/features/dynamic-servers/ruby/spec/api_client_spec.rb
index 9a211e72255..536f38c67ea 100644
--- a/samples/openapi3/client/features/dynamic-servers/ruby/spec/api_client_spec.rb
+++ b/samples/openapi3/client/features/dynamic-servers/ruby/spec/api_client_spec.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/dynamic-servers/ruby/spec/configuration_spec.rb b/samples/openapi3/client/features/dynamic-servers/ruby/spec/configuration_spec.rb
index b2e2b5e6bf7..0cf4da3cbc2 100644
--- a/samples/openapi3/client/features/dynamic-servers/ruby/spec/configuration_spec.rb
+++ b/samples/openapi3/client/features/dynamic-servers/ruby/spec/configuration_spec.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/dynamic-servers/ruby/spec/spec_helper.rb b/samples/openapi3/client/features/dynamic-servers/ruby/spec/spec_helper.rb
index e2275aca204..2c425b59e55 100644
--- a/samples/openapi3/client/features/dynamic-servers/ruby/spec/spec_helper.rb
+++ b/samples/openapi3/client/features/dynamic-servers/ruby/spec/spec_helper.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/.openapi-generator/VERSION b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/.openapi-generator/VERSION
index 1e20ec35c64..5f68295fc19 100644
--- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/.openapi-generator/VERSION
+++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/.openapi-generator/VERSION
@@ -1 +1 @@
-5.4.0
\ No newline at end of file
+6.0.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore.rb
index 67f85e3b695..65857baeb0c 100644
--- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore.rb
+++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb
index a2116debfb8..74a845fbe6a 100644
--- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb
+++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api/usage_api.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_client.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_client.rb
index 150baa1f124..ebabf150bf4 100644
--- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_client.rb
+++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_client.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_error.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_error.rb
index f5aac8f02fd..da466010b4e 100644
--- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_error.rb
+++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/api_error.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/configuration.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/configuration.rb
index 6457c549ce0..56c3c1a3f8e 100644
--- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/configuration.rb
+++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/configuration.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/array_alias.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/array_alias.rb
index 81778de5f86..c72355b506c 100644
--- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/array_alias.rb
+++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/array_alias.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/map_alias.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/map_alias.rb
index f28021e6b98..cf7fc57d9bb 100644
--- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/map_alias.rb
+++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/models/map_alias.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/version.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/version.rb
index 5dc7d2b7d97..df2dd7ae50a 100644
--- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/version.rb
+++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/lib/petstore/version.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/petstore.gemspec b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/petstore.gemspec
index 5d276bf6cf9..8a19b1bfcda 100644
--- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/petstore.gemspec
+++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/petstore.gemspec
@@ -8,7 +8,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/spec/api_client_spec.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/spec/api_client_spec.rb
index 0956e189ef2..7d0d15c6185 100644
--- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/spec/api_client_spec.rb
+++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/spec/api_client_spec.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/spec/configuration_spec.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/spec/configuration_spec.rb
index 34a4590a52a..9e5aa7b6f4a 100644
--- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/spec/configuration_spec.rb
+++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/spec/configuration_spec.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/spec/spec_helper.rb b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/spec/spec_helper.rb
index adc351664ee..f4974f981a3 100644
--- a/samples/openapi3/client/features/generate-alias-as-model/ruby-client/spec/spec_helper.rb
+++ b/samples/openapi3/client/features/generate-alias-as-model/ruby-client/spec/spec_helper.rb
@@ -6,7 +6,7 @@
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
-OpenAPI Generator version: 5.4.0
+OpenAPI Generator version: 6.0.0-SNAPSHOT
=end
diff --git a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/.openapi-generator/VERSION
index 0984c4c1ad2..5f68295fc19 100644
--- a/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/.openapi-generator/VERSION
+++ b/samples/openapi3/client/petstore/dart-dio-next/dio_http_petstore_client_lib_fake/.openapi-generator/VERSION
@@ -1 +1 @@
-5.4.0-SNAPSHOT
\ No newline at end of file
+6.0.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/.openapi-generator/VERSION
index 1e20ec35c64..5f68295fc19 100644
--- a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/.openapi-generator/VERSION
+++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/.openapi-generator/VERSION
@@ -1 +1 @@
-5.4.0
\ No newline at end of file
+6.0.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/VERSION
index 1e20ec35c64..5f68295fc19 100644
--- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/VERSION
+++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/.openapi-generator/VERSION
@@ -1 +1 @@
-5.4.0
\ No newline at end of file
+6.0.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/VERSION
index 1e20ec35c64..5f68295fc19 100644
--- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/VERSION
+++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/VERSION
@@ -1 +1 @@
-5.4.0
\ No newline at end of file
+6.0.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/openapi3/client/petstore/dart2/petstore/README.md b/samples/openapi3/client/petstore/dart2/petstore/README.md
deleted file mode 100644
index 2139c301745..00000000000
--- a/samples/openapi3/client/petstore/dart2/petstore/README.md
+++ /dev/null
@@ -1,37 +0,0 @@
-# Background
-
-## Current state of tests
-
-TL;DR currently the only tests are e2e tests that were adapted to use a faked http client. While pushing data around as a smoke test has some value, more testing is required. In particular we need comprehensive unit/integration tests.
-
-- an old set of e2e tests are skipped for CI, as they hit a live endpoint and so are inherently flaky
- - `pet_test.dart`
- - `store_test.dart`
- - `user_test.dart`
-- the above set of tests were adapted to use a faked http client
- - the tests are not really well suited to being used with a stubbed client, many are basically just testing the endpoint logic
- - while not a great set of tests, they do have some value as a smoke test for template changes
-- the adapted tests and files that contain test data:
- - `pet_test_fake_client.dart`
- - `store_test_fake_client.dart`
- - `user_test_fake_client.dart`
- - `fake_client.dart`
- - `file_upload_response.json`
-
-## Assumptions
-
-- the tests will be run as part of CI and so have access to dart:io
-
-# Running
-
-## If not already done, resolve dependencies
-
-`pub get`
-
-## To run tests in a single file:
-
-`pub run test test/pet_test.dart`
-
-## To run all tests in the test folder:
-
-`pub run test`
diff --git a/samples/openapi3/client/petstore/dart2/petstore/pom.xml b/samples/openapi3/client/petstore/dart2/petstore/pom.xml
deleted file mode 100644
index c4ce7b4d68e..00000000000
--- a/samples/openapi3/client/petstore/dart2/petstore/pom.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-
- 4.0.0
- org.openapitools
- Dart2PetstoreClientTests
- pom
- 1.0.0-SNAPSHOT
- Dart2 Petstore Client
-
-
-
- maven-dependency-plugin
-
-
- package
-
- copy-dependencies
-
-
- ${project.build.directory}
-
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
- 1.2.1
-
-
- export-dartfmt
- pre-install-test
-
- exec
-
-
- export
-
- DART_FMT_PATH=/usr/local/bin/dartfmt
-
-
-
-
- pub-get
- pre-integration-test
-
- exec
-
-
- pub
-
- get
-
-
-
-
- pub-test
- integration-test
-
- exec
-
-
- pub
-
- run
- test
-
-
-
-
-
-
-
-
diff --git a/samples/openapi3/client/petstore/dart2/petstore/pubspec.lock b/samples/openapi3/client/petstore/dart2/petstore/pubspec.lock
deleted file mode 100644
index dd5bbc89254..00000000000
--- a/samples/openapi3/client/petstore/dart2/petstore/pubspec.lock
+++ /dev/null
@@ -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: "14.0.0"
- analyzer:
- dependency: transitive
- description:
- name: analyzer
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.41.2"
- args:
- dependency: transitive
- description:
- name: args
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.1.1"
- async:
- dependency: transitive
- description:
- name: async
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.7.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: "1.6.2"
- built_collection:
- dependency: transitive
- description:
- name: built_collection
- url: "https://pub.dartlang.org"
- source: hosted
- version: "5.1.0"
- built_value:
- dependency: transitive
- description:
- name: built_value
- url: "https://pub.dartlang.org"
- source: hosted
- version: "8.1.1"
- 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.3"
- clock:
- dependency: transitive
- description:
- name: clock
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.1.0"
- code_builder:
- dependency: transitive
- description:
- name: code_builder
- url: "https://pub.dartlang.org"
- source: hosted
- version: "3.7.0"
- collection:
- dependency: "direct dev"
- description:
- name: collection
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.15.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: "0.15.2"
- 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: "1.3.12"
- 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"
- glob:
- dependency: transitive
- description:
- name: glob
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.1"
- http:
- dependency: "direct dev"
- description:
- name: http
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.13.3"
- http_multi_server:
- dependency: transitive
- description:
- name: http_multi_server
- url: "https://pub.dartlang.org"
- source: hosted
- version: "3.0.1"
- http_parser:
- dependency: transitive
- description:
- name: http_parser
- url: "https://pub.dartlang.org"
- source: hosted
- version: "4.0.0"
- intl:
- dependency: transitive
- description:
- name: intl
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.17.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.3"
- logging:
- dependency: transitive
- description:
- name: logging
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.0.1"
- matcher:
- dependency: transitive
- description:
- name: matcher
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.12.10"
- meta:
- dependency: "direct dev"
- description:
- name: meta
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.6.0"
- mime:
- dependency: transitive
- description:
- name: mime
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.0.0"
- mockito:
- dependency: "direct dev"
- description:
- name: mockito
- url: "https://pub.dartlang.org"
- source: hosted
- version: "4.1.4"
- node_preamble:
- dependency: transitive
- description:
- name: node_preamble
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.4.13"
- openapi:
- dependency: "direct main"
- description:
- path: "../petstore_client_lib"
- relative: true
- source: path
- version: "1.0.0"
- package_config:
- dependency: transitive
- description:
- name: package_config
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.9.3"
- path:
- dependency: transitive
- description:
- name: path
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.8.0"
- 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.0.0"
- shelf:
- dependency: transitive
- description:
- name: shelf
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.2.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: "0.9.10+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.1"
- 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.16.5"
- test_api:
- dependency: transitive
- description:
- name: test_api
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.2.19"
- test_core:
- dependency: transitive
- description:
- name: test_core
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.3.15"
- 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.0"
- 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.12.0 <3.0.0"
diff --git a/samples/openapi3/client/petstore/dart2/petstore/pubspec.yaml b/samples/openapi3/client/petstore/dart2/petstore/pubspec.yaml
deleted file mode 100644
index 6b1e0dcfa3a..00000000000
--- a/samples/openapi3/client/petstore/dart2/petstore/pubspec.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
-name: petstore_client
-version: 1.0.0
-description: Petstore client using OpenAPI library
-
-publish_to: none
-
-environment:
- sdk: '>=2.11.0 <3.0.0'
-
-dependencies:
- openapi:
- path: ../petstore_client_lib
-
-dev_dependencies:
- meta: <1.7.0
- test: ^1.8.0
- mockito: ^4.1.1
- http: ^0.13.0
- collection: ^1.14.12
diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/fake_client.dart b/samples/openapi3/client/petstore/dart2/petstore/test/fake_client.dart
deleted file mode 100644
index ed60f386aa4..00000000000
--- a/samples/openapi3/client/petstore/dart2/petstore/test/fake_client.dart
+++ /dev/null
@@ -1,134 +0,0 @@
-import 'dart:convert';
-
-import 'package:collection/collection.dart';
-import 'package:http/http.dart';
-import 'package:mockito/mockito.dart';
-
-/// A fake client that checks for expected values and returns given responses
-///
-/// Checks for the expected values (url, headers, body) and throws if not found
-///
-/// If exception is non-null the request will throw the exception, after other
-/// checks are performed
-class FakeClient extends Fake implements Client {
- FakeClient({
- this.throwException,
- this.expectedPostRequestBody,
- this.postResponseBody,
- this.expectedGetRequestBody,
- this.getResponseBody,
- this.deleteResponseBody,
- this.expectedPutRequestBody,
- this.putResponseBody,
- this.sendResponseBody,
- String expectedUrl,
- this.expectedHeaders = null,
- }) : this.expectedUrl = Uri.parse(expectedUrl);
-
- Exception throwException;
- Object expectedPostRequestBody;
- String postResponseBody;
- String expectedGetRequestBody;
- String getResponseBody;
- String deleteResponseBody;
- String expectedPutRequestBody;
- String putResponseBody;
- String sendResponseBody;
- Uri expectedUrl;
- Map expectedHeaders;
-
- @override
- Future post(Uri url,
- {Map headers, Object body, Encoding encoding}) async {
- // check that the request was made with expected values
- if (url != expectedUrl) {
- throw StateError(
- 'POST was called with unexpected url: ${url} should be ${expectedUrl}');
- }
- if (!MapEquality().equals(headers, expectedHeaders)) {
- throw StateError(
- 'POST was called with unexpected headers: ${headers} should be ${expectedHeaders}');
- }
- // currently we only expect Map (and subtypes) or Strings
- if (body is Map) {
- if (!MapEquality().equals(body, expectedPostRequestBody)) {
- throw StateError(
- 'POST was called with unexpected body: ${body} should be ${expectedPostRequestBody}');
- }
- } else if (body != expectedPostRequestBody) {
- throw StateError(
- 'POST was called with unexpected body: ${body} should be ${expectedPostRequestBody}');
- }
-
- // throw if set to throw
- if (throwException != null) throw throwException;
-
- return Response(postResponseBody, 200);
- }
-
- @override
- Future get(Uri url, {Map headers}) async {
- // check that the request was made with expected values
- if (url != expectedUrl) {
- throw StateError(
- 'GET was called with unexpected url: ${url} should be ${expectedUrl}');
- }
- if (!MapEquality().equals(headers, expectedHeaders)) {
- throw StateError(
- 'GET was called with unexpected headers: ${headers} should be ${expectedHeaders}');
- }
-
- // throw if set to throw
- if (throwException != null) throw throwException;
-
- return Response(getResponseBody, 200);
- }
-
- @override
- Future delete(Uri url,
- {Map headers, Object body, Encoding encoding}) async {
- // check that the request was made with expected values
- if (url != expectedUrl) {
- throw StateError(
- 'DELETE was called with unexpected url: ${url} should be ${expectedUrl}');
- }
- if (!MapEquality().equals(headers, expectedHeaders)) {
- throw StateError(
- 'DELETE was called with unexpected headers: ${headers} should be ${expectedHeaders}');
- }
-
- // throw if set to throw
- if (throwException != null) throw throwException;
-
- return Response(deleteResponseBody, 200);
- }
-
- @override
- Future put(Uri url,
- {Map headers, Object body, Encoding encoding}) async {
- // check that the request was made with expected values
- if (url != expectedUrl) {
- throw StateError(
- 'PUT was called with unexpected url: ${url} should be ${expectedUrl}');
- }
- if (!MapEquality().equals(headers, expectedHeaders)) {
- throw StateError(
- 'PUT was called with unexpected headers: ${headers} should be ${expectedHeaders}');
- }
- if (body != expectedPutRequestBody) {
- throw StateError(
- 'PUT was called with unexpected body: ${body} should be ${expectedPutRequestBody}');
- }
-
- // throw if set to throw
- if (throwException != null) throw throwException;
-
- return Response(putResponseBody, 200);
- }
-
- @override
- Future send(BaseRequest request) async {
- List bytes = utf8.encode(sendResponseBody);
- return StreamedResponse(Stream.fromIterable([bytes]), 200);
- }
-}
diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/file_upload_response.json b/samples/openapi3/client/petstore/dart2/petstore/test/file_upload_response.json
deleted file mode 100644
index 8855b00d9e3..00000000000
--- a/samples/openapi3/client/petstore/dart2/petstore/test/file_upload_response.json
+++ /dev/null
@@ -1 +0,0 @@
-{"code":200,"type":"unknown","message":"additionalMetadata: \nFile uploaded to ./null, 4 bytes"}
\ No newline at end of file
diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/inventory_response.json b/samples/openapi3/client/petstore/dart2/petstore/test/inventory_response.json
deleted file mode 100644
index b4388d1e7b3..00000000000
--- a/samples/openapi3/client/petstore/dart2/petstore/test/inventory_response.json
+++ /dev/null
@@ -1 +0,0 @@
-{"mine":1,"sold":18,"string":568,"Dead":2,"test":2,"Nonavailable":1,"custom":3,"pending":20,"available":2212,"notAvailable":26,"avaiflable":1,"AVAILABLE":1,"swimming":1,"availablee":2,"success":1,"105":1,"missing":11,"disabled":1,"Available":1,"]]>":1}
\ No newline at end of file
diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/order_model_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/order_model_test.dart
deleted file mode 100644
index 7048659e894..00000000000
--- a/samples/openapi3/client/petstore/dart2/petstore/test/order_model_test.dart
+++ /dev/null
@@ -1,9 +0,0 @@
-import 'package:openapi/api.dart';
-import 'package:test/test.dart';
-
-void main() {
- test('Check if default value is generated', () async {
- var order = Order();
- expect(order.complete, equals(false));
- });
-}
diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart
deleted file mode 100644
index 9737df5d488..00000000000
--- a/samples/openapi3/client/petstore/dart2/petstore/test/pet_faked_client_test.dart
+++ /dev/null
@@ -1,223 +0,0 @@
-import 'dart:io';
-
-import 'package:http/http.dart';
-import 'package:openapi/api.dart';
-import 'package:test/test.dart';
-
-import 'fake_client.dart';
-import 'random_id.dart';
-
-void main() {
- final petApi = PetApi();
-
- Pet makePet({
- int id = 1234,
- String name = 'Fluffy',
- String status = '',
- }) {
- final category = Category()
- ..id = 1234
- ..name = 'eyeColor';
- final tags = [
- Tag()
- ..id = 1234
- ..name = 'New York',
- Tag()
- ..id = 124321
- ..name = 'Jose'
- ];
- return Pet(name: name)
- ..id = id
- ..category = category
- ..tags = tags
- ..status = PetStatusEnum.fromJson(status)
- ..photoUrls = ['https://petstore.com/sample/photo1.jpg'];
- }
-
- /// Setup the fake client then call [petApi.addPet]
- Future addPet(Pet pet) async {
- petApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/pet',
- expectedPostRequestBody: await petApi.apiClient.serializeAsync(pet),
- postResponseBody: await petApi.apiClient.serializeAsync(pet),
- expectedHeaders: {'Content-Type': 'application/json'});
- return petApi.addPet(pet);
- }
-
- group('Pet API with faked client', () {
- test('adds a new pet and gets it by id', () async {
- final id = newId();
- final newPet = makePet(id: id);
-
- // use the pet api to add a pet
- petApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/pet',
- expectedPostRequestBody: await petApi.apiClient.serializeAsync(newPet),
- postResponseBody: await petApi.apiClient.serializeAsync(newPet),
- expectedHeaders: {'Content-Type': 'application/json'});
- await petApi.addPet(newPet);
-
- // retrieve the same pet by id
- petApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/pet/$id',
- getResponseBody: await petApi.apiClient.serializeAsync(newPet),
- );
- final retrievedPet = await petApi.getPetById(id);
-
- // check that the retrieved id is as expected
- expect(retrievedPet.id, equals(id));
- });
-
- test('doesn\'t get non-existing pet by id', () {
- final id = newId();
- petApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/pet/$id',
- throwException: ApiException(400, 'not found'),
- );
- expect(petApi.getPetById(id), throwsA(equals(TypeMatcher())));
- });
-
- test('deletes existing pet by id', () async {
- final id = newId();
- Pet newPet = makePet(id: id);
-
- // add a new pet
- petApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/pet',
- expectedPostRequestBody: await petApi.apiClient.serializeAsync(newPet),
- postResponseBody: await petApi.apiClient.serializeAsync(newPet),
- expectedHeaders: {'Content-Type': 'application/json'});
- await petApi.addPet(newPet);
-
- // delete the pet
- petApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/pet/$id',
- expectedHeaders: {'api_key': 'special-key'},
- deleteResponseBody: '',
- );
- await petApi.deletePet(id, apiKey: 'special-key');
-
- // check for the deleted pet
- petApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/pet/$id',
- throwException: ApiException(400, 'Not found'),
- );
- expect(petApi.getPetById(id), throwsA(equals(TypeMatcher())));
- });
-
- test('updates pet with form', () async {
- final id = newId();
- final newPet = makePet(id: id, name: 'Snowy');
-
- // add a new pet
- petApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/pet',
- expectedPostRequestBody: await petApi.apiClient.serializeAsync(newPet),
- postResponseBody: await petApi.apiClient.serializeAsync(newPet),
- expectedHeaders: {'Content-Type': 'application/json'});
- await petApi.addPet(newPet);
-
- // update with form
- petApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/pet/$id',
- expectedHeaders: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- },
- expectedPostRequestBody: {'name': 'Doge', 'status': ''},
- postResponseBody: '',
- );
- await petApi.updatePetWithForm(id, name: 'Doge', status: '');
-
- // check update worked
- newPet.name = 'Doge';
- petApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/pet/$id',
- getResponseBody: await petApi.apiClient.serializeAsync(newPet),
- );
- final pet = await petApi.getPetById(id);
- expect(pet.name, equals('Doge'));
- });
-
- test('updates existing pet', () async {
- final id = newId();
- final name = 'Snowy';
- final newPet = makePet(id: id);
- final updatePet = makePet(id: id, name: name);
-
- // add a new pet
- petApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/pet',
- expectedPostRequestBody: await petApi.apiClient.serializeAsync(newPet),
- postResponseBody: await petApi.apiClient.serializeAsync(newPet),
- expectedHeaders: {'Content-Type': 'application/json'});
- await petApi.addPet(newPet);
-
- // update the same pet
- petApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/pet',
- expectedPutRequestBody: await petApi.apiClient.serializeAsync(updatePet),
- putResponseBody: await petApi.apiClient.serializeAsync(updatePet),
- expectedHeaders: {'Content-Type': 'application/json'});
- await petApi.updatePet(updatePet);
-
- // check update worked
- petApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/pet/$id',
- getResponseBody: await petApi.apiClient.serializeAsync(updatePet),
- );
- final pet = await petApi.getPetById(id);
- expect(pet.name, equals(name));
- });
-
- test('finds pets by status', () async {
- final id1 = newId();
- final id2 = newId();
- final id3 = newId();
- final status = '${PetStatusEnum.available}';
- final pet1 = makePet(id: id1, status: status);
- final pet2 = makePet(id: id2, status: status);
- final pet3 = makePet(id: id3, status: '${PetStatusEnum.sold}');
-
- await addPet(pet1);
- await addPet(pet2);
- await addPet(pet3);
-
- // retrieve pets by status
- petApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/pet/findByStatus?status=$status',
- getResponseBody: await petApi.apiClient.serializeAsync([pet1, pet2]),
- );
- final pets = await petApi.findPetsByStatus([status]);
-
- // tests serialisation and deserialisation of enum
- final petsByStatus = pets.where((p) => p.status == PetStatusEnum.available);
- expect(petsByStatus.length, equals(2));
- final petIds = pets.map((pet) => pet.id).toList();
- expect(petIds, contains(id1));
- expect(petIds, contains(id2));
- expect(petIds, isNot(contains(id3)));
- });
-
- test('uploads a pet image', () async {
- final id = newId();
- final newPet = makePet(id: id);
- // get some test data (recorded from live response)
- final uploadResponse = await File('test/file_upload_response.json').readAsString();
-
- // add a new pet
- petApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/pet',
- expectedPostRequestBody: await petApi.apiClient.serializeAsync(newPet),
- postResponseBody: await petApi.apiClient.serializeAsync(newPet),
- expectedHeaders: {'Content-Type': 'application/json'});
- await petApi.addPet(newPet);
-
- petApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/pet',
- sendResponseBody: uploadResponse,
- );
- final file = new MultipartFile.fromBytes('file', [104, 101, 108, 108, 111]);
- await petApi.uploadFile(id, file: file);
- });
- });
-}
diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart
deleted file mode 100644
index cbd26c68c7e..00000000000
--- a/samples/openapi3/client/petstore/dart2/petstore/test/pet_test.dart
+++ /dev/null
@@ -1,101 +0,0 @@
-@Skip('Needs real petstore')
-import 'package:http/http.dart';
-import 'package:openapi/api.dart';
-import 'package:test/test.dart';
-
-import 'random_id.dart';
-
-void main() {
- var petApi = PetApi();
-
- Pet makePet({
- int id = 1234,
- String name = 'Fluffy',
- String status = '',
- }) {
- final category = Category()
- ..id = 1234
- ..name = 'eyeColor';
- final tags = [
- Tag()
- ..id = 1234
- ..name = 'New York',
- Tag()
- ..id = 124321
- ..name = 'Jose'
- ];
-
- return Pet(
- id: id,
- category: category,
- name: name, //required field
- tags: tags,
- photoUrls: ['https://petstore.com/sample/photo1.jpg'] //required field
- )
- ..status = PetStatusEnum.fromJson(status)
- ..photoUrls = ['https://petstore.com/sample/photo1.jpg'];
- }
-
- group('Pet API with live client', () {
- test('adds a new pet and gets it by id', () async {
- var id = newId();
- await petApi.addPet(makePet(id: id));
- var pet = await petApi.getPetById(id);
- expect(pet.id, equals(id));
- });
-
- test('doesn\'t get non-existing pet by id', () {
- expect(petApi.getPetById(newId()), throwsA(equals(TypeMatcher())));
- });
-
- test('deletes existing pet by id', () async {
- var id = newId();
- await petApi.addPet(makePet(id: id));
- await petApi.deletePet(id, apiKey: 'special-key');
- expect(petApi.getPetById(id), throwsA(equals(TypeMatcher())));
- });
-
- test('updates pet with form', () async {
- var id = newId();
-
- await petApi.addPet(makePet(id: id, name: 'Snowy'));
- await petApi.updatePetWithForm(id, name: 'Doge', status: '');
- var pet = await petApi.getPetById(id);
- expect(pet.name, equals('Doge'));
- });
-
- test('updates existing pet', () async {
- var id = newId();
- var name = 'Snowy';
-
- await petApi.addPet(makePet(id: id));
- await petApi.updatePet(makePet(id: id, name: name));
- var pet = await petApi.getPetById(id);
- expect(pet.name, equals(name));
- });
-
- test('finds pets by status', () async {
- var id1 = newId();
- var id2 = newId();
- var id3 = newId();
- var status = '${PetStatusEnum.available}';
-
- await petApi.addPet(makePet(id: id1, status: status));
- await petApi.addPet(makePet(id: id2, status: status));
- await petApi.addPet(makePet(id: id3, status: '${PetStatusEnum.sold}'));
-
- var pets = await petApi.findPetsByStatus([status]);
- var petIds = pets.map((pet) => pet.id).toList();
- expect(petIds, contains(id1));
- expect(petIds, contains(id2));
- expect(petIds, isNot(contains(id3)));
- });
-
- test('uploads a pet image', () async {
- var id = newId();
- await petApi.addPet(makePet(id: id));
- var file = new MultipartFile.fromBytes('file', [104, 101, 108, 108, 111]);
- await petApi.uploadFile(id, additionalMetadata: '', file: file);
- });
- });
-}
diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/random_id.dart b/samples/openapi3/client/petstore/dart2/petstore/test/random_id.dart
deleted file mode 100644
index ca67ac20993..00000000000
--- a/samples/openapi3/client/petstore/dart2/petstore/test/random_id.dart
+++ /dev/null
@@ -1,7 +0,0 @@
-import 'dart:math';
-
-final _random = new Random();
-
-int newId() {
- return _random.nextInt(999999);
-}
diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/store_faked_client_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/store_faked_client_test.dart
deleted file mode 100644
index 541d08b8c6a..00000000000
--- a/samples/openapi3/client/petstore/dart2/petstore/test/store_faked_client_test.dart
+++ /dev/null
@@ -1,83 +0,0 @@
-import 'dart:io';
-
-import 'package:openapi/api.dart';
-import 'package:test/test.dart';
-
-import 'fake_client.dart';
-import 'random_id.dart';
-
-void main() {
- var storeApi = new StoreApi();
-
- Order makeOrder({int id}) {
- return Order()
- ..id = id
- ..petId = 1234
- ..quantity = 1
- ..shipDate = DateTime.now()
- ..status
- ..complete = false;
- }
-
- group('Store API with faked client', () {
- test('places an order and gets it by id', () async {
- final id = newId();
- final newOrder = makeOrder(id: id);
-
- // use the store api to add an order
- storeApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/store/order',
- expectedPostRequestBody: await storeApi.apiClient.serializeAsync(newOrder),
- postResponseBody: await storeApi.apiClient.serializeAsync(newOrder),
- expectedHeaders: {"Content-Type": "application/json"});
- await storeApi.placeOrder(newOrder);
-
- // retrieve the same order by id
- storeApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id',
- getResponseBody: await storeApi.apiClient.serializeAsync(newOrder),
- );
- final placedOrder = await storeApi.getOrderById(id);
- expect(placedOrder.id, equals(id));
- });
-
- test('deletes an order', () async {
- final id = newId();
- final newOrder = makeOrder(id: id);
-
- // use the store api to add an order
- storeApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/store/order',
- expectedPostRequestBody: await storeApi.apiClient.serializeAsync(newOrder),
- postResponseBody: await storeApi.apiClient.serializeAsync(newOrder),
- expectedHeaders: {"Content-Type": "application/json"});
- await storeApi.placeOrder(newOrder);
-
- // delete the same order
- storeApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id',
- deleteResponseBody: '',
- );
- await storeApi.deleteOrder(id.toString());
-
- // try and retrieve the order
- storeApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/store/order/$id',
- throwException: ApiException(400, 'Not found'),
- );
- expect(storeApi.getOrderById(id), throwsA(equals(TypeMatcher())));
- });
-
- test('gets the store inventory', () async {
- // get some test data (recorded from live response)
- final inventoryResponse = await File('test/inventory_response.json').readAsString();
- // use the store api to get the inventory
- storeApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/store/inventory',
- getResponseBody: inventoryResponse,
- );
- Map inventory = await storeApi.getInventory();
- expect(inventory.length, isNot(equals(0)));
- });
- });
-}
diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/store_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/store_test.dart
deleted file mode 100644
index a5b19cd1de5..00000000000
--- a/samples/openapi3/client/petstore/dart2/petstore/test/store_test.dart
+++ /dev/null
@@ -1,42 +0,0 @@
-@Skip('Needs real petstore')
-import 'package:openapi/api.dart';
-import 'package:test/test.dart';
-
-import 'random_id.dart';
-
-void main() {
- var storeApi = new StoreApi();
-
- Order makeOrder({int id}) {
- return Order()
- ..id = id
- ..petId = 1234
- ..quantity = 1
- ..shipDate = DateTime.now()
- ..status
- ..complete = false;
- }
-
- group('Store API with live client', () {
- test('places an order and gets it by id', () async {
- var id = newId();
-
- await storeApi.placeOrder(makeOrder(id: id));
- var order = await storeApi.getOrderById(id);
- expect(order.id, equals(id));
- });
-
- test('deletes an order', () async {
- var id = newId();
-
- await storeApi.placeOrder(makeOrder(id: id));
- await storeApi.deleteOrder(id.toString());
- expect(storeApi.getOrderById(id), throwsA(equals(TypeMatcher())));
- });
-
- test('gets the store inventory', () async {
- Map inventory = await storeApi.getInventory();
- expect(inventory.length, isNot(equals(0)));
- });
- });
-}
diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/user_faked_client_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/user_faked_client_test.dart
deleted file mode 100644
index f8137935192..00000000000
--- a/samples/openapi3/client/petstore/dart2/petstore/test/user_faked_client_test.dart
+++ /dev/null
@@ -1,180 +0,0 @@
-import 'package:openapi/api.dart';
-import 'package:test/test.dart';
-
-import 'fake_client.dart';
-import 'random_id.dart';
-
-void main() {
- var userApi = new UserApi();
-
- User makeUser(
- {int id, String userName = 'username', String password = 'password'}) {
- return User()
- ..id = id
- ..username = userName
- ..firstName = 'firstname'
- ..lastName = 'lastname'
- ..email = 'email'
- ..password = password
- ..phone = 'phone'
- ..userStatus = 0;
- }
-
- group('User API with faked client', () {
- test('creates a user', () async {
- final id = newId();
- final username = 'Mally45';
- final newUser = makeUser(id: id, userName: username);
-
- // use the user api to create a user
- userApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/user',
- expectedPostRequestBody:
- await userApi.apiClient.serializeAsync(newUser),
- expectedHeaders: {'Content-Type': 'application/json'},
- postResponseBody: await userApi.apiClient.serializeAsync(newUser),
- );
- await userApi.createUser(newUser);
-
- // retrieve the same user
- userApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/user/$username',
- getResponseBody: await userApi.apiClient.serializeAsync(newUser),
- );
- var user = await userApi.getUserByName(username);
- expect(user.id, equals(id));
- });
-
- test('creates users with list input', () async {
- final firstId = newId();
- final joe = 'Joe';
-
- final sally = 'Sally';
- final secondId = newId();
-
- final users = [
- makeUser(id: firstId, userName: joe),
- makeUser(id: secondId, userName: sally),
- ];
-
- // use the user api to create a list of users
- userApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/user/createWithList',
- expectedPostRequestBody: await userApi.apiClient.serializeAsync(users),
- expectedHeaders: {'Content-Type': 'application/json'},
- postResponseBody: await userApi.apiClient.serializeAsync(users),
- );
- await userApi.createUsersWithListInput(users);
-
- // retrieve the users
- userApi.apiClient.client = FakeClient(
- expectedUrl:
- 'http://petstore.swagger.io/v2/user/${users.elementAt(0).username}',
- getResponseBody: await userApi.apiClient.serializeAsync(
- users.elementAt(0),
- ),
- );
- final firstUser = await userApi.getUserByName(joe);
- userApi.apiClient.client = FakeClient(
- expectedUrl:
- 'http://petstore.swagger.io/v2/user/${users.elementAt(1).username}',
- getResponseBody: await userApi.apiClient.serializeAsync(
- users.elementAt(1),
- ),
- );
- final secondUser = await userApi.getUserByName(sally);
- expect(firstUser.id, equals(firstId));
- expect(secondUser.id, equals(secondId));
- });
-
- test('updates a user', () async {
- final username = 'Arkjam89';
- final email = 'test@example.com';
- final newUser = makeUser(id: newId(), userName: username);
-
- // use the user api to create a user
- userApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/user',
- expectedPostRequestBody:
- await userApi.apiClient.serializeAsync(newUser),
- expectedHeaders: {'Content-Type': 'application/json'},
- postResponseBody: await userApi.apiClient.serializeAsync(newUser),
- );
- await userApi.createUser(newUser);
- newUser.email = email;
-
- // use the user api to update the user
- userApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/user/${newUser.username}',
- expectedPutRequestBody: await userApi.apiClient.serializeAsync(newUser),
- expectedHeaders: {'Content-Type': 'application/json'},
- putResponseBody: await userApi.apiClient.serializeAsync(newUser),
- );
- await userApi.updateUser(username, newUser);
-
- // retrieve the same user
- userApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/user/${newUser.username}',
- getResponseBody: await userApi.apiClient.serializeAsync(newUser),
- );
- var foundUser = await userApi.getUserByName(username);
- expect(foundUser.email, equals(email));
- });
-
- test('deletes a user', () async {
- final username = 'Riddlem325';
- final newUser = makeUser(id: newId(), userName: username);
-
- // use the user api to create a user
- userApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/user',
- expectedPostRequestBody:
- await userApi.apiClient.serializeAsync(newUser),
- expectedHeaders: {'Content-Type': 'application/json'},
- postResponseBody: await userApi.apiClient.serializeAsync(newUser),
- );
- await userApi.createUser(newUser);
-
- // delete the same user
- userApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/user/${newUser.username}',
- deleteResponseBody: '',
- );
- await userApi.deleteUser(username);
-
- // try and retrieve the user
- userApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/user/${newUser.username}',
- throwException: ApiException(400, 'Not found'),
- );
- expect(userApi.getUserByName(username),
- throwsA(TypeMatcher()));
- });
-
- test('logs a user in', () async {
- final username = 'sgarad625';
- final password = 'lokimoki1';
- final newUser =
- makeUser(id: newId(), userName: username, password: password);
-
- // use the user api to create a user
- userApi.apiClient.client = FakeClient(
- expectedUrl: 'http://petstore.swagger.io/v2/user',
- expectedPostRequestBody:
- await userApi.apiClient.serializeAsync(newUser),
- expectedHeaders: {'Content-Type': 'application/json'},
- postResponseBody: await userApi.apiClient.serializeAsync(newUser),
- );
- await userApi.createUser(newUser);
-
- // use the user api to login
- userApi.apiClient.client = FakeClient(
- expectedUrl:
- 'http://petstore.swagger.io/v2/user/login?username=${newUser.username}&password=${newUser.password}',
- getResponseBody: 'logged in user session:',
- );
- final result = await userApi.loginUser(username, password);
- expect(result, contains('logged in user session:'));
- });
- });
-}
diff --git a/samples/openapi3/client/petstore/dart2/petstore/test/user_test.dart b/samples/openapi3/client/petstore/dart2/petstore/test/user_test.dart
deleted file mode 100644
index d604363622d..00000000000
--- a/samples/openapi3/client/petstore/dart2/petstore/test/user_test.dart
+++ /dev/null
@@ -1,79 +0,0 @@
-@Skip('Needs real petstore')
-import 'package:openapi/api.dart';
-import 'package:test/test.dart';
-
-import 'random_id.dart';
-
-void main() {
- var userApi = new UserApi();
-
- User makeUser({int id, String userName = 'username', String password = 'password'}) {
- return User()
- ..id = id
- ..username = userName
- ..firstName = 'firstname'
- ..lastName = 'lastname'
- ..email = 'email'
- ..password = password
- ..phone = 'phone'
- ..userStatus = 0;
- }
-
- group('User API with live client', () {
- test('creates a user', () async {
- var id = newId();
- var username = 'Mally45';
- await userApi.createUser(makeUser(id: id, userName: username));
- var user = await userApi.getUserByName(username);
- expect(user.id, equals(id));
- });
-
- test('creates users with list input', () async {
- var firstId = newId();
- var joe = 'Joe';
-
- var sally = 'Sally';
- var secondId = newId();
-
- var users = [
- makeUser(id: firstId, userName: joe),
- makeUser(id: secondId, userName: sally),
- ];
-
- await userApi.createUsersWithListInput(users);
- var firstUser = await userApi.getUserByName(joe);
- var secondUser = await userApi.getUserByName(sally);
- expect(firstUser.id, equals(firstId));
- expect(secondUser.id, equals(secondId));
- });
-
- test('updates a user', () async {
- var username = 'Arkjam89';
- var email = 'test@example.com';
- var user = makeUser(id: newId(), userName: username);
-
- await userApi.createUser(user);
- user.email = email;
- await userApi.updateUser(username, user);
- var foundUser = await userApi.getUserByName(username);
- expect(foundUser.email, equals(email));
- });
-
- test('deletes a user', () async {
- var username = 'Riddlem325';
- await userApi.createUser(makeUser(id: newId(), userName: username));
- await userApi.deleteUser(username);
- expect(userApi.getUserByName(username), throwsA(TypeMatcher()));
- });
-
- test('logs a user in', () async {
- var username = 'sgarad625';
- var password = 'lokimoki1';
- var user = makeUser(id: newId(), userName: username, password: password);
-
- await userApi.createUser(user);
- var result = await userApi.loginUser(username, password);
- expect(result, contains('logged in user session:'));
- });
- });
-}
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/.gitignore b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.gitignore
index 8b7331fd822..1be28ced094 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/.gitignore
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.gitignore
@@ -1,27 +1,17 @@
-# See https://www.dartlang.org/tools/private-files.html
+# See https://dart.dev/guides/libraries/private-files
-# Files and directories created by pub
-.buildlog
+.dart_tool/
.packages
-.project
-.pub/
build/
-**/packages/
+pubspec.lock # Except for application packages
-# Files created by dart2js
-# (Most Dart developers will use pub build to compile Dart, use/modify these
-# rules if you intend to use dart2js directly
-# Convention is to use extension '.dart.js' for Dart compiled to Javascript to
-# differentiate from explicit Javascript files)
-*.dart.js
-*.part.js
-*.js.deps
-*.js.map
-*.info.json
-
-# Directory created by dartdoc
doc/api/
-# Don't commit pubspec lock file
-# (Library packages only! Remove pattern if developing an application package)
-pubspec.lock
+# IntelliJ
+*.iml
+*.ipr
+*.iws
+.idea/
+
+# Mac
+.DS_Store
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/VERSION
index 1e20ec35c64..5f68295fc19 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/VERSION
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.openapi-generator/VERSION
@@ -1 +1 @@
-5.4.0
\ No newline at end of file
+6.0.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/.travis.yml b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.travis.yml
index 1a3af66d54c..2774ccbba0e 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/.travis.yml
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/.travis.yml
@@ -6,7 +6,7 @@
language: dart
dart:
# Install a specific stable release
-- "2.2.0"
+- "2.12"
install:
- pub get
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/README.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/README.md
index b41b8970d0c..dd7e2f92353 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/README.md
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/README.md
@@ -8,7 +8,7 @@ This Dart package is automatically generated by the [OpenAPI Generator](https://
## Requirements
-Dart 2.0 or later
+Dart 2.12 or later
## Installation & Usage
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart
index e67b60f2670..742bcfa1154 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart
@@ -1,7 +1,7 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
-// @dart=2.0
+// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart
index 5b299b6b2cd..b4ee176a926 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/pet_api.dart
@@ -1,7 +1,7 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
-// @dart=2.0
+// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
@@ -12,7 +12,7 @@ part of openapi.api;
class PetApi {
- PetApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient;
+ PetApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
final ApiClient apiClient;
@@ -25,16 +25,11 @@ class PetApi {
/// * [Pet] pet (required):
/// Pet object that needs to be added to the store
Future addPetWithHttpInfo(Pet pet,) async {
- // Verify required params are set.
- if (pet == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: pet');
- }
-
// ignore: prefer_const_declarations
final path = r'/pet';
// ignore: prefer_final_locals
- Object postBody = pet;
+ Object? postBody = pet;
final queryParams = [];
final headerParams = {};
@@ -51,7 +46,7 @@ class PetApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -62,7 +57,7 @@ class PetApi {
///
/// * [Pet] pet (required):
/// Pet object that needs to be added to the store
- Future addPet(Pet pet,) async {
+ Future addPet(Pet pet,) async {
final response = await addPetWithHttpInfo(pet,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@@ -70,11 +65,11 @@ class PetApi {
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
- if (response.body != null && response.statusCode != HttpStatus.noContent) {
+ if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet;
}
- return Future.value();
+ return null;
}
/// Deletes a pet
@@ -87,18 +82,13 @@ class PetApi {
/// Pet id to delete
///
/// * [String] apiKey:
- Future deletePetWithHttpInfo(int petId, { String apiKey, }) async {
- // Verify required params are set.
- if (petId == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: petId');
- }
-
+ Future deletePetWithHttpInfo(int petId, { String? apiKey, }) async {
// ignore: prefer_const_declarations
final path = r'/pet/{petId}'
.replaceAll('{petId}', petId.toString());
// ignore: prefer_final_locals
- Object postBody;
+ Object? postBody;
final queryParams = [];
final headerParams = {};
@@ -119,7 +109,7 @@ class PetApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -132,7 +122,7 @@ class PetApi {
/// Pet id to delete
///
/// * [String] apiKey:
- Future deletePet(int petId, { String apiKey, }) async {
+ Future deletePet(int petId, { String? apiKey, }) async {
final response = await deletePetWithHttpInfo(petId, apiKey: apiKey, );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@@ -150,22 +140,17 @@ class PetApi {
/// * [List] status (required):
/// Status values that need to be considered for filter
Future findPetsByStatusWithHttpInfo(List status,) async {
- // Verify required params are set.
- if (status == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: status');
- }
-
// ignore: prefer_const_declarations
final path = r'/pet/findByStatus';
// ignore: prefer_final_locals
- Object postBody;
+ Object? postBody;
final queryParams = [];
final headerParams = {};
final formParams = {};
- queryParams.addAll(_convertParametersForCollectionFormat('csv', 'status', status));
+ queryParams.addAll(_queryParams('csv', 'status', status));
const authNames = ['petstore_auth'];
const contentTypes = [];
@@ -178,7 +163,7 @@ class PetApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -191,7 +176,7 @@ class PetApi {
///
/// * [List] status (required):
/// Status values that need to be considered for filter
- Future> findPetsByStatus(List status,) async {
+ Future?> findPetsByStatus(List status,) async {
final response = await findPetsByStatusWithHttpInfo(status,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@@ -199,14 +184,14 @@ class PetApi {
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
- if (response.body != null && response.statusCode != HttpStatus.noContent) {
+ if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
final responseBody = await _decodeBodyBytes(response);
return (await apiClient.deserializeAsync(responseBody, 'List') as List)
.cast()
- .toList(growable: false);
+ .toList();
}
- return Future>.value();
+ return null;
}
/// Finds Pets by tags
@@ -220,22 +205,17 @@ class PetApi {
/// * [List] tags (required):
/// Tags to filter by
Future findPetsByTagsWithHttpInfo(List tags,) async {
- // Verify required params are set.
- if (tags == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: tags');
- }
-
// ignore: prefer_const_declarations
final path = r'/pet/findByTags';
// ignore: prefer_final_locals
- Object postBody;
+ Object? postBody;
final queryParams = [];
final headerParams = {};
final formParams = {};
- queryParams.addAll(_convertParametersForCollectionFormat('csv', 'tags', tags));
+ queryParams.addAll(_queryParams('csv', 'tags', tags));
const authNames = ['petstore_auth'];
const contentTypes = [];
@@ -248,7 +228,7 @@ class PetApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -261,7 +241,7 @@ class PetApi {
///
/// * [List] tags (required):
/// Tags to filter by
- Future> findPetsByTags(List tags,) async {
+ Future?> findPetsByTags(List tags,) async {
final response = await findPetsByTagsWithHttpInfo(tags,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@@ -269,14 +249,14 @@ class PetApi {
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
- if (response.body != null && response.statusCode != HttpStatus.noContent) {
+ if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
final responseBody = await _decodeBodyBytes(response);
return (await apiClient.deserializeAsync(responseBody, 'List') as List)
.cast()
- .toList(growable: false);
+ .toList();
}
- return Future>.value();
+ return null;
}
/// Find pet by ID
@@ -290,17 +270,12 @@ class PetApi {
/// * [int] petId (required):
/// ID of pet to return
Future getPetByIdWithHttpInfo(int petId,) async {
- // Verify required params are set.
- if (petId == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: petId');
- }
-
// ignore: prefer_const_declarations
final path = r'/pet/{petId}'
.replaceAll('{petId}', petId.toString());
// ignore: prefer_final_locals
- Object postBody;
+ Object? postBody;
final queryParams = [];
final headerParams = {};
@@ -317,7 +292,7 @@ class PetApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -330,7 +305,7 @@ class PetApi {
///
/// * [int] petId (required):
/// ID of pet to return
- Future getPetById(int petId,) async {
+ Future getPetById(int petId,) async {
final response = await getPetByIdWithHttpInfo(petId,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@@ -338,11 +313,11 @@ class PetApi {
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
- if (response.body != null && response.statusCode != HttpStatus.noContent) {
+ if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet;
}
- return Future.value();
+ return null;
}
/// Update an existing pet
@@ -354,16 +329,11 @@ class PetApi {
/// * [Pet] pet (required):
/// Pet object that needs to be added to the store
Future updatePetWithHttpInfo(Pet pet,) async {
- // Verify required params are set.
- if (pet == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: pet');
- }
-
// ignore: prefer_const_declarations
final path = r'/pet';
// ignore: prefer_final_locals
- Object postBody = pet;
+ Object? postBody = pet;
final queryParams = [];
final headerParams = {};
@@ -380,7 +350,7 @@ class PetApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -391,7 +361,7 @@ class PetApi {
///
/// * [Pet] pet (required):
/// Pet object that needs to be added to the store
- Future updatePet(Pet pet,) async {
+ Future updatePet(Pet pet,) async {
final response = await updatePetWithHttpInfo(pet,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@@ -399,11 +369,11 @@ class PetApi {
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
- if (response.body != null && response.statusCode != HttpStatus.noContent) {
+ if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet;
}
- return Future.value();
+ return null;
}
/// Updates a pet in the store with form data
@@ -420,18 +390,13 @@ class PetApi {
///
/// * [String] status:
/// Updated status of the pet
- Future updatePetWithFormWithHttpInfo(int petId, { String name, String status, }) async {
- // Verify required params are set.
- if (petId == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: petId');
- }
-
+ Future updatePetWithFormWithHttpInfo(int petId, { String? name, String? status, }) async {
// ignore: prefer_const_declarations
final path = r'/pet/{petId}'
.replaceAll('{petId}', petId.toString());
// ignore: prefer_final_locals
- Object postBody;
+ Object? postBody;
final queryParams = [];
final headerParams = {};
@@ -454,7 +419,7 @@ class PetApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -471,7 +436,7 @@ class PetApi {
///
/// * [String] status:
/// Updated status of the pet
- Future updatePetWithForm(int petId, { String name, String status, }) async {
+ Future updatePetWithForm(int petId, { String? name, String? status, }) async {
final response = await updatePetWithFormWithHttpInfo(petId, name: name, status: status, );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@@ -492,18 +457,13 @@ class PetApi {
///
/// * [MultipartFile] file:
/// file to upload
- Future uploadFileWithHttpInfo(int petId, { String additionalMetadata, MultipartFile file, }) async {
- // Verify required params are set.
- if (petId == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: petId');
- }
-
+ Future uploadFileWithHttpInfo(int petId, { String? additionalMetadata, MultipartFile? file, }) async {
// ignore: prefer_const_declarations
final path = r'/pet/{petId}/uploadImage'
.replaceAll('{petId}', petId.toString());
// ignore: prefer_final_locals
- Object postBody;
+ Object? postBody;
final queryParams = [];
final headerParams = {};
@@ -534,7 +494,7 @@ class PetApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -551,7 +511,7 @@ class PetApi {
///
/// * [MultipartFile] file:
/// file to upload
- Future uploadFile(int petId, { String additionalMetadata, MultipartFile file, }) async {
+ Future uploadFile(int petId, { String? additionalMetadata, MultipartFile? file, }) async {
final response = await uploadFileWithHttpInfo(petId, additionalMetadata: additionalMetadata, file: file, );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@@ -559,10 +519,10 @@ class PetApi {
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
- if (response.body != null && response.statusCode != HttpStatus.noContent) {
+ if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse;
}
- return Future.value();
+ return null;
}
}
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart
index 0c5c49a9554..dff1442125d 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/store_api.dart
@@ -1,7 +1,7 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
-// @dart=2.0
+// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
@@ -12,7 +12,7 @@ part of openapi.api;
class StoreApi {
- StoreApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient;
+ StoreApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
final ApiClient apiClient;
@@ -27,17 +27,12 @@ class StoreApi {
/// * [String] orderId (required):
/// ID of the order that needs to be deleted
Future deleteOrderWithHttpInfo(String orderId,) async {
- // Verify required params are set.
- if (orderId == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId');
- }
-
// ignore: prefer_const_declarations
final path = r'/store/order/{orderId}'
.replaceAll('{orderId}', orderId);
// ignore: prefer_final_locals
- Object postBody;
+ Object? postBody;
final queryParams = [];
final headerParams = {};
@@ -54,7 +49,7 @@ class StoreApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -84,7 +79,7 @@ class StoreApi {
final path = r'/store/inventory';
// ignore: prefer_final_locals
- Object postBody;
+ Object? postBody;
final queryParams = [];
final headerParams = {};
@@ -101,7 +96,7 @@ class StoreApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -109,7 +104,7 @@ class StoreApi {
/// Returns pet inventories by status
///
/// Returns a map of status codes to quantities
- Future> getInventory() async {
+ Future?> getInventory() async {
final response = await getInventoryWithHttpInfo();
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@@ -117,11 +112,11 @@ class StoreApi {
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
- if (response.body != null && response.statusCode != HttpStatus.noContent) {
+ if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return Map.from(await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map'),);
}
- return Future>.value();
+ return null;
}
/// Find purchase order by ID
@@ -135,17 +130,12 @@ class StoreApi {
/// * [int] orderId (required):
/// ID of pet that needs to be fetched
Future getOrderByIdWithHttpInfo(int orderId,) async {
- // Verify required params are set.
- if (orderId == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId');
- }
-
// ignore: prefer_const_declarations
final path = r'/store/order/{orderId}'
.replaceAll('{orderId}', orderId.toString());
// ignore: prefer_final_locals
- Object postBody;
+ Object? postBody;
final queryParams = [];
final headerParams = {};
@@ -162,7 +152,7 @@ class StoreApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -175,7 +165,7 @@ class StoreApi {
///
/// * [int] orderId (required):
/// ID of pet that needs to be fetched
- Future getOrderById(int orderId,) async {
+ Future getOrderById(int orderId,) async {
final response = await getOrderByIdWithHttpInfo(orderId,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@@ -183,11 +173,11 @@ class StoreApi {
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
- if (response.body != null && response.statusCode != HttpStatus.noContent) {
+ if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order;
}
- return Future.value();
+ return null;
}
/// Place an order for a pet
@@ -199,16 +189,11 @@ class StoreApi {
/// * [Order] order (required):
/// order placed for purchasing the pet
Future placeOrderWithHttpInfo(Order order,) async {
- // Verify required params are set.
- if (order == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: order');
- }
-
// ignore: prefer_const_declarations
final path = r'/store/order';
// ignore: prefer_final_locals
- Object postBody = order;
+ Object? postBody = order;
final queryParams = [];
final headerParams = {};
@@ -225,7 +210,7 @@ class StoreApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -236,7 +221,7 @@ class StoreApi {
///
/// * [Order] order (required):
/// order placed for purchasing the pet
- Future placeOrder(Order order,) async {
+ Future placeOrder(Order order,) async {
final response = await placeOrderWithHttpInfo(order,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@@ -244,10 +229,10 @@ class StoreApi {
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
- if (response.body != null && response.statusCode != HttpStatus.noContent) {
+ if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order;
}
- return Future.value();
+ return null;
}
}
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart
index 3d30943890f..a479e0b1dd3 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api/user_api.dart
@@ -1,7 +1,7 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
-// @dart=2.0
+// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
@@ -12,7 +12,7 @@ part of openapi.api;
class UserApi {
- UserApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient;
+ UserApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
final ApiClient apiClient;
@@ -27,16 +27,11 @@ class UserApi {
/// * [User] user (required):
/// Created user object
Future createUserWithHttpInfo(User user,) async {
- // Verify required params are set.
- if (user == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: user');
- }
-
// ignore: prefer_const_declarations
final path = r'/user';
// ignore: prefer_final_locals
- Object postBody = user;
+ Object? postBody = user;
final queryParams = [];
final headerParams = {};
@@ -53,7 +48,7 @@ class UserApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -82,16 +77,11 @@ class UserApi {
/// * [List] user (required):
/// List of user object
Future createUsersWithArrayInputWithHttpInfo(List user,) async {
- // Verify required params are set.
- if (user == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: user');
- }
-
// ignore: prefer_const_declarations
final path = r'/user/createWithArray';
// ignore: prefer_final_locals
- Object postBody = user;
+ Object? postBody = user;
final queryParams = [];
final headerParams = {};
@@ -108,7 +98,7 @@ class UserApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -135,16 +125,11 @@ class UserApi {
/// * [List] user (required):
/// List of user object
Future createUsersWithListInputWithHttpInfo(List user,) async {
- // Verify required params are set.
- if (user == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: user');
- }
-
// ignore: prefer_const_declarations
final path = r'/user/createWithList';
// ignore: prefer_final_locals
- Object postBody = user;
+ Object? postBody = user;
final queryParams = [];
final headerParams = {};
@@ -161,7 +146,7 @@ class UserApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -190,17 +175,12 @@ class UserApi {
/// * [String] username (required):
/// The name that needs to be deleted
Future deleteUserWithHttpInfo(String username,) async {
- // Verify required params are set.
- if (username == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: username');
- }
-
// ignore: prefer_const_declarations
final path = r'/user/{username}'
.replaceAll('{username}', username);
// ignore: prefer_final_locals
- Object postBody;
+ Object? postBody;
final queryParams = [];
final headerParams = {};
@@ -217,7 +197,7 @@ class UserApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -246,17 +226,12 @@ class UserApi {
/// * [String] username (required):
/// The name that needs to be fetched. Use user1 for testing.
Future getUserByNameWithHttpInfo(String username,) async {
- // Verify required params are set.
- if (username == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: username');
- }
-
// ignore: prefer_const_declarations
final path = r'/user/{username}'
.replaceAll('{username}', username);
// ignore: prefer_final_locals
- Object postBody;
+ Object? postBody;
final queryParams = [];
final headerParams = {};
@@ -273,7 +248,7 @@ class UserApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -284,7 +259,7 @@ class UserApi {
///
/// * [String] username (required):
/// The name that needs to be fetched. Use user1 for testing.
- Future getUserByName(String username,) async {
+ Future getUserByName(String username,) async {
final response = await getUserByNameWithHttpInfo(username,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@@ -292,11 +267,11 @@ class UserApi {
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
- if (response.body != null && response.statusCode != HttpStatus.noContent) {
+ if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'User',) as User;
}
- return Future.value();
+ return null;
}
/// Logs user into the system
@@ -311,26 +286,18 @@ class UserApi {
/// * [String] password (required):
/// The password for login in clear text
Future loginUserWithHttpInfo(String username, String password,) async {
- // Verify required params are set.
- if (username == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: username');
- }
- if (password == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: password');
- }
-
// ignore: prefer_const_declarations
final path = r'/user/login';
// ignore: prefer_final_locals
- Object postBody;
+ Object? postBody;
final queryParams = [];
final headerParams = {};
final formParams = {};
- queryParams.addAll(_convertParametersForCollectionFormat('', 'username', username));
- queryParams.addAll(_convertParametersForCollectionFormat('', 'password', password));
+ queryParams.addAll(_queryParams('', 'username', username));
+ queryParams.addAll(_queryParams('', 'password', password));
const authNames = [];
const contentTypes = [];
@@ -343,7 +310,7 @@ class UserApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -357,7 +324,7 @@ class UserApi {
///
/// * [String] password (required):
/// The password for login in clear text
- Future loginUser(String username, String password,) async {
+ Future loginUser(String username, String password,) async {
final response = await loginUserWithHttpInfo(username, password,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
@@ -365,11 +332,11 @@ class UserApi {
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
- if (response.body != null && response.statusCode != HttpStatus.noContent) {
+ if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String;
}
- return Future.value();
+ return null;
}
/// Logs out current logged in user session
@@ -380,7 +347,7 @@ class UserApi {
final path = r'/user/logout';
// ignore: prefer_final_locals
- Object postBody;
+ Object? postBody;
final queryParams = [];
final headerParams = {};
@@ -397,7 +364,7 @@ class UserApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
@@ -424,20 +391,12 @@ class UserApi {
/// * [User] user (required):
/// Updated user object
Future updateUserWithHttpInfo(String username, User user,) async {
- // Verify required params are set.
- if (username == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: username');
- }
- if (user == null) {
- throw ApiException(HttpStatus.badRequest, 'Missing required param: user');
- }
-
// ignore: prefer_const_declarations
final path = r'/user/{username}'
.replaceAll('{username}', username);
// ignore: prefer_final_locals
- Object postBody = user;
+ Object? postBody = user;
final queryParams = [];
final headerParams = {};
@@ -454,7 +413,7 @@ class UserApi {
postBody,
headerParams,
formParams,
- contentTypes.isEmpty ? null : contentTypes[0],
+ contentTypes.isEmpty ? null : contentTypes.first,
authNames,
);
}
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart
index 93057a79a7b..3efae0775a5 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_client.dart
@@ -1,7 +1,7 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
-// @dart=2.0
+// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
@@ -27,12 +27,7 @@ class ApiClient {
Client get client => _client;
/// Requests to use a new HTTP [Client] in this class.
- ///
- /// If the [newClient] is null, an [ArgumentError] is thrown.
set client(Client newClient) {
- if (newClient == null) {
- throw ArgumentError('New client instance cannot be null.');
- }
_client = newClient;
}
@@ -49,7 +44,7 @@ class ApiClient {
/// or deleted.
Map get authentications => Map.unmodifiable(_authentications);
- T getAuthentication(String name) {
+ T? getAuthentication(String name) {
final authentication = _authentications[name];
return authentication is T ? authentication : null;
}
@@ -60,35 +55,28 @@ class ApiClient {
String path,
String method,
List queryParams,
- Object body,
+ Object? body,
Map headerParams,
Map formParams,
- String nullableContentType,
+ String? contentType,
List authNames,
) async {
_updateParamsForAuth(authNames, queryParams, headerParams);
headerParams.addAll(_defaultHeaderMap);
-
- final urlEncodedQueryParams = queryParams
- .where((param) => param.value != null)
- .map((param) => '$param');
-
- final queryString = urlEncodedQueryParams.isNotEmpty
- ? '?${urlEncodedQueryParams.join('&')}'
- : '';
-
- final uri = Uri.parse('$basePath$path$queryString');
-
- if (nullableContentType != null) {
- headerParams['Content-Type'] = nullableContentType;
+ if (contentType != null) {
+ headerParams['Content-Type'] = contentType;
}
+ final urlEncodedQueryParams = queryParams.map((param) => '$param');
+ final queryString = urlEncodedQueryParams.isNotEmpty ? '?${urlEncodedQueryParams.join('&')}' : '';
+ final uri = Uri.parse('$basePath$path$queryString');
+
try {
// Special case for uploading a single file which isn't a 'multipart/form-data'.
if (
- body is MultipartFile && (nullableContentType == null ||
- !nullableContentType.toLowerCase().startsWith('multipart/form-data'))
+ body is MultipartFile && (contentType == null ||
+ !contentType.toLowerCase().startsWith('multipart/form-data'))
) {
final request = StreamedRequest(method, uri);
request.headers.addAll(headerParams);
@@ -114,7 +102,7 @@ class ApiClient {
return Response.fromStream(response);
}
- final msgBody = nullableContentType == 'application/x-www-form-urlencoded'
+ final msgBody = contentType == 'application/x-www-form-urlencoded'
? formParams
: await serializeAsync(body);
final nullableHeaderParams = headerParams.isEmpty ? null : headerParams;
@@ -127,41 +115,69 @@ class ApiClient {
case 'HEAD': return await _client.head(uri, headers: nullableHeaderParams,);
case 'GET': return await _client.get(uri, headers: nullableHeaderParams,);
}
- } on SocketException catch (e, trace) {
- throw ApiException.withInner(HttpStatus.badRequest, 'Socket operation failed: $method $path', e, trace,);
- } on TlsException catch (e, trace) {
- throw ApiException.withInner(HttpStatus.badRequest, 'TLS/SSL communication failed: $method $path', e, trace,);
- } on IOException catch (e, trace) {
- throw ApiException.withInner(HttpStatus.badRequest, 'I/O operation failed: $method $path', e, trace,);
- } on ClientException catch (e, trace) {
- throw ApiException.withInner(HttpStatus.badRequest, 'HTTP connection failed: $method $path', e, trace,);
- } on Exception catch (e, trace) {
- throw ApiException.withInner(HttpStatus.badRequest, 'Exception occurred: $method $path', e, trace,);
+ } on SocketException catch (error, trace) {
+ throw ApiException.withInner(
+ HttpStatus.badRequest,
+ 'Socket operation failed: $method $path',
+ error,
+ trace,
+ );
+ } on TlsException catch (error, trace) {
+ throw ApiException.withInner(
+ HttpStatus.badRequest,
+ 'TLS/SSL communication failed: $method $path',
+ error,
+ trace,
+ );
+ } on IOException catch (error, trace) {
+ throw ApiException.withInner(
+ HttpStatus.badRequest,
+ 'I/O operation failed: $method $path',
+ error,
+ trace,
+ );
+ } on ClientException catch (error, trace) {
+ throw ApiException.withInner(
+ HttpStatus.badRequest,
+ 'HTTP connection failed: $method $path',
+ error,
+ trace,
+ );
+ } on Exception catch (error, trace) {
+ throw ApiException.withInner(
+ HttpStatus.badRequest,
+ 'Exception occurred: $method $path',
+ error,
+ trace,
+ );
}
- throw ApiException(HttpStatus.badRequest, 'Invalid HTTP operation: $method $path',);
+ throw ApiException(
+ HttpStatus.badRequest,
+ 'Invalid HTTP operation: $method $path',
+ );
}
- Future deserializeAsync(String json, String targetType, {bool growable}) async =>
+ Future deserializeAsync(String json, String targetType, {bool growable = false,}) async =>
// ignore: deprecated_member_use_from_same_package
deserialize(json, targetType, growable: growable);
@Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use deserializeAsync() instead.')
- dynamic deserialize(String json, String targetType, {bool growable}) {
+ dynamic deserialize(String json, String targetType, {bool growable = false,}) {
// Remove all spaces. Necessary for regular expressions as well.
targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments
// If the expected target type is String, nothing to do...
return targetType == 'String'
? json
- : _deserialize(jsonDecode(json), targetType, growable: growable == true);
+ : _deserialize(jsonDecode(json), targetType, growable: growable);
}
// ignore: deprecated_member_use_from_same_package
- Future serializeAsync(Object value) async => serialize(value);
+ Future serializeAsync(Object? value) async => serialize(value);
@Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.')
- String serialize(Object value) => value == null ? '' : json.encode(value);
+ String serialize(Object? value) => value == null ? '' : json.encode(value);
/// Update query and header parameters based on authentication settings.
/// @param authNames The authentications to apply
@@ -179,7 +195,7 @@ class ApiClient {
}
}
- static dynamic _deserialize(dynamic value, String targetType, {bool growable}) {
+ static dynamic _deserialize(dynamic value, String targetType, {bool growable = false}) {
try {
switch (targetType) {
case 'String':
@@ -207,24 +223,21 @@ class ApiClient {
case 'User':
return User.fromJson(value);
default:
- Match match;
- if (value is List && (match = _regList.firstMatch(targetType)) != null) {
- targetType = match[1]; // ignore: parameter_assignments
+ dynamic match;
+ if (value is List && (match = _regList.firstMatch(targetType)?.group(1)) != null) {
return value
- .map((dynamic v) => _deserialize(v, targetType, growable: growable))
+ .map((dynamic v) => _deserialize(v, match, growable: growable,))
.toList(growable: growable);
}
- if (value is Set && (match = _regSet.firstMatch(targetType)) != null) {
- targetType = match[1]; // ignore: parameter_assignments
+ if (value is Set && (match = _regSet.firstMatch(targetType)?.group(1)) != null) {
return value
- .map((dynamic v) => _deserialize(v, targetType, growable: growable))
+ .map((dynamic v) => _deserialize(v, match, growable: growable,))
.toSet();
}
- if (value is Map && (match = _regMap.firstMatch(targetType)) != null) {
- targetType = match[1]; // ignore: parameter_assignments
+ if (value is Map && (match = _regMap.firstMatch(targetType)?.group(1)) != null) {
return Map.fromIterables(
value.keys.cast(),
- value.values.map((dynamic v) => _deserialize(v, targetType, growable: growable)),
+ value.values.map((dynamic v) => _deserialize(v, match, growable: growable,)),
);
}
}
@@ -238,9 +251,9 @@ class ApiClient {
/// Primarily intended for use in an isolate.
class DeserializationMessage {
const DeserializationMessage({
- @required this.json,
- @required this.targetType,
- this.growable,
+ required this.json,
+ required this.targetType,
+ this.growable = false,
});
/// The JSON value to deserialize.
@@ -264,9 +277,9 @@ Future deserializeAsync(DeserializationMessage message) async {
: ApiClient._deserialize(
jsonDecode(message.json),
targetType,
- growable: message.growable == true,
+ growable: message.growable,
);
}
/// Primarily intended for use in an isolate.
-Future serializeAsync(Object value) async => value == null ? '' : json.encode(value);
+Future serializeAsync(Object? value) async => value == null ? '' : json.encode(value);
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_exception.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_exception.dart
index 8ffc340b4c9..796f7f7ee74 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_exception.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_exception.dart
@@ -1,7 +1,7 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
-// @dart=2.0
+// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
@@ -16,9 +16,9 @@ class ApiException implements Exception {
ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace);
int code = 0;
- String message;
- Exception innerException;
- StackTrace stackTrace;
+ String? message;
+ Exception? innerException;
+ StackTrace? stackTrace;
@override
String toString() {
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart
index cf97058bec2..d6adb179825 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api_helper.dart
@@ -1,7 +1,7 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
-// @dart=2.0
+// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
@@ -21,32 +21,27 @@ class QueryParam {
}
// Ported from the Java version.
-Iterable _convertParametersForCollectionFormat(
- String collectionFormat,
- String name,
- dynamic value,
-) {
+Iterable _queryParams(String collectionFormat, String name, dynamic value,) {
+ // Assertions to run in debug mode only.
+ assert(name.isNotEmpty, 'Parameter cannot be an empty string.');
+
final params = [];
- // preconditions
- if (name != null && name.isNotEmpty && value != null) {
- if (value is List) {
- if (collectionFormat == 'multi') {
- return value.map((dynamic v) => QueryParam(name, parameterToString(v)),);
- }
-
- // Default collection format is 'csv'.
- if (collectionFormat == null || collectionFormat.isEmpty) {
- // ignore: parameter_assignments
- collectionFormat = 'csv';
- }
-
- final delimiter = _delimiters[collectionFormat] ?? ',';
-
- params.add(QueryParam(name, value.map(parameterToString).join(delimiter)),);
- } else {
- params.add(QueryParam(name, parameterToString(value),));
+ if (value is List) {
+ if (collectionFormat == 'multi') {
+ return value.map((dynamic v) => QueryParam(name, parameterToString(v)),);
}
+
+ // Default collection format is 'csv'.
+ if (collectionFormat.isEmpty) {
+ collectionFormat = 'csv'; // ignore: parameter_assignments
+ }
+
+ final delimiter = _delimiters[collectionFormat] ?? ',';
+
+ params.add(QueryParam(name, value.map(parameterToString).join(delimiter),));
+ } else if (value != null) {
+ params.add(QueryParam(name, parameterToString(value)));
}
return params;
@@ -68,27 +63,27 @@ String parameterToString(dynamic value) {
Future _decodeBodyBytes(Response response) async {
final contentType = response.headers['content-type'];
return contentType != null && contentType.toLowerCase().startsWith('application/json')
- ? response.bodyBytes == null ? null : utf8.decode(response.bodyBytes)
+ ? response.bodyBytes.isEmpty ? '' : utf8.decode(response.bodyBytes)
: response.body;
}
/// Returns a valid [T] value found at the specified Map [key], null otherwise.
-T mapValueOfType(dynamic map, String key) {
+T? mapValueOfType(dynamic map, String key) {
final dynamic value = map is Map ? map[key] : null;
return value is T ? value : null;
}
/// Returns a valid Map found at the specified Map [key], null otherwise.
-Map mapCastOfType(dynamic map, String key) {
+Map? mapCastOfType(dynamic map, String key) {
final dynamic value = map is Map ? map[key] : null;
return value is Map ? value.cast() : null;
}
/// Returns a valid [DateTime] found at the specified Map [key], null otherwise.
-DateTime mapDateTime(dynamic map, String key, [String pattern]) {
+DateTime? mapDateTime(dynamic map, String key, [String? pattern]) {
final dynamic value = map is Map ? map[key] : null;
if (value != null) {
- int millis;
+ int? millis;
if (value is int) {
millis = value;
} else if (value is String) {
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart
index 0c2303af09e..e304eda321e 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/api_key_auth.dart
@@ -1,7 +1,7 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
-// @dart=2.0
+// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
@@ -16,23 +16,25 @@ class ApiKeyAuth implements Authentication {
final String location;
final String paramName;
- String apiKeyPrefix;
- String apiKey;
+ String apiKeyPrefix = '';
+ String apiKey = '';
@override
void applyToParams(List queryParams, Map headerParams) {
- final value = apiKeyPrefix == null ? apiKey : '$apiKeyPrefix $apiKey';
+ final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey';
- if (location == 'query' && value != null) {
- queryParams.add(QueryParam(paramName, value));
- } else if (location == 'header' && value != null) {
- headerParams[paramName] = value;
- } else if (location == 'cookie' && value != null) {
- headerParams.update(
- 'Cookie',
- (existingCookie) => '$existingCookie; $paramName=$value',
- ifAbsent: () => '$paramName=$value',
- );
+ if (paramValue.isNotEmpty) {
+ if (location == 'query') {
+ queryParams.add(QueryParam(paramName, paramValue));
+ } else if (location == 'header') {
+ headerParams[paramName] = paramValue;
+ } else if (location == 'cookie') {
+ headerParams.update(
+ 'Cookie',
+ (existingCookie) => '$existingCookie; $paramName=$paramValue',
+ ifAbsent: () => '$paramName=$paramValue',
+ );
+ }
}
}
}
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart
index 4257e190006..49baf7c46a9 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/authentication.dart
@@ -1,7 +1,7 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
-// @dart=2.0
+// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart
index 0494f402d95..81abd7185f2 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_basic_auth.dart
@@ -1,7 +1,7 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
-// @dart=2.0
+// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
@@ -11,12 +11,16 @@
part of openapi.api;
class HttpBasicAuth implements Authentication {
+ HttpBasicAuth({this.username = '', this.password = ''});
+
String username;
String password;
@override
void applyToParams(List queryParams, Map headerParams) {
- final credentials = '${username ?? ''}:${password ?? ''}';
- headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}';
+ if (username.isNotEmpty && password.isNotEmpty) {
+ final credentials = '$username:$password';
+ headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}';
+ }
}
}
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart
index 23e243523dd..213f3483b8f 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/http_bearer_auth.dart
@@ -1,7 +1,7 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
-// @dart=2.0
+// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
@@ -21,19 +21,29 @@ class HttpBearerAuth implements Authentication {
set accessToken(dynamic accessToken) {
if (accessToken is! String && accessToken is! HttpBearerAuthProvider) {
- throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().');
+ throw ArgumentError('accessToken value must be either a String or a String Function().');
}
_accessToken = accessToken;
}
@override
void applyToParams(List queryParams, Map headerParams) {
+ if (_accessToken == null) {
+ return;
+ }
+
+ String accessToken;
+
if (_accessToken is String) {
- headerParams['Authorization'] = 'Bearer $_accessToken';
+ accessToken = _accessToken;
} else if (_accessToken is HttpBearerAuthProvider) {
- headerParams['Authorization'] = 'Bearer ${_accessToken()}';
+ accessToken = _accessToken!();
} else {
- throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().');
+ return;
+ }
+
+ if (accessToken.isNotEmpty) {
+ headerParams['Authorization'] = 'Bearer $accessToken';
}
}
}
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart
index 9299ac13f5b..e9b87cffb05 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/auth/oauth.dart
@@ -1,7 +1,7 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
-// @dart=2.0
+// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
@@ -11,13 +11,13 @@
part of openapi.api;
class OAuth implements Authentication {
- OAuth({this.accessToken});
+ OAuth({this.accessToken = ''});
String accessToken;
@override
void applyToParams(List queryParams, Map headerParams) {
- if (accessToken != null) {
+ if (accessToken.isNotEmpty) {
headerParams['Authorization'] = 'Bearer $accessToken';
}
}
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart
index bfd43366211..6042baea551 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/api_response.dart
@@ -1,7 +1,7 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
-// @dart=2.0
+// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
@@ -18,11 +18,29 @@ class ApiResponse {
this.message,
});
- int code;
+ ///
+ /// Please note: This property should have been non-nullable! Since the specification file
+ /// does not include a default value (using the "default:" property), however, the generated
+ /// source code must fall back to having a nullable type.
+ /// Consider adding a "default:" property in the specification file to hide this note.
+ ///
+ int? code;
- String type;
+ ///
+ /// Please note: This property should have been non-nullable! Since the specification file
+ /// does not include a default value (using the "default:" property), however, the generated
+ /// source code must fall back to having a nullable type.
+ /// Consider adding a "default:" property in the specification file to hide this note.
+ ///
+ String? type;
- String message;
+ ///
+ /// Please note: This property should have been non-nullable! Since the specification file
+ /// does not include a default value (using the "default:" property), however, the generated
+ /// source code must fall back to having a nullable type.
+ /// Consider adding a "default:" property in the specification file to hide this note.
+ ///
+ String? message;
@override
bool operator ==(Object other) => identical(this, other) || other is ApiResponse &&
@@ -32,10 +50,10 @@ class ApiResponse {
@override
int get hashCode =>
- // ignore: unnecessary_parenthesis
- (code == null ? 0 : code.hashCode) +
- (type == null ? 0 : type.hashCode) +
- (message == null ? 0 : message.hashCode);
+ // ignore: unnecessary_parenthesis
+ (code == null ? 0 : code!.hashCode) +
+ (type == null ? 0 : type!.hashCode) +
+ (message == null ? 0 : message!.hashCode);
@override
String toString() => 'ApiResponse[code=$code, type=$type, message=$message]';
@@ -57,9 +75,21 @@ class ApiResponse {
/// Returns a new [ApiResponse] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
- static ApiResponse fromJson(dynamic value) {
+ static ApiResponse? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast();
+
+ // Ensure that the map contains the required keys.
+ // Note 1: the values aren't checked for validity beyond being non-null.
+ // Note 2: this code is stripped in release mode!
+ assert(() {
+ requiredKeys.forEach((key) {
+ assert(json.containsKey(key), 'Required key "ApiResponse[$key]" is missing from JSON.');
+ assert(json[key] != null, 'Required key "ApiResponse[$key]" has a null value in JSON.');
+ });
+ return true;
+ }());
+
return ApiResponse(
code: mapValueOfType(json, r'code'),
type: mapValueOfType(json, r'type'),
@@ -69,36 +99,50 @@ class ApiResponse {
return null;
}
- static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
- json is List && json.isNotEmpty
- ? json.map(ApiResponse.fromJson).toList(growable: true == growable)
- : true == emptyIsNull ? null : [];
+ static List? listFromJson(dynamic json, {bool growable = false,}) {
+ final result = [];
+ if (json is List && json.isNotEmpty) {
+ for (final row in json) {
+ final value = ApiResponse.fromJson(row);
+ if (value != null) {
+ result.add(value);
+ }
+ }
+ }
+ return result.toList(growable: growable);
+ }
static Map mapFromJson(dynamic json) {
final map = {};
if (json is Map && json.isNotEmpty) {
- json
- .cast()
- .forEach((key, dynamic value) => map[key] = ApiResponse.fromJson(value));
+ json = json.cast(); // ignore: parameter_assignments
+ for (final entry in json.entries) {
+ final value = ApiResponse.fromJson(entry.value);
+ if (value != null) {
+ map[entry.key] = value;
+ }
+ }
}
return map;
}
// maps a json object with a list of ApiResponse-objects as value to a dart map
- static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
+ static Map> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = >{};
if (json is Map && json.isNotEmpty) {
- json
- .cast()
- .forEach((key, dynamic value) {
- map[key] = ApiResponse.listFromJson(
- value,
- emptyIsNull: emptyIsNull,
- growable: growable,
- );
- });
+ json = json.cast(); // ignore: parameter_assignments
+ for (final entry in json.entries) {
+ final value = ApiResponse.listFromJson(entry.value, growable: growable,);
+ if (value != null) {
+ map[entry.key] = value;
+ }
+ }
}
return map;
}
+
+ /// The list of required keys that must be present in a JSON.
+ static const requiredKeys = {
+ };
}
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart
index 50ad28ee006..f4a572dffc7 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/category.dart
@@ -1,7 +1,7 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
-// @dart=2.0
+// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
@@ -17,9 +17,21 @@ class Category {
this.name,
});
- int id;
+ ///
+ /// Please note: This property should have been non-nullable! Since the specification file
+ /// does not include a default value (using the "default:" property), however, the generated
+ /// source code must fall back to having a nullable type.
+ /// Consider adding a "default:" property in the specification file to hide this note.
+ ///
+ int? id;
- String name;
+ ///
+ /// Please note: This property should have been non-nullable! Since the specification file
+ /// does not include a default value (using the "default:" property), however, the generated
+ /// source code must fall back to having a nullable type.
+ /// Consider adding a "default:" property in the specification file to hide this note.
+ ///
+ String? name;
@override
bool operator ==(Object other) => identical(this, other) || other is Category &&
@@ -28,9 +40,9 @@ class Category {
@override
int get hashCode =>
- // ignore: unnecessary_parenthesis
- (id == null ? 0 : id.hashCode) +
- (name == null ? 0 : name.hashCode);
+ // ignore: unnecessary_parenthesis
+ (id == null ? 0 : id!.hashCode) +
+ (name == null ? 0 : name!.hashCode);
@override
String toString() => 'Category[id=$id, name=$name]';
@@ -49,9 +61,21 @@ class Category {
/// Returns a new [Category] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
- static Category fromJson(dynamic value) {
+ static Category? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast();
+
+ // Ensure that the map contains the required keys.
+ // Note 1: the values aren't checked for validity beyond being non-null.
+ // Note 2: this code is stripped in release mode!
+ assert(() {
+ requiredKeys.forEach((key) {
+ assert(json.containsKey(key), 'Required key "Category[$key]" is missing from JSON.');
+ assert(json[key] != null, 'Required key "Category[$key]" has a null value in JSON.');
+ });
+ return true;
+ }());
+
return Category(
id: mapValueOfType(json, r'id'),
name: mapValueOfType(json, r'name'),
@@ -60,36 +84,50 @@ class Category {
return null;
}
- static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
- json is List && json.isNotEmpty
- ? json.map(Category.fromJson).toList(growable: true == growable)
- : true == emptyIsNull ? null : [];
+ static List? listFromJson(dynamic json, {bool growable = false,}) {
+ final result = [];
+ if (json is List && json.isNotEmpty) {
+ for (final row in json) {
+ final value = Category.fromJson(row);
+ if (value != null) {
+ result.add(value);
+ }
+ }
+ }
+ return result.toList(growable: growable);
+ }
static Map mapFromJson(dynamic json) {
final map = {};
if (json is Map && json.isNotEmpty) {
- json
- .cast()
- .forEach((key, dynamic value) => map[key] = Category.fromJson(value));
+ json = json.cast(); // ignore: parameter_assignments
+ for (final entry in json.entries) {
+ final value = Category.fromJson(entry.value);
+ if (value != null) {
+ map[entry.key] = value;
+ }
+ }
}
return map;
}
// maps a json object with a list of Category-objects as value to a dart map
- static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
+ static Map> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = >{};
if (json is Map && json.isNotEmpty) {
- json
- .cast()
- .forEach((key, dynamic value) {
- map[key] = Category.listFromJson(
- value,
- emptyIsNull: emptyIsNull,
- growable: growable,
- );
- });
+ json = json.cast(); // ignore: parameter_assignments
+ for (final entry in json.entries) {
+ final value = Category.listFromJson(entry.value, growable: growable,);
+ if (value != null) {
+ map[entry.key] = value;
+ }
+ }
}
return map;
}
+
+ /// The list of required keys that must be present in a JSON.
+ static const requiredKeys = {
+ };
}
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart
index 61d01acfaaa..ad84a894e8d 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/model/order.dart
@@ -1,7 +1,7 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
-// @dart=2.0
+// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
@@ -21,16 +21,40 @@ class Order {
this.complete = false,
});
- int id;
+ ///
+ /// Please note: This property should have been non-nullable! Since the specification file
+ /// does not include a default value (using the "default:" property), however, the generated
+ /// source code must fall back to having a nullable type.
+ /// Consider adding a "default:" property in the specification file to hide this note.
+ ///
+ int? id;
- int petId;
+ ///
+ /// Please note: This property should have been non-nullable! Since the specification file
+ /// does not include a default value (using the "default:" property), however, the generated
+ /// source code must fall back to having a nullable type.
+ /// Consider adding a "default:" property in the specification file to hide this note.
+ ///
+ int? petId;
- int quantity;
+ ///
+ /// Please note: This property should have been non-nullable! Since the specification file
+ /// does not include a default value (using the "default:" property), however, the generated
+ /// source code must fall back to having a nullable type.
+ /// Consider adding a "default:" property in the specification file to hide this note.
+ ///
+ int? quantity;
- DateTime shipDate;
+ ///
+ /// Please note: This property should have been non-nullable! Since the specification file
+ /// does not include a default value (using the "default:" property), however, the generated
+ /// source code must fall back to having a nullable type.
+ /// Consider adding a "default:" property in the specification file to hide this note.
+ ///
+ DateTime? shipDate;
/// Order Status
- OrderStatusEnum status;
+ OrderStatusEnum? status;
bool complete;
@@ -45,13 +69,13 @@ class Order {
@override
int get hashCode =>
- // ignore: unnecessary_parenthesis
- (id == null ? 0 : id.hashCode) +
- (petId == null ? 0 : petId.hashCode) +
- (quantity == null ? 0 : quantity.hashCode) +
- (shipDate == null ? 0 : shipDate.hashCode) +
- (status == null ? 0 : status.hashCode) +
- (complete == null ? 0 : complete.hashCode);
+ // ignore: unnecessary_parenthesis
+ (id == null ? 0 : id!.hashCode) +
+ (petId == null ? 0 : petId!.hashCode) +
+ (quantity == null ? 0 : quantity!.hashCode) +
+ (shipDate == null ? 0 : shipDate!.hashCode) +
+ (status == null ? 0 : status!.hashCode) +
+ (complete.hashCode);
@override
String toString() => 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete]';
@@ -68,66 +92,90 @@ class Order {
json[r'quantity'] = quantity;
}
if (shipDate != null) {
- json[r'shipDate'] = shipDate.toUtc().toIso8601String();
+ json[r'shipDate'] = shipDate!.toUtc().toIso8601String();
}
if (status != null) {
json[r'status'] = status;
}
- if (complete != null) {
json[r'complete'] = complete;
- }
return json;
}
/// Returns a new [Order] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
- static Order fromJson(dynamic value) {
+ static Order? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast();
+
+ // Ensure that the map contains the required keys.
+ // Note 1: the values aren't checked for validity beyond being non-null.
+ // Note 2: this code is stripped in release mode!
+ assert(() {
+ requiredKeys.forEach((key) {
+ assert(json.containsKey(key), 'Required key "Order[$key]" is missing from JSON.');
+ assert(json[key] != null, 'Required key "Order[$key]" has a null value in JSON.');
+ });
+ return true;
+ }());
+
return Order(
id: mapValueOfType(json, r'id'),
petId: mapValueOfType(json, r'petId'),
quantity: mapValueOfType(json, r'quantity'),
shipDate: mapDateTime(json, r'shipDate', ''),
status: OrderStatusEnum.fromJson(json[r'status']),
- complete: mapValueOfType(json, r'complete'),
+ complete: mapValueOfType(json, r'complete') ?? false,
);
}
return null;
}
- static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
- json is List && json.isNotEmpty
- ? json.map(Order.fromJson).toList(growable: true == growable)
- : true == emptyIsNull ? null : [];
+ static List? listFromJson(dynamic json, {bool growable = false,}) {
+ final result = [];
+ if (json is List && json.isNotEmpty) {
+ for (final row in json) {
+ final value = Order.fromJson(row);
+ if (value != null) {
+ result.add(value);
+ }
+ }
+ }
+ return result.toList(growable: growable);
+ }
static Map mapFromJson(dynamic json) {
final map = {};
if (json is Map && json.isNotEmpty) {
- json
- .cast()
- .forEach((key, dynamic value) => map[key] = Order.fromJson(value));
+ json = json.cast(); // ignore: parameter_assignments
+ for (final entry in json.entries) {
+ final value = Order.fromJson(entry.value);
+ if (value != null) {
+ map[entry.key] = value;
+ }
+ }
}
return map;
}
// maps a json object with a list of Order-objects as value to a dart map
- static Map> mapListFromJson(dynamic json, {bool emptyIsNull, bool growable,}) {
+ static Map> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = >{};
if (json is Map && json.isNotEmpty) {
- json
- .cast()
- .forEach((key, dynamic value) {
- map[key] = Order.listFromJson(
- value,
- emptyIsNull: emptyIsNull,
- growable: growable,
- );
- });
+ json = json.cast(); // ignore: parameter_assignments
+ for (final entry in json.entries) {
+ final value = Order.listFromJson(entry.value, growable: growable,);
+ if (value != null) {
+ map[entry.key] = value;
+ }
+ }
}
return map;
}
+
+ /// The list of required keys that must be present in a JSON.
+ static const requiredKeys = {
+ };
}
/// Order Status
@@ -139,7 +187,7 @@ class OrderStatusEnum {
final String value;
@override
- String toString() => value ?? '';
+ String toString() => value;
String toJson() => value;
@@ -154,13 +202,20 @@ class OrderStatusEnum {
delivered,
];
- static OrderStatusEnum fromJson(dynamic value) =>
- OrderStatusEnumTypeTransformer().decode(value);
+ static OrderStatusEnum? fromJson(dynamic value) => OrderStatusEnumTypeTransformer().decode(value);
- static List listFromJson(dynamic json, {bool emptyIsNull, bool growable,}) =>
- json is List && json.isNotEmpty
- ? json.map(OrderStatusEnum.fromJson).toList(growable: true == growable)
- : true == emptyIsNull ? null : [];
+ static List? listFromJson(dynamic json, {bool growable = false,}) {
+ final result =