diff --git a/README.md b/README.md
index 5d2ef01e41d..228b189e017 100644
--- a/README.md
+++ b/README.md
@@ -628,6 +628,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
- [TUI InfoTec GmbH](http://www.tui-infotec.com/)
- [unblu inc.](https://www.unblu.com/)
- [Veamly](https://www.veamly.com/)
+- [Woleet](https://www.woleet.io/)
- [WSO2](https://wso2.com/)
- [Vouchery.io](https://vouchery.io)
- [Xero](https://www.xero.com/)
diff --git a/bin/asciidoc-documentation-petstore.sh b/bin/asciidoc-documentation-petstore.sh
index 2d3d4adb40a..2f1ae34f950 100755
--- a/bin/asciidoc-documentation-petstore.sh
+++ b/bin/asciidoc-documentation-petstore.sh
@@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
-ags="$@ generate -t modules/openapi-generator/src/main/resources/asciidoc-documentation --additional-properties=specDir=modules/openapi-generator/src/main/resources/asciidoc-documentation,snippetDir=. -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g asciidoc -o samples/documentation/asciidoc"
+ags="generate -t modules/openapi-generator/src/main/resources/asciidoc-documentation --additional-properties=specDir=modules/openapi-generator/src/main/resources/asciidoc-documentation,snippetDir=. -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g asciidoc -o samples/documentation/asciidoc $@"
java ${JAVA_OPTS} -jar ${executable} ${ags}
diff --git a/bin/kotlin-client-uppercase-enum.sh b/bin/kotlin-client-uppercase-enum.sh
new file mode 100755
index 00000000000..7f456fc3a06
--- /dev/null
+++ b/bin/kotlin-client-uppercase-enum.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+SCRIPT="$0"
+echo "# START SCRIPT: $SCRIPT"
+
+while [ -h "$SCRIPT" ] ; do
+ ls=$(ls -ld "$SCRIPT")
+ link=$(expr "$ls" : '.*-> \(.*\)$')
+ if expr "$link" : '/.*' > /dev/null; then
+ SCRIPT="$link"
+ else
+ SCRIPT=$(dirname "$SCRIPT")/"$link"
+ fi
+done
+
+if [ ! -d "${APP_DIR}" ]; then
+ APP_DIR=$(dirname "$SCRIPT")/..
+ APP_DIR=$(cd "${APP_DIR}"; pwd)
+fi
+
+executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
+
+if [ ! -f "$executable" ]
+then
+ mvn -B clean package
+fi
+
+# if you've executed sbt assembly previously it will use that instead.
+export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
+ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/3_0/issue-4062.yaml -g kotlin --artifact-id kotlin-uppercase-enum --additional-properties enumPropertyNaming=UPPERCASE -o samples/client/petstore/kotlin-uppercase-enum $@"
+
+java ${JAVA_OPTS} -jar ${executable} ${ags}
+
+#cp CI/samples.ci/client/petstore/kotlin-uppercase-enum/pom.xml samples/client/petstore/kotlin-uppercase-enum/pom.xml
diff --git a/bin/python-server-all.sh b/bin/python-server-all.sh
index 5a4f5c75489..5fe3176eed9 100755
--- a/bin/python-server-all.sh
+++ b/bin/python-server-all.sh
@@ -3,3 +3,4 @@
./bin/python-server-aiohttp-petstore.sh
./bin/python-server-flask-petstore.sh
./bin/python-server-flask-petstore-python2.sh
+./bin/python-server-blueplanet-petstore.sh
diff --git a/docs/generators/asciidoc.md b/docs/generators/asciidoc.md
index ed61ca4c77a..d69dbacdb76 100644
--- a/docs/generators/asciidoc.md
+++ b/docs/generators/asciidoc.md
@@ -20,5 +20,6 @@ sidebar_label: asciidoc
|groupId|groupId in generated pom.xml| |null|
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |null|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |null|
-|snippetDir|path with includable markup snippets (e.g. test output generated by restdoc, default: .| |.|
-|specDir|path with includable markup spec files (e.g. handwritten additional docs, default: .| |..|
+|snippetDir|path with includable markup snippets (e.g. test output generated by restdoc, default: .)| |.|
+|specDir|path with includable markup spec files (e.g. handwritten additional docs, default: ..)| |..|
+|headerAttributes|generation of asciidoc header meta data attributes (set to false to suppress, default: true)| |true|
diff --git a/docs/generators/dart-dio.md b/docs/generators/dart-dio.md
index adb9b30ad59..045175c038b 100644
--- a/docs/generators/dart-dio.md
+++ b/docs/generators/dart-dio.md
@@ -14,6 +14,9 @@ sidebar_label: dart-dio
|pubName|Name in generated pubspec| |null|
|pubVersion|Version in generated pubspec| |null|
|pubDescription|Description in generated pubspec| |null|
+|pubAuthor|Author name in generated pubspec| |null|
+|pubAuthorEmail|Email address of the author in generated pubspec| |null|
+|pubHomepage|Homepage in generated pubspec| |null|
|useEnumExtension|Allow the 'x-enum-values' extension for enums| |null|
|sourceFolder|Source folder for generated code| |null|
|supportDart2|Support Dart 2.x (Dart 1.x support has been deprecated)| |true|
diff --git a/docs/generators/dart-jaguar.md b/docs/generators/dart-jaguar.md
index 71eff87bf02..5a06755bf28 100644
--- a/docs/generators/dart-jaguar.md
+++ b/docs/generators/dart-jaguar.md
@@ -14,6 +14,9 @@ sidebar_label: dart-jaguar
|pubName|Name in generated pubspec| |null|
|pubVersion|Version in generated pubspec| |null|
|pubDescription|Description in generated pubspec| |null|
+|pubAuthor|Author name in generated pubspec| |null|
+|pubAuthorEmail|Email address of the author in generated pubspec| |null|
+|pubHomepage|Homepage in generated pubspec| |null|
|useEnumExtension|Allow the 'x-enum-values' extension for enums| |null|
|sourceFolder|Source folder for generated code| |null|
|supportDart2|Support Dart 2.x (Dart 1.x support has been deprecated)| |true|
diff --git a/docs/generators/dart.md b/docs/generators/dart.md
index 365b2fc35a6..12c6550b1c2 100644
--- a/docs/generators/dart.md
+++ b/docs/generators/dart.md
@@ -14,6 +14,9 @@ sidebar_label: dart
|pubName|Name in generated pubspec| |null|
|pubVersion|Version in generated pubspec| |null|
|pubDescription|Description in generated pubspec| |null|
+|pubAuthor|Author name in generated pubspec| |null|
+|pubAuthorEmail|Email address of the author in generated pubspec| |null|
+|pubHomepage|Homepage in generated pubspec| |null|
|useEnumExtension|Allow the 'x-enum-values' extension for enums| |null|
|sourceFolder|Source folder for generated code| |null|
|supportDart2|Support Dart 2.x (Dart 1.x support has been deprecated)| |true|
diff --git a/docs/generators/go-experimental.md b/docs/generators/go-experimental.md
index 432b4d8dd53..00cec6310b4 100644
--- a/docs/generators/go-experimental.md
+++ b/docs/generators/go-experimental.md
@@ -13,4 +13,5 @@ sidebar_label: go-experimental
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
|enumClassPrefix|Prefix enum with class name| |false|
|structPrefix|whether to prefix struct with the class name. e.g. DeletePetOpts => PetApiDeletePetOpts| |false|
+|withAWSV4Signature|whether to include AWS v4 signature support| |false|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/go.md b/docs/generators/go.md
index 5e1560050c0..0801d2108f9 100644
--- a/docs/generators/go.md
+++ b/docs/generators/go.md
@@ -13,4 +13,5 @@ sidebar_label: go
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
|enumClassPrefix|Prefix enum with class name| |false|
|structPrefix|whether to prefix struct with the class name. e.g. DeletePetOpts => PetApiDeletePetOpts| |false|
+|withAWSV4Signature|whether to include AWS v4 signature support| |false|
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
diff --git a/docs/generators/mysql-schema.md b/docs/generators/mysql-schema.md
index 63a48d23da0..6b48a721cb4 100644
--- a/docs/generators/mysql-schema.md
+++ b/docs/generators/mysql-schema.md
@@ -7,3 +7,4 @@ sidebar_label: mysql-schema
| ------ | ----------- | ------ | ------- |
|defaultDatabaseName|Default database name for all MySQL queries| ||
|jsonDataTypeEnabled|Use special JSON MySQL data type for complex model properties. Requires MySQL version 5.7.8. Generates TEXT data type when disabled| |true|
+|identifierNamingConvention|Naming convention of MySQL identifiers(table names and column names). This is not related to database name which is defined by defaultDatabaseName option|
**original** Do not transform original names **snake_case** Use snake_case names |original|
diff --git a/docs/generators/python-aiohttp.md b/docs/generators/python-aiohttp.md
index 16a4fc8056f..a116fc6e96b 100644
--- a/docs/generators/python-aiohttp.md
+++ b/docs/generators/python-aiohttp.md
@@ -16,3 +16,4 @@ sidebar_label: python-aiohttp
|defaultController|default controller| |default_controller|
|supportPython2|support python2| |false|
|serverPort|TCP port to listen to in app.run| |8080|
+|useNose|use the nose test framework| |false|
diff --git a/docs/generators/python-blueplanet.md b/docs/generators/python-blueplanet.md
index 21891902860..7114953628d 100644
--- a/docs/generators/python-blueplanet.md
+++ b/docs/generators/python-blueplanet.md
@@ -16,3 +16,4 @@ sidebar_label: python-blueplanet
|defaultController|default controller| |default_controller|
|supportPython2|support python2| |false|
|serverPort|TCP port to listen to in app.run| |8080|
+|useNose|use the nose test framework| |false|
diff --git a/docs/generators/python-experimental.md b/docs/generators/python-experimental.md
index 65aaee19857..8ba2d699ed5 100644
--- a/docs/generators/python-experimental.md
+++ b/docs/generators/python-experimental.md
@@ -12,4 +12,5 @@ sidebar_label: python-experimental
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false|
+|useNose|use the nose test framework| |false|
|library|library template (sub-template) to use: asyncio, tornado, urllib3| |urllib3|
diff --git a/docs/generators/python-flask.md b/docs/generators/python-flask.md
index 05f6e46a1c6..1b68530a868 100644
--- a/docs/generators/python-flask.md
+++ b/docs/generators/python-flask.md
@@ -16,3 +16,4 @@ sidebar_label: python-flask
|defaultController|default controller| |default_controller|
|supportPython2|support python2| |false|
|serverPort|TCP port to listen to in app.run| |8080|
+|useNose|use the nose test framework| |false|
diff --git a/docs/generators/python.md b/docs/generators/python.md
index 023e92b6671..ee581848b02 100644
--- a/docs/generators/python.md
+++ b/docs/generators/python.md
@@ -12,4 +12,5 @@ sidebar_label: python
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false|
+|useNose|use the nose test framework| |false|
|library|library template (sub-template) to use: asyncio, tornado, urllib3| |urllib3|
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java
index c0fa1f667e2..1c79ee3b1de 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java
@@ -69,6 +69,9 @@ public class CodegenConstants {
public static final String WITH_GO_CODEGEN_COMMENT = "withGoCodegenComment";
public static final String WITH_GO_CODEGEN_COMMENT_DESC = "whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in PRs and diffs";
+ public static final String WITH_AWSV4_SIGNATURE_COMMENT = "withAWSV4Signature";
+ public static final String WITH_AWSV4_SIGNATURE_COMMENT_DESC = "whether to include AWS v4 signature support";
+
public static final String IS_GO_SUBMODULE = "isGoSubmodule";
public static final String IS_GO_SUBMODULE_DESC = "whether the generated Go module is a submodule";
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java
index a7b1dfdcb73..df595d68f08 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java
@@ -1876,7 +1876,7 @@ public class DefaultCodegen implements CodegenConfig {
// parent model
final String parentName = ModelUtils.getParentName(composed, allDefinitions);
- final List allParents = ModelUtils.getAllParentsName(composed, allDefinitions);
+ final List allParents = ModelUtils.getAllParentsName(composed, allDefinitions, false);
final Schema parent = StringUtils.isBlank(parentName) || allDefinitions == null ? null : allDefinitions.get(parentName);
// TODO revise the logic below to set dicriminator, xml attributes
@@ -2083,10 +2083,8 @@ public class DefaultCodegen implements CodegenConfig {
Map allDefinitions = ModelUtils.getSchemas(this.openAPI);
allDefinitions.forEach((childName, child) -> {
if (child instanceof ComposedSchema && ((ComposedSchema) child).getAllOf() != null) {
- Set parentSchemas = ((ComposedSchema) child).getAllOf().stream()
- .filter(s -> s.get$ref() != null)
- .map(s -> ModelUtils.getSimpleRef(s.get$ref()))
- .collect(Collectors.toSet());
+
+ final List parentSchemas = ModelUtils.getAllParentsName((ComposedSchema) child, allDefinitions, true);
if (parentSchemas.contains(schemaName)) {
discriminator.getMappedModels().add(new MappedModel(childName, toModelName(childName)));
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java
index 05e732b23f9..50f2db60053 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java
@@ -26,6 +26,7 @@ import io.swagger.v3.oas.models.responses.ApiResponse;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.servers.Server;
+import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger;
@@ -163,7 +164,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
addOption(CodegenConstants.PROJECT_NAME, "GNAT project name",
this.projectName);
- modelNameSuffix = "_Type";
+ modelNameSuffix = "Type";
embeddedTemplateDir = templateDir = "Ada";
languageSpecificPrimitives = new HashSet(
@@ -242,11 +243,37 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
* @return capitalized model name
*/
public String toModelName(final String name) {
- String result = super.toModelName(name);
- if (result.matches("^\\d.*") || result.startsWith("_")) {
- result = "Model_" + result;
+ String result = camelize(sanitizeName(name));
+
+ if (!StringUtils.isEmpty(modelNamePrefix)) {
+ result = modelNamePrefix + "_" + result;
}
- return result.replaceAll("[\\.-]", "_").replaceAll("__+", "_");
+
+ // model name cannot use reserved keyword, e.g. return
+ if (isReservedWord(name)) {
+ String modelName = "Model_" + result;
+ LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + modelName);
+ return modelName;
+ }
+
+ // model name starts with number
+ if (result.matches("^\\d.*")) {
+ String modelName = "Model_" + result; // e.g. 200Response => Model_200Response (after camelize)
+ LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName);
+ return modelName;
+ }
+
+ if (languageSpecificPrimitives.contains(result)) {
+ String modelName = "Model_" + result;
+ LOGGER.warn(name + " (model name matches existing language type) cannot be used as a model name. Renamed to " + modelName);
+ return modelName;
+ }
+
+ if (!StringUtils.isEmpty(modelNameSuffix)) {
+ result = result + "_" + modelNameSuffix;
+ }
+
+ return result;
}
@Override
@@ -517,7 +544,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
if (v instanceof CodegenModel) {
CodegenModel m = (CodegenModel) v;
List d = new ArrayList();
- for (CodegenProperty p : m.allVars) {
+ for (CodegenProperty p : m.vars) {
boolean isModel = false;
CodegenProperty item = p;
if (p.isContainer) {
@@ -531,9 +558,10 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg
isModel = true;
}
p.vendorExtensions.put("x-is-model-type", isModel);
+ Boolean required = p.getRequired();
// Convert optional members to use the Nullable_ type.
- if (!p.required && nullableTypeMapping.containsKey(p.dataType)) {
+ if (!Boolean.TRUE.equals(required) && nullableTypeMapping.containsKey(p.dataType)) {
p.dataType = nullableTypeMapping.get(p.dataType);
}
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java
index 49cf187a13a..4b95e1038d4 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java
@@ -477,7 +477,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co
// Because the child models extend the parents, the enums will be available via the parent.
// Only bother with reconciliation if the parent model has enums.
- if (!parentCodegenModel.hasEnums) {
+ if (parentCodegenModel == null || !parentCodegenModel.hasEnums) {
return codegenModel;
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java
index 14d5f51808c..6950cfa4e05 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java
@@ -38,6 +38,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
private static final String NUMERIC_ENUM_PREFIX = "_";
protected boolean withGoCodegenComment = false;
+ protected boolean withAWSV4Signature = false;
protected boolean withXml = false;
protected boolean enumClassPrefix = false;
protected boolean structPrefix = false;
@@ -633,6 +634,10 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege
this.withGoCodegenComment = withGoCodegenComment;
}
+ public void setWithAWSV4Signature(boolean withAWSV4Signature) {
+ this.withAWSV4Signature = withAWSV4Signature;
+ }
+
public void setWithXml(boolean withXml) {
this.withXml = withXml;
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java
index ed895fd5ac1..b0227feae16 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java
@@ -93,58 +93,24 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
// this includes hard reserved words defined by https://github.com/JetBrains/kotlin/blob/master/core/descriptors/src/org/jetbrains/kotlin/renderer/KeywordStringsGenerated.java
// as well as keywords from https://kotlinlang.org/docs/reference/keyword-reference.html
reservedWords = new HashSet(Arrays.asList(
- "abstract",
- "annotation",
"as",
"break",
- "case",
- "catch",
"class",
- "companion",
- "const",
- "constructor",
"continue",
- "crossinline",
- "data",
- "delegate",
"do",
"else",
- "enum",
- "external",
"false",
- "final",
- "finally",
"for",
"fun",
"if",
"in",
- "infix",
- "init",
- "inline",
- "inner",
"interface",
- "internal",
"is",
- "it",
- "lateinit",
- "lazy",
- "noinline",
"null",
"object",
- "open",
- "operator",
- "out",
- "override",
"package",
- "private",
- "protected",
- "public",
- "reified",
"return",
- "sealed",
"super",
- "suspend",
- "tailrec",
"this",
"throw",
"true",
@@ -153,7 +119,6 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
"typeof",
"val",
"var",
- "vararg",
"when",
"while"
));
@@ -565,7 +530,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
modified = underscore(modified);
break;
case UPPERCASE:
- modified = modified.toUpperCase(Locale.ROOT);
+ modified = underscore(modified).toUpperCase(Locale.ROOT);
break;
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AsciidocDocumentationCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AsciidocDocumentationCodegen.java
index 23fa88fb05e..22c57710026 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AsciidocDocumentationCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AsciidocDocumentationCodegen.java
@@ -46,6 +46,7 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
public static final String SPEC_DIR = "specDir";
public static final String SNIPPET_DIR = "snippetDir";
+ public static final String HEADER_ATTRIBUTES_FLAG = "headerAttributes";
/**
* Lambda emitting an asciidoc "include::filename.adoc[]" if file is found in
@@ -140,6 +141,7 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
protected String groupId = "org.openapitools";
protected String artifactId = "openapi-client";
protected String artifactVersion = "1.0.0";
+ protected boolean headerAttributes = true;
private IncludeMarkupLambda includeSpecMarkupLambda;
private IncludeMarkupLambda includeSnippetMarkupLambda;
@@ -159,7 +161,7 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
static String sanitize(final String name) {
String sanitized = name == null ? "" : name.trim();
sanitized = sanitized.replace("//", "/"); // rest paths may or may not end with slashes, leading to redundant
- // path separators.
+ // path separators.
return sanitized.startsWith(File.separator) || sanitized.startsWith("/") ? sanitized.substring(1) : sanitized;
}
@@ -201,11 +203,14 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC));
cliOptions.add(new CliOption(SNIPPET_DIR,
- "path with includable markup snippets (e.g. test output generated by restdoc, default: .")
- .defaultValue("."));
+ "path with includable markup snippets (e.g. test output generated by restdoc, default: .)")
+ .defaultValue("."));
cliOptions.add(new CliOption(SPEC_DIR,
- "path with includable markup spec files (e.g. handwritten additional docs, default: .")
- .defaultValue(".."));
+ "path with includable markup spec files (e.g. handwritten additional docs, default: ..)")
+ .defaultValue(".."));
+ cliOptions.add(CliOption.newBoolean(HEADER_ATTRIBUTES_FLAG,
+ "generation of asciidoc header meta data attributes (set to false to suppress, default: true)",
+ true));
additionalProperties.put("appName", "OpenAPI Sample description");
additionalProperties.put("appDescription", "A sample OpenAPI documentation");
@@ -236,6 +241,14 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
return input; // just return the original string
}
+ public boolean isHeaderAttributes() {
+ return headerAttributes;
+ }
+
+ public void setHeaderAttributes(boolean headerAttributes) {
+ this.headerAttributes = headerAttributes;
+ }
+
@Override
public void processOpts() {
super.processOpts();
@@ -260,6 +273,13 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
this.linkSnippetMarkupLambda = new LinkMarkupLambda(snippetDir);
additionalProperties.put("snippetlink", this.linkSnippetMarkupLambda);
+
+
+ if (additionalProperties.containsKey(HEADER_ATTRIBUTES_FLAG)) {
+ this.setHeaderAttributes(convertPropertyToBooleanAndWriteBack(HEADER_ATTRIBUTES_FLAG));
+ } else {
+ additionalProperties.put(HEADER_ATTRIBUTES_FLAG, headerAttributes);
+ }
}
@Override
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java
index 3efe1b9a6b0..99232bc47bf 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java
@@ -572,7 +572,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
}
for (final CodegenProperty property : codegenModel.readWriteVars) {
- if (property.defaultValue == null && property.baseName.equals(parentCodegenModel.discriminator.getPropertyName())) {
+ if (property.defaultValue == null && parentCodegenModel.discriminator != null && property.baseName.equals(parentCodegenModel.discriminator.getPropertyName())) {
property.defaultValue = "\"" + name + "\"";
}
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java
index 34dd208b583..20013cdf8ef 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNetCoreClientCodegen.java
@@ -252,7 +252,7 @@ public class CSharpNetCoreClientCodegen extends AbstractCSharpCodegen {
}
for (final CodegenProperty property : codegenModel.readWriteVars) {
- if (property.defaultValue == null && property.baseName.equals(parentCodegenModel.discriminator.getPropertyName())) {
+ if (property.defaultValue == null && parentCodegenModel.discriminator != null && property.baseName.equals(parentCodegenModel.discriminator.getPropertyName())) {
property.defaultValue = "\"" + name + "\"";
}
}
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 8930d2d6b53..4f6d03b4cab 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
@@ -74,16 +74,22 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
public static final String PUB_NAME = "pubName";
public static final String PUB_VERSION = "pubVersion";
public static final String PUB_DESCRIPTION = "pubDescription";
+ public static final String PUB_AUTHOR = "pubAuthor";
+ public static final String PUB_AUTHOR_EMAIL = "pubAuthorEmail";
+ public static final String PUB_HOMEPAGE = "pubHomepage";
public static final String USE_ENUM_EXTENSION = "useEnumExtension";
public static final String SUPPORT_DART2 = "supportDart2";
protected boolean browserClient = true;
protected String pubName = "openapi";
protected String pubVersion = "1.0.0";
protected String pubDescription = "OpenAPI API client";
+ protected String pubAuthor = "Author";
+ protected String pubAuthorEmail = "author@homepage";
+ protected String pubHomepage = "homepage";
protected boolean useEnumExtension = false;
protected String sourceFolder = "";
- protected String apiDocPath = "docs" + File.separator;
- protected String modelDocPath = "docs" + File.separator;
+ protected String apiDocPath = "doc" + File.separator;
+ protected String modelDocPath = "doc" + File.separator;
protected String apiTestPath = "test" + File.separator;
protected String modelTestPath = "test" + File.separator;
@@ -108,7 +114,9 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
List reservedWordsList = new ArrayList();
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(DartClientCodegen.class.getResourceAsStream("/dart/dart-keywords.txt"), Charset.forName("UTF-8")));
- while(reader.ready()) { reservedWordsList.add(reader.readLine()); }
+ while (reader.ready()) {
+ reservedWordsList.add(reader.readLine());
+ }
reader.close();
} catch (Exception e) {
LOGGER.error("Error reading dart keywords. Exception: {}", e.getMessage());
@@ -153,6 +161,9 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
cliOptions.add(new CliOption(PUB_NAME, "Name in generated pubspec"));
cliOptions.add(new CliOption(PUB_VERSION, "Version in generated pubspec"));
cliOptions.add(new CliOption(PUB_DESCRIPTION, "Description in generated pubspec"));
+ cliOptions.add(new CliOption(PUB_AUTHOR, "Author name in generated pubspec"));
+ cliOptions.add(new CliOption(PUB_AUTHOR_EMAIL, "Email address of the author in generated pubspec"));
+ cliOptions.add(new CliOption(PUB_HOMEPAGE, "Homepage in generated pubspec"));
cliOptions.add(new CliOption(USE_ENUM_EXTENSION, "Allow the 'x-enum-values' extension for enums"));
cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, "Source folder for generated code"));
cliOptions.add(CliOption.newBoolean(SUPPORT_DART2, "Support Dart 2.x (Dart 1.x support has been deprecated)").defaultValue(Boolean.TRUE.toString()));
@@ -214,6 +225,27 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
additionalProperties.put(PUB_DESCRIPTION, pubDescription);
}
+ if (additionalProperties.containsKey(PUB_AUTHOR)) {
+ this.setPubAuthor((String) additionalProperties.get(PUB_AUTHOR));
+ } else {
+ //not set, use to be passed to template
+ additionalProperties.put(PUB_AUTHOR, pubAuthor);
+ }
+
+ if (additionalProperties.containsKey(PUB_AUTHOR_EMAIL)) {
+ this.setPubAuthorEmail((String) additionalProperties.get(PUB_AUTHOR_EMAIL));
+ } else {
+ //not set, use to be passed to template
+ additionalProperties.put(PUB_AUTHOR_EMAIL, pubAuthorEmail);
+ }
+
+ if (additionalProperties.containsKey(PUB_HOMEPAGE)) {
+ this.setPubHomepage((String) additionalProperties.get(PUB_HOMEPAGE));
+ } else {
+ //not set, use to be passed to template
+ additionalProperties.put(PUB_HOMEPAGE, pubHomepage);
+ }
+
if (additionalProperties.containsKey(USE_ENUM_EXTENSION)) {
this.setUseEnumExtension(convertPropertyToBooleanAndWriteBack(USE_ENUM_EXTENSION));
} else {
@@ -551,6 +583,18 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
this.pubDescription = pubDescription;
}
+ public void setPubAuthor(String pubAuthor) {
+ this.pubAuthor = pubAuthor;
+ }
+
+ public void setPubAuthorEmail(String pubAuthorEmail) {
+ this.pubAuthorEmail = pubAuthorEmail;
+ }
+
+ public void setPubHomepage(String pubHomepage) {
+ this.pubHomepage = pubHomepage;
+ }
+
public void setUseEnumExtension(boolean useEnumExtension) {
this.useEnumExtension = useEnumExtension;
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java
index 764a0ddac9e..f5e82b6c2b8 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java
@@ -17,6 +17,7 @@
package org.openapitools.codegen.languages;
import java.util.HashMap;
+
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.CodegenConstants;
@@ -121,8 +122,9 @@ public class DartDioClientCodegen extends DartClientCodegen {
return "Generates a Dart Dio client library.";
}
- @Override public void setBrowserClient(boolean browserClient) {
- super.browserClient = browserClient;
+ @Override
+ public void setBrowserClient(boolean browserClient) {
+ super.browserClient = browserClient;
}
@Override
@@ -285,37 +287,26 @@ public class DartDioClientCodegen extends DartClientCodegen {
property.isNullable = true;
}
- if (property.isListContainer) {
- //Updates any List properties on a model to a BuiltList. This happens in post processing rather
- //than type mapping as we only want this to apply to models, not every other class.
- if ("List".equals(property.baseType)) {
- property.setDatatype(
- property.dataType.replaceAll(property.baseType, "BuiltList"));
- property.setBaseType("BuiltList");
- model.imports.add("BuiltList");
- if ("Object".equals(property.items.baseType)) {
- property.setDatatype(
- property.dataType.replaceAll("Object", "JsonObject"));
- property.items.setDatatype("JsonObject");
- model.imports.add("JsonObject");
- }
- }
- }
- if (property.isMapContainer) {
- //Updates any List properties on a model to a BuiltList. This happens in post processing rather
- //than type mapping as we only want this to apply to models, not every other class.
- if ("Map".equals(property.baseType)) {
- property.setDatatype(property.dataType.replaceAll(property.baseType, "BuiltMap"));
- property.setBaseType("BuiltMap");
- model.imports.add("BuiltMap");
- if ("Object".equals(property.items.baseType)) {
- property.setDatatype(property.dataType.replaceAll("Object", "JsonObject"));
- property.items.setDatatype("JsonObject");
- model.imports.add("JsonObject");
- }
- }
- }
+ property.setDatatype(property.getDataType()
+ .replaceAll("\\bList\\b", "BuiltList")
+ .replaceAll("\\bMap\\b", "BuiltMap")
+ .replaceAll("\\bObject\\b", "JsonObject")
+ );
+ property.setBaseType(property.getBaseType()
+ .replaceAll("\\bList\\b", "BuiltList")
+ .replaceAll("\\bMap\\b", "BuiltMap")
+ .replaceAll("\\bObject\\b", "JsonObject")
+ );
+ if (property.dataType.contains("BuiltList")) {
+ model.imports.add("BuiltList");
+ }
+ if (property.dataType.contains("BuiltMap")) {
+ model.imports.add("BuiltMap");
+ }
+ if (property.dataType.contains("JsonObject")) {
+ model.imports.add("JsonObject");
+ }
}
@Override
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java
index 2176c6f1e00..9e5080cf1f2 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java
@@ -37,6 +37,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
public static final String WITH_GO_CODEGEN_COMMENT = "withGoCodegenComment";
public static final String WITH_XML = "withXml";
public static final String STRUCT_PREFIX = "structPrefix";
+ public static final String WITH_AWSV4_SIGNATURE = "withAWSV4Signature";
public GoClientCodegen() {
super();
@@ -58,6 +59,7 @@ public class GoClientCodegen extends AbstractGoCodegen {
cliOptions.add(CliOption.newBoolean(WITH_XML, "whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)"));
cliOptions.add(CliOption.newBoolean(CodegenConstants.ENUM_CLASS_PREFIX, CodegenConstants.ENUM_CLASS_PREFIX_DESC));
cliOptions.add(CliOption.newBoolean(STRUCT_PREFIX, "whether to prefix struct with the class name. e.g. DeletePetOpts => PetApiDeletePetOpts"));
+ cliOptions.add(CliOption.newBoolean(WITH_AWSV4_SIGNATURE, "whether to include AWS v4 signature support"));
// option to change the order of form/body parameter
cliOptions.add(CliOption.newBoolean(
@@ -109,6 +111,13 @@ public class GoClientCodegen extends AbstractGoCodegen {
}
}
+ if (additionalProperties.containsKey(WITH_AWSV4_SIGNATURE)) {
+ setWithAWSV4Signature(Boolean.parseBoolean(additionalProperties.get(WITH_AWSV4_SIGNATURE).toString()));
+ if (withAWSV4Signature) {
+ additionalProperties.put(WITH_AWSV4_SIGNATURE, "true");
+ }
+ }
+
if (additionalProperties.containsKey(WITH_XML)) {
setWithXml(Boolean.parseBoolean(additionalProperties.get(WITH_XML).toString()));
if (withXml) {
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/MysqlSchemaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/MysqlSchemaCodegen.java
index 3376c2359ce..788a981f75a 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/MysqlSchemaCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/MysqlSchemaCodegen.java
@@ -24,12 +24,15 @@ import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import static org.openapitools.codegen.utils.StringUtils.underscore;
+
public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig {
private static final Logger LOGGER = LoggerFactory.getLogger(MysqlSchemaCodegen.class);
public static final String CODEGEN_VENDOR_EXTENSION_KEY = "x-mysqlSchema";
public static final String DEFAULT_DATABASE_NAME = "defaultDatabaseName";
public static final String JSON_DATA_TYPE_ENABLED = "jsonDataTypeEnabled";
+ public static final String IDENTIFIER_NAMING_CONVENTION = "identifierNamingConvention";
public static final Integer ENUM_MAX_ELEMENTS = 65535;
public static final Integer IDENTIFIER_MAX_LENGTH = 64;
@@ -53,6 +56,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
protected String tableNamePrefix = "tbl_", tableNameSuffix = "";
protected String columnNamePrefix = "col_", columnNameSuffix = "";
protected Boolean jsonDataTypeEnabled = true;
+ protected String identifierNamingConvention = "original";
public MysqlSchemaCodegen() {
super();
@@ -158,6 +162,16 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
cliOptions.clear();
addOption(DEFAULT_DATABASE_NAME, "Default database name for all MySQL queries", defaultDatabaseName);
addSwitch(JSON_DATA_TYPE_ENABLED, "Use special JSON MySQL data type for complex model properties. Requires MySQL version 5.7.8. Generates TEXT data type when disabled", jsonDataTypeEnabled);
+
+ // we used to snake_case table/column names, let's add this option
+ CliOption identifierNamingOpt = new CliOption(IDENTIFIER_NAMING_CONVENTION,
+ "Naming convention of MySQL identifiers(table names and column names). This is not related to database name which is defined by " + DEFAULT_DATABASE_NAME + " option");
+
+ identifierNamingOpt.addEnum("original", "Do not transform original names")
+ .addEnum("snake_case", "Use snake_case names")
+ .setDefault("original");
+
+ cliOptions.add(identifierNamingOpt);
}
@Override
@@ -195,6 +209,10 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
additionalProperties.put(JSON_DATA_TYPE_ENABLED, getJsonDataTypeEnabled());
}
+ if (additionalProperties.containsKey(IDENTIFIER_NAMING_CONVENTION)) {
+ this.setIdentifierNamingConvention((String) additionalProperties.get(IDENTIFIER_NAMING_CONVENTION));
+ }
+
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
supportingFiles.add(new SupportingFile("mysql_schema.mustache", "", "mysql_schema.sql"));
}
@@ -208,11 +226,18 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
Map mo = (Map) _mo;
CodegenModel model = (CodegenModel) mo.get("model");
String modelName = model.getName();
+ String tableName = this.toTableName(modelName);
String modelDescription = model.getDescription();
Map modelVendorExtensions = model.getVendorExtensions();
Map mysqlSchema = new HashMap();
Map tableDefinition = new HashMap();
+ if (this.getIdentifierNamingConvention().equals("snake_case") && !modelName.equals(tableName)) {
+ // add original name in table comment
+ String commentExtra = "Original model name - " + modelName + ".";
+ modelDescription = (modelDescription == null || modelDescription.isEmpty()) ? commentExtra : modelDescription + ". " + commentExtra;
+ }
+
if (modelVendorExtensions.containsKey(CODEGEN_VENDOR_EXTENSION_KEY)) {
// user already specified schema values
LOGGER.info("Found vendor extension in '" + modelName + "' model, autogeneration skipped");
@@ -220,7 +245,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
} else {
modelVendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema);
mysqlSchema.put("tableDefinition", tableDefinition);
- tableDefinition.put("tblName", toTableName(modelName));
+ tableDefinition.put("tblName", tableName);
tableDefinition.put("tblComment", modelDescription);
}
}
@@ -271,6 +296,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
Map columnDefinition = new HashMap();
ArrayList columnDataTypeArguments = new ArrayList();
String baseName = property.getBaseName();
+ String colName = this.toColumnName(baseName);
String dataType = property.getDataType();
String dataFormat = property.getDataFormat();
String description = property.getDescription();
@@ -290,9 +316,15 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
return;
}
+ if (this.getIdentifierNamingConvention().equals("snake_case") && !baseName.equals(colName)) {
+ // add original name in column comment
+ String commentExtra = "Original param name - " + baseName + ".";
+ description = (description == null || description.isEmpty()) ? commentExtra : description + ". " + commentExtra;
+ }
+
vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema);
mysqlSchema.put("columnDefinition", columnDefinition);
- columnDefinition.put("colName", toColumnName(baseName));
+ columnDefinition.put("colName", colName);
if (Boolean.TRUE.equals(isEnum)) {
Map allowableValues = property.getAllowableValues();
@@ -352,6 +384,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
Map columnDefinition = new HashMap();
ArrayList columnDataTypeArguments = new ArrayList();
String baseName = property.getBaseName();
+ String colName = this.toColumnName(baseName);
String dataType = property.getDataType();
String dataFormat = property.getDataFormat();
String description = property.getDescription();
@@ -370,9 +403,15 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
return;
}
+ if (this.getIdentifierNamingConvention().equals("snake_case") && !baseName.equals(colName)) {
+ // add original name in column comment
+ String commentExtra = "Original param name - " + baseName + ".";
+ description = (description == null || description.isEmpty()) ? commentExtra : description + ". " + commentExtra;
+ }
+
vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema);
mysqlSchema.put("columnDefinition", columnDefinition);
- columnDefinition.put("colName", toColumnName(baseName));
+ columnDefinition.put("colName", colName);
if (Boolean.TRUE.equals(isEnum)) {
Map allowableValues = property.getAllowableValues();
@@ -431,6 +470,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
Map columnDefinition = new HashMap();
ArrayList columnDataTypeArguments = new ArrayList();
String baseName = property.getBaseName();
+ String colName = this.toColumnName(baseName);
String description = property.getDescription();
String defaultValue = property.getDefaultValue();
Boolean required = property.getRequired();
@@ -441,9 +481,15 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
return;
}
+ if (this.getIdentifierNamingConvention().equals("snake_case") && !baseName.equals(colName)) {
+ // add original name in column comment
+ String commentExtra = "Original param name - " + baseName + ".";
+ description = (description == null || description.isEmpty()) ? commentExtra : description + ". " + commentExtra;
+ }
+
vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema);
mysqlSchema.put("columnDefinition", columnDefinition);
- columnDefinition.put("colName", toColumnName(baseName));
+ columnDefinition.put("colName", colName);
columnDefinition.put("colDataType", "TINYINT");
columnDefinition.put("colDataTypeArguments", columnDataTypeArguments);
columnDataTypeArguments.add(toCodegenMysqlDataTypeArgument(1, false));
@@ -477,6 +523,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
Map columnDefinition = new HashMap();
ArrayList columnDataTypeArguments = new ArrayList();
String baseName = property.getBaseName();
+ String colName = this.toColumnName(baseName);
String dataType = property.getDataType();
String dataFormat = property.getDataFormat();
String description = property.getDescription();
@@ -492,9 +539,15 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
return;
}
+ if (this.getIdentifierNamingConvention().equals("snake_case") && !baseName.equals(colName)) {
+ // add original name in column comment
+ String commentExtra = "Original param name - " + baseName + ".";
+ description = (description == null || description.isEmpty()) ? commentExtra : description + ". " + commentExtra;
+ }
+
vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema);
mysqlSchema.put("columnDefinition", columnDefinition);
- columnDefinition.put("colName", toColumnName(baseName));
+ columnDefinition.put("colName", colName);
if (Boolean.TRUE.equals(isEnum)) {
Map allowableValues = property.getAllowableValues();
@@ -548,6 +601,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
Map mysqlSchema = new HashMap();
Map columnDefinition = new HashMap();
String baseName = property.getBaseName();
+ String colName = this.toColumnName(baseName);
String dataType = property.getDataType();
Boolean required = property.getRequired();
String description = property.getDescription();
@@ -559,9 +613,15 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
return;
}
+ if (this.getIdentifierNamingConvention().equals("snake_case") && !baseName.equals(colName)) {
+ // add original name in column comment
+ String commentExtra = "Original param name - " + baseName + ".";
+ description = (description == null || description.isEmpty()) ? commentExtra : description + ". " + commentExtra;
+ }
+
vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema);
mysqlSchema.put("columnDefinition", columnDefinition);
- columnDefinition.put("colName", toColumnName(baseName));
+ columnDefinition.put("colName", colName);
columnDefinition.put("colDataType", dataType);
if (Boolean.TRUE.equals(required)) {
@@ -592,6 +652,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
Map mysqlSchema = new HashMap();
Map columnDefinition = new HashMap();
String baseName = property.getBaseName();
+ String colName = this.toColumnName(baseName);
String dataType = property.getDataType();
Boolean required = property.getRequired();
String description = property.getDescription();
@@ -603,9 +664,15 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
return;
}
+ if (this.getIdentifierNamingConvention().equals("snake_case") && !baseName.equals(colName)) {
+ // add original name in column comment
+ String commentExtra = "Original param name - " + baseName + ".";
+ description = (description == null || description.isEmpty()) ? commentExtra : description + ". " + commentExtra;
+ }
+
vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema);
mysqlSchema.put("columnDefinition", columnDefinition);
- columnDefinition.put("colName", toColumnName(baseName));
+ columnDefinition.put("colName", colName);
columnDefinition.put("colDataType", dataType);
if (Boolean.FALSE.equals(getJsonDataTypeEnabled())) {
columnDefinition.put("colDataType", "TEXT");
@@ -640,6 +707,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
Map mysqlSchema = new HashMap();
Map columnDefinition = new HashMap();
String baseName = property.getBaseName();
+ String colName = this.toColumnName(baseName);
Boolean required = property.getRequired();
String description = property.getDescription();
String defaultValue = property.getDefaultValue();
@@ -650,9 +718,15 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
return;
}
+ if (this.getIdentifierNamingConvention().equals("snake_case") && !baseName.equals(colName)) {
+ // add original name in column comment
+ String commentExtra = "Original param name - " + baseName + ".";
+ description = (description == null || description.isEmpty()) ? commentExtra : description + ". " + commentExtra;
+ }
+
vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema);
mysqlSchema.put("columnDefinition", columnDefinition);
- columnDefinition.put("colName", toColumnName(baseName));
+ columnDefinition.put("colName", colName);
columnDefinition.put("colDataType", "TEXT");
if (Boolean.TRUE.equals(required)) {
@@ -897,6 +971,9 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
*/
public String toTableName(String name) {
String identifier = toMysqlIdentifier(name, tableNamePrefix, tableNameSuffix);
+ if (identifierNamingConvention.equals("snake_case")) {
+ identifier = underscore(identifier);
+ }
if (identifier.length() > IDENTIFIER_MAX_LENGTH) {
LOGGER.warn("Table name cannot exceed 64 chars. Name '" + name + "' will be truncated");
identifier = identifier.substring(0, IDENTIFIER_MAX_LENGTH);
@@ -913,6 +990,9 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
*/
public String toColumnName(String name) {
String identifier = toMysqlIdentifier(name, columnNamePrefix, columnNameSuffix);
+ if (identifierNamingConvention.equals("snake_case")) {
+ identifier = underscore(identifier);
+ }
if (identifier.length() > IDENTIFIER_MAX_LENGTH) {
LOGGER.warn("Column name cannot exceed 64 chars. Name '" + name + "' will be truncated");
identifier = identifier.substring(0, IDENTIFIER_MAX_LENGTH);
@@ -1054,4 +1134,30 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
return this.jsonDataTypeEnabled;
}
+ /**
+ * Sets identifier naming convention for table names and column names.
+ * This is not related to database name which is defined by defaultDatabaseName option.
+ *
+ * @param naming identifier naming convention (original|snake_case)
+ */
+ public void setIdentifierNamingConvention(String naming) {
+ switch (naming) {
+ case "original":
+ case "snake_case":
+ this.identifierNamingConvention = naming;
+ break;
+ default:
+ LOGGER.warn("\"" + (String) naming + "\" is invalid \"identifierNamingConvention\" argument. Current \"" + (String) this.identifierNamingConvention + "\" used instead.");
+ }
+ }
+
+ /**
+ * Returns identifier naming convention for table names and column names.
+ *
+ * @return identifier naming convention
+ */
+ public String getIdentifierNamingConvention() {
+ return this.identifierNamingConvention;
+ }
+
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlim4ServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlim4ServerCodegen.java
index b2b8fd31e76..4ec5c1f1166 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlim4ServerCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlim4ServerCodegen.java
@@ -42,6 +42,8 @@ public class PhpSlim4ServerCodegen extends PhpSlimServerCodegen {
protected String psr7Implementation = "slim-psr7";
protected String mockDirName = "Mock";
protected String mockPackage = "";
+ protected String utilsDirName = "Utils";
+ protected String utilsPackage = "";
public PhpSlim4ServerCodegen() {
super();
@@ -51,6 +53,7 @@ public class PhpSlim4ServerCodegen extends PhpSlimServerCodegen {
.build();
mockPackage = invokerPackage + "\\" + mockDirName;
+ utilsPackage = invokerPackage + "\\" + utilsDirName;
outputFolder = "generated-code" + File.separator + "slim4";
embeddedTemplateDir = templateDir = "php-slim4-server";
@@ -86,8 +89,9 @@ public class PhpSlim4ServerCodegen extends PhpSlimServerCodegen {
super.processOpts();
if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) {
- // Update the invokerPackage for the default mockPackage
+ // Update mockPackage and utilsPackage
mockPackage = invokerPackage + "\\" + mockDirName;
+ utilsPackage = invokerPackage + "\\" + utilsDirName;
}
// make mock src path available in mustache template
@@ -95,6 +99,11 @@ public class PhpSlim4ServerCodegen extends PhpSlimServerCodegen {
additionalProperties.put("mockSrcPath", "./" + toSrcPath(mockPackage, srcBasePath));
additionalProperties.put("mockTestPath", "./" + toSrcPath(mockPackage, testBasePath));
+ // same for utils package
+ additionalProperties.put("utilsPackage", utilsPackage);
+ additionalProperties.put("utilsSrcPath", "./" + toSrcPath(utilsPackage, srcBasePath));
+ additionalProperties.put("utilsTestPath", "./" + toSrcPath(utilsPackage, testBasePath));
+
if (additionalProperties.containsKey(PSR7_IMPLEMENTATION)) {
this.setPsr7Implementation((String) additionalProperties.get(PSR7_IMPLEMENTATION));
}
@@ -132,6 +141,12 @@ public class PhpSlim4ServerCodegen extends PhpSlimServerCodegen {
supportingFiles.add(new SupportingFile("openapi_data_mocker_interface.mustache", toSrcPath(mockPackage, srcBasePath), toInterfaceName("OpenApiDataMocker") + ".php"));
supportingFiles.add(new SupportingFile("openapi_data_mocker.mustache", toSrcPath(mockPackage, srcBasePath), "OpenApiDataMocker.php"));
supportingFiles.add(new SupportingFile("openapi_data_mocker_test.mustache", toSrcPath(mockPackage, testBasePath), "OpenApiDataMockerTest.php"));
+
+ // traits of ported utils
+ supportingFiles.add(new SupportingFile("string_utils_trait.mustache", toSrcPath(utilsPackage, srcBasePath), toTraitName("StringUtils") + ".php"));
+ supportingFiles.add(new SupportingFile("string_utils_trait_test.mustache", toSrcPath(utilsPackage, testBasePath), toTraitName("StringUtils") + "Test.php"));
+ supportingFiles.add(new SupportingFile("model_utils_trait.mustache", toSrcPath(utilsPackage, srcBasePath), toTraitName("ModelUtils") + ".php"));
+ supportingFiles.add(new SupportingFile("model_utils_trait_test.mustache", toSrcPath(utilsPackage, testBasePath), toTraitName("ModelUtils") + "Test.php"));
}
/**
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAbstractConnexionServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAbstractConnexionServerCodegen.java
index 5d6c5ca102e..5b6e133cac2 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAbstractConnexionServerCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAbstractConnexionServerCodegen.java
@@ -48,6 +48,8 @@ public class PythonAbstractConnexionServerCodegen extends DefaultCodegen impleme
public static final String CONTROLLER_PACKAGE = "controllerPackage";
public static final String DEFAULT_CONTROLLER = "defaultController";
public static final String SUPPORT_PYTHON2 = "supportPython2";
+ // nose is a python testing framework, we use pytest if USE_NOSE is unset
+ public static final String USE_NOSE = "useNose";
static final String MEDIA_TYPE = "mediaType";
protected int serverPort = 8080;
@@ -57,6 +59,7 @@ public class PythonAbstractConnexionServerCodegen extends DefaultCodegen impleme
protected String defaultController;
protected Map regexModifiers;
protected boolean fixBodyName;
+ protected boolean useNose = Boolean.FALSE;
public PythonAbstractConnexionServerCodegen(String templateDirectory, boolean fixBodyNameValue) {
super();
@@ -156,6 +159,8 @@ public class PythonAbstractConnexionServerCodegen extends DefaultCodegen impleme
defaultValue("false"));
cliOptions.add(new CliOption("serverPort", "TCP port to listen to in app.run").
defaultValue("8080"));
+ cliOptions.add(CliOption.newBoolean(USE_NOSE, "use the nose test framework").
+ defaultValue(Boolean.FALSE.toString()));
}
protected void addSupportingFiles() {
@@ -200,6 +205,9 @@ public class PythonAbstractConnexionServerCodegen extends DefaultCodegen impleme
additionalProperties.put(SUPPORT_PYTHON2, Boolean.TRUE);
typeMapping.put("long", "long");
}
+ if (additionalProperties.containsKey(USE_NOSE)) {
+ setUseNose((String) additionalProperties.get(USE_NOSE));
+ }
supportingFiles.add(new SupportingFile("__main__.mustache", packagePath(), "__main__.py"));
supportingFiles.add(new SupportingFile("util.mustache", packagePath(), "util.py"));
supportingFiles.add(new SupportingFile("typing_utils.mustache", packagePath(), "typing_utils.py"));
@@ -214,6 +222,10 @@ public class PythonAbstractConnexionServerCodegen extends DefaultCodegen impleme
controllerPackage = packageName + "." + controllerPackage;
}
+ public void setUseNose(String val) {
+ this.useNose = Boolean.valueOf(val);
+ }
+
private static String packageToPath(String pkg) {
return pkg.replace(".", File.separator);
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAiohttpConnexionServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAiohttpConnexionServerCodegen.java
index 0f725396b66..eac3c6b0b2e 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAiohttpConnexionServerCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonAiohttpConnexionServerCodegen.java
@@ -44,5 +44,7 @@ public class PythonAiohttpConnexionServerCodegen extends PythonAbstractConnexion
supportingFiles.add(new SupportingFile("conftest.mustache", testPackage, "conftest.py"));
supportingFiles.add(new SupportingFile("__init__test.mustache", testPackage, "__init__.py"));
supportingFiles.add(new SupportingFile("__init__main.mustache", packagePath(), "__init__.py"));
+ supportingFiles.add(new SupportingFile("tox.mustache", "", "tox.ini"));
+ supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
}
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java
index 4538ee1b5f2..ef410594ec9 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java
@@ -40,6 +40,8 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
public static final String PACKAGE_URL = "packageUrl";
public static final String DEFAULT_LIBRARY = "urllib3";
+ // nose is a python testing framework, we use pytest if USE_NOSE is unset
+ public static final String USE_NOSE = "useNose";
protected String packageName = "openapi_client";
protected String packageVersion = "1.0.0";
@@ -47,6 +49,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
protected String packageUrl;
protected String apiDocPath = "docs/";
protected String modelDocPath = "docs/";
+ protected boolean useNose = Boolean.FALSE;
protected Map regexModifiers;
@@ -127,7 +130,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
"and", "del", "from", "not", "while", "as", "elif", "global", "or", "with",
"assert", "else", "if", "pass", "yield", "break", "except", "import",
"print", "class", "exec", "in", "raise", "continue", "finally", "is",
- "return", "def", "for", "lambda", "try", "self", "nonlocal", "None", "True",
+ "return", "def", "for", "lambda", "try", "self", "nonlocal", "None", "True",
"False", "async", "await"));
regexModifiers = new HashMap();
@@ -151,6 +154,8 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
.defaultValue(Boolean.TRUE.toString()));
cliOptions.add(new CliOption(CodegenConstants.SOURCECODEONLY_GENERATION, CodegenConstants.SOURCECODEONLY_GENERATION_DESC)
.defaultValue(Boolean.FALSE.toString()));
+ cliOptions.add(CliOption.newBoolean(USE_NOSE, "use the nose test framework").
+ defaultValue(Boolean.FALSE.toString()));
supportedLibraries.put("urllib3", "urllib3-based client");
supportedLibraries.put("asyncio", "Asyncio-based client (python 3.5+)");
@@ -190,7 +195,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
if (additionalProperties.containsKey(CodegenConstants.PACKAGE_VERSION)) {
setPackageVersion((String) additionalProperties.get(CodegenConstants.PACKAGE_VERSION));
- }
+ }
Boolean generateSourceCodeOnly = false;
if (additionalProperties.containsKey(CodegenConstants.SOURCECODEONLY_GENERATION)) {
@@ -216,6 +221,10 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
setPackageUrl((String) additionalProperties.get(PACKAGE_URL));
}
+ if (additionalProperties.containsKey(USE_NOSE)) {
+ setUseNose((String) additionalProperties.get(USE_NOSE));
+ }
+
String readmePath = "README.md";
String readmeTemplate = "README.mustache";
if (generateSourceCodeOnly) {
@@ -228,6 +237,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
supportingFiles.add(new SupportingFile("tox.mustache", "", "tox.ini"));
supportingFiles.add(new SupportingFile("test-requirements.mustache", "", "test-requirements.txt"));
supportingFiles.add(new SupportingFile("requirements.mustache", "", "requirements.txt"));
+ supportingFiles.add(new SupportingFile("setup_cfg.mustache", "", "setup.cfg"));
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
@@ -579,6 +589,10 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
this.packageName = packageName;
}
+ public void setUseNose(String val) {
+ this.useNose = Boolean.valueOf(val);
+ }
+
public void setProjectName(String projectName) {
this.projectName = projectName;
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java
index f456ac9f17a..92d66ddee8f 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java
@@ -26,6 +26,7 @@ import io.swagger.v3.oas.models.media.FileSchema;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.media.XML;
import io.swagger.v3.oas.models.parameters.RequestBody;
+import io.swagger.v3.oas.models.responses.ApiResponse;
import io.swagger.v3.oas.models.servers.Server;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
@@ -65,6 +66,11 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
private static final String uuidType = "uuid::Uuid";
private static final String bytesType = "swagger::ByteArray";
+ private static final String xmlMimeType = "application/xml";
+ private static final String octetMimeType = "application/octet-stream";
+ private static final String plainMimeType = "text/plain";
+ private static final String jsonMimeType = "application/json";
+
public RustServerCodegen() {
super();
@@ -485,11 +491,11 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
}
private boolean isMimetypeXml(String mimetype) {
- return mimetype.toLowerCase(Locale.ROOT).startsWith("application/xml");
+ return mimetype.toLowerCase(Locale.ROOT).startsWith(xmlMimeType);
}
private boolean isMimetypePlainText(String mimetype) {
- return mimetype.toLowerCase(Locale.ROOT).startsWith("text/plain");
+ return mimetype.toLowerCase(Locale.ROOT).startsWith(plainMimeType);
}
private boolean isMimetypeHtmlText(String mimetype) {
@@ -505,7 +511,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
}
private boolean isMimetypeOctetStream(String mimetype) {
- return mimetype.toLowerCase(Locale.ROOT).startsWith("application/octet-stream");
+ return mimetype.toLowerCase(Locale.ROOT).startsWith(octetMimeType);
}
private boolean isMimetypePlain(String mimetype) {
@@ -563,36 +569,17 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
processParam(param, op);
}
- List consumes = new ArrayList();
-
- boolean consumesPlainText = false;
- boolean consumesXml = false;
- // if "consumes" is defined (per operation or using global definition)
- if (consumes != null && !consumes.isEmpty()) {
- consumes.addAll(getConsumesInfo(this.openAPI, operation));
- List> c = new ArrayList>();
- for (String mimeType : consumes) {
- Map mediaType = new HashMap();
-
- if (isMimetypeXml(mimeType)) {
- additionalProperties.put("usesXml", true);
- consumesXml = true;
- } else if (isMimetypePlain(mimeType)) {
- consumesPlainText = true;
- } else if (isMimetypeWwwFormUrlEncoded(mimeType)) {
- additionalProperties.put("usesUrlEncodedForm", true);
- }
-
- mediaType.put("mediaType", mimeType);
- c.add(mediaType);
- }
- op.consumes = c;
- op.hasConsumes = true;
- }
-
-
- List produces = new ArrayList(getProducesInfo(this.openAPI, operation));
+ // We keep track of the 'default' model type for this API. If there are
+ // *any* XML responses, then we set the default to XML, otherwise we
+ // let the default be JSON. It would be odd for an API to want to use
+ // both XML and JSON on a single operation, and if we don't know
+ // anything then JSON is a more modern (ergo reasonable) choice.
+ boolean defaultsToXml = false;
+ // Determine the types that this operation produces. `getProducesInfo`
+ // simply lists all the types, and then we add the correct imports to
+ // the generated library.
+ List produces = new ArrayList(getProducesInfo(openAPI, operation));
boolean producesXml = false;
boolean producesPlainText = false;
if (produces != null && !produces.isEmpty()) {
@@ -602,6 +589,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
if (isMimetypeXml(mimeType)) {
additionalProperties.put("usesXml", true);
+ defaultsToXml = true;
producesXml = true;
} else if (isMimetypePlain(mimeType)) {
producesPlainText = true;
@@ -621,32 +609,132 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
param.vendorExtensions.put("typeName", toModelName(param.baseName));
}
+ // Set for deduplication of response IDs
+ Set responseIds = new HashSet();
+
for (CodegenResponse rsp : op.responses) {
+
+ // Get the original API response so we get process the schema
+ // directly.
+ ApiResponse original;
+ if (rsp.code == "0") {
+ original = operation.getResponses().get("default");
+ } else {
+ original = operation.getResponses().get(rsp.code);
+ }
String[] words = rsp.message.split("[^A-Za-z ]");
+
+ // Create a unique responseID for this response.
String responseId;
+
if (rsp.vendorExtensions.containsKey("x-responseId")) {
+ // If it's been specified directly, use that.
responseId = (String) rsp.vendorExtensions.get("x-responseId");
} else if (words.length != 0) {
+ // If there's a description, build it from the description.
responseId = camelize(words[0].replace(" ", "_"));
} else {
+ // Otherwise fall back to the http response code.
responseId = "Status" + rsp.code;
}
+
+ // Deduplicate response IDs that would otherwise contain the same
+ // text. We rely on the ID being unique, but since we form it from
+ // the raw description field we can't require that the spec writer
+ // provides unique descriptions.
+ int idTieBreaker = 2;
+ while (responseIds.contains(responseId)) {
+ String trial = String.format(Locale.ROOT, "%s_%d", responseId, idTieBreaker);
+ if (!responseIds.contains(trial)) {
+ responseId = trial;
+ } else {
+ idTieBreaker++;
+ }
+ }
+
+ responseIds.add(responseId);
+
rsp.vendorExtensions.put("x-responseId", responseId);
rsp.vendorExtensions.put("x-uppercaseResponseId", underscore(responseId).toUpperCase(Locale.ROOT));
rsp.vendorExtensions.put("uppercase_operation_id", underscore(op.operationId).toUpperCase(Locale.ROOT));
if (rsp.dataType != null) {
rsp.vendorExtensions.put("uppercase_data_type", (rsp.dataType.replace("models::", "")).toUpperCase(Locale.ROOT));
- // Default to producing json if nothing else is specified
+ // Get the mimetype which is produced by this response. Note
+ // that although in general responses produces a set of
+ // different mimetypes currently we only support 1 per
+ // response.
+ String firstProduces = null;
+
+ if (original.getContent() != null) {
+ for (String mimetype : original.getContent().keySet()) {
+ firstProduces = mimetype;
+ break;
+ }
+ }
+
+ // The output mime type. This allows us to do sensible fallback
+ // to JSON/XML rather than using only the default operation
+ // mimetype.
+ String outputMime;
+
+ if (firstProduces == null) {
+ if (producesXml) {
+ outputMime = xmlMimeType;
+ } else if (producesPlainText) {
+ if (rsp.dataType.equals(bytesType)) {
+ outputMime = octetMimeType;
+ } else {
+ outputMime = plainMimeType;
+ }
+ } else {
+ outputMime = jsonMimeType;
+ }
+ } else {
+ // If we know exactly what mimetype this response is
+ // going to produce, then use that. If we have not found
+ // anything, then we'll fall back to the 'producesXXX'
+ // definitions we worked out above for the operation as a
+ // whole.
+ if (isMimetypeXml(firstProduces)) {
+ producesXml = true;
+ producesPlainText = false;
+ } else if (isMimetypePlain(firstProduces)) {
+ producesXml = false;
+ producesPlainText = true;
+ } else {
+ producesXml = false;
+ producesPlainText = false;
+ }
+
+ outputMime = firstProduces;
+ }
+
+ rsp.vendorExtensions.put("mimeType", outputMime);
+
+ // Write out the type of data we actually expect this response
+ // to make.
if (producesXml) {
rsp.vendorExtensions.put("producesXml", true);
- } else if (producesPlainText && rsp.dataType.equals(bytesType)) {
- rsp.vendorExtensions.put("producesPlainText", true);
+ } else if (producesPlainText) {
+ // Plain text means that there is not structured data in
+ // this response. So it'll either be a UTF-8 encoded string
+ // 'plainText' or some generic 'bytes'.
+ //
+ // Note that we don't yet distinguish between string/binary
+ // and string/bytes - that is we don't auto-detect whether
+ // base64 encoding should be done. They both look like
+ // 'producesBytes'.
+ if (rsp.dataType.equals(bytesType)) {
+ rsp.vendorExtensions.put("producesBytes", true);
+ } else {
+ rsp.vendorExtensions.put("producesPlainText", true);
+ }
} else {
rsp.vendorExtensions.put("producesJson", true);
- // If the data type is just "object", then ensure that the Rust data type
- // is "serde_json::Value". This allows us to define APIs that
- // can return arbitrary JSON bodies.
+ // If the data type is just "object", then ensure that the
+ // Rust data type is "serde_json::Value". This allows us
+ // to define APIs that can return arbitrary JSON bodies.
if (rsp.dataType.equals("object")) {
rsp.dataType = "serde_json::Value";
}
@@ -686,7 +774,6 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
Map operations = (Map) objs.get("operations");
List operationList = (List) operations.get("operation");
-
for (CodegenOperation op : operationList) {
boolean consumesPlainText = false;
boolean consumesXml = false;
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java
index ad53e421ef5..89c84256d6e 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java
@@ -937,7 +937,7 @@ public class ModelUtils {
if (s == null) {
LOGGER.error("Failed to obtain schema from {}", parentName);
return "UNKNOWN_PARENT_NAME";
- } else if (s.getDiscriminator() != null && StringUtils.isNotEmpty(s.getDiscriminator().getPropertyName())) {
+ } else if (hasOrInheritsDiscriminator(s, allSchemas)) {
// discriminator.propertyName is used
return parentName;
} else {
@@ -961,7 +961,7 @@ public class ModelUtils {
return null;
}
- public static List getAllParentsName(ComposedSchema composedSchema, Map allSchemas) {
+ public static List getAllParentsName(ComposedSchema composedSchema, Map allSchemas, boolean includeAncestors) {
List interfaces = getInterfaces(composedSchema);
List names = new ArrayList();
@@ -974,9 +974,12 @@ public class ModelUtils {
if (s == null) {
LOGGER.error("Failed to obtain schema from {}", parentName);
names.add("UNKNOWN_PARENT_NAME");
- } else if (s.getDiscriminator() != null && StringUtils.isNotEmpty(s.getDiscriminator().getPropertyName())) {
+ } else if (hasOrInheritsDiscriminator(s, allSchemas)) {
// discriminator.propertyName is used
names.add(parentName);
+ if (includeAncestors && s instanceof ComposedSchema) {
+ names.addAll(getAllParentsName((ComposedSchema) s, allSchemas, true));
+ }
} else {
LOGGER.debug("Not a parent since discriminator.propertyName is not set {}", s.get$ref());
// not a parent since discriminator.propertyName is not set
@@ -990,6 +993,32 @@ public class ModelUtils {
return names;
}
+ private static boolean hasOrInheritsDiscriminator(Schema schema, Map allSchemas) {
+ if (schema.getDiscriminator() != null && StringUtils.isNotEmpty(schema.getDiscriminator().getPropertyName())) {
+ return true;
+ }
+ else if (StringUtils.isNotEmpty(schema.get$ref())) {
+ String parentName = getSimpleRef(schema.get$ref());
+ Schema s = allSchemas.get(parentName);
+ if (s != null) {
+ return hasOrInheritsDiscriminator(s, allSchemas);
+ }
+ else {
+ LOGGER.error("Failed to obtain schema from {}", parentName);
+ }
+ }
+ else if (schema instanceof ComposedSchema) {
+ final ComposedSchema composed = (ComposedSchema) schema;
+ final List interfaces = getInterfaces(composed);
+ for (Schema i : interfaces) {
+ if (hasOrInheritsDiscriminator(i, allSchemas)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
public static boolean isNullable(Schema schema) {
if (schema == null) {
return false;
diff --git a/modules/openapi-generator/src/main/resources/Ada/gnat-project.mustache b/modules/openapi-generator/src/main/resources/Ada/gnat-project.mustache
index c1fa58eebea..1f8ded35698 100644
--- a/modules/openapi-generator/src/main/resources/Ada/gnat-project.mustache
+++ b/modules/openapi-generator/src/main/resources/Ada/gnat-project.mustache
@@ -6,11 +6,12 @@
--
-- NOTE: Auto generated by OpenAPI Generator (https://openapi-generator.tech).
with "config";
-with "util";
-with "util_http";
+with "utilada_sys";
+with "utilada_xml";
+with "utilada_http";
with "security";
with "swagger";{{#isServer}}
-with "servlet";
+with "servletada";
with "swagger_server";{{/isServer}}
project {{{projectName}}} is
diff --git a/modules/openapi-generator/src/main/resources/Ada/server.mustache b/modules/openapi-generator/src/main/resources/Ada/server.mustache
index 08aba9f071a..f0a0fd00885 100644
--- a/modules/openapi-generator/src/main/resources/Ada/server.mustache
+++ b/modules/openapi-generator/src/main/resources/Ada/server.mustache
@@ -2,17 +2,22 @@ with Ada.IO_Exceptions;
with AWS.Config.Set;
with Swagger.Servers.AWS;
with Swagger.Servers.Applications;
+with Util.Strings;
with Util.Log.Loggers;
with Util.Properties;
+with Util.Properties.Basic;
with {{package}}.Servers;
procedure {{package}}.Server is
procedure Configure (Config : in out AWS.Config.Object);
+ use Util.Properties.Basic;
+
CONFIG_PATH : constant String := "{{packageConfig}}.properties";
+ Port : Natural := 8080;
procedure Configure (Config : in out AWS.Config.Object) is
begin
- AWS.Config.Set.Server_Port (Config, 8080);
+ AWS.Config.Set.Server_Port (Config, Port);
AWS.Config.Set.Max_Connection (Config, 8);
AWS.Config.Set.Accept_Queue_Size (Config, 512);
end Configure;
@@ -25,13 +30,15 @@ begin
Props.Load_Properties (CONFIG_PATH);
Util.Log.Loggers.Initialize (Props);
+ Port := Integer_Property.Get (Props, "swagger.port", Port);
App.Configure (Props);
{{package}}.Servers.Server_Impl.Register (App);
WS.Configure (Configure'Access);
WS.Register_Application ("{{basePathWithoutHost}}", App'Unchecked_Access);
App.Dump_Routes (Util.Log.INFO_LEVEL);
- Log.Info ("Connect you browser to: http://localhost:8080{{basePathWithoutHost}}/ui/index.html");
+ Log.Info ("Connect you browser to: http://localhost:{0}{{basePathWithoutHost}}/ui/index.html",
+ Util.Strings.Image (Port));
WS.Start;
diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/api-body.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/api-body.mustache
index 56c719f1e08..36ce98d9275 100644
--- a/modules/openapi-generator/src/main/resources/C-libcurl/api-body.mustache
+++ b/modules/openapi-generator/src/main/resources/C-libcurl/api-body.mustache
@@ -22,7 +22,7 @@
//
{{/notes}}
{{#returnType}}{{#returnTypeIsPrimitive}}{{#returnSimpleType}}{{{.}}}*{{/returnSimpleType}}{{^returnSimpleType}}{{#isListContainer}}{{{.}}}_t*{{/isListContainer}}{{#isMapContainer}}{{{.}}}{{/isMapContainer}}{{/returnSimpleType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}{{{.}}}_t*{{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void{{/returnType}}
-{{{classname}}}_{{{operationId}}}(apiClient_t *apiClient{{#allParams}} ,{{#isPrimitiveType}}{{#isNumber}}{{{dataType}}}{{/isNumber}}{{#isLong}}{{{dataType}}}{{/isLong}}{{#isInteger}}{{{dataType}}}{{/isInteger}}{{#isDouble}}{{{dataType}}}{{/isDouble}}{{#isFloat}}{{{dataType}}}{{/isFloat}}{{#isBoolean}}{{dataType}}{{/isBoolean}}{{#isEnum}}{{#isString}}{{{baseName}}}_e{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}{{{dataType}}} *{{/isString}}{{/isEnum}}{{#isByteArray}}{{{dataType}}}{{/isByteArray}}{{#isDate}}{{{dataType}}}{{/isDate}}{{#isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isFile}}{{{dataType}}}{{/isFile}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{^isEnum}}{{{dataType}}}_t *{{/isEnum}}{{/isModel}}{{^isModel}}{{^isListContainer}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{/isListContainer}}{{/isModel}}{{#isUuid}}{{dataType}} *{{/isUuid}}{{#isEmail}}{{dataType}}{{/isEmail}}{{/isPrimitiveType}}{{#isContainer}}{{#isListContainer}}{{dataType}}_t *{{/isListContainer}}{{#isMapContainer}}{{dataType}}{{/isMapContainer}}{{/isContainer}} {{{paramName}}}{{/allParams}})
+{{{classname}}}_{{{operationId}}}(apiClient_t *apiClient{{#allParams}} ,{{#isPrimitiveType}}{{#isNumber}}{{{dataType}}}{{/isNumber}}{{#isLong}}{{{dataType}}}{{/isLong}}{{#isInteger}}{{{dataType}}}{{/isInteger}}{{#isDouble}}{{{dataType}}}{{/isDouble}}{{#isFloat}}{{{dataType}}}{{/isFloat}}{{#isBoolean}}{{dataType}}{{/isBoolean}}{{#isEnum}}{{#isString}}{{{baseName}}}_e{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}{{{dataType}}} *{{/isString}}{{/isEnum}}{{#isByteArray}}{{{dataType}}}{{/isByteArray}}{{#isDate}}{{{dataType}}}{{/isDate}}{{#isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isFile}}{{{dataType}}}{{/isFile}}{{#isFreeFormObject}}{{dataType}}_t *{{/isFreeFormObject}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{^isEnum}}{{{dataType}}}_t *{{/isEnum}}{{/isModel}}{{^isModel}}{{^isListContainer}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{/isListContainer}}{{/isModel}}{{#isUuid}}{{dataType}} *{{/isUuid}}{{#isEmail}}{{dataType}}{{/isEmail}}{{/isPrimitiveType}}{{#isContainer}}{{#isListContainer}}{{dataType}}_t *{{/isListContainer}}{{#isMapContainer}}{{dataType}}{{/isMapContainer}}{{/isContainer}} {{{paramName}}}{{/allParams}})
{
list_t *localVarQueryParameters = {{#hasQueryParams}}list_create();{{/hasQueryParams}}{{^hasQueryParams}}NULL;{{/hasQueryParams}}
list_t *localVarHeaderParameters = {{#hasHeaderParams}}list_create();{{/hasHeaderParams}}{{^hasHeaderParams}}NULL;{{/hasHeaderParams}}
@@ -39,7 +39,7 @@
{{#pathParams}}
// Path Params
- long sizeOfPathParams_{{{paramName}}} = {{#pathParams}}{{#isLong}}sizeof({{paramName}})+3{{/isLong}}{{#isString}}strlen({{paramName}})+3{{/isString}}{{/pathParams}} + strlen("{ {{paramName}} }");
+ long sizeOfPathParams_{{{paramName}}} = {{#pathParams}}{{#isLong}}sizeof({{paramName}})+3{{/isLong}}{{#isString}}strlen({{paramName}})+3{{/isString}}{{#hasMore}} + {{/hasMore}}{{/pathParams}} + strlen("{ {{paramName}} }");
{{#isNumeric}}
if({{paramName}} == 0){
goto end;
diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/api-header.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/api-header.mustache
index a20e4be02fd..4556d2d0294 100644
--- a/modules/openapi-generator/src/main/resources/C-libcurl/api-header.mustache
+++ b/modules/openapi-generator/src/main/resources/C-libcurl/api-header.mustache
@@ -19,7 +19,7 @@
//
{{/notes}}
{{#returnType}}{{#returnTypeIsPrimitive}}{{#returnSimpleType}}{{{.}}}*{{/returnSimpleType}}{{^returnSimpleType}}{{#isListContainer}}{{{.}}}_t*{{/isListContainer}}{{#isMapContainer}}{{{.}}}{{/isMapContainer}}{{/returnSimpleType}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}{{{.}}}_t*{{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void{{/returnType}}
-{{{classname}}}_{{{operationId}}}(apiClient_t *apiClient{{#allParams}} ,{{#isPrimitiveType}}{{#isNumber}}{{{dataType}}}{{/isNumber}}{{#isLong}}{{{dataType}}}{{/isLong}}{{#isInteger}}{{{dataType}}}{{/isInteger}}{{#isDouble}}{{{dataType}}}{{/isDouble}}{{#isFloat}}{{{dataType}}}{{/isFloat}}{{#isBoolean}}{{dataType}}{{/isBoolean}}{{#isEnum}}{{#isString}}{{{baseName}}}_e{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}{{{dataType}}} *{{/isString}}{{/isEnum}}{{#isByteArray}}{{{dataType}}}{{/isByteArray}}{{#isDate}}{{{dataType}}}{{/isDate}}{{#isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isFile}}{{{dataType}}}{{/isFile}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{^isEnum}}{{{dataType}}}_t *{{/isEnum}}{{/isModel}}{{^isModel}}{{^isListContainer}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{/isListContainer}}{{/isModel}}{{#isUuid}}{{dataType}} *{{/isUuid}}{{#isEmail}}{{dataType}}{{/isEmail}}{{/isPrimitiveType}}{{#isContainer}}{{#isListContainer}}{{dataType}}_t *{{/isListContainer}}{{#isMapContainer}}{{dataType}}{{/isMapContainer}}{{/isContainer}} {{{paramName}}}{{/allParams}});
+{{{classname}}}_{{{operationId}}}(apiClient_t *apiClient{{#allParams}} ,{{#isPrimitiveType}}{{#isNumber}}{{{dataType}}}{{/isNumber}}{{#isLong}}{{{dataType}}}{{/isLong}}{{#isInteger}}{{{dataType}}}{{/isInteger}}{{#isDouble}}{{{dataType}}}{{/isDouble}}{{#isFloat}}{{{dataType}}}{{/isFloat}}{{#isBoolean}}{{dataType}}{{/isBoolean}}{{#isEnum}}{{#isString}}{{{baseName}}}_e{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}{{{dataType}}} *{{/isString}}{{/isEnum}}{{#isByteArray}}{{{dataType}}}{{/isByteArray}}{{#isDate}}{{{dataType}}}{{/isDate}}{{#isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isFile}}{{{dataType}}}{{/isFile}}{{#isFreeFormObject}}{{dataType}}_t *{{/isFreeFormObject}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{^isEnum}}{{{dataType}}}_t *{{/isEnum}}{{/isModel}}{{^isModel}}{{^isListContainer}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{/isListContainer}}{{/isModel}}{{#isUuid}}{{dataType}} *{{/isUuid}}{{#isEmail}}{{dataType}}{{/isEmail}}{{/isPrimitiveType}}{{#isContainer}}{{#isListContainer}}{{dataType}}_t *{{/isListContainer}}{{#isMapContainer}}{{dataType}}{{/isMapContainer}}{{/isContainer}} {{{paramName}}}{{/allParams}});
{{/operation}}
diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/model-header.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/model-header.mustache
index 780e148cbae..28817ccd91e 100644
--- a/modules/openapi-generator/src/main/resources/C-libcurl/model-header.mustache
+++ b/modules/openapi-generator/src/main/resources/C-libcurl/model-header.mustache
@@ -72,7 +72,7 @@ typedef struct {{classname}}_t {
{{datatype}}_e {{name}}; //enum model
{{/isEnum}}
{{^isEnum}}
- {{datatype}}_t *{{name}}; //model
+ struct {{datatype}}_t *{{name}}; //model
{{/isEnum}}
{{/isModel}}
{{#isUuid}}
diff --git a/modules/openapi-generator/src/main/resources/Java/JSON.mustache b/modules/openapi-generator/src/main/resources/Java/JSON.mustache
index b7f458c9d12..b951c3c555d 100644
--- a/modules/openapi-generator/src/main/resources/Java/JSON.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/JSON.mustache
@@ -75,7 +75,7 @@ public class JSON {
{{/mappedModels}}
classByDiscriminatorValue.put("{{classname}}".toUpperCase(Locale.ROOT), {{classname}}.class);
return getClassByDiscriminator(classByDiscriminatorValue,
- getDiscriminatorValue(readElement, "{{{propertyName}}}"));
+ getDiscriminatorValue(readElement, "{{{propertyBaseName}}}"));
}
})
{{/discriminator}}
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache
index 0aa3683cf35..b12740b0f64 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache
@@ -715,6 +715,13 @@ public class ApiClient {
}
}
+ for (Entry entry : defaultCookieMap.entrySet()) {
+ String value = entry.getValue();
+ if (value != null) {
+ invocationBuilder = invocationBuilder.cookie(entry.getKey(), value);
+ }
+ }
+
for (Entry entry : defaultHeaderMap.entrySet()) {
String key = entry.getKey();
if (!headerParams.containsKey(key)) {
diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/ApiClient.mustache
index 2a327daca24..b160b7cca23 100644
--- a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/ApiClient.mustache
+++ b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/ApiClient.mustache
@@ -659,14 +659,20 @@ public class ApiClient {
}
}
+ /**
+ * Build cookie header. Keeps a single value per cookie (as per
+ * RFC6265 section 5.3 ).
+ *
+ * @param cookies map all cookies
+ * @return header string for cookies.
+ */
private String buildCookieHeader(MultiValueMap cookies) {
final StringBuilder cookieValue = new StringBuilder();
String delimiter = "";
for (final Map.Entry> entry : cookies.entrySet()) {
- for (String value : entry.getValue()) {
- cookieValue.append(String.format("%s%s=%s", delimiter, entry.getKey(), entry.getValue()));
- delimiter = "; ";
- }
+ final String value = entry.getValue().get(entry.getValue().size() - 1);
+ cookieValue.append(String.format("%s%s=%s", delimiter, entry.getKey(), value));
+ delimiter = "; ";
}
return cookieValue.toString();
}
diff --git a/modules/openapi-generator/src/main/resources/asciidoc-documentation/index.mustache b/modules/openapi-generator/src/main/resources/asciidoc-documentation/index.mustache
index f3783348c04..910b46266aa 100644
--- a/modules/openapi-generator/src/main/resources/asciidoc-documentation/index.mustache
+++ b/modules/openapi-generator/src/main/resources/asciidoc-documentation/index.mustache
@@ -1,4 +1,5 @@
-= {{{appName}}}
+= {{{appName}}}
+{{#headerAttributes}}
{{infoEmail}}
{{#version}}{{{version}}}{{/version}}
:toc: left
@@ -8,9 +9,10 @@
:keywords: openapi, rest, {{appName}}
:specDir: {{specDir}}
:snippetDir: {{snippetDir}}
-:generator-template: v1 2019-11-19
+:generator-template: v1 2019-12-20
:info-url: {{infoUrl}}
:app-name: {{appName}}
+{{/headerAttributes}}
[abstract]
.Abstract
diff --git a/modules/openapi-generator/src/main/resources/dart-dio/class.mustache b/modules/openapi-generator/src/main/resources/dart-dio/class.mustache
index cf95d3ce0eb..c7e26935d34 100644
--- a/modules/openapi-generator/src/main/resources/dart-dio/class.mustache
+++ b/modules/openapi-generator/src/main/resources/dart-dio/class.mustache
@@ -10,8 +10,6 @@ abstract class {{classname}} implements Built<{{classname}}, {{classname}}Builde
{{#isNullable}}
@nullable
{{/isNullable}}
-
- {{#description}}/* {{{description}}} */{{/description}}
@BuiltValueField(wireName: '{{baseName}}')
{{{dataType}}} get {{name}};
{{#allowableValues}}
diff --git a/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache b/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache
index 59801210034..6f1bd2bb4a0 100644
--- a/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache
+++ b/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache
@@ -1,6 +1,9 @@
name: {{pubName}}
version: {{pubVersion}}
description: {{pubDescription}}
+authors:
+ - {{pubAuthor}} <{{pubAuthorEmail}}>
+homepage: {{pubHomepage}}
environment:
sdk: '>=2.0.0 <3.0.0'
dependencies:
diff --git a/modules/openapi-generator/src/main/resources/go/README.mustache b/modules/openapi-generator/src/main/resources/go/README.mustache
index 5c9639022a1..b96f612f8a5 100644
--- a/modules/openapi-generator/src/main/resources/go/README.mustache
+++ b/modules/openapi-generator/src/main/resources/go/README.mustache
@@ -24,6 +24,9 @@ Install the following dependencies:
```shell
go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
+{{#withAWSV4Signature}}
+go get github.com/aws/aws-sdk-go/aws
+{{/withAWSV4Signature}}
go get golang.org/x/net/context
go get github.com/antihax/optional
```
@@ -113,6 +116,18 @@ r, err := client.Service.Operation(auth, args)
{{/isOAuth}}
{{/authMethods}}
+{{#withAWSV4Signature}}
+Example
+
+```golang
+auth := context.WithValue(context.Background(), sw.ContextAWSv4, sw.AWSv4{
+ AccessKey: "ACCESSKEYSTRING",
+ SecretKey: "SECRETKEYSTRING",
+})
+r, err := client.Service.Operation(auth, args)
+```
+{{/withAWSV4Signature}}
+
## Author
{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
diff --git a/modules/openapi-generator/src/main/resources/go/client.mustache b/modules/openapi-generator/src/main/resources/go/client.mustache
index a7c6802a0b8..78ee276d0f3 100644
--- a/modules/openapi-generator/src/main/resources/go/client.mustache
+++ b/modules/openapi-generator/src/main/resources/go/client.mustache
@@ -24,6 +24,10 @@ import (
"unicode/utf8"
"golang.org/x/oauth2"
+ {{#withAWSV4Signature}}
+ awsv4 "github.com/aws/aws-sdk-go/aws/signer/v4"
+ awscredentials "github.com/aws/aws-sdk-go/aws/credentials"
+ {{/withAWSV4Signature}}
)
var (
@@ -352,6 +356,25 @@ func (c *APIClient) prepareRequest(
if auth, ok := ctx.Value(ContextAccessToken).(string); ok {
localVarRequest.Header.Add("Authorization", "Bearer "+auth)
}
+
+ {{#withAWSV4Signature}}
+ // AWS Signature v4 Authentication
+ if auth, ok := ctx.Value(ContextAWSv4).(AWSv4); ok {
+ creds := awscredentials.NewStaticCredentials(auth.AccessKey, auth.SecretKey, "")
+ signer := awsv4.NewSigner(creds)
+ var reader *strings.Reader
+ if body == nil {
+ reader = strings.NewReader("")
+ } else {
+ reader = strings.NewReader(body.String())
+ }
+ timestamp := time.Now()
+ _, err := signer.Sign(localVarRequest, reader, "oapi", "eu-west-2", timestamp)
+ if err != nil {
+ return nil, err
+ }
+ }
+ {{/withAWSV4Signature}}
}
for header, value := range c.cfg.DefaultHeader {
diff --git a/modules/openapi-generator/src/main/resources/go/configuration.mustache b/modules/openapi-generator/src/main/resources/go/configuration.mustache
index e6fa96d2057..ec28dd024cf 100644
--- a/modules/openapi-generator/src/main/resources/go/configuration.mustache
+++ b/modules/openapi-generator/src/main/resources/go/configuration.mustache
@@ -29,6 +29,11 @@ var (
// ContextAPIKey takes an APIKey as authentication for the request
ContextAPIKey = contextKey("apikey")
+
+ {{#withAWSV4Signature}}
+ // ContextAWSv4 takes an Access Key and a Secret Key for signing AWS Signature v4.
+ ContextAWSv4 = contextKey("awsv4")
+ {{/withAWSV4Signature}}
)
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
@@ -43,6 +48,15 @@ type APIKey struct {
Prefix string
}
+{{#withAWSV4Signature}}
+// AWSv4 provides AWS Signature to a request passed via context using ContextAWSv4
+// https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html
+type AWSv4 struct {
+ AccessKey string
+ SecretKey string
+}
+{{/withAWSV4Signature}}
+
// ServerVariable stores the information about a server variable
type ServerVariable struct {
Description string
diff --git a/modules/openapi-generator/src/main/resources/go/go.mod.mustache b/modules/openapi-generator/src/main/resources/go/go.mod.mustache
index 83502890599..6c31cf3e9f1 100644
--- a/modules/openapi-generator/src/main/resources/go/go.mod.mustache
+++ b/modules/openapi-generator/src/main/resources/go/go.mod.mustache
@@ -3,4 +3,5 @@ module {{gitHost}}/{{gitUserId}}/{{gitRepoId}}{{#isGoSubmodule}}/{{packageName}}
require (
github.com/antihax/optional v1.0.0
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
+ {{#withAWSV4Signature}}github.com/aws/aws-sdk-go v1.26.3{{/withAWSV4Signature}}
)
diff --git a/modules/openapi-generator/src/main/resources/go/go.sum b/modules/openapi-generator/src/main/resources/go/go.sum
index ce55b3c6a08..ee695202297 100644
--- a/modules/openapi-generator/src/main/resources/go/go.sum
+++ b/modules/openapi-generator/src/main/resources/go/go.sum
@@ -1,6 +1,8 @@
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
+github.com/aws/aws-sdk-go v1.26.3 h1:szQdfJcUBAhQT0zZEx4sxoDuWb7iScoucxCiVxDmaBk=
+github.com/aws/aws-sdk-go v1.26.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/.gitignore b/modules/openapi-generator/src/main/resources/php-slim4-server/.gitignore
index db204792ea3..3203d7d7814 100644
--- a/modules/openapi-generator/src/main/resources/php-slim4-server/.gitignore
+++ b/modules/openapi-generator/src/main/resources/php-slim4-server/.gitignore
@@ -5,7 +5,7 @@ composer.phar
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
-# composer.lock
+composer.lock
# phplint tool creates cache file which is not necessary in a codebase
/.phplint-cache
diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache
index cc4f128875f..68b2c89e92f 100644
--- a/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache
+++ b/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache
@@ -43,11 +43,13 @@
"test": [
"@test-apis",
"@test-models",
- "@test-mock"
+ "@test-mock",
+ "@test-utils"
],
"test-apis": "phpunit --testsuite Apis",
"test-models": "phpunit --testsuite Models",
"test-mock": "phpunit --testsuite Mock",
+ "test-utils": "phpunit --testsuite Utils",
"phpcs": "phpcs",
"phplint": "phplint ./ --exclude=vendor"
}
diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/model_utils_trait.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/model_utils_trait.mustache
new file mode 100644
index 00000000000..7f068fa1c77
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/php-slim4-server/model_utils_trait.mustache
@@ -0,0 +1,132 @@
+ ModelReturn (after camelize)
+ }
+
+ // model name starts with number
+ if (preg_match('/^\d.*/', $name) === 1) {
+ $name = 'model_' . $name; // e.g. 200Response => Model200Response (after camelize)
+ }
+
+ // add prefix and/or suffic only if name does not start wth \ (e.g. \DateTime)
+ if (preg_match('/^\\\\.*/', $name) !== 1) {
+ if (is_string($modelNamePrefix) && !empty($modelNamePrefix)) {
+ $name = $modelNamePrefix . '_' . $name;
+ }
+
+ if (is_string($modelNameSuffix) && !empty($modelNameSuffix)) {
+ $name = $name . '_' . $modelNameSuffix;
+ }
+ }
+
+ // camelize the model name
+ // phone_number => PhoneNumber
+ return self::camelize($name);
+ }
+}
+{{/apiInfo}}
diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/model_utils_trait_test.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/model_utils_trait_test.mustache
new file mode 100644
index 00000000000..f3d365eba67
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/php-slim4-server/model_utils_trait_test.mustache
@@ -0,0 +1,111 @@
+assertSame($expectedRef, ModelUtils::getSimpleRef($ref));
+ }
+
+ public function provideRefs()
+ {
+ return [
+ 'Reference Object OAS 3.0' => [
+ '#/components/schemas/Pet', 'Pet',
+ ],
+ 'Reference Object Swagger 2.0' => [
+ '#/definitions/Pet', 'Pet',
+ ],
+ 'Underscored classname' => [
+ '#/components/schemas/_foobar_Objects', '_foobar_Objects',
+ ],
+ 'Relative Documents With Embedded Schema' => [
+ 'definitions.json#/Pet', null,
+ ],
+ 'null as argument' => [
+ null, null,
+ ],
+ 'number as argument' => [
+ 156, null,
+ ],
+ ];
+ }
+
+ /**
+ * @covers ::toModelName
+ * @dataProvider provideModelNames
+ */
+ public function testToModelName($name, $prefix, $suffix, $expectedModel)
+ {
+ $this->assertSame($expectedModel, ModelUtils::toModelName($name, $prefix, $suffix));
+ }
+
+ public function provideModelNames()
+ {
+ return [
+ // fixtures from modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/StringUtilsTest.java
+ ['abcd', null, null, 'Abcd'],
+ ['some-value', null, null, 'SomeValue'],
+ ['some_value', null, null, 'SomeValue'],
+ ['$type', null, null, 'Type'],
+ ['123', null, null, 'Model123'],
+ ['$123', null, null, 'Model123'],
+ ['return', null, null, 'ModelReturn'],
+ ['200Response', null, null, 'Model200Response'],
+ ['abcd', 'SuperModel', null, 'SuperModelAbcd'],
+ ['abcd', null, 'WithEnd', 'AbcdWithEnd'],
+ ['abcd', 'WithStart', 'AndEnd', 'WithStartAbcdAndEnd'],
+ ['_foobar_Objects', null, null, 'FoobarObjects'],
+ [null, null, null, null],
+ ];
+ }
+}
+{{/apiInfo}}
diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker.mustache
index 80d6cd2e9db..4a335b5c312 100644
--- a/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker.mustache
+++ b/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker.mustache
@@ -34,6 +34,7 @@
namespace {{mockPackage}};
use {{mockPackage}}\{{interfaceNamePrefix}}OpenApiDataMocker{{interfaceNameSuffix}} as IMocker;
+use StdClass;
use InvalidArgumentException;
/**
@@ -82,6 +83,13 @@ final class OpenApiDataMocker implements IMocker
$maxItems = $options['maxItems'] ?? null;
$uniqueItems = $options['uniqueItems'] ?? false;
return $this->mockArray($items, $minItems, $maxItems, $uniqueItems);
+ case IMocker::DATA_TYPE_OBJECT:
+ $properties = $options['properties'] ?? null;
+ $minProperties = $options['minProperties'] ?? 0;
+ $maxProperties = $options['maxProperties'] ?? null;
+ $additionalProperties = $options['additionalProperties'] ?? null;
+ $required = $options['required'] ?? null;
+ return $this->mockObject($properties, $minProperties, $maxProperties, $additionalProperties, $required);
default:
throw new InvalidArgumentException('"dataType" must be one of ' . implode(', ', [
IMocker::DATA_TYPE_INTEGER,
@@ -89,6 +97,7 @@ final class OpenApiDataMocker implements IMocker
IMocker::DATA_TYPE_STRING,
IMocker::DATA_TYPE_BOOLEAN,
IMocker::DATA_TYPE_ARRAY,
+ IMocker::DATA_TYPE_OBJECT,
]));
}
}
@@ -220,10 +229,10 @@ final class OpenApiDataMocker implements IMocker
* Shortcut to mock array type
* Equivalent to mockData(DATA_TYPE_ARRAY);
*
- * @param array $items Array of described items
- * @param int|null $minItems (optional) An array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword.
- * @param int|null $maxItems (optional) An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword
- * @param bool|null $uniqueItems (optional) If it has boolean value true, the instance validates successfully if all of its elements are unique
+ * @param object|array $items Object or assoc array of described items
+ * @param int|null $minItems (optional) An array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword.
+ * @param int|null $maxItems (optional) An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword
+ * @param bool|null $uniqueItems (optional) If it has boolean value true, the instance validates successfully if all of its elements are unique
*
* @throws \InvalidArgumentException when invalid arguments passed
*
@@ -239,8 +248,12 @@ final class OpenApiDataMocker implements IMocker
$minSize = 0;
$maxSize = \PHP_INT_MAX;
- if (is_array($items) === false || array_key_exists('type', $items) === false) {
- throw new InvalidArgumentException('"items" must be assoc array with "type" key');
+ if (
+ (is_array($items) === false && is_object($items) === false)
+ || (is_array($items) && array_key_exists('type', $items) === false)
+ || (is_object($items) && isset($items->type) === false)
+ ) {
+ new InvalidArgumentException('"items" must be object or assoc array with "type" key');
}
if ($minItems !== null) {
@@ -260,9 +273,9 @@ final class OpenApiDataMocker implements IMocker
$maxSize = $maxItems;
}
- $dataType = $items['type'];
- $dataFormat = $items['format'] ?? null;
$options = $this->extractSchemaProperties($items);
+ $dataType = $options['type'];
+ $dataFormat = $options['format'] ?? null;
// always genarate smallest possible array to avoid huge JSON responses
$arrSize = ($maxSize < 1) ? $maxSize : max($minSize, 1);
@@ -273,17 +286,104 @@ final class OpenApiDataMocker implements IMocker
}
/**
- * @internal Extract OAS properties from array or object.
+ * Shortcut to mock object type.
+ * Equivalent to mockData(DATA_TYPE_OBJECT);
*
- * @param array $arr Processed array
+ * @param object|array $properties Object or array of described properties
+ * @param int|null $minProperties (optional) An object instance is valid against "minProperties" if its number of properties is greater than, or equal to, the value of this keyword.
+ * @param int|null $maxProperties (optional) An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, the value of this keyword.
+ * @param bool|object|array|null $additionalProperties (optional) If "additionalProperties" is true, validation always succeeds.
+ * If "additionalProperties" is false, validation succeeds only if the instance is an object and all properties on the instance were covered by "properties" and/or "patternProperties".
+ * If "additionalProperties" is an object, validate the value as a schema to all of the properties that weren't validated by "properties" nor "patternProperties".
+ * @param array|null $required (optional) This array MUST have at least one element. Elements of this array must be strings, and MUST be unique.
+ * An object instance is valid if its property set contains all elements in this array value.
+ *
+ * @throws \InvalidArgumentException when invalid arguments passed
+ *
+ * @return object
+ */
+ public function mockObject(
+ $properties,
+ $minProperties = 0,
+ $maxProperties = null,
+ $additionalProperties = null,
+ $required = null
+ ) {
+ $obj = new StdClass();
+
+ if (is_object($properties) === false && is_array($properties) === false) {
+ throw new InvalidArgumentException('The value of "properties" must be an array or object');
+ }
+
+ foreach ($properties as $propName => $propValue) {
+ if (is_object($propValue) === false && is_array($propValue) === false) {
+ throw new InvalidArgumentException('Each value of "properties" must be an array or object');
+ }
+ }
+
+ if ($minProperties !== null) {
+ if (is_integer($minProperties) === false || $minProperties < 0) {
+ throw new InvalidArgumentException('"minProperties" must be an integer. This integer must be greater than, or equal to, 0');
+ }
+ }
+
+ if ($maxProperties !== null) {
+ if (is_integer($maxProperties) === false || $maxProperties < 0) {
+ throw new InvalidArgumentException('"maxProperties" must be an integer. This integer must be greater than, or equal to, 0.');
+ }
+ if ($maxProperties < $minProperties) {
+ throw new InvalidArgumentException('"maxProperties" value cannot be less than "minProperties"');
+ }
+ }
+
+ if ($additionalProperties !== null) {
+ if (is_bool($additionalProperties) === false && is_object($additionalProperties) === false && is_array($additionalProperties) === false) {
+ throw new InvalidArgumentException('The value of "additionalProperties" must be a boolean or object or array.');
+ }
+ }
+
+ if ($required !== null) {
+ if (
+ is_array($required) === false
+ || count($required) > count(array_unique($required))
+ ) {
+ throw new InvalidArgumentException('The value of "required" must be an array. Elements of this array must be unique.');
+ }
+ foreach ($required as $requiredPropName) {
+ if (is_string($requiredPropName) === false) {
+ throw new InvalidArgumentException('Elements of "required" array must be strings');
+ }
+ }
+ }
+
+ foreach ($properties as $propName => $propValue) {
+ $options = $this->extractSchemaProperties($propValue);
+ $dataType = $options['type'];
+ $dataFormat = $options['dataFormat'] ?? null;
+ $obj->$propName = $this->mock($dataType, $dataFormat, $options);
+ }
+
+ return $obj;
+ }
+
+ /**
+ * @internal Extract OAS properties from array or object.
+ * @codeCoverageIgnore
+ *
+ * @param array|object $val Processed array or object
*
* @return array
*/
- private function extractSchemaProperties($arr)
+ private function extractSchemaProperties($val)
{
- $props = [];
+ $props = [
+ 'type' => null,
+ 'format' => null,
+ ];
foreach (
[
+ 'type',
+ 'format',
'minimum',
'maximum',
'exclusiveMinimum',
@@ -304,8 +404,10 @@ final class OpenApiDataMocker implements IMocker
'example',
] as $propName
) {
- if (array_key_exists($propName, $arr)) {
- $props[$propName] = $arr[$propName];
+ if (is_array($val) && array_key_exists($propName, $val)) {
+ $props[$propName] = $val[$propName];
+ } elseif (is_object($val) && isset($val->$propName)) {
+ $props[$propName] = $val->$propName;
}
}
return $props;
@@ -313,6 +415,7 @@ final class OpenApiDataMocker implements IMocker
/**
* @internal
+ * @codeCoverageIgnore
*
* @return float|int
*/
diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_interface.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_interface.mustache
index e94d55f1afd..cbed4323a22 100644
--- a/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_interface.mustache
+++ b/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_interface.mustache
@@ -63,6 +63,9 @@ interface {{interfaceNamePrefix}}OpenApiDataMocker{{interfaceNameSuffix}}
/** @var string DATA_TYPE_ARRAY */
public const DATA_TYPE_ARRAY = 'array';
+ /** @var string DATA_TYPE_OBJECT */
+ public const DATA_TYPE_OBJECT = 'object';
+
/** @var string DATA_FORMAT_INT32 Signed 32 bits */
public const DATA_FORMAT_INT32 = 'int32';
@@ -194,10 +197,10 @@ interface {{interfaceNamePrefix}}OpenApiDataMocker{{interfaceNameSuffix}}
* Shortcut to mock array type
* Equivalent to mockData(DATA_TYPE_ARRAY);
*
- * @param array $items Array of described items
- * @param int|null $minItems (optional) An array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword.
- * @param int|null $maxItems (optional) An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword
- * @param bool|null $uniqueItems (optional) If it has boolean value true, the instance validates successfully if all of its elements are unique
+ * @param object|array $items Object or assoc array of described items
+ * @param int|null $minItems (optional) An array instance is valid against "minItems" if its size is greater than, or equal to, the value of this keyword.
+ * @param int|null $maxItems (optional) An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword
+ * @param bool|null $uniqueItems (optional) If it has boolean value true, the instance validates successfully if all of its elements are unique
*
* @throws \InvalidArgumentException when invalid arguments passed
*
@@ -209,5 +212,30 @@ interface {{interfaceNamePrefix}}OpenApiDataMocker{{interfaceNameSuffix}}
$maxItems = null,
$uniqueItems = false
);
+
+ /**
+ * Shortcut to mock object type.
+ * Equivalent to mockData(DATA_TYPE_OBJECT);
+ *
+ * @param object|array $properties Object or array of described properties
+ * @param int|null $minProperties (optional) An object instance is valid against "minProperties" if its number of properties is greater than, or equal to, the value of this keyword.
+ * @param int|null $maxProperties (optional) An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, the value of this keyword.
+ * @param bool|object|array|null $additionalProperties (optional) If "additionalProperties" is true, validation always succeeds.
+ * If "additionalProperties" is false, validation succeeds only if the instance is an object and all properties on the instance were covered by "properties" and/or "patternProperties".
+ * If "additionalProperties" is an object, validate the value as a schema to all of the properties that weren't validated by "properties" nor "patternProperties".
+ * @param array|null $required (optional) This array MUST have at least one element. Elements of this array must be strings, and MUST be unique.
+ * An object instance is valid if its property set contains all elements in this array value.
+ *
+ * @throws \InvalidArgumentException when invalid arguments passed
+ *
+ * @return object
+ */
+ public function mockObject(
+ $properties,
+ $minProperties = 0,
+ $maxProperties = null,
+ $additionalProperties = null,
+ $required = null
+ );
}
{{/apiInfo}}
diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_test.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_test.mustache
index eef16fffd93..53a700bed73 100644
--- a/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_test.mustache
+++ b/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_test.mustache
@@ -37,6 +37,7 @@ use {{mockPackage}}\OpenApiDataMocker;
use {{mockPackage}}\{{interfaceNamePrefix}}OpenApiDataMocker{{interfaceNameSuffix}} as IMocker;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Constraint\IsType;
+use StdClass;
/**
* OpenApiDataMockerTest Class Doc Comment
@@ -55,7 +56,8 @@ class OpenApiDataMockerTest extends TestCase
public function testMockCorrectArguments($dataType, $dataFormat, $options, $expectedType)
{
$mocker = new OpenApiDataMocker();
- $this->assertInternalType($expectedType, $mocker->mock($dataType));
+ $data = $mocker->mock($dataType, $dataFormat, $options);
+ $this->assertInternalType($expectedType, $data);
}
public function provideMockCorrectArguments()
@@ -65,6 +67,39 @@ class OpenApiDataMockerTest extends TestCase
[IMocker::DATA_TYPE_NUMBER, null, null, IsType::TYPE_FLOAT],
[IMocker::DATA_TYPE_STRING, null, null, IsType::TYPE_STRING],
[IMocker::DATA_TYPE_BOOLEAN, null, null, IsType::TYPE_BOOL],
+ [IMocker::DATA_TYPE_ARRAY, null, [
+ 'items' => [
+ 'type' => IMocker::DATA_TYPE_INTEGER,
+ ],
+ ], IsType::TYPE_ARRAY],
+ [IMocker::DATA_TYPE_OBJECT, null, [
+ 'properties' => [
+ 'username' => [
+ 'type' => IMocker::DATA_TYPE_INTEGER,
+ ],
+ ],
+ ], IsType::TYPE_OBJECT],
+ ];
+ }
+
+ /**
+ * @covers ::mock
+ * @dataProvider provideMockInvalidArguments
+ * @expectedException \InvalidArgumentException
+ * @expectedExceptionMessage "dataType" must be one of integer, number, string, boolean, array, object
+ */
+ public function testMockInvalidArguments($dataType, $dataFormat, $options)
+ {
+ $mocker = new OpenApiDataMocker();
+ $data = $mocker->mock($dataType, $dataFormat, $options);
+ }
+
+ public function provideMockInvalidArguments()
+ {
+ return [
+ ['foobar', null, null],
+ [3.14, null, null],
+ [null, null, null],
];
}
@@ -440,28 +475,54 @@ class OpenApiDataMockerTest extends TestCase
$this->assertContainsOnly($expectedItemsType, $arr, true);
}
- $dataFormat = $items['dataFormat'] ?? null;
+ if (is_array($items)) {
+ $dataType = $items['type'];
+ $dataFormat = $items['dataFormat'] ?? null;
- // items field numeric properties
- $minimum = $items['minimum'] ?? null;
- $maximum = $items['maximum'] ?? null;
- $exclusiveMinimum = $items['exclusiveMinimum'] ?? null;
- $exclusiveMaximum = $items['exclusiveMaximum'] ?? null;
+ // items field numeric properties
+ $minimum = $items['minimum'] ?? null;
+ $maximum = $items['maximum'] ?? null;
+ $exclusiveMinimum = $items['exclusiveMinimum'] ?? null;
+ $exclusiveMaximum = $items['exclusiveMaximum'] ?? null;
- // items field string properties
- $minLength = $items['minLength'] ?? null;
- $maxLength = $items['maxLength'] ?? null;
- $enum = $items['enum'] ?? null;
- $pattern = $items['pattern'] ?? null;
+ // items field string properties
+ $minLength = $items['minLength'] ?? null;
+ $maxLength = $items['maxLength'] ?? null;
+ $enum = $items['enum'] ?? null;
+ $pattern = $items['pattern'] ?? null;
- // items field array properties
- $subItems = $items['items'] ?? null;
- $subMinItems = $items['minItems'] ?? null;
- $subMaxItems = $items['maxItems'] ?? null;
- $subUniqueItems = $items['uniqueItems'] ?? null;
+ // items field array properties
+ $subItems = $items['items'] ?? null;
+ $subMinItems = $items['minItems'] ?? null;
+ $subMaxItems = $items['maxItems'] ?? null;
+ $subUniqueItems = $items['uniqueItems'] ?? null;
+ } else {
+ // is object
+ $dataType = $items->type;
+ $dataFormat = $items->dataFormat ?? null;
+
+ // items field numeric properties
+ $minimum = $items->minimum ?? null;
+ $maximum = $items->maximum ?? null;
+ $exclusiveMinimum = $items->exclusiveMinimum ?? null;
+ $exclusiveMaximum = $items->exclusiveMaximum ?? null;
+
+ // items field string properties
+ $minLength = $items->minLength ?? null;
+ $maxLength = $items->maxLength ?? null;
+ $enum = $items->enum ?? null;
+ $pattern = $items->pattern ?? null;
+
+ // items field array properties
+ $subItems = $items->items ?? null;
+ $subMinItems = $items->minItems ?? null;
+ $subMaxItems = $items->maxItems ?? null;
+ $subUniqueItems = $items->uniqueItems ?? null;
+ }
+
foreach ($arr as $item) {
- switch ($items['type']) {
+ switch ($dataType) {
case IMocker::DATA_TYPE_INTEGER:
$this->internalAssertNumber($item, $minimum, $maximum, $exclusiveMinimum, $exclusiveMaximum);
break;
@@ -486,13 +547,15 @@ class OpenApiDataMockerTest extends TestCase
$intItems = ['type' => IMocker::DATA_TYPE_INTEGER, 'minimum' => 5, 'maximum' => 10];
$floatItems = ['type' => IMocker::DATA_TYPE_NUMBER, 'minimum' => -32.4, 'maximum' => 88.6, 'exclusiveMinimum' => true, 'exclusiveMaximum' => true];
$strItems = ['type' => IMocker::DATA_TYPE_STRING, 'minLength' => 20, 'maxLength' => 50];
- $boolItems = ['type' => IMocker::DATA_TYPE_BOOLEAN];
- $arrayItems = ['type' => IMocker::DATA_TYPE_ARRAY, 'items' => ['type' => IMocker::DATA_TYPE_STRING, 'minItems' => 3, 'maxItems' => 10]];
+ $boolItems = (object) ['type' => IMocker::DATA_TYPE_BOOLEAN];
+ $arrayItems = (object) ['type' => IMocker::DATA_TYPE_ARRAY, 'items' => ['type' => IMocker::DATA_TYPE_STRING, 'minItems' => 3, 'maxItems' => 10]];
+ $objectItems = (object) ['type' => IMocker::DATA_TYPE_OBJECT, 'properties' => (object)['username' => ['type' => IMocker::DATA_TYPE_STRING]]];
$expectedInt = IsType::TYPE_INT;
$expectedFloat = IsType::TYPE_FLOAT;
$expectedStr = IsType::TYPE_STRING;
$expectedBool = IsType::TYPE_BOOL;
$expectedArray = IsType::TYPE_ARRAY;
+ $expectedObject = IsType::TYPE_OBJECT;
return [
'empty array' => [
@@ -531,6 +594,9 @@ class OpenApiDataMockerTest extends TestCase
'array of one array of strings' => [
$arrayItems, null, null, false, $expectedArray, 1,
],
+ 'array of one object' => [
+ $objectItems, null, null, false, $expectedObject, 1
+ ],
];
}
@@ -583,5 +649,125 @@ class OpenApiDataMockerTest extends TestCase
],
];
}
+
+ /**
+ * @dataProvider provideMockObjectCorrectArguments
+ * @covers ::mockObject
+ */
+ public function testMockObjectWithCorrectArguments(
+ $properties,
+ $minProperties,
+ $maxProperties,
+ $additionalProperties,
+ $required,
+ $expectedKeys
+ ) {
+ $mocker = new OpenApiDataMocker();
+ $obj = $mocker->mockObject(
+ $properties,
+ $minProperties,
+ $maxProperties,
+ $additionalProperties,
+ $required
+ );
+
+ $this->assertInternalType(IsType::TYPE_OBJECT, $obj);
+ $this->assertSame($expectedKeys, array_keys(get_object_vars($obj)));
+ }
+
+ public function provideMockObjectCorrectArguments()
+ {
+ $additionProps = [
+ 'extra' => [
+ 'type' => IMocker::DATA_TYPE_STRING,
+ ],
+ ];
+ return [
+ 'empty object' => [
+ [], 1, 10, true, null, [],
+ ],
+ 'empty object from StdClass' => [
+ new StdClass(), 1, 5, false, null, [],
+ ],
+ 'object with username property' => [
+ [
+ 'username' => [
+ 'type' => IMocker::DATA_TYPE_STRING,
+ ],
+ ], 0, 5, $additionProps, null, ['username'],
+ ],
+ 'object with foobar property' => [
+ (object) [
+ 'foobar' => [
+ 'type' => IMocker::DATA_TYPE_INTEGER,
+ ],
+ ], 1, 1, (object) $additionProps, null, ['foobar'],
+ ],
+ ];
+ }
+
+ /**
+ * @dataProvider provideMockObjectInvalidArguments
+ * @expectedException \InvalidArgumentException
+ * @covers ::mockObject
+ */
+ public function testMockObjectWithInvalidArguments(
+ $properties,
+ $minProperties,
+ $maxProperties,
+ $additionalProperties,
+ $required
+ ) {
+ $mocker = new OpenApiDataMocker();
+ $obj = $mocker->mockObject($properties, $minProperties, $maxProperties, $additionalProperties, $required);
+ }
+
+ public function provideMockObjectInvalidArguments()
+ {
+ return [
+ 'properties cannot be null' => [
+ null, 0, 10, false, null,
+ ],
+ 'properties cannot be a string' => [
+ 'foobar', 0, 10, false, null,
+ ],
+ 'minProperties is not integer' => [
+ [], 3.12, null, false, null,
+ ],
+ 'minProperties is negative' => [
+ [], -10, null, false, null,
+ ],
+ 'minProperties is not number' => [
+ [], '1', null, false, null,
+ ],
+ 'maxProperties is not integer' => [
+ [], null, 3.12, false, null,
+ ],
+ 'maxProperties is negative' => [
+ [], null, -10, false, null,
+ ],
+ 'maxProperties is not number' => [
+ [], null, 'foobaz', false, null,
+ ],
+ 'maxProperties less than minProperties' => [
+ [], 5, 2, false, null,
+ ],
+ 'additionalProperties is not object|array|boolean' => [
+ [], null, null, 'foobar', null,
+ ],
+ 'required is object, not array' => [
+ [], null, null, null, new StdClass(),
+ ],
+ 'required is not array' => [
+ [], null, null, null, 'foobar',
+ ],
+ 'required array with duplicates' => [
+ [], null, null, null, ['username', 'username'],
+ ],
+ 'required array of non-strings' => [
+ [], null, null, null, [1, 2, 3],
+ ],
+ ];
+ }
}
{{/apiInfo}}
diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/phpunit.xml.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/phpunit.xml.mustache
index 81e19e73605..82f86439083 100644
--- a/modules/openapi-generator/src/main/resources/php-slim4-server/phpunit.xml.mustache
+++ b/modules/openapi-generator/src/main/resources/php-slim4-server/phpunit.xml.mustache
@@ -20,12 +20,16 @@
{{mockTestPath}}
+
+ {{utilsTestPath}}
+
{{apiSrcPath}}
{{modelSrcPath}}
{{mockSrcPath}}
+ {{utilsSrcPath}}
diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/string_utils_trait.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/string_utils_trait.mustache
new file mode 100644
index 00000000000..6d5d15feff6
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/php-slim4-server/string_utils_trait.mustache
@@ -0,0 +1,141 @@
+ 0) {
+ $str .= strtoupper(substr($z, 0, 1)) . substr($z, 1);
+ }
+ }
+ $word = $str;
+
+ // Uppercase the class name.
+ $p = '/(\.?)(\w)([^\.]*)$/';
+ $word = preg_replace_callback($p, function ($matches) {
+ $rep = $matches[1] . strtoupper($matches[2]) . $matches[3];
+ $rep = preg_replace('/\$/', '\\\$', $rep);
+ return $rep;
+ }, $word);
+
+ // Remove all underscores (underscore_case to camelCase)
+ $p = '/(_)(.)/';
+ while (preg_match($p, $word, $matches) === 1) {
+ $original = $matches[2][0];
+ $upperCase = strtoupper($original);
+ if ($original === $upperCase) {
+ $word = preg_replace($p, '$2', $word);
+ } else {
+ $word = preg_replace($p, $upperCase, $word);
+ }
+ }
+
+ // Remove all hyphens (hyphen-case to camelCase)
+ $p = '/(-)(.)/';
+ while (preg_match($p, $word, $matches) === 1) {
+ $upperCase = strtoupper($matches[2][0]);
+ $word = preg_replace($p, $upperCase, $word);
+ }
+
+ if ($lowercaseFirstLetter === true && strlen($word) > 0) {
+ $i = 0;
+ $charAt = substr($word, $i, 1);
+ while (
+ $i + 1 < strlen($word)
+ && !(
+ ($charAt >= 'a' && $charAt <= 'z')
+ || ($charAt >= 'A' && $charAt <= 'Z')
+ )
+ ) {
+ $i++;
+ $charAt = substr($word, $i, 1);
+ }
+ $i++;
+ $word = strtolower(substr($word, 0, $i)) . substr($word, $i);
+ }
+
+ // remove all underscore
+ $word = str_replace('_', '', $word);
+
+ return $word;
+ }
+
+ /**
+ * Checks whether string is reserved php keyword.
+ * This is recreated method of @link modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java class.
+ *
+ * @param string $word Checked string
+ *
+ * @return bool
+ */
+ public static function isReservedWord($word)
+ {
+ if (is_string($word) === false) {
+ return false;
+ }
+ // __halt_compiler is ommited because class names with underscores not allowed anyway
+ return in_array(
+ strtolower($word),
+ ['abstract', 'and', 'array', 'as', 'break', 'callable', 'case', 'catch', 'class', 'clone', 'const', 'continue', 'declare', 'default', 'die', 'do', 'echo', 'else', 'elseif', 'empty', 'enddeclare', 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile', 'eval', 'exit', 'extends', 'final', 'for', 'foreach', 'function', 'global', 'goto', 'if', 'implements', 'include', 'include_once', 'instanceof', 'insteadof', 'interface', 'isset', 'list', 'namespace', 'new', 'or', 'print', 'private', 'protected', 'public', 'require', 'require_once', 'return', 'static', 'switch', 'throw', 'trait', 'try', 'unset', 'use', 'var', 'while', 'xor']
+ );
+ }
+}
+{{/apiInfo}}
diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/string_utils_trait_test.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/string_utils_trait_test.mustache
new file mode 100644
index 00000000000..9698d6bcf6c
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/php-slim4-server/string_utils_trait_test.mustache
@@ -0,0 +1,108 @@
+assertSame($expectedWord, StringUtils::camelize($word, $lowercaseFirstLetter));
+ }
+
+ public function provideWordsForCamelizeTest()
+ {
+ return [
+ // fixtures from modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/StringUtilsTest.java
+ ['openApiServer/model/pet', null, 'OpenApiServerModelPet'],
+ ['abcd', null, 'Abcd'],
+ ['some-value', null, 'SomeValue'],
+ ['some-Value', null, 'SomeValue'],
+ ['some_value', null, 'SomeValue'],
+ ['some_Value', null, 'SomeValue'],
+ ['$type', null, '$Type'],
+
+ ['abcd', true, 'abcd'],
+ ['some-value', true, 'someValue'],
+ ['some_value', true, 'someValue'],
+ ['Abcd', true, 'abcd'],
+ ['$type', true, '$type'],
+
+ ['123', true, '123'],
+ ['$123', true, '$123'],
+ ];
+ }
+
+ /**
+ * @covers ::isReservedWord
+ * @dataProvider provideWordsForIsReservedTest
+ */
+ public function testisReservedWord($word, $expected)
+ {
+ $this->assertSame($expected, StringUtils::isReservedWord($word));
+ }
+
+ public function provideWordsForIsReservedTest()
+ {
+ return [
+ ['return', true],
+ ['switch', true],
+ ['class', true],
+ ['interface', true],
+ ['ABSTRACT', true],
+ ['Trait', true],
+ ['final', true],
+ ['foobar', false],
+ ['DateTime', false],
+ ['Pet', false],
+ [123, false],
+ [null, false],
+ ];
+ }
+}
+{{/apiInfo}}
diff --git a/modules/openapi-generator/src/main/resources/python-aiohttp/gitignore.mustache b/modules/openapi-generator/src/main/resources/python-aiohttp/gitignore.mustache
new file mode 100644
index 00000000000..43995bd42fa
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/python-aiohttp/gitignore.mustache
@@ -0,0 +1,66 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*,cover
+.hypothesis/
+venv/
+.venv/
+.python-version
+.pytest_cache
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+#Ipython Notebook
+.ipynb_checkpoints
diff --git a/modules/openapi-generator/src/main/resources/python-aiohttp/test-requirements.mustache b/modules/openapi-generator/src/main/resources/python-aiohttp/test-requirements.mustache
index 1cb425f6551..16ba4a48111 100644
--- a/modules/openapi-generator/src/main/resources/python-aiohttp/test-requirements.mustache
+++ b/modules/openapi-generator/src/main/resources/python-aiohttp/test-requirements.mustache
@@ -1,6 +1,13 @@
+{{#useNose}}
coverage>=4.0.3
-pytest>=1.3.7
+nose>=1.3.7
pluggy>=0.3.1
py>=1.4.31
randomize>=0.13
+{{/useNose}}
+{{^useNose}}
+pytest~=4.6.7 # needed for python 2.7+3.4
+pytest-cov>=2.8.1
+pytest-randomly==1.2.3 # needed for python 2.7+3.4
pytest-aiohttp>=0.3.0
+{{/useNose}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/python-aiohttp/tox.mustache b/modules/openapi-generator/src/main/resources/python-aiohttp/tox.mustache
new file mode 100644
index 00000000000..87cc65eeeb7
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/python-aiohttp/tox.mustache
@@ -0,0 +1,10 @@
+[tox]
+envlist = py3
+skipsdist=True
+
+[testenv]
+deps=-r{toxinidir}/requirements.txt
+ -r{toxinidir}/test-requirements.txt
+
+commands=
+ {{^useNose}}pytest --cov={{{packageName}}}{{/useNose}}{{#useNose}}nosetests{{/useNose}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/python-blueplanet/app/gitignore.mustache b/modules/openapi-generator/src/main/resources/python-blueplanet/app/gitignore.mustache
index a655050c263..a77a0ebd166 100644
--- a/modules/openapi-generator/src/main/resources/python-blueplanet/app/gitignore.mustache
+++ b/modules/openapi-generator/src/main/resources/python-blueplanet/app/gitignore.mustache
@@ -46,6 +46,7 @@ coverage.xml
.hypothesis/
venv/
.python-version
+.pytest_cache
# Translations
*.mo
diff --git a/modules/openapi-generator/src/main/resources/python-blueplanet/app/test-requirements.mustache b/modules/openapi-generator/src/main/resources/python-blueplanet/app/test-requirements.mustache
index 7f8d96e6b40..efad5423cb5 100644
--- a/modules/openapi-generator/src/main/resources/python-blueplanet/app/test-requirements.mustache
+++ b/modules/openapi-generator/src/main/resources/python-blueplanet/app/test-requirements.mustache
@@ -1,6 +1,13 @@
-flask_testing==0.6.1
+{{#useNose}}
coverage>=4.0.3
nose>=1.3.7
pluggy>=0.3.1
py>=1.4.31
randomize>=0.13
+{{/useNose}}
+{{^useNose}}
+pytest~=4.6.7 # needed for python 2.7+3.4
+pytest-cov>=2.8.1
+pytest-randomly==1.2.3 # needed for python 2.7+3.4
+{{/useNose}}
+flask_testing==0.6.1
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/python-blueplanet/app/tox.mustache b/modules/openapi-generator/src/main/resources/python-blueplanet/app/tox.mustache
index 3efa994317d..7b3246c36e2 100644
--- a/modules/openapi-generator/src/main/resources/python-blueplanet/app/tox.mustache
+++ b/modules/openapi-generator/src/main/resources/python-blueplanet/app/tox.mustache
@@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands=
- nosetests \
- []
\ No newline at end of file
+ {{^useNose}}pytest --cov={{{packageName}}}{{/useNose}}{{#useNose}}nosetests{{/useNose}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/python-flask/gitignore.mustache b/modules/openapi-generator/src/main/resources/python-flask/gitignore.mustache
index a655050c263..43995bd42fa 100644
--- a/modules/openapi-generator/src/main/resources/python-flask/gitignore.mustache
+++ b/modules/openapi-generator/src/main/resources/python-flask/gitignore.mustache
@@ -45,7 +45,9 @@ coverage.xml
*,cover
.hypothesis/
venv/
+.venv/
.python-version
+.pytest_cache
# Translations
*.mo
diff --git a/modules/openapi-generator/src/main/resources/python-flask/requirements.mustache b/modules/openapi-generator/src/main/resources/python-flask/requirements.mustache
index b5a702d5de8..921d67d029a 100644
--- a/modules/openapi-generator/src/main/resources/python-flask/requirements.mustache
+++ b/modules/openapi-generator/src/main/resources/python-flask/requirements.mustache
@@ -1,4 +1,7 @@
-connexion >= 2.0.2
+connexion >= 2.5.0; python_version>="3.6"
+connexion >= 2.3.0; python_version=="3.5"
+connexion >= 2.3.0; python_version=="3.4"
+connexion == 2.4.0; python_version<="2.7"
swagger-ui-bundle >= 0.0.2
python_dateutil >= 2.6.0
{{#supportPython2}}
diff --git a/modules/openapi-generator/src/main/resources/python-flask/test-requirements.mustache b/modules/openapi-generator/src/main/resources/python-flask/test-requirements.mustache
index 7f8d96e6b40..efad5423cb5 100644
--- a/modules/openapi-generator/src/main/resources/python-flask/test-requirements.mustache
+++ b/modules/openapi-generator/src/main/resources/python-flask/test-requirements.mustache
@@ -1,6 +1,13 @@
-flask_testing==0.6.1
+{{#useNose}}
coverage>=4.0.3
nose>=1.3.7
pluggy>=0.3.1
py>=1.4.31
randomize>=0.13
+{{/useNose}}
+{{^useNose}}
+pytest~=4.6.7 # needed for python 2.7+3.4
+pytest-cov>=2.8.1
+pytest-randomly==1.2.3 # needed for python 2.7+3.4
+{{/useNose}}
+flask_testing==0.6.1
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/python-flask/tox.mustache b/modules/openapi-generator/src/main/resources/python-flask/tox.mustache
index 1195b3391b0..7fcd185a8d8 100644
--- a/modules/openapi-generator/src/main/resources/python-flask/tox.mustache
+++ b/modules/openapi-generator/src/main/resources/python-flask/tox.mustache
@@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands=
- nosetests \
- []
\ No newline at end of file
+ {{^useNose}}pytest --cov={{{packageName}}}{{/useNose}}{{#useNose}}nosetests{{/useNose}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/python/gitignore.mustache b/modules/openapi-generator/src/main/resources/python/gitignore.mustache
index a655050c263..43995bd42fa 100644
--- a/modules/openapi-generator/src/main/resources/python/gitignore.mustache
+++ b/modules/openapi-generator/src/main/resources/python/gitignore.mustache
@@ -45,7 +45,9 @@ coverage.xml
*,cover
.hypothesis/
venv/
+.venv/
.python-version
+.pytest_cache
# Translations
*.mo
diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/test-requirements.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/test-requirements.mustache
index 023ff960788..338b229bae5 100644
--- a/modules/openapi-generator/src/main/resources/python/python-experimental/test-requirements.mustache
+++ b/modules/openapi-generator/src/main/resources/python/python-experimental/test-requirements.mustache
@@ -1,13 +1,13 @@
-{{^asyncio}}
+{{#useNose}}
coverage>=4.0.3
nose>=1.3.7
-{{/asyncio}}
-{{#asyncio}}
-pytest>=3.6.0
-pytest-cov>=2.6.1
-{{/asyncio}}
pluggy>=0.3.1
py>=1.4.31
randomize>=0.13
-mock; python_version<="2.7"
-
+{{/useNose}}
+{{^useNose}}
+pytest~=4.6.7 # needed for python 2.7+3.4
+pytest-cov>=2.8.1
+pytest-randomly==1.2.3 # needed for python 2.7+3.4
+{{/useNose}}
+mock; python_version<="2.7"
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/python/setup_cfg.mustache b/modules/openapi-generator/src/main/resources/python/setup_cfg.mustache
new file mode 100644
index 00000000000..d89aa72ee4c
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/python/setup_cfg.mustache
@@ -0,0 +1,13 @@
+{{#useNose}}
+[nosetests]
+logging-clear-handlers=true
+verbosity=2
+randomize=true
+exe=true
+with-coverage=true
+cover-package=petstore_api
+cover-erase=true
+
+{{/useNose}}
+[flake8]
+max-line-length=99
diff --git a/modules/openapi-generator/src/main/resources/python/test-requirements.mustache b/modules/openapi-generator/src/main/resources/python/test-requirements.mustache
index d9e3f20b536..12021b47a1c 100644
--- a/modules/openapi-generator/src/main/resources/python/test-requirements.mustache
+++ b/modules/openapi-generator/src/main/resources/python/test-requirements.mustache
@@ -1,11 +1,12 @@
-{{^asyncio}}
+{{#useNose}}
coverage>=4.0.3
nose>=1.3.7
-{{/asyncio}}
-{{#asyncio}}
-pytest>=3.6.0
-pytest-cov>=2.6.1
-{{/asyncio}}
pluggy>=0.3.1
py>=1.4.31
randomize>=0.13
+{{/useNose}}
+{{^useNose}}
+pytest~=4.6.7 # needed for python 2.7+3.4
+pytest-cov>=2.8.1
+pytest-randomly==1.2.3 # needed for python 2.7+3.4
+{{/useNose}}
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/python/tox.mustache b/modules/openapi-generator/src/main/resources/python/tox.mustache
index 585feb3c681..fe989faf930 100644
--- a/modules/openapi-generator/src/main/resources/python/tox.mustache
+++ b/modules/openapi-generator/src/main/resources/python/tox.mustache
@@ -11,10 +11,4 @@ deps=-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands=
-{{^asyncio}}
- nosetests \
- []
-{{/asyncio}}
-{{#asyncio}}
- pytest -v --cov {{{packageName}}}
-{{/asyncio}}
+ {{^useNose}}pytest --cov={{{packageName}}}{{/useNose}}{{#useNose}}nosetests{{/useNose}}
diff --git a/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache b/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache
index 8dd7eea26eb..cd5ba4fab6e 100644
--- a/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache
@@ -18,7 +18,7 @@ conversion = ["frunk", "frunk_derives", "frunk_core", "frunk-enum-core", "frunk-
chrono = { version = "0.4", features = ["serde"] }
futures = "0.1"
swagger = "2"
-lazy_static = "0.2"
+lazy_static = "1.4"
log = "0.3.0"
mime = "0.2.6"
multipart = "0.13.3"
diff --git a/modules/openapi-generator/src/main/resources/rust-server/client-mod.mustache b/modules/openapi-generator/src/main/resources/rust-server/client-mod.mustache
index 9c1bd23e0c9..bd0f3af3e01 100644
--- a/modules/openapi-generator/src/main/resources/rust-server/client-mod.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-server/client-mod.mustache
@@ -86,7 +86,7 @@ fn into_base_path(input: &str, correct_scheme: Option<&'static str>) -> Result where
F: Future- + 'static {
- client_service: Arc
, Response=hyper::Response, Error=hyper::Error, Future=F>>>,
+ client_service: Arc, Response=hyper::Response, Error=hyper::Error, Future=F>>>,
base_path: String,
}
@@ -197,7 +197,7 @@ impl Client {
handle: Handle,
base_path: &str,
protocol: Option<&'static str>,
- connector_fn: Box C + Send + Sync>,
+ connector_fn: Box C + Send + Sync>,
) -> Result, ClientInitError>
where
C: hyper::client::Connect + hyper::client::Service,
@@ -224,7 +224,7 @@ impl Client {
/// should be mentioned here.
#[deprecated(note="Use try_new_with_client_service instead")]
pub fn try_new_with_hyper_client(
- hyper_client: Arc, Response=hyper::Response, Error=hyper::Error, Future=hyper::client::FutureResponse>>>,
+ hyper_client: Arc, Response=hyper::Response, Error=hyper::Error, Future=hyper::client::FutureResponse>>>,
handle: Handle,
base_path: &str
) -> Result, ClientInitError>
@@ -242,7 +242,7 @@ impl Client where
/// Constructor for creating a `Client` by passing in a pre-made `hyper` client Service.
///
/// This allows adding custom wrappers around the underlying transport, for example for logging.
- pub fn try_new_with_client_service(client_service: Arc, Response=hyper::Response, Error=hyper::Error, Future=F>>>,
+ pub fn try_new_with_client_service(client_service: Arc, Response=hyper::Response, Error=hyper::Error, Future=F>>>,
handle: Handle,
base_path: &str)
-> Result, ClientInitError>
@@ -258,7 +258,7 @@ impl Api for Client where
F: Future- + 'static,
C: Has
{{#hasAuthMethods}}+ Has>{{/hasAuthMethods}}{
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}
- fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}(&self{{#allParams}}, param_{{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}{{/allParams}}, context: &C) -> Box> {
+ fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}(&self{{#allParams}}, param_{{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}{{/allParams}}, context: &C) -> Box> {
let mut uri = format!(
"{}{{{basePathWithoutHost}}}{{path}}",
self.base_path{{#pathParams}}, {{{baseName}}}=utf8_percent_encode(¶m_{{{paramName}}}.to_string(), ID_ENCODE_SET){{/pathParams}}
@@ -269,7 +269,7 @@ impl Api for Client where
{{^required}} if let Some({{{paramName}}}) = param_{{{paramName}}} {
query_string.append_pair("{{{baseName}}}", &{{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}{{^isListContainer}}.to_string(){{/isListContainer}});
}{{/required}}{{/queryParams}}
-{{#authMethods}}{{#isApiKey}}{{#isKeyInQuery}} if let Some(auth_data) = (context as &Has>).get().as_ref() {
+{{#authMethods}}{{#isApiKey}}{{#isKeyInQuery}} if let Some(auth_data) = (context as &dyn Has >).get().as_ref() {
if let AuthData::ApiKey(ref api_key) = *auth_data {
query_string.append_pair("{{keyParamName}}", api_key);
}
@@ -416,10 +416,10 @@ impl Api for Client where
{{/consumesMultipart}}
{{/vendorExtensions}}
- request.headers_mut().set(XSpanId((context as &Has).get().0.clone()));
+ request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone()));
{{#vendorExtensions.hasHeaderAuthMethods}}
- (context as &Has>).get().as_ref().map(|auth_data| {
+ (context as &dyn Has >).get().as_ref().map(|auth_data| {
// Currently only authentication with Basic, API Key, and Bearer are supported
match auth_data {
{{#authMethods}}
@@ -480,7 +480,7 @@ impl Api for Client where
{{#headers}} header! { (Response{{{nameInCamelCase}}}, "{{{baseName}}}") => [{{{datatype}}}] }
let response_{{{name}}} = match response.headers().get::() {
Some(response_{{{name}}}) => response_{{{name}}}.0.clone(),
- None => return Box::new(future::err(ApiError(String::from("Required response header {{{baseName}}} for response {{{code}}} was not found.")))) as Box>,
+ None => return Box::new(future::err(ApiError(String::from("Required response header {{{baseName}}} for response {{{code}}} was not found.")))) as Box>,
};
{{/headers}}
let body = response.body();
@@ -491,24 +491,30 @@ impl Api for Client where
.map_err(|e| ApiError(format!("Failed to read response: {}", e)))
.and_then(|body|
{{#vendorExtensions}}
-{{#producesPlainText}}
- Ok(swagger::ByteArray(body.to_vec()))
-{{/producesPlainText}}{{^producesPlainText}}
- str::from_utf8(&body)
- .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))
- .and_then(|body|
-{{#producesXml}}
- // ToDo: this will move to swagger-rs and become a standard From conversion trait
- // once https://github.com/RReverser/serde-xml-rs/pull/45 is accepted upstream
- serde_xml_rs::from_str::<{{{dataType}}}>(body)
- .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e)))
-{{/producesXml}}{{#producesJson}}
- serde_json::from_str::<{{{dataType}}}>(body)
- .map_err(|e| e.into())
-{{/producesJson}}
- )
-{{/producesPlainText}}{{/vendorExtensions}}
- )
+ {{#producesBytes}}
+ Ok(swagger::ByteArray(body.to_vec()))
+ {{/producesBytes}}
+ {{^producesBytes}}
+ str::from_utf8(&body)
+ .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))
+ .and_then(|body|
+ {{#producesXml}}
+ // ToDo: this will move to swagger-rs and become a standard From conversion trait
+ // once https://github.com/RReverser/serde-xml-rs/pull/45 is accepted upstream
+ serde_xml_rs::from_str::<{{{dataType}}}>(body)
+ .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e)))
+ {{/producesXml}}
+ {{#producesJson}}
+ serde_json::from_str::<{{{dataType}}}>(body)
+ .map_err(|e| e.into())
+ {{/producesJson}}
+ {{#producesPlainText}}
+ Ok(body.to_string())
+ {{/producesPlainText}}
+ )
+ {{/producesBytes}}
+{{/vendorExtensions}}
+ )
.map(move |body| {
{{{operationId}}}Response::{{#vendorExtensions}}{{x-responseId}}{{/vendorExtensions}}{{^headers}}(body){{/headers}}{{#headers}}{{#-first}}{ body: body, {{/-first}}{{{name}}}: response_{{{name}}}{{^-last}}, {{/-last}}{{#-last}} }{{/-last}}{{/headers}}
})
@@ -526,7 +532,7 @@ impl Api for Client where
{{/headers}}
)
{{/dataType}}
- ) as Box>
+ ) as Box>
},
{{/responses}}
code => {
@@ -546,7 +552,7 @@ impl Api for Client where
Err(e) => Cow::from(format!("", e)),
})))
)
- ) as Box>
+ ) as Box>
}
}
}))
@@ -577,7 +583,7 @@ impl From for ClientInitError {
impl fmt::Display for ClientInitError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- (self as &fmt::Debug).fmt(f)
+ (self as &dyn fmt::Debug).fmt(f)
}
}
diff --git a/modules/openapi-generator/src/main/resources/rust-server/example-client.mustache b/modules/openapi-generator/src/main/resources/rust-server/example-client.mustache
index 4657024c625..3d90017d84e 100644
--- a/modules/openapi-generator/src/main/resources/rust-server/example-client.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-server/example-client.mustache
@@ -72,7 +72,7 @@ fn main() {
{{#vendorExtensions}}{{#noClientExample}}// Disabled because there's no example.
// {{/noClientExample}}Some("{{{operationId}}}") => {
{{#noClientExample}}// {{/noClientExample}} let result = core.run(client.{{{operation_id}}}{{/vendorExtensions}}({{#allParams}}{{^-first}}, {{/-first}}{{#vendorExtensions}}{{{example}}}{{/vendorExtensions}}{{/allParams}}));
- {{#vendorExtensions}}{{#noClientExample}}// {{/noClientExample}}{{/vendorExtensions}} println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone());
+ {{#vendorExtensions}}{{#noClientExample}}// {{/noClientExample}}{{/vendorExtensions}} println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone());
{{#vendorExtensions}}{{#noClientExample}}// {{/noClientExample}}{{/vendorExtensions}} },
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
_ => {
diff --git a/modules/openapi-generator/src/main/resources/rust-server/example-server_server.mustache b/modules/openapi-generator/src/main/resources/rust-server/example-server_server.mustache
index 89bf5d89224..f0b72b52b91 100644
--- a/modules/openapi-generator/src/main/resources/rust-server/example-server_server.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-server/example-server_server.mustache
@@ -31,7 +31,7 @@ impl Server {
impl Api for Server where C: Has{
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}
{{#summary}} /// {{{summary}}}{{/summary}}
- fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}(&self{{#allParams}}, {{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}{{/allParams}}, context: &C) -> Box> {
+ fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}(&self{{#allParams}}, {{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}{{/allParams}}, context: &C) -> Box> {
let context = context.clone();
println!("{{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}({{#allParams}}{{#vendorExtensions}}{{{formatString}}}{{/vendorExtensions}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) - X-Span-ID: {:?}"{{#allParams}}, {{{paramName}}}{{/allParams}}, context.get().0.clone());{{#allParams}}{{/allParams}}
Box::new(futures::failed("Generic failure".into()))
diff --git a/modules/openapi-generator/src/main/resources/rust-server/lib.mustache b/modules/openapi-generator/src/main/resources/rust-server/lib.mustache
index 218f2b0579f..e505b843fbf 100644
--- a/modules/openapi-generator/src/main/resources/rust-server/lib.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-server/lib.mustache
@@ -92,7 +92,7 @@ pub enum {{{operationId}}}Response {
pub trait Api {
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}
{{#summary}} /// {{{summary}}}{{/summary}}
- fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}(&self{{#allParams}}, {{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}{{/allParams}}, context: &C) -> Box>;
+ fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}(&self{{#allParams}}, {{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}{{/allParams}}, context: &C) -> Box>;
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
}
@@ -100,7 +100,7 @@ pub trait Api {
pub trait ApiNoContext {
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}
{{#summary}} /// {{{summary}}}{{/summary}}
- fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}(&self{{#allParams}}, {{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}{{/allParams}}) -> Box>;
+ fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}(&self{{#allParams}}, {{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}{{/allParams}}) -> Box>;
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
}
@@ -119,7 +119,7 @@ impl<'a, T: Api + Sized, C> ContextWrapperExt<'a, C> for T {
impl<'a, T: Api, C> ApiNoContext for ContextWrapper<'a, T, C> {
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}
{{#summary}} /// {{{summary}}}{{/summary}}
- fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}(&self{{#allParams}}, {{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}{{/allParams}}) -> Box> {
+ fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}(&self{{#allParams}}, {{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}{{/allParams}}) -> Box> {
self.api().{{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}({{#allParams}}{{{paramName}}}, {{/allParams}}&self.context())
}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
diff --git a/modules/openapi-generator/src/main/resources/rust-server/mimetypes.mustache b/modules/openapi-generator/src/main/resources/rust-server/mimetypes.mustache
index b8492bebf98..7df7d28f46e 100644
--- a/modules/openapi-generator/src/main/resources/rust-server/mimetypes.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-server/mimetypes.mustache
@@ -7,7 +7,7 @@ pub mod responses {
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}{{#responses}}{{#produces}}{{#-first}}{{#dataType}}
lazy_static! {
/// Create Mime objects for the response content types for {{{operationId}}}
- pub static ref {{#vendorExtensions}}{{{uppercase_operation_id}}}_{{x-uppercaseResponseId}}{{/vendorExtensions}}: Mime = "{{{mediaType}}}".parse().unwrap();
+ pub static ref {{#vendorExtensions}}{{{uppercase_operation_id}}}_{{x-uppercaseResponseId}}: Mime = "{{{mimeType}}}".parse().unwrap();{{/vendorExtensions}}
}
{{/dataType}}{{/-first}}{{/produces}}{{/responses}}{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
}
diff --git a/modules/openapi-generator/src/main/resources/rust-server/server-mod.mustache b/modules/openapi-generator/src/main/resources/rust-server/server-mod.mustache
index 1806ac1208b..060b64422b7 100644
--- a/modules/openapi-generator/src/main/resources/rust-server/server-mod.mustache
+++ b/modules/openapi-generator/src/main/resources/rust-server/server-mod.mustache
@@ -128,7 +128,7 @@ where
type Request = (Request, C);
type Response = Response;
type Error = Error;
- type Future = Box>;
+ type Future = Box>;
fn call(&self, (req, mut context): Self::Request) -> Self::Future {
let api_impl = self.api_impl.clone();
@@ -143,7 +143,7 @@ where
&hyper::Method::{{vendorExtensions.HttpMethod}} if path.matched(paths::ID_{{vendorExtensions.PATH_ID}}) => {
{{#hasAuthMethods}}
{
- let authorization = match (&context as &Has>).get() {
+ let authorization = match (&context as &dyn Has >).get() {
&Some(ref authorization) => authorization,
&None => return Box::new(future::ok(Response::new()
.with_status(StatusCode::Forbidden)
@@ -257,7 +257,7 @@ where
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
Box::new(body.concat2()
- .then(move |result| -> Box> {
+ .then(move |result| -> Box> {
match result {
Ok(body) => {
{{#vendorExtensions}}
@@ -313,7 +313,7 @@ where
// values, rather than causing a 400 response). Produce warning header and logs for
// any unused fields.
Box::new(body.concat2()
- .then(move |result| -> Box> {
+ .then(move |result| -> Box> {
match result {
Ok(body) => {
// Read Form Parameters from body
@@ -404,7 +404,7 @@ where
Box::new(api_impl.{{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}({{#allParams}}param_{{{paramName}}}{{#isListContainer}}.as_ref(){{/isListContainer}}, {{/allParams}}&context)
.then(move |result| {
let mut response = Response::new();
- response.headers_mut().set(XSpanId((&context as &Has).get().0.to_string()));
+ response.headers_mut().set(XSpanId((&context as &dyn Has).get().0.to_string()));
{{#bodyParams}}{{#vendorExtensions}}{{^consumesPlainText}}
if !unused_elements.is_empty() {
response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements)));
@@ -444,18 +444,28 @@ where
response.headers_mut().set(ContentType(mimetypes::responses::{{#vendorExtensions}}{{{uppercase_operation_id}}}_{{x-uppercaseResponseId}}{{/vendorExtensions}}.clone()));
{{/dataType}}{{/-first}}{{/produces}}
{{#dataType}}
-{{#vendorExtensions}}{{#producesXml}}{{^has_namespace}}
+{{#vendorExtensions}}
+ {{#producesXml}}
+ {{^has_namespace}}
let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
-{{/has_namespace}}{{#has_namespace}}
+ {{/has_namespace}}
+ {{#has_namespace}}
let mut namespaces = BTreeMap::new();
// An empty string is used to indicate a global namespace in xmltree.
namespaces.insert("".to_string(), {{{dataType}}}::NAMESPACE.to_string());
let body = serde_xml_rs::to_string_with_namespaces(&body, namespaces).expect("impossible to fail to serialize");
-{{/has_namespace}}{{/producesXml}}{{#producesJson}}
+ {{/has_namespace}}
+ {{/producesXml}}
+ {{#producesJson}}
let body = serde_json::to_string(&body).expect("impossible to fail to serialize");
-{{/producesJson}}{{#producesPlainText}}
+ {{/producesJson}}
+ {{#producesBytes}}
let body = body.0;
-{{/producesPlainText}}{{/vendorExtensions}}
+ {{/producesBytes}}
+ {{#producesPlainText}}
+ let body = body;
+ {{/producesPlainText}}
+{{/vendorExtensions}}
response.set_body(body);
{{/dataType}}
},
@@ -476,7 +486,7 @@ where
{{^consumesMultipart}}
{{^bodyParams}}
}}
- }) as Box>
+ }) as Box>
{{/bodyParams}}
{{/consumesMultipart}}
{{/vendorExtensions}}
@@ -486,13 +496,13 @@ where
Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter {{{baseName}}}: {}", e)))),
}
})
- ) as Box>
+ ) as Box>
{{/-first}}
{{/bodyParams}}
{{#vendorExtensions}}
{{#consumesMultipart}}
{{^bodyParams}}
- as Box>
+ as Box>
},
Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read multipart body")))),
}
@@ -503,7 +513,7 @@ where
{{/vendorExtensions}}
},
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
- _ => Box::new(future::ok(Response::new().with_status(StatusCode::NotFound))) as Box>,
+ _ => Box::new(future::ok(Response::new().with_status(StatusCode::NotFound))) as Box>,
}
}
}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java
index 0f25bf02e8c..d6fa3a18803 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java
@@ -488,6 +488,7 @@ public class DefaultCodegenTest {
test.setPropertyBaseName("className");
test.getMappedModels().add(new CodegenDiscriminator.MappedModel("Dog", "Dog"));
test.getMappedModels().add(new CodegenDiscriminator.MappedModel("Cat", "Cat"));
+ test.getMappedModels().add(new CodegenDiscriminator.MappedModel("BigCat", "BigCat"));
Assert.assertEquals(discriminator, test);
}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/asciidoc/AsciidocGeneratorTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/asciidoc/AsciidocGeneratorTest.java
index 746a5bd87af..a685a47e428 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/asciidoc/AsciidocGeneratorTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/asciidoc/AsciidocGeneratorTest.java
@@ -22,7 +22,7 @@ import org.testng.annotations.Test;
import io.swagger.v3.oas.models.OpenAPI;
-/** check against ping.yaml spec. */
+/** unit test asciidoc markup generation against ping.yaml openapi spec. */
public class AsciidocGeneratorTest {
private static final Logger LOGGER = LoggerFactory.getLogger(AsciidocGeneratorTest.class);
@@ -113,5 +113,41 @@ public class AsciidocGeneratorTest {
Assert.assertTrue(markupFileGenerated, "index.adoc is not generated!");
}
+
+
+ @Test
+ public void testHeaderAttributesFlagRemovesAttributesFromMarkupHeaderSection() throws Exception {
+ File output = Files.createTempDirectory("test").toFile();
+
+ LOGGER.info("test: generating sample markup " + output.getAbsolutePath());
+
+ Map props = new TreeMap();
+ props.put("specDir", "spec");
+
+ final CodegenConfigurator configurator = new CodegenConfigurator()
+ .setGeneratorName("asciidoc")
+ .setInputSpec("src/test/resources/3_0/ping.yaml")
+ .setOutputDir(output.getAbsolutePath())
+ .addAdditionalProperty(AsciidocDocumentationCodegen.HEADER_ATTRIBUTES_FLAG, "false") // option avoids generation of attributes
+ .addAdditionalProperty(AsciidocDocumentationCodegen.SPEC_DIR, "SPEC-DIR")
+ .addAdditionalProperty(AsciidocDocumentationCodegen.SNIPPET_DIR, "MY/SNIPPET/DIR");
+
+ DefaultGenerator generator = new DefaultGenerator();
+ boolean markupFileGenerated = false;
+ List files = generator.opts(configurator.toClientOptInput()).generate();
+ for (File file : files) {
+ if (file.getName().equals("index.adoc")) {
+ markupFileGenerated = true;
+ String markupContent = FileUtils.readFileToString(file, StandardCharsets.UTF_8);
+ Assert.assertFalse(markupContent.contains(":specDir: SPEC-DIR"),
+ "not expected :specDir: in: " + markupContent.substring(0, 250));
+ Assert.assertFalse(markupContent.contains(":snippetDir: MY/SNIPPET/DIR"),
+ "not expected :snippetDir: in: " + markupContent.substring(0, 250));
+ Assert.assertFalse(markupContent.contains(":toc:"),
+ "not expected :toc: in: " + markupContent.substring(0, 250)); // typical attributes not found in markup.
+ }
+ }
+ Assert.assertTrue(markupFileGenerated, "index.adoc is not generated!");
+ }
}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartClientOptionsTest.java
index e9e32475553..902a0ebad30 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartClientOptionsTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartClientOptionsTest.java
@@ -52,6 +52,12 @@ public class DartClientOptionsTest extends AbstractOptionsTest {
times = 1;
clientCodegen.setPubDescription(DartClientOptionsProvider.PUB_DESCRIPTION_VALUE);
times = 1;
+ clientCodegen.setPubAuthor(DartClientOptionsProvider.PUB_AUTHOR_VALUE);
+ times = 1;
+ clientCodegen.setPubAuthorEmail(DartClientOptionsProvider.PUB_AUTHOR_EMAIL_VALUE);
+ times = 1;
+ clientCodegen.setPubHomepage(DartClientOptionsProvider.PUB_HOMEPAGE_VALUE);
+ times = 1;
clientCodegen.setSourceFolder(DartClientOptionsProvider.SOURCE_FOLDER_VALUE);
times = 1;
clientCodegen.setUseEnumExtension(Boolean.valueOf(DartClientOptionsProvider.USE_ENUM_EXTENSION));
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioClientOptionsTest.java
index f59c02ddf48..3f53525a52a 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioClientOptionsTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioClientOptionsTest.java
@@ -21,10 +21,8 @@ import mockit.Expectations;
import mockit.Tested;
import org.openapitools.codegen.AbstractOptionsTest;
import org.openapitools.codegen.CodegenConfig;
-import org.openapitools.codegen.languages.DartClientCodegen;
import org.openapitools.codegen.languages.DartDioClientCodegen;
import org.openapitools.codegen.options.DartDioClientOptionsProvider;
-import org.openapitools.codegen.options.DartDioClientOptionsProvider;
public class DartDioClientOptionsTest extends AbstractOptionsTest {
@@ -54,6 +52,12 @@ public class DartDioClientOptionsTest extends AbstractOptionsTest {
times = 1;
clientCodegen.setPubDescription(DartDioClientOptionsProvider.PUB_DESCRIPTION_VALUE);
times = 1;
+ //clientCodegen.setPubAuthor(DartDioClientOptionsProvider.PUB_AUTHOR_VALUE);
+ //times = 1;
+ //clientCodegen.setPubAuthorEmail(DartDioClientOptionsProvider.PUB_AUTHOR_EMAIL_VALUE);
+ //times = 1;
+ //clientCodegen.setPubHomepage(DartDioClientOptionsProvider.PUB_HOMEPAGE_VALUE);
+ //times = 1;
clientCodegen.setSourceFolder(DartDioClientOptionsProvider.SOURCE_FOLDER_VALUE);
times = 1;
clientCodegen.setUseEnumExtension(Boolean.valueOf(DartDioClientOptionsProvider.USE_ENUM_EXTENSION));
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java
index 7a6f4f79d19..c34f467b699 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java
@@ -58,6 +58,8 @@ public class GoClientOptionsTest extends AbstractOptionsTest {
times = 1;
clientCodegen.setStructPrefix(Boolean.valueOf(GoClientOptionsProvider.STRUCT_PREFIX_VALUE));
times = 1;
+ clientCodegen.setWithAWSV4Signature(Boolean.valueOf(GoClientOptionsProvider.WITH_AWSV4_SIGNATURE));
+ times = 1;
}};
}
}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJaxrsBaseTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJaxrsBaseTest.java
index ca580b8a75d..a37aab8ce79 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJaxrsBaseTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJaxrsBaseTest.java
@@ -45,6 +45,7 @@ public abstract class JavaJaxrsBaseTest {
String jsonSubType = "@JsonSubTypes({\n" +
" @JsonSubTypes.Type(value = Dog.class, name = \"Dog\"),\n" +
" @JsonSubTypes.Type(value = Cat.class, name = \"Cat\"),\n" +
+ " @JsonSubTypes.Type(value = BigDog.class, name = \"BigDog\"),\n" +
"})";
assertFileContains(generator, outputPath + "/src/gen/java/org/openapitools/model/Animal.java", jsonTypeInfo, jsonSubType);
}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/mysql/MysqlSchemaCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/mysql/MysqlSchemaCodegenTest.java
index 7cf9fc80d3b..b1fa6b646b5 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/mysql/MysqlSchemaCodegenTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/mysql/MysqlSchemaCodegenTest.java
@@ -274,4 +274,24 @@ public class MysqlSchemaCodegenTest {
Assert.assertFalse(codegen.getJsonDataTypeEnabled());
}
+ @Test
+ public void testSetIdentifierNamingConvention() {
+ final MysqlSchemaCodegen codegen = new MysqlSchemaCodegen();
+ Assert.assertSame("original", codegen.getIdentifierNamingConvention());
+ codegen.setIdentifierNamingConvention("invalidValue");
+ Assert.assertSame("original", codegen.getIdentifierNamingConvention());
+ codegen.setIdentifierNamingConvention("snake_case");
+ Assert.assertSame("snake_case", codegen.getIdentifierNamingConvention());
+ codegen.setIdentifierNamingConvention("anotherInvalid");
+ Assert.assertSame("snake_case", codegen.getIdentifierNamingConvention());
+ }
+
+ @Test
+ public void testGetIdentifierNamingConvention() {
+ final MysqlSchemaCodegen codegen = new MysqlSchemaCodegen();
+ Assert.assertSame("original", codegen.getIdentifierNamingConvention());
+ codegen.setIdentifierNamingConvention("snake_case");
+ Assert.assertSame("snake_case", codegen.getIdentifierNamingConvention());
+ }
+
}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/mysql/MysqlSchemaOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/mysql/MysqlSchemaOptionsTest.java
index 677eaacdf84..01ce4a04884 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/mysql/MysqlSchemaOptionsTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/mysql/MysqlSchemaOptionsTest.java
@@ -45,6 +45,8 @@ public class MysqlSchemaOptionsTest extends AbstractOptionsTest {
times = 1;
clientCodegen.setJsonDataTypeEnabled(Boolean.valueOf(MysqlSchemaOptionsProvider.JSON_DATA_TYPE_ENABLED_VALUE));
times = 1;
+ clientCodegen.setIdentifierNamingConvention(MysqlSchemaOptionsProvider.IDENTIFIER_NAMING_CONVENTION_VALUE);
+ times = 1;
}};
}
}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java
index 0ed8360cd61..4bd72b19ca3 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java
@@ -28,9 +28,12 @@ public class DartClientOptionsProvider implements OptionsProvider {
public static final String SORT_MODEL_PROPERTIES_VALUE = "false";
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
public static final String BROWSER_CLIENT_VALUE = "true";
- public static final String PUB_NAME_VALUE = "swagger";
+ public static final String PUB_NAME_VALUE = "openapi";
public static final String PUB_VERSION_VALUE = "1.0.0-SNAPSHOT";
- public static final String PUB_DESCRIPTION_VALUE = "Swagger API client dart";
+ public static final String PUB_DESCRIPTION_VALUE = "OpenAPI API client dart";
+ public static final String PUB_AUTHOR_VALUE = "Author";
+ public static final String PUB_AUTHOR_EMAIL_VALUE = "author@homepage";
+ public static final String PUB_HOMEPAGE_VALUE = "Homepage";
public static final String SOURCE_FOLDER_VALUE = "src";
public static final String USE_ENUM_EXTENSION = "true";
public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false";
@@ -51,6 +54,9 @@ public class DartClientOptionsProvider implements OptionsProvider {
.put(DartClientCodegen.PUB_NAME, PUB_NAME_VALUE)
.put(DartClientCodegen.PUB_VERSION, PUB_VERSION_VALUE)
.put(DartClientCodegen.PUB_DESCRIPTION, PUB_DESCRIPTION_VALUE)
+ .put(DartClientCodegen.PUB_AUTHOR, PUB_AUTHOR_VALUE)
+ .put(DartClientCodegen.PUB_AUTHOR_EMAIL, PUB_AUTHOR_EMAIL_VALUE)
+ .put(DartClientCodegen.PUB_HOMEPAGE, PUB_HOMEPAGE_VALUE)
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
.put(DartClientCodegen.USE_ENUM_EXTENSION, USE_ENUM_EXTENSION)
.put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE)
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioClientOptionsProvider.java
index 067d0cc4342..981a8ef6684 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioClientOptionsProvider.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioClientOptionsProvider.java
@@ -18,29 +18,33 @@
package org.openapitools.codegen.options;
import com.google.common.collect.ImmutableMap;
+
import java.util.Map;
+
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.languages.DartDioClientCodegen;
-import org.openapitools.codegen.languages.DartDioClientCodegen;
public class DartDioClientOptionsProvider implements OptionsProvider {
public static final String SORT_PARAMS_VALUE = "true";
public static final String SORT_MODEL_PROPERTIES_VALUE = "false";
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
public static final String BROWSER_CLIENT_VALUE = "true";
- public static final String PUB_NAME_VALUE = "swagger";
+ public static final String PUB_NAME_VALUE = "openapi";
public static final String PUB_VERSION_VALUE = "1.0.0-SNAPSHOT";
- public static final String PUB_DESCRIPTION_VALUE = "Swagger API client dart";
+ public static final String PUB_DESCRIPTION_VALUE = "OpenAPI API client dart";
public static final String SOURCE_FOLDER_VALUE = "src";
public static final String USE_ENUM_EXTENSION = "true";
public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false";
public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true";
public static final String DATE_LIBRARY = "core";
public static final String NULLABLE_FIELDS = "true";
+ public static final String PUB_AUTHOR_VALUE = "Author";
+ public static final String PUB_AUTHOR_EMAIL_VALUE = "author@homepage";
+ public static final String PUB_HOMEPAGE_VALUE = "Homepage";
@Override
public String getLanguage() {
- return "dart";
+ return "dart-dio";
}
@Override
@@ -53,6 +57,9 @@ public class DartDioClientOptionsProvider implements OptionsProvider {
.put(DartDioClientCodegen.PUB_NAME, PUB_NAME_VALUE)
.put(DartDioClientCodegen.PUB_VERSION, PUB_VERSION_VALUE)
.put(DartDioClientCodegen.PUB_DESCRIPTION, PUB_DESCRIPTION_VALUE)
+ .put(DartDioClientCodegen.PUB_AUTHOR, PUB_AUTHOR_VALUE)
+ .put(DartDioClientCodegen.PUB_AUTHOR_EMAIL, PUB_AUTHOR_EMAIL_VALUE)
+ .put(DartDioClientCodegen.PUB_HOMEPAGE, PUB_HOMEPAGE_VALUE)
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
.put(DartDioClientCodegen.USE_ENUM_EXTENSION, USE_ENUM_EXTENSION)
.put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE)
@@ -60,8 +67,7 @@ public class DartDioClientOptionsProvider implements OptionsProvider {
.put(DartDioClientCodegen.SUPPORT_DART2, "false")
.put(DartDioClientCodegen.DATE_LIBRARY, DATE_LIBRARY)
.put(DartDioClientCodegen.NULLABLE_FIELDS, NULLABLE_FIELDS)
-
- .build();
+ .build();
}
@Override
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java
index 9ccf0584ab3..e11ff84b592 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java
@@ -32,6 +32,7 @@ public class GoClientOptionsProvider implements OptionsProvider {
public static final Boolean PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = true;
public static final boolean IS_GO_SUBMODULE_VALUE = true;
public static final boolean STRUCT_PREFIX_VALUE = true;
+ public static final boolean WITH_AWSV4_SIGNATURE = true;
@Override
public String getLanguage() {
@@ -50,6 +51,7 @@ public class GoClientOptionsProvider implements OptionsProvider {
.put(CodegenConstants.ENUM_CLASS_PREFIX, "true")
.put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, "true")
.put(CodegenConstants.IS_GO_SUBMODULE, "true")
+ .put(CodegenConstants.WITH_AWSV4_SIGNATURE_COMMENT, "true")
.put("structPrefix", "true")
.build();
}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/MysqlSchemaOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/MysqlSchemaOptionsProvider.java
index 1af42991c93..67218e92467 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/MysqlSchemaOptionsProvider.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/MysqlSchemaOptionsProvider.java
@@ -24,6 +24,7 @@ import java.util.Map;
public class MysqlSchemaOptionsProvider implements OptionsProvider {
public static final String DEFAULT_DATABASE_NAME_VALUE = "database_name";
public static final String JSON_DATA_TYPE_ENABLED_VALUE = "false";
+ public static final String IDENTIFIER_NAMING_CONVENTION_VALUE = "snake_case";
@Override
public String getLanguage() {
@@ -35,6 +36,7 @@ public class MysqlSchemaOptionsProvider implements OptionsProvider {
ImmutableMap.Builder builder = new ImmutableMap.Builder();
return builder.put(MysqlSchemaCodegen.DEFAULT_DATABASE_NAME, DEFAULT_DATABASE_NAME_VALUE)
.put(MysqlSchemaCodegen.JSON_DATA_TYPE_ENABLED, JSON_DATA_TYPE_ENABLED_VALUE)
+ .put(MysqlSchemaCodegen.IDENTIFIER_NAMING_CONVENTION, IDENTIFIER_NAMING_CONVENTION_VALUE)
.build();
}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonClientOptionsProvider.java
index f74b17266ce..d3afcc8f844 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonClientOptionsProvider.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonClientOptionsProvider.java
@@ -28,6 +28,7 @@ public class PythonClientOptionsProvider implements OptionsProvider {
public static final String PROJECT_NAME_VALUE = "swagger-client-python";
public static final String PACKAGE_VERSION_VALUE = "1.0.0-SNAPSHOT";
public static final String PACKAGE_URL_VALUE = "";
+ public static final String USE_NOSE_VALUE = "false";
@Override
public String getLanguage() {
@@ -45,6 +46,7 @@ public class PythonClientOptionsProvider implements OptionsProvider {
.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true")
.put(CodegenConstants.SOURCECODEONLY_GENERATION, "false")
.put(CodegenConstants.LIBRARY, "urllib3")
+ .put(PythonClientCodegen.USE_NOSE, USE_NOSE_VALUE)
.build();
}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientOptionsTest.java
index 47d59ba78c4..ce9d564f470 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientOptionsTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientOptionsTest.java
@@ -56,6 +56,9 @@ public class PythonClientOptionsTest extends AbstractOptionsTest {
clientCodegen.setPackageUrl(PythonClientOptionsProvider.PACKAGE_URL_VALUE);
times = 1;
+ clientCodegen.setUseNose(PythonClientOptionsProvider.USE_NOSE_VALUE);
+ times = 1;
+
clientCodegen.packagePath();
result = PythonClientOptionsProvider.PACKAGE_NAME_VALUE.replace('.', File.separatorChar);
minTimes = 1;
diff --git a/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
index 73d734f75fa..02c9e70300b 100644
--- a/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
+++ b/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
@@ -1330,6 +1330,14 @@ definitions:
properties:
declawed:
type: boolean
+ BigCat:
+ allOf:
+ - $ref: '#/definitions/Cat'
+ - type: object
+ properties:
+ kind:
+ type: string
+ enum: [lions, tigers, leopards, jaguars]
Animal:
type: object
discriminator: className
diff --git a/modules/openapi-generator/src/test/resources/3_0/issue-4062.yaml b/modules/openapi-generator/src/test/resources/3_0/issue-4062.yaml
new file mode 100644
index 00000000000..2ad7665265c
--- /dev/null
+++ b/modules/openapi-generator/src/test/resources/3_0/issue-4062.yaml
@@ -0,0 +1,33 @@
+openapi: 3.0.0
+servers:
+ - url: 'http://petstore.swagger.io/v2'
+info:
+ description: Test for issue 4062
+ version: 1.0.0
+ title: OpenAPI Petstore
+ license:
+ name: Apache-2.0
+ url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
+paths:
+ /enum:
+ get:
+ tags:
+ - enum
+ summary: Get enums
+ description: ''
+ operationId: getEnum
+ responses:
+ '200':
+ description: success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/PetEnum'
+components:
+ schemas:
+ PetEnum:
+ type: string
+ description: An enum with complex-ish naming
+ enum:
+ - myFirstValue
+ - MY_SECOND_VALUE
\ No newline at end of file
diff --git a/modules/openapi-generator/src/test/resources/3_0/rust-server/openapi-v3.yaml b/modules/openapi-generator/src/test/resources/3_0/rust-server/openapi-v3.yaml
index 2e558056871..619a49d1c50 100644
--- a/modules/openapi-generator/src/test/resources/3_0/rust-server/openapi-v3.yaml
+++ b/modules/openapi-generator/src/test/resources/3_0/rust-server/openapi-v3.yaml
@@ -45,6 +45,56 @@ paths:
description: 'OK'
'400':
description: Bad Request
+ /multiget:
+ get:
+ summary: Get some stuff.
+ responses:
+ 200:
+ description: JSON rsp
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/anotherXmlObject"
+ 201:
+ description: XML rsp
+ content:
+ application/xml:
+ schema:
+ type: object
+ properties:
+ foo:
+ type: string
+ 202:
+ description: octet rsp
+ content:
+ application/octet-stream:
+ schema:
+ type: string
+ format: binary
+ 203:
+ description: string rsp
+ content:
+ text/plain:
+ schema:
+ type: string
+ 204:
+ description: Duplicate Response long text. One.
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/anotherXmlObject"
+ 205:
+ description: Duplicate Response long text. Two.
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/anotherXmlObject"
+ 206:
+ description: Duplicate Response long text. Three.
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/anotherXmlObject"
/xml_other:
post:
requestBody:
diff --git a/samples/client/petstore/ada/.openapi-generator/VERSION b/samples/client/petstore/ada/.openapi-generator/VERSION
index afa63656064..58592f031f6 100644
--- a/samples/client/petstore/ada/.openapi-generator/VERSION
+++ b/samples/client/petstore/ada/.openapi-generator/VERSION
@@ -1 +1 @@
-4.0.0-SNAPSHOT
\ No newline at end of file
+4.2.3-SNAPSHOT
\ No newline at end of file
diff --git a/samples/client/petstore/ada/petstore.gpr b/samples/client/petstore/ada/petstore.gpr
index 4c8ce69b930..e4036b9bfa4 100644
--- a/samples/client/petstore/ada/petstore.gpr
+++ b/samples/client/petstore/ada/petstore.gpr
@@ -6,8 +6,9 @@
--
-- NOTE: Auto generated by the swagger code generator program.
with "config";
-with "util";
-with "util_http";
+with "utilada_sys";
+with "utilada_xml";
+with "utilada_http";
with "security";
with "swagger";
project Petstore is
diff --git a/samples/client/petstore/ada/src/client/samples-petstore-clients.adb b/samples/client/petstore/ada/src/client/samples-petstore-clients.adb
index e479690cf44..1920cbf1fe4 100644
--- a/samples/client/petstore/ada/src/client/samples-petstore-clients.adb
+++ b/samples/client/petstore/ada/src/client/samples-petstore-clients.adb
@@ -1,10 +1,10 @@
-- OpenAPI Petstore
-- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters.
--
--- OpenAPI spec version: 1.0.0
+-- The version of the OpenAPI document: 1.0.0
--
--
--- NOTE: This package is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT.
+-- NOTE: This package is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT.
-- https://openapi-generator.tech
-- Do not edit the class manually.
@@ -14,7 +14,7 @@ package body Samples.Petstore.Clients is
-- Add a new pet to the store
procedure Add_Pet
(Client : in out Client_Type;
- P_Body : in Samples.Petstore.Models.PetType) is
+ P_Body : in Samples.Petstore.Models.Pet_Type) is
URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type;
begin
@@ -46,7 +46,7 @@ package body Samples.Petstore.Clients is
procedure Find_Pets_By_Status
(Client : in out Client_Type;
Status : in Swagger.UString_Vectors.Vector;
- Result : out Samples.Petstore.Models.PetType_Vectors.Vector) is
+ Result : out Samples.Petstore.Models.Pet_Type_Vectors.Vector) is
URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type;
begin
@@ -64,7 +64,7 @@ package body Samples.Petstore.Clients is
procedure Find_Pets_By_Tags
(Client : in out Client_Type;
Tags : in Swagger.UString_Vectors.Vector;
- Result : out Samples.Petstore.Models.PetType_Vectors.Vector) is
+ Result : out Samples.Petstore.Models.Pet_Type_Vectors.Vector) is
URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type;
begin
@@ -82,7 +82,7 @@ package body Samples.Petstore.Clients is
procedure Get_Pet_By_Id
(Client : in out Client_Type;
Pet_Id : in Swagger.Long;
- Result : out Samples.Petstore.Models.PetType) is
+ Result : out Samples.Petstore.Models.Pet_Type) is
URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type;
begin
@@ -98,7 +98,7 @@ package body Samples.Petstore.Clients is
-- Update an existing pet
procedure Update_Pet
(Client : in out Client_Type;
- P_Body : in Samples.Petstore.Models.PetType) is
+ P_Body : in Samples.Petstore.Models.Pet_Type) is
URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type;
begin
@@ -136,7 +136,7 @@ package body Samples.Petstore.Clients is
Pet_Id : in Swagger.Long;
Additional_Metadata : in Swagger.Nullable_UString;
File : in Swagger.File_Part_Type;
- Result : out Samples.Petstore.Models.ApiResponseType) is
+ Result : out Samples.Petstore.Models.ApiResponse_Type) is
URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type;
Reply : Swagger.Value_Type;
@@ -186,7 +186,7 @@ package body Samples.Petstore.Clients is
procedure Get_Order_By_Id
(Client : in out Client_Type;
Order_Id : in Swagger.Long;
- Result : out Samples.Petstore.Models.OrderType) is
+ Result : out Samples.Petstore.Models.Order_Type) is
URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type;
begin
@@ -202,8 +202,8 @@ package body Samples.Petstore.Clients is
-- Place an order for a pet
procedure Place_Order
(Client : in out Client_Type;
- P_Body : in Samples.Petstore.Models.OrderType;
- Result : out Samples.Petstore.Models.OrderType) is
+ P_Body : in Samples.Petstore.Models.Order_Type;
+ Result : out Samples.Petstore.Models.Order_Type) is
URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type;
Reply : Swagger.Value_Type;
@@ -222,7 +222,7 @@ package body Samples.Petstore.Clients is
-- This can only be done by the logged in user.
procedure Create_User
(Client : in out Client_Type;
- P_Body : in Samples.Petstore.Models.UserType) is
+ P_Body : in Samples.Petstore.Models.User_Type) is
URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type;
begin
@@ -237,7 +237,7 @@ package body Samples.Petstore.Clients is
-- Creates list of users with given input array
procedure Create_Users_With_Array_Input
(Client : in out Client_Type;
- P_Body : in Samples.Petstore.Models.UserType_Vectors.Vector) is
+ P_Body : in Samples.Petstore.Models.User_Type_Vectors.Vector) is
URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type;
begin
@@ -252,7 +252,7 @@ package body Samples.Petstore.Clients is
-- Creates list of users with given input array
procedure Create_Users_With_List_Input
(Client : in out Client_Type;
- P_Body : in Samples.Petstore.Models.UserType_Vectors.Vector) is
+ P_Body : in Samples.Petstore.Models.User_Type_Vectors.Vector) is
URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type;
begin
@@ -282,7 +282,7 @@ package body Samples.Petstore.Clients is
procedure Get_User_By_Name
(Client : in out Client_Type;
Username : in Swagger.UString;
- Result : out Samples.Petstore.Models.UserType) is
+ Result : out Samples.Petstore.Models.User_Type) is
URI : Swagger.Clients.URI_Type;
Reply : Swagger.Value_Type;
begin
@@ -330,7 +330,7 @@ package body Samples.Petstore.Clients is
procedure Update_User
(Client : in out Client_Type;
Username : in Swagger.UString;
- P_Body : in Samples.Petstore.Models.UserType) is
+ P_Body : in Samples.Petstore.Models.User_Type) is
URI : Swagger.Clients.URI_Type;
Req : Swagger.Clients.Request_Type;
begin
diff --git a/samples/client/petstore/ada/src/client/samples-petstore-clients.ads b/samples/client/petstore/ada/src/client/samples-petstore-clients.ads
index 581760b2404..adc6a3c692a 100644
--- a/samples/client/petstore/ada/src/client/samples-petstore-clients.ads
+++ b/samples/client/petstore/ada/src/client/samples-petstore-clients.ads
@@ -1,10 +1,10 @@
-- OpenAPI Petstore
-- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters.
--
--- OpenAPI spec version: 1.0.0
+-- The version of the OpenAPI document: 1.0.0
--
--
--- NOTE: This package is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT.
+-- NOTE: This package is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT.
-- https://openapi-generator.tech
-- Do not edit the class manually.
@@ -17,7 +17,7 @@ package Samples.Petstore.Clients is
-- Add a new pet to the store
procedure Add_Pet
(Client : in out Client_Type;
- P_Body : in Samples.Petstore.Models.PetType);
+ P_Body : in Samples.Petstore.Models.Pet_Type);
-- Deletes a pet
procedure Delete_Pet
@@ -30,26 +30,26 @@ package Samples.Petstore.Clients is
procedure Find_Pets_By_Status
(Client : in out Client_Type;
Status : in Swagger.UString_Vectors.Vector;
- Result : out Samples.Petstore.Models.PetType_Vectors.Vector);
+ Result : out Samples.Petstore.Models.Pet_Type_Vectors.Vector);
-- Finds Pets by tags
-- Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
procedure Find_Pets_By_Tags
(Client : in out Client_Type;
Tags : in Swagger.UString_Vectors.Vector;
- Result : out Samples.Petstore.Models.PetType_Vectors.Vector);
+ Result : out Samples.Petstore.Models.Pet_Type_Vectors.Vector);
-- Find pet by ID
-- Returns a single pet
procedure Get_Pet_By_Id
(Client : in out Client_Type;
Pet_Id : in Swagger.Long;
- Result : out Samples.Petstore.Models.PetType);
+ Result : out Samples.Petstore.Models.Pet_Type);
-- Update an existing pet
procedure Update_Pet
(Client : in out Client_Type;
- P_Body : in Samples.Petstore.Models.PetType);
+ P_Body : in Samples.Petstore.Models.Pet_Type);
-- Updates a pet in the store with form data
procedure Update_Pet_With_Form
@@ -64,7 +64,7 @@ package Samples.Petstore.Clients is
Pet_Id : in Swagger.Long;
Additional_Metadata : in Swagger.Nullable_UString;
File : in Swagger.File_Part_Type;
- Result : out Samples.Petstore.Models.ApiResponseType);
+ Result : out Samples.Petstore.Models.ApiResponse_Type);
-- Delete purchase order by ID
-- For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
@@ -83,29 +83,29 @@ package Samples.Petstore.Clients is
procedure Get_Order_By_Id
(Client : in out Client_Type;
Order_Id : in Swagger.Long;
- Result : out Samples.Petstore.Models.OrderType);
+ Result : out Samples.Petstore.Models.Order_Type);
-- Place an order for a pet
procedure Place_Order
(Client : in out Client_Type;
- P_Body : in Samples.Petstore.Models.OrderType;
- Result : out Samples.Petstore.Models.OrderType);
+ P_Body : in Samples.Petstore.Models.Order_Type;
+ Result : out Samples.Petstore.Models.Order_Type);
-- Create user
-- This can only be done by the logged in user.
procedure Create_User
(Client : in out Client_Type;
- P_Body : in Samples.Petstore.Models.UserType);
+ P_Body : in Samples.Petstore.Models.User_Type);
-- Creates list of users with given input array
procedure Create_Users_With_Array_Input
(Client : in out Client_Type;
- P_Body : in Samples.Petstore.Models.UserType_Vectors.Vector);
+ P_Body : in Samples.Petstore.Models.User_Type_Vectors.Vector);
-- Creates list of users with given input array
procedure Create_Users_With_List_Input
(Client : in out Client_Type;
- P_Body : in Samples.Petstore.Models.UserType_Vectors.Vector);
+ P_Body : in Samples.Petstore.Models.User_Type_Vectors.Vector);
-- Delete user
-- This can only be done by the logged in user.
@@ -117,7 +117,7 @@ package Samples.Petstore.Clients is
procedure Get_User_By_Name
(Client : in out Client_Type;
Username : in Swagger.UString;
- Result : out Samples.Petstore.Models.UserType);
+ Result : out Samples.Petstore.Models.User_Type);
-- Logs user into the system
procedure Login_User
@@ -135,6 +135,6 @@ package Samples.Petstore.Clients is
procedure Update_User
(Client : in out Client_Type;
Username : in Swagger.UString;
- P_Body : in Samples.Petstore.Models.UserType);
+ P_Body : in Samples.Petstore.Models.User_Type);
end Samples.Petstore.Clients;
diff --git a/samples/client/petstore/ada/src/model/samples-petstore-models.adb b/samples/client/petstore/ada/src/model/samples-petstore-models.adb
index d03b9401c37..db3f9463478 100644
--- a/samples/client/petstore/ada/src/model/samples-petstore-models.adb
+++ b/samples/client/petstore/ada/src/model/samples-petstore-models.adb
@@ -1,10 +1,10 @@
-- OpenAPI Petstore
-- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters.
--
--- OpenAPI spec version: 1.0.0
+-- The version of the OpenAPI document: 1.0.0
--
--
--- NOTE: This package is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT.
+-- NOTE: This package is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT.
-- https://openapi-generator.tech
-- Do not edit the class manually.
@@ -17,7 +17,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in ApiResponseType) is
+ Value : in ApiResponse_Type) is
begin
Into.Start_Entity (Name);
Into.Write_Entity ("code", Value.Code);
@@ -28,7 +28,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in ApiResponseType_Vectors.Vector) is
+ Value : in ApiResponse_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
@@ -39,7 +39,7 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out ApiResponseType) is
+ Value : out ApiResponse_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
@@ -50,9 +50,9 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out ApiResponseType_Vectors.Vector) is
+ Value : out ApiResponse_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
- Item : ApiResponseType;
+ Item : ApiResponse_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
@@ -67,7 +67,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in TagType) is
+ Value : in Tag_Type) is
begin
Into.Start_Entity (Name);
Serialize (Into, "id", Value.Id);
@@ -77,7 +77,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in TagType_Vectors.Vector) is
+ Value : in Tag_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
@@ -88,7 +88,7 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out TagType) is
+ Value : out Tag_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
@@ -98,9 +98,9 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out TagType_Vectors.Vector) is
+ Value : out Tag_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
- Item : TagType;
+ Item : Tag_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
@@ -115,7 +115,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in CategoryType) is
+ Value : in Category_Type) is
begin
Into.Start_Entity (Name);
Serialize (Into, "id", Value.Id);
@@ -125,7 +125,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in CategoryType_Vectors.Vector) is
+ Value : in Category_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
@@ -136,7 +136,7 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out CategoryType) is
+ Value : out Category_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
@@ -146,9 +146,9 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out CategoryType_Vectors.Vector) is
+ Value : out Category_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
- Item : CategoryType;
+ Item : Category_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
@@ -163,7 +163,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in PetType) is
+ Value : in Pet_Type) is
begin
Into.Start_Entity (Name);
Serialize (Into, "id", Value.Id);
@@ -177,7 +177,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in PetType_Vectors.Vector) is
+ Value : in Pet_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
@@ -188,23 +188,23 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out PetType) is
+ Value : out Pet_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "id", Value.Id);
- Swagger.Streams.Deserialize (Object, "category", Value.Category);
+ Deserialize (Object, "category", Value.Category);
Swagger.Streams.Deserialize (Object, "name", Value.Name);
Swagger.Streams.Deserialize (Object, "photoUrls", Value.Photo_Urls);
- Swagger.Streams.Deserialize (Object, "tags", Value.Tags);
+ Deserialize (Object, "tags", Value.Tags);
Swagger.Streams.Deserialize (Object, "status", Value.Status);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out PetType_Vectors.Vector) is
+ Value : out Pet_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
- Item : PetType;
+ Item : Pet_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
@@ -219,7 +219,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in UserType) is
+ Value : in User_Type) is
begin
Into.Start_Entity (Name);
Serialize (Into, "id", Value.Id);
@@ -235,7 +235,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in UserType_Vectors.Vector) is
+ Value : in User_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
@@ -246,7 +246,7 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out UserType) is
+ Value : out User_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
@@ -262,9 +262,9 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out UserType_Vectors.Vector) is
+ Value : out User_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
- Item : UserType;
+ Item : User_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
@@ -279,7 +279,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in OrderType) is
+ Value : in Order_Type) is
begin
Into.Start_Entity (Name);
Serialize (Into, "id", Value.Id);
@@ -293,7 +293,7 @@ package body Samples.Petstore.Models is
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in OrderType_Vectors.Vector) is
+ Value : in Order_Type_Vectors.Vector) is
begin
Into.Start_Array (Name);
for Item of Value loop
@@ -304,23 +304,23 @@ package body Samples.Petstore.Models is
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out OrderType) is
+ Value : out Order_Type) is
Object : Swagger.Value_Type;
begin
Swagger.Streams.Deserialize (From, Name, Object);
Swagger.Streams.Deserialize (Object, "id", Value.Id);
Swagger.Streams.Deserialize (Object, "petId", Value.Pet_Id);
Swagger.Streams.Deserialize (Object, "quantity", Value.Quantity);
- Swagger.Streams.Deserialize (Object, "shipDate", Value.Ship_Date);
+ Deserialize (Object, "shipDate", Value.Ship_Date);
Swagger.Streams.Deserialize (Object, "status", Value.Status);
Swagger.Streams.Deserialize (Object, "complete", Value.Complete);
end Deserialize;
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out OrderType_Vectors.Vector) is
+ Value : out Order_Type_Vectors.Vector) is
List : Swagger.Value_Array_Type;
- Item : OrderType;
+ Item : Order_Type;
begin
Value.Clear;
Swagger.Streams.Deserialize (From, Name, List);
diff --git a/samples/client/petstore/ada/src/model/samples-petstore-models.ads b/samples/client/petstore/ada/src/model/samples-petstore-models.ads
index f52cb0676fc..4b0e867aa07 100644
--- a/samples/client/petstore/ada/src/model/samples-petstore-models.ads
+++ b/samples/client/petstore/ada/src/model/samples-petstore-models.ads
@@ -1,10 +1,10 @@
-- OpenAPI Petstore
-- This is a sample server Petstore server. For this sample, you can use the api key `special_key` to test the authorization filters.
--
--- OpenAPI spec version: 1.0.0
+-- The version of the OpenAPI document: 1.0.0
--
--
--- NOTE: This package is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT.
+-- NOTE: This package is auto generated by OpenAPI-Generator 4.2.3-SNAPSHOT.
-- https://openapi-generator.tech
-- Do not edit the class manually.
@@ -17,32 +17,32 @@ package Samples.Petstore.Models is
-- An uploaded response
-- Describes the result of uploading an image resource
-- ------------------------------
- type ApiResponseType is
+ type ApiResponse_Type is
record
- Code : Integer;
- P_Type : Swagger.UString;
- Message : Swagger.UString;
+ Code : Swagger.Nullable_Integer;
+ P_Type : Swagger.Nullable_UString;
+ Message : Swagger.Nullable_UString;
end record;
- package ApiResponseType_Vectors is
+ package ApiResponse_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
- Element_Type => ApiResponseType);
+ Element_Type => ApiResponse_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in ApiResponseType);
+ Value : in ApiResponse_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in ApiResponseType_Vectors.Vector);
+ Value : in ApiResponse_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out ApiResponseType);
+ Value : out ApiResponse_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out ApiResponseType_Vectors.Vector);
+ Value : out ApiResponse_Type_Vectors.Vector);
@@ -50,31 +50,31 @@ package Samples.Petstore.Models is
-- Pet Tag
-- A tag for a pet
-- ------------------------------
- type TagType is
+ type Tag_Type is
record
- Id : Swagger.Long;
- Name : Swagger.UString;
+ Id : Swagger.Nullable_Long;
+ Name : Swagger.Nullable_UString;
end record;
- package TagType_Vectors is
+ package Tag_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
- Element_Type => TagType);
+ Element_Type => Tag_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in TagType);
+ Value : in Tag_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in TagType_Vectors.Vector);
+ Value : in Tag_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out TagType);
+ Value : out Tag_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out TagType_Vectors.Vector);
+ Value : out Tag_Type_Vectors.Vector);
@@ -82,31 +82,31 @@ package Samples.Petstore.Models is
-- Pet category
-- A category for a pet
-- ------------------------------
- type CategoryType is
+ type Category_Type is
record
- Id : Swagger.Long;
- Name : Swagger.UString;
+ Id : Swagger.Nullable_Long;
+ Name : Swagger.Nullable_UString;
end record;
- package CategoryType_Vectors is
+ package Category_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
- Element_Type => CategoryType);
+ Element_Type => Category_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in CategoryType);
+ Value : in Category_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in CategoryType_Vectors.Vector);
+ Value : in Category_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out CategoryType);
+ Value : out Category_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out CategoryType_Vectors.Vector);
+ Value : out Category_Type_Vectors.Vector);
@@ -114,35 +114,35 @@ package Samples.Petstore.Models is
-- a Pet
-- A pet for sale in the pet store
-- ------------------------------
- type PetType is
+ type Pet_Type is
record
- Id : Swagger.Long;
- Category : Samples.Petstore.Models.CategoryType;
+ Id : Swagger.Nullable_Long;
+ Category : Samples.Petstore.Models.Category_Type;
Name : Swagger.UString;
Photo_Urls : Swagger.UString_Vectors.Vector;
- Tags : Samples.Petstore.Models.TagType_Vectors.Vector;
- Status : Swagger.UString;
+ Tags : Samples.Petstore.Models.Tag_Type_Vectors.Vector;
+ Status : Swagger.Nullable_UString;
end record;
- package PetType_Vectors is
+ package Pet_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
- Element_Type => PetType);
+ Element_Type => Pet_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in PetType);
+ Value : in Pet_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in PetType_Vectors.Vector);
+ Value : in Pet_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out PetType);
+ Value : out Pet_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out PetType_Vectors.Vector);
+ Value : out Pet_Type_Vectors.Vector);
@@ -150,37 +150,37 @@ package Samples.Petstore.Models is
-- a User
-- A User who is purchasing from the pet store
-- ------------------------------
- type UserType is
+ type User_Type is
record
- Id : Swagger.Long;
- Username : Swagger.UString;
- First_Name : Swagger.UString;
- Last_Name : Swagger.UString;
- Email : Swagger.UString;
- Password : Swagger.UString;
- Phone : Swagger.UString;
- User_Status : Integer;
+ Id : Swagger.Nullable_Long;
+ Username : Swagger.Nullable_UString;
+ First_Name : Swagger.Nullable_UString;
+ Last_Name : Swagger.Nullable_UString;
+ Email : Swagger.Nullable_UString;
+ Password : Swagger.Nullable_UString;
+ Phone : Swagger.Nullable_UString;
+ User_Status : Swagger.Nullable_Integer;
end record;
- package UserType_Vectors is
+ package User_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
- Element_Type => UserType);
+ Element_Type => User_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in UserType);
+ Value : in User_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in UserType_Vectors.Vector);
+ Value : in User_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out UserType);
+ Value : out User_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out UserType_Vectors.Vector);
+ Value : out User_Type_Vectors.Vector);
@@ -188,35 +188,35 @@ package Samples.Petstore.Models is
-- Pet Order
-- An order for a pets from the pet store
-- ------------------------------
- type OrderType is
+ type Order_Type is
record
- Id : Swagger.Long;
- Pet_Id : Swagger.Long;
- Quantity : Integer;
- Ship_Date : Swagger.Datetime;
- Status : Swagger.UString;
- Complete : Boolean;
+ Id : Swagger.Nullable_Long;
+ Pet_Id : Swagger.Nullable_Long;
+ Quantity : Swagger.Nullable_Integer;
+ Ship_Date : Swagger.Nullable_Date;
+ Status : Swagger.Nullable_UString;
+ Complete : Swagger.Nullable_Boolean;
end record;
- package OrderType_Vectors is
+ package Order_Type_Vectors is
new Ada.Containers.Vectors (Index_Type => Positive,
- Element_Type => OrderType);
+ Element_Type => Order_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in OrderType);
+ Value : in Order_Type);
procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class;
Name : in String;
- Value : in OrderType_Vectors.Vector);
+ Value : in Order_Type_Vectors.Vector);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out OrderType);
+ Value : out Order_Type);
procedure Deserialize (From : in Swagger.Value_Type;
Name : in String;
- Value : out OrderType_Vectors.Vector);
+ Value : out Order_Type_Vectors.Vector);
diff --git a/samples/client/petstore/ada/src/petstore.adb b/samples/client/petstore/ada/src/petstore.adb
index 9c1db2490ad..6254252e57c 100644
--- a/samples/client/petstore/ada/src/petstore.adb
+++ b/samples/client/petstore/ada/src/petstore.adb
@@ -5,12 +5,10 @@ with Util.Http.Clients.Curl;
with Ada.Text_IO;
with Ada.Command_Line;
with Ada.Calendar.Formatting;
-with Ada.Strings.Unbounded;
with Ada.Exceptions;
-procedure Test is
+procedure Petstore is
use Ada.Text_IO;
- use type Ada.Strings.Unbounded.Unbounded_String;
procedure Usage;
procedure Print_Pet (Pet : in Samples.Petstore.Models.Pet_Type);
@@ -65,7 +63,7 @@ procedure Test is
Need_Indent := False;
Put ("URLs : ");
for Url of Pet.Photo_Urls loop
- Put_Line ((if Need_Indent then " " else "") & Swagger.To_String (Url.Value));
+ Put_Line ((if Need_Indent then " " else "") & Url);
Need_Indent := True;
end loop;
end if;
@@ -130,10 +128,10 @@ procedure Test is
begin
for I in Arg .. Arg_Count loop
declare
- Status : Swagger.Nullable_UString_Vectors.Vector;
+ Status : Swagger.UString_Vectors.Vector;
P : constant String := Ada.Command_Line.Argument (I);
begin
- Status.Append ((Is_Null => False, Value => Swagger.To_UString (P)));
+ Status.Append (New_Item => P);
C.Find_Pets_By_Status (Status, Pets);
for Pet of Pets loop
Print_Pet (Pet);
@@ -143,17 +141,17 @@ procedure Test is
end List_Pet;
procedure List_Inventory (C : in out Samples.Petstore.Clients.Client_Type) is
- List : Swagger.Nullable_Integer_Map;
- Iter : Swagger.Nullable_Integer_Maps.Cursor;
+ List : Swagger.Integer_Map;
+ Iter : Swagger.Integer_Maps.Cursor;
begin
C.Get_Inventory (List);
Ada.Text_IO.Put_Line ("Inventory size " & Natural'Image (Natural (List.Length)));
Iter := List.First;
- while Swagger.Nullable_Integer_Maps.Has_Element (Iter) loop
- Put (Swagger.Nullable_Integer_Maps.Key (Iter));
+ while Swagger.Integer_Maps.Has_Element (Iter) loop
+ Put (Swagger.Integer_Maps.Key (Iter));
Set_Col (70);
- Put_Line (Natural'Image (Swagger.Nullable_Integer_Maps.Element (Iter).Value));
- Swagger.Nullable_Integer_Maps.Next (Iter);
+ Put_Line (Natural'Image (Swagger.Integer_Maps.Element (Iter)));
+ Swagger.Integer_Maps.Next (Iter);
end loop;
end List_Inventory;
@@ -271,4 +269,4 @@ begin
Put_Line ("Constraint error raised: " & Ada.Exceptions.Exception_Message (E));
end;
-end Test;
+end Petstore;
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md
index 46e3202f715..eb8098a2e3b 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md
@@ -145,6 +145,8 @@ Class | Method | HTTP request | Description
- [Model.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [Model.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [Model.ArrayTest](docs/ArrayTest.md)
+ - [Model.BigCat](docs/BigCat.md)
+ - [Model.BigCatAllOf](docs/BigCatAllOf.md)
- [Model.Capitalization](docs/Capitalization.md)
- [Model.Cat](docs/Cat.md)
- [Model.CatAllOf](docs/CatAllOf.md)
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/BigCat.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/BigCat.md
new file mode 100644
index 00000000000..41c336e4ca9
--- /dev/null
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/BigCat.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.BigCat
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Declawed** | **bool** | | [optional]
+**Kind** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/BigCatAllOf.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/BigCatAllOf.md
new file mode 100644
index 00000000000..88a739b7e4a
--- /dev/null
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/BigCatAllOf.md
@@ -0,0 +1,9 @@
+# Org.OpenAPITools.Model.BigCatAllOf
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Kind** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Model/BigCatAllOfTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Model/BigCatAllOfTests.cs
new file mode 100644
index 00000000000..f1b24c7f8fe
--- /dev/null
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Model/BigCatAllOfTests.cs
@@ -0,0 +1,71 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+
+using Xunit;
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Collections.Generic;
+using Org.OpenAPITools.Api;
+using Org.OpenAPITools.Model;
+using Org.OpenAPITools.Client;
+using System.Reflection;
+using Newtonsoft.Json;
+
+namespace Org.OpenAPITools.Test
+{
+ ///
+ /// Class for testing BigCatAllOf
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class BigCatAllOfTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for BigCatAllOf
+ //private BigCatAllOf instance;
+
+ public BigCatAllOfTests()
+ {
+ // TODO uncomment below to create an instance of BigCatAllOf
+ //instance = new BigCatAllOf();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of BigCatAllOf
+ ///
+ [Fact]
+ public void BigCatAllOfInstanceTest()
+ {
+ // TODO uncomment below to test "IsInstanceOfType" BigCatAllOf
+ //Assert.IsInstanceOfType (instance, "variable 'instance' is a BigCatAllOf");
+ }
+
+
+ ///
+ /// Test the property 'Kind'
+ ///
+ [Fact]
+ public void KindTest()
+ {
+ // TODO unit test for the property 'Kind'
+ }
+
+ }
+
+}
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Model/BigCatTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Model/BigCatTests.cs
new file mode 100644
index 00000000000..4bda812119c
--- /dev/null
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Model/BigCatTests.cs
@@ -0,0 +1,71 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+
+using Xunit;
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Collections.Generic;
+using Org.OpenAPITools.Api;
+using Org.OpenAPITools.Model;
+using Org.OpenAPITools.Client;
+using System.Reflection;
+using Newtonsoft.Json;
+
+namespace Org.OpenAPITools.Test
+{
+ ///
+ /// Class for testing BigCat
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class BigCatTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for BigCat
+ //private BigCat instance;
+
+ public BigCatTests()
+ {
+ // TODO uncomment below to create an instance of BigCat
+ //instance = new BigCat();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of BigCat
+ ///
+ [Fact]
+ public void BigCatInstanceTest()
+ {
+ // TODO uncomment below to test "IsInstanceOfType" BigCat
+ //Assert.IsInstanceOfType (instance, "variable 'instance' is a BigCat");
+ }
+
+
+ ///
+ /// Test the property 'Kind'
+ ///
+ [Fact]
+ public void KindTest()
+ {
+ // TODO unit test for the property 'Kind'
+ }
+
+ }
+
+}
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs
index 8631afa2dba..43b638c4a8d 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs
@@ -34,8 +34,10 @@ namespace Org.OpenAPITools.Model
[JsonConverter(typeof(JsonSubtypes), "ClassName")]
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
+ [JsonSubtypes.KnownSubType(typeof(BigCat), "BigCat")]
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
+ [JsonSubtypes.KnownSubType(typeof(BigCat), "BigCat")]
public partial class Animal : IEquatable, IValidatableObject
{
///
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/BigCat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/BigCat.cs
new file mode 100644
index 00000000000..2fd960256c4
--- /dev/null
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/BigCat.cs
@@ -0,0 +1,158 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+using System.ComponentModel.DataAnnotations;
+using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
+using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// BigCat
+ ///
+ [DataContract]
+ public partial class BigCat : Cat, IEquatable, IValidatableObject
+ {
+ ///
+ /// Defines Kind
+ ///
+ [JsonConverter(typeof(StringEnumConverter))]
+ public enum KindEnum
+ {
+ ///
+ /// Enum Lions for value: lions
+ ///
+ [EnumMember(Value = "lions")]
+ Lions = 1,
+
+ ///
+ /// Enum Tigers for value: tigers
+ ///
+ [EnumMember(Value = "tigers")]
+ Tigers = 2,
+
+ ///
+ /// Enum Leopards for value: leopards
+ ///
+ [EnumMember(Value = "leopards")]
+ Leopards = 3,
+
+ ///
+ /// Enum Jaguars for value: jaguars
+ ///
+ [EnumMember(Value = "jaguars")]
+ Jaguars = 4
+
+ }
+
+ ///
+ /// Gets or Sets Kind
+ ///
+ [DataMember(Name="kind", EmitDefaultValue=false)]
+ public KindEnum? Kind { get; set; }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ [JsonConstructorAttribute]
+ protected BigCat() { }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// kind.
+ /// className (required).
+ /// color (default to "red").
+ /// declawed.
+ public BigCat(KindEnum? kind = default(KindEnum?), string className = default(string), string color = "red", bool declawed = default(bool)) : base(declawed)
+ {
+ this.Kind = kind;
+ }
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ var sb = new StringBuilder();
+ sb.Append("class BigCat {\n");
+ sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n");
+ sb.Append(" Kind: ").Append(Kind).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Returns the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public override string ToJson()
+ {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
+
+ ///
+ /// Returns true if objects are equal
+ ///
+ /// Object to be compared
+ /// Boolean
+ public override bool Equals(object input)
+ {
+ return OpenAPIClientUtils.compareLogic.Compare(this, input as BigCat).AreEqual;
+ }
+
+ ///
+ /// Returns true if BigCat instances are equal
+ ///
+ /// Instance of BigCat to be compared
+ /// Boolean
+ public bool Equals(BigCat input)
+ {
+ return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
+ }
+
+ ///
+ /// Gets the hash code
+ ///
+ /// Hash code
+ public override int GetHashCode()
+ {
+ unchecked // Overflow is fine, just wrap
+ {
+ int hashCode = base.GetHashCode();
+ hashCode = hashCode * 59 + this.Kind.GetHashCode();
+ return hashCode;
+ }
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
+ {
+ foreach(var x in BaseValidate(validationContext)) yield return x;
+ yield break;
+ }
+ }
+
+}
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/BigCatAllOf.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/BigCatAllOf.cs
new file mode 100644
index 00000000000..5244a8f3488
--- /dev/null
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/BigCatAllOf.cs
@@ -0,0 +1,148 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+using System.ComponentModel.DataAnnotations;
+using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
+using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// BigCatAllOf
+ ///
+ [DataContract]
+ public partial class BigCatAllOf : IEquatable, IValidatableObject
+ {
+ ///
+ /// Defines Kind
+ ///
+ [JsonConverter(typeof(StringEnumConverter))]
+ public enum KindEnum
+ {
+ ///
+ /// Enum Lions for value: lions
+ ///
+ [EnumMember(Value = "lions")]
+ Lions = 1,
+
+ ///
+ /// Enum Tigers for value: tigers
+ ///
+ [EnumMember(Value = "tigers")]
+ Tigers = 2,
+
+ ///
+ /// Enum Leopards for value: leopards
+ ///
+ [EnumMember(Value = "leopards")]
+ Leopards = 3,
+
+ ///
+ /// Enum Jaguars for value: jaguars
+ ///
+ [EnumMember(Value = "jaguars")]
+ Jaguars = 4
+
+ }
+
+ ///
+ /// Gets or Sets Kind
+ ///
+ [DataMember(Name="kind", EmitDefaultValue=false)]
+ public KindEnum? Kind { get; set; }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// kind.
+ public BigCatAllOf(KindEnum? kind = default(KindEnum?))
+ {
+ this.Kind = kind;
+ }
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ var sb = new StringBuilder();
+ sb.Append("class BigCatAllOf {\n");
+ sb.Append(" Kind: ").Append(Kind).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Returns the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public virtual string ToJson()
+ {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
+
+ ///
+ /// Returns true if objects are equal
+ ///
+ /// Object to be compared
+ /// Boolean
+ public override bool Equals(object input)
+ {
+ return OpenAPIClientUtils.compareLogic.Compare(this, input as BigCatAllOf).AreEqual;
+ }
+
+ ///
+ /// Returns true if BigCatAllOf instances are equal
+ ///
+ /// Instance of BigCatAllOf to be compared
+ /// Boolean
+ public bool Equals(BigCatAllOf input)
+ {
+ return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
+ }
+
+ ///
+ /// Gets the hash code
+ ///
+ /// Hash code
+ public override int GetHashCode()
+ {
+ unchecked // Overflow is fine, just wrap
+ {
+ int hashCode = 41;
+ hashCode = hashCode * 59 + this.Kind.GetHashCode();
+ return hashCode;
+ }
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+}
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md
index 78b126b5641..fd42741e8d4 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md
@@ -157,6 +157,8 @@ Class | Method | HTTP request | Description
- [Model.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [Model.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [Model.ArrayTest](docs/ArrayTest.md)
+ - [Model.BigCat](docs/BigCat.md)
+ - [Model.BigCatAllOf](docs/BigCatAllOf.md)
- [Model.Capitalization](docs/Capitalization.md)
- [Model.Cat](docs/Cat.md)
- [Model.CatAllOf](docs/CatAllOf.md)
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/BigCat.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/BigCat.md
new file mode 100644
index 00000000000..41c336e4ca9
--- /dev/null
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/BigCat.md
@@ -0,0 +1,10 @@
+# Org.OpenAPITools.Model.BigCat
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Declawed** | **bool** | | [optional]
+**Kind** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/BigCatAllOf.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/BigCatAllOf.md
new file mode 100644
index 00000000000..88a739b7e4a
--- /dev/null
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/BigCatAllOf.md
@@ -0,0 +1,9 @@
+# Org.OpenAPITools.Model.BigCatAllOf
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Kind** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/BigCatAllOfTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/BigCatAllOfTests.cs
new file mode 100644
index 00000000000..f1b24c7f8fe
--- /dev/null
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/BigCatAllOfTests.cs
@@ -0,0 +1,71 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+
+using Xunit;
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Collections.Generic;
+using Org.OpenAPITools.Api;
+using Org.OpenAPITools.Model;
+using Org.OpenAPITools.Client;
+using System.Reflection;
+using Newtonsoft.Json;
+
+namespace Org.OpenAPITools.Test
+{
+ ///
+ /// Class for testing BigCatAllOf
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class BigCatAllOfTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for BigCatAllOf
+ //private BigCatAllOf instance;
+
+ public BigCatAllOfTests()
+ {
+ // TODO uncomment below to create an instance of BigCatAllOf
+ //instance = new BigCatAllOf();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of BigCatAllOf
+ ///
+ [Fact]
+ public void BigCatAllOfInstanceTest()
+ {
+ // TODO uncomment below to test "IsInstanceOfType" BigCatAllOf
+ //Assert.IsInstanceOfType (instance, "variable 'instance' is a BigCatAllOf");
+ }
+
+
+ ///
+ /// Test the property 'Kind'
+ ///
+ [Fact]
+ public void KindTest()
+ {
+ // TODO unit test for the property 'Kind'
+ }
+
+ }
+
+}
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/BigCatTests.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/BigCatTests.cs
new file mode 100644
index 00000000000..4bda812119c
--- /dev/null
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/BigCatTests.cs
@@ -0,0 +1,71 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+
+using Xunit;
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Collections.Generic;
+using Org.OpenAPITools.Api;
+using Org.OpenAPITools.Model;
+using Org.OpenAPITools.Client;
+using System.Reflection;
+using Newtonsoft.Json;
+
+namespace Org.OpenAPITools.Test
+{
+ ///
+ /// Class for testing BigCat
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class BigCatTests : IDisposable
+ {
+ // TODO uncomment below to declare an instance variable for BigCat
+ //private BigCat instance;
+
+ public BigCatTests()
+ {
+ // TODO uncomment below to create an instance of BigCat
+ //instance = new BigCat();
+ }
+
+ public void Dispose()
+ {
+ // Cleanup when everything is done.
+ }
+
+ ///
+ /// Test an instance of BigCat
+ ///
+ [Fact]
+ public void BigCatInstanceTest()
+ {
+ // TODO uncomment below to test "IsInstanceOfType" BigCat
+ //Assert.IsInstanceOfType (instance, "variable 'instance' is a BigCat");
+ }
+
+
+ ///
+ /// Test the property 'Kind'
+ ///
+ [Fact]
+ public void KindTest()
+ {
+ // TODO unit test for the property 'Kind'
+ }
+
+ }
+
+}
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Animal.cs
index 8631afa2dba..43b638c4a8d 100644
--- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Animal.cs
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Animal.cs
@@ -34,8 +34,10 @@ namespace Org.OpenAPITools.Model
[JsonConverter(typeof(JsonSubtypes), "ClassName")]
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
+ [JsonSubtypes.KnownSubType(typeof(BigCat), "BigCat")]
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
+ [JsonSubtypes.KnownSubType(typeof(BigCat), "BigCat")]
public partial class Animal : IEquatable, IValidatableObject
{
///
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/BigCat.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/BigCat.cs
new file mode 100644
index 00000000000..2fd960256c4
--- /dev/null
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/BigCat.cs
@@ -0,0 +1,158 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+using System.ComponentModel.DataAnnotations;
+using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
+using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// BigCat
+ ///
+ [DataContract]
+ public partial class BigCat : Cat, IEquatable, IValidatableObject
+ {
+ ///
+ /// Defines Kind
+ ///
+ [JsonConverter(typeof(StringEnumConverter))]
+ public enum KindEnum
+ {
+ ///
+ /// Enum Lions for value: lions
+ ///
+ [EnumMember(Value = "lions")]
+ Lions = 1,
+
+ ///
+ /// Enum Tigers for value: tigers
+ ///
+ [EnumMember(Value = "tigers")]
+ Tigers = 2,
+
+ ///
+ /// Enum Leopards for value: leopards
+ ///
+ [EnumMember(Value = "leopards")]
+ Leopards = 3,
+
+ ///
+ /// Enum Jaguars for value: jaguars
+ ///
+ [EnumMember(Value = "jaguars")]
+ Jaguars = 4
+
+ }
+
+ ///
+ /// Gets or Sets Kind
+ ///
+ [DataMember(Name="kind", EmitDefaultValue=false)]
+ public KindEnum? Kind { get; set; }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ [JsonConstructorAttribute]
+ protected BigCat() { }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// kind.
+ /// className (required).
+ /// color (default to "red").
+ /// declawed.
+ public BigCat(KindEnum? kind = default(KindEnum?), string className = default(string), string color = "red", bool declawed = default(bool)) : base(declawed)
+ {
+ this.Kind = kind;
+ }
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ var sb = new StringBuilder();
+ sb.Append("class BigCat {\n");
+ sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n");
+ sb.Append(" Kind: ").Append(Kind).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Returns the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public override string ToJson()
+ {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
+
+ ///
+ /// Returns true if objects are equal
+ ///
+ /// Object to be compared
+ /// Boolean
+ public override bool Equals(object input)
+ {
+ return OpenAPIClientUtils.compareLogic.Compare(this, input as BigCat).AreEqual;
+ }
+
+ ///
+ /// Returns true if BigCat instances are equal
+ ///
+ /// Instance of BigCat to be compared
+ /// Boolean
+ public bool Equals(BigCat input)
+ {
+ return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
+ }
+
+ ///
+ /// Gets the hash code
+ ///
+ /// Hash code
+ public override int GetHashCode()
+ {
+ unchecked // Overflow is fine, just wrap
+ {
+ int hashCode = base.GetHashCode();
+ hashCode = hashCode * 59 + this.Kind.GetHashCode();
+ return hashCode;
+ }
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
+ {
+ foreach(var x in BaseValidate(validationContext)) yield return x;
+ yield break;
+ }
+ }
+
+}
diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/BigCatAllOf.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/BigCatAllOf.cs
new file mode 100644
index 00000000000..5244a8f3488
--- /dev/null
+++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/BigCatAllOf.cs
@@ -0,0 +1,148 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+using System.ComponentModel.DataAnnotations;
+using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
+using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// BigCatAllOf
+ ///
+ [DataContract]
+ public partial class BigCatAllOf : IEquatable, IValidatableObject
+ {
+ ///
+ /// Defines Kind
+ ///
+ [JsonConverter(typeof(StringEnumConverter))]
+ public enum KindEnum
+ {
+ ///
+ /// Enum Lions for value: lions
+ ///
+ [EnumMember(Value = "lions")]
+ Lions = 1,
+
+ ///
+ /// Enum Tigers for value: tigers
+ ///
+ [EnumMember(Value = "tigers")]
+ Tigers = 2,
+
+ ///
+ /// Enum Leopards for value: leopards
+ ///
+ [EnumMember(Value = "leopards")]
+ Leopards = 3,
+
+ ///
+ /// Enum Jaguars for value: jaguars
+ ///
+ [EnumMember(Value = "jaguars")]
+ Jaguars = 4
+
+ }
+
+ ///
+ /// Gets or Sets Kind
+ ///
+ [DataMember(Name="kind", EmitDefaultValue=false)]
+ public KindEnum? Kind { get; set; }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// kind.
+ public BigCatAllOf(KindEnum? kind = default(KindEnum?))
+ {
+ this.Kind = kind;
+ }
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ var sb = new StringBuilder();
+ sb.Append("class BigCatAllOf {\n");
+ sb.Append(" Kind: ").Append(Kind).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Returns the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public virtual string ToJson()
+ {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
+
+ ///
+ /// Returns true if objects are equal
+ ///
+ /// Object to be compared
+ /// Boolean
+ public override bool Equals(object input)
+ {
+ return OpenAPIClientUtils.compareLogic.Compare(this, input as BigCatAllOf).AreEqual;
+ }
+
+ ///
+ /// Returns true if BigCatAllOf instances are equal
+ ///
+ /// Instance of BigCatAllOf to be compared
+ /// Boolean
+ public bool Equals(BigCatAllOf input)
+ {
+ return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual;
+ }
+
+ ///
+ /// Gets the hash code
+ ///
+ /// Hash code
+ public override int GetHashCode()
+ {
+ unchecked // Overflow is fine, just wrap
+ {
+ int hashCode = 41;
+ hashCode = hashCode * 59 + this.Kind.GetHashCode();
+ return hashCode;
+ }
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+}
diff --git a/samples/client/petstore/csharp/OpenAPIClient/README.md b/samples/client/petstore/csharp/OpenAPIClient/README.md
index 7bd9201f88b..5f55053b6f5 100644
--- a/samples/client/petstore/csharp/OpenAPIClient/README.md
+++ b/samples/client/petstore/csharp/OpenAPIClient/README.md
@@ -159,6 +159,8 @@ Class | Method | HTTP request | Description
- [Model.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [Model.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [Model.ArrayTest](docs/ArrayTest.md)
+ - [Model.BigCat](docs/BigCat.md)
+ - [Model.BigCatAllOf](docs/BigCatAllOf.md)
- [Model.Capitalization](docs/Capitalization.md)
- [Model.Cat](docs/Cat.md)
- [Model.CatAllOf](docs/CatAllOf.md)
diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/BigCat.md b/samples/client/petstore/csharp/OpenAPIClient/docs/BigCat.md
new file mode 100644
index 00000000000..6247107ab35
--- /dev/null
+++ b/samples/client/petstore/csharp/OpenAPIClient/docs/BigCat.md
@@ -0,0 +1,14 @@
+
+# Org.OpenAPITools.Model.BigCat
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Declawed** | **bool** | | [optional]
+**Kind** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/BigCatAllOf.md b/samples/client/petstore/csharp/OpenAPIClient/docs/BigCatAllOf.md
new file mode 100644
index 00000000000..864c2298e03
--- /dev/null
+++ b/samples/client/petstore/csharp/OpenAPIClient/docs/BigCatAllOf.md
@@ -0,0 +1,13 @@
+
+# Org.OpenAPITools.Model.BigCatAllOf
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Kind** | **string** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/BigCatAllOfTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/BigCatAllOfTests.cs
new file mode 100644
index 00000000000..4cbdb4b8a5e
--- /dev/null
+++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/BigCatAllOfTests.cs
@@ -0,0 +1,79 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+
+using NUnit.Framework;
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Collections.Generic;
+using Org.OpenAPITools.Api;
+using Org.OpenAPITools.Model;
+using Org.OpenAPITools.Client;
+using System.Reflection;
+using Newtonsoft.Json;
+
+namespace Org.OpenAPITools.Test
+{
+ ///
+ /// Class for testing BigCatAllOf
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class BigCatAllOfTests
+ {
+ // TODO uncomment below to declare an instance variable for BigCatAllOf
+ //private BigCatAllOf instance;
+
+ ///
+ /// Setup before each test
+ ///
+ [SetUp]
+ public void Init()
+ {
+ // TODO uncomment below to create an instance of BigCatAllOf
+ //instance = new BigCatAllOf();
+ }
+
+ ///
+ /// Clean up after each test
+ ///
+ [TearDown]
+ public void Cleanup()
+ {
+
+ }
+
+ ///
+ /// Test an instance of BigCatAllOf
+ ///
+ [Test]
+ public void BigCatAllOfInstanceTest()
+ {
+ // TODO uncomment below to test "IsInstanceOf" BigCatAllOf
+ //Assert.IsInstanceOf(typeof(BigCatAllOf), instance);
+ }
+
+
+ ///
+ /// Test the property 'Kind'
+ ///
+ [Test]
+ public void KindTest()
+ {
+ // TODO unit test for the property 'Kind'
+ }
+
+ }
+
+}
diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/BigCatTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/BigCatTests.cs
new file mode 100644
index 00000000000..1d78ea9f1e6
--- /dev/null
+++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/BigCatTests.cs
@@ -0,0 +1,79 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+
+using NUnit.Framework;
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Collections.Generic;
+using Org.OpenAPITools.Api;
+using Org.OpenAPITools.Model;
+using Org.OpenAPITools.Client;
+using System.Reflection;
+using Newtonsoft.Json;
+
+namespace Org.OpenAPITools.Test
+{
+ ///
+ /// Class for testing BigCat
+ ///
+ ///
+ /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+ /// Please update the test case below to test the model.
+ ///
+ public class BigCatTests
+ {
+ // TODO uncomment below to declare an instance variable for BigCat
+ //private BigCat instance;
+
+ ///
+ /// Setup before each test
+ ///
+ [SetUp]
+ public void Init()
+ {
+ // TODO uncomment below to create an instance of BigCat
+ //instance = new BigCat();
+ }
+
+ ///
+ /// Clean up after each test
+ ///
+ [TearDown]
+ public void Cleanup()
+ {
+
+ }
+
+ ///
+ /// Test an instance of BigCat
+ ///
+ [Test]
+ public void BigCatInstanceTest()
+ {
+ // TODO uncomment below to test "IsInstanceOf" BigCat
+ //Assert.IsInstanceOf(typeof(BigCat), instance);
+ }
+
+
+ ///
+ /// Test the property 'Kind'
+ ///
+ [Test]
+ public void KindTest()
+ {
+ // TODO unit test for the property 'Kind'
+ }
+
+ }
+
+}
diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs
index d158ed573a6..eb9b58f2075 100644
--- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs
+++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Animal.cs
@@ -32,6 +32,7 @@ namespace Org.OpenAPITools.Model
[JsonConverter(typeof(JsonSubtypes), "ClassName")]
[JsonSubtypes.KnownSubType(typeof(Dog), "Dog")]
[JsonSubtypes.KnownSubType(typeof(Cat), "Cat")]
+ [JsonSubtypes.KnownSubType(typeof(BigCat), "BigCat")]
public partial class Animal : IEquatable, IValidatableObject
{
///
diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/BigCat.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/BigCat.cs
new file mode 100644
index 00000000000..ffdab926c34
--- /dev/null
+++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/BigCat.cs
@@ -0,0 +1,163 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+using System.ComponentModel.DataAnnotations;
+using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// BigCat
+ ///
+ [DataContract]
+ public partial class BigCat : Cat, IEquatable, IValidatableObject
+ {
+ ///
+ /// Defines Kind
+ ///
+ [JsonConverter(typeof(StringEnumConverter))]
+ public enum KindEnum
+ {
+ ///
+ /// Enum Lions for value: lions
+ ///
+ [EnumMember(Value = "lions")]
+ Lions = 1,
+
+ ///
+ /// Enum Tigers for value: tigers
+ ///
+ [EnumMember(Value = "tigers")]
+ Tigers = 2,
+
+ ///
+ /// Enum Leopards for value: leopards
+ ///
+ [EnumMember(Value = "leopards")]
+ Leopards = 3,
+
+ ///
+ /// Enum Jaguars for value: jaguars
+ ///
+ [EnumMember(Value = "jaguars")]
+ Jaguars = 4
+
+ }
+
+ ///
+ /// Gets or Sets Kind
+ ///
+ [DataMember(Name="kind", EmitDefaultValue=false)]
+ public KindEnum? Kind { get; set; }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ [JsonConstructorAttribute]
+ protected BigCat() { }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// kind.
+ public BigCat(KindEnum? kind = default(KindEnum?), string className = default(string), string color = "red", bool declawed = default(bool)) : base(declawed)
+ {
+ this.Kind = kind;
+ }
+
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ var sb = new StringBuilder();
+ sb.Append("class BigCat {\n");
+ sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n");
+ sb.Append(" Kind: ").Append(Kind).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Returns the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public override string ToJson()
+ {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
+
+ ///
+ /// Returns true if objects are equal
+ ///
+ /// Object to be compared
+ /// Boolean
+ public override bool Equals(object input)
+ {
+ return this.Equals(input as BigCat);
+ }
+
+ ///
+ /// Returns true if BigCat instances are equal
+ ///
+ /// Instance of BigCat to be compared
+ /// Boolean
+ public bool Equals(BigCat input)
+ {
+ if (input == null)
+ return false;
+
+ return base.Equals(input) &&
+ (
+ this.Kind == input.Kind ||
+ (this.Kind != null &&
+ this.Kind.Equals(input.Kind))
+ );
+ }
+
+ ///
+ /// Gets the hash code
+ ///
+ /// Hash code
+ public override int GetHashCode()
+ {
+ unchecked // Overflow is fine, just wrap
+ {
+ int hashCode = base.GetHashCode();
+ if (this.Kind != null)
+ hashCode = hashCode * 59 + this.Kind.GetHashCode();
+ return hashCode;
+ }
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
+ {
+ foreach(var x in base.BaseValidate(validationContext)) yield return x;
+ yield break;
+ }
+ }
+
+}
diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/BigCatAllOf.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/BigCatAllOf.cs
new file mode 100644
index 00000000000..79871b557ba
--- /dev/null
+++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/BigCatAllOf.cs
@@ -0,0 +1,156 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+using System.ComponentModel.DataAnnotations;
+using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
+
+namespace Org.OpenAPITools.Model
+{
+ ///
+ /// BigCatAllOf
+ ///
+ [DataContract]
+ public partial class BigCatAllOf : IEquatable, IValidatableObject
+ {
+ ///
+ /// Defines Kind
+ ///
+ [JsonConverter(typeof(StringEnumConverter))]
+ public enum KindEnum
+ {
+ ///
+ /// Enum Lions for value: lions
+ ///
+ [EnumMember(Value = "lions")]
+ Lions = 1,
+
+ ///
+ /// Enum Tigers for value: tigers
+ ///
+ [EnumMember(Value = "tigers")]
+ Tigers = 2,
+
+ ///
+ /// Enum Leopards for value: leopards
+ ///
+ [EnumMember(Value = "leopards")]
+ Leopards = 3,
+
+ ///
+ /// Enum Jaguars for value: jaguars
+ ///
+ [EnumMember(Value = "jaguars")]
+ Jaguars = 4
+
+ }
+
+ ///
+ /// Gets or Sets Kind
+ ///
+ [DataMember(Name="kind", EmitDefaultValue=false)]
+ public KindEnum? Kind { get; set; }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// kind.
+ public BigCatAllOf(KindEnum? kind = default(KindEnum?))
+ {
+ this.Kind = kind;
+ }
+
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ var sb = new StringBuilder();
+ sb.Append("class BigCatAllOf {\n");
+ sb.Append(" Kind: ").Append(Kind).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Returns the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public virtual string ToJson()
+ {
+ return JsonConvert.SerializeObject(this, Formatting.Indented);
+ }
+
+ ///
+ /// Returns true if objects are equal
+ ///
+ /// Object to be compared
+ /// Boolean
+ public override bool Equals(object input)
+ {
+ return this.Equals(input as BigCatAllOf);
+ }
+
+ ///
+ /// Returns true if BigCatAllOf instances are equal
+ ///
+ /// Instance of BigCatAllOf to be compared
+ /// Boolean
+ public bool Equals(BigCatAllOf input)
+ {
+ if (input == null)
+ return false;
+
+ return
+ (
+ this.Kind == input.Kind ||
+ (this.Kind != null &&
+ this.Kind.Equals(input.Kind))
+ );
+ }
+
+ ///
+ /// Gets the hash code
+ ///
+ /// Hash code
+ public override int GetHashCode()
+ {
+ unchecked // Overflow is fine, just wrap
+ {
+ int hashCode = 41;
+ if (this.Kind != null)
+ hashCode = hashCode * 59 + this.Kind.GetHashCode();
+ return hashCode;
+ }
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
+ {
+ yield break;
+ }
+ }
+
+}
diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs
index 1c28fb2755f..42674c5ffce 100644
--- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs
+++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs
@@ -122,6 +122,16 @@ namespace Org.OpenAPITools.Model
/// Validation context
/// Validation Result
IEnumerable IValidatableObject.Validate(ValidationContext validationContext)
+ {
+ return this.BaseValidate(validationContext);
+ }
+
+ ///
+ /// To validate all properties of the instance
+ ///
+ /// Validation context
+ /// Validation Result
+ protected IEnumerable BaseValidate(ValidationContext validationContext)
{
foreach(var x in base.BaseValidate(validationContext)) yield return x;
yield break;
diff --git a/samples/client/petstore/dart-dio/.openapi-generator/VERSION b/samples/client/petstore/dart-dio/.openapi-generator/VERSION
index c3a2c7076fa..58592f031f6 100644
--- a/samples/client/petstore/dart-dio/.openapi-generator/VERSION
+++ b/samples/client/petstore/dart-dio/.openapi-generator/VERSION
@@ -1 +1 @@
-4.2.0-SNAPSHOT
\ No newline at end of file
+4.2.3-SNAPSHOT
\ No newline at end of file
diff --git a/samples/client/petstore/dart-dio/README.md b/samples/client/petstore/dart-dio/README.md
index 824ea71074d..ceda34066bc 100644
--- a/samples/client/petstore/dart-dio/README.md
+++ b/samples/client/petstore/dart-dio/README.md
@@ -4,7 +4,6 @@ This is a sample server Petstore server. For this sample, you can use the api ke
This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: 1.0.0
-- Build date: 2019-10-30T08:32:55.947+13:00[Pacific/Auckland]
- Build package: org.openapitools.codegen.languages.DartDioClientCodegen
## Requirements
@@ -58,36 +57,36 @@ All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
-*PetApi* | [**addPet**](docs//PetApi.md#addpet) | **post** /pet | Add a new pet to the store
-*PetApi* | [**deletePet**](docs//PetApi.md#deletepet) | **delete** /pet/{petId} | Deletes a pet
-*PetApi* | [**findPetsByStatus**](docs//PetApi.md#findpetsbystatus) | **get** /pet/findByStatus | Finds Pets by status
-*PetApi* | [**findPetsByTags**](docs//PetApi.md#findpetsbytags) | **get** /pet/findByTags | Finds Pets by tags
-*PetApi* | [**getPetById**](docs//PetApi.md#getpetbyid) | **get** /pet/{petId} | Find pet by ID
-*PetApi* | [**updatePet**](docs//PetApi.md#updatepet) | **put** /pet | Update an existing pet
-*PetApi* | [**updatePetWithForm**](docs//PetApi.md#updatepetwithform) | **post** /pet/{petId} | Updates a pet in the store with form data
-*PetApi* | [**uploadFile**](docs//PetApi.md#uploadfile) | **post** /pet/{petId}/uploadImage | uploads an image
-*StoreApi* | [**deleteOrder**](docs//StoreApi.md#deleteorder) | **delete** /store/order/{orderId} | Delete purchase order by ID
-*StoreApi* | [**getInventory**](docs//StoreApi.md#getinventory) | **get** /store/inventory | Returns pet inventories by status
-*StoreApi* | [**getOrderById**](docs//StoreApi.md#getorderbyid) | **get** /store/order/{orderId} | Find purchase order by ID
-*StoreApi* | [**placeOrder**](docs//StoreApi.md#placeorder) | **post** /store/order | Place an order for a pet
-*UserApi* | [**createUser**](docs//UserApi.md#createuser) | **post** /user | Create user
-*UserApi* | [**createUsersWithArrayInput**](docs//UserApi.md#createuserswitharrayinput) | **post** /user/createWithArray | Creates list of users with given input array
-*UserApi* | [**createUsersWithListInput**](docs//UserApi.md#createuserswithlistinput) | **post** /user/createWithList | Creates list of users with given input array
-*UserApi* | [**deleteUser**](docs//UserApi.md#deleteuser) | **delete** /user/{username} | Delete user
-*UserApi* | [**getUserByName**](docs//UserApi.md#getuserbyname) | **get** /user/{username} | Get user by user name
-*UserApi* | [**loginUser**](docs//UserApi.md#loginuser) | **get** /user/login | Logs user into the system
-*UserApi* | [**logoutUser**](docs//UserApi.md#logoutuser) | **get** /user/logout | Logs out current logged in user session
-*UserApi* | [**updateUser**](docs//UserApi.md#updateuser) | **put** /user/{username} | Updated user
+*PetApi* | [**addPet**](doc//PetApi.md#addpet) | **post** /pet | Add a new pet to the store
+*PetApi* | [**deletePet**](doc//PetApi.md#deletepet) | **delete** /pet/{petId} | Deletes a pet
+*PetApi* | [**findPetsByStatus**](doc//PetApi.md#findpetsbystatus) | **get** /pet/findByStatus | Finds Pets by status
+*PetApi* | [**findPetsByTags**](doc//PetApi.md#findpetsbytags) | **get** /pet/findByTags | Finds Pets by tags
+*PetApi* | [**getPetById**](doc//PetApi.md#getpetbyid) | **get** /pet/{petId} | Find pet by ID
+*PetApi* | [**updatePet**](doc//PetApi.md#updatepet) | **put** /pet | Update an existing pet
+*PetApi* | [**updatePetWithForm**](doc//PetApi.md#updatepetwithform) | **post** /pet/{petId} | Updates a pet in the store with form data
+*PetApi* | [**uploadFile**](doc//PetApi.md#uploadfile) | **post** /pet/{petId}/uploadImage | uploads an image
+*StoreApi* | [**deleteOrder**](doc//StoreApi.md#deleteorder) | **delete** /store/order/{orderId} | Delete purchase order by ID
+*StoreApi* | [**getInventory**](doc//StoreApi.md#getinventory) | **get** /store/inventory | Returns pet inventories by status
+*StoreApi* | [**getOrderById**](doc//StoreApi.md#getorderbyid) | **get** /store/order/{orderId} | Find purchase order by ID
+*StoreApi* | [**placeOrder**](doc//StoreApi.md#placeorder) | **post** /store/order | Place an order for a pet
+*UserApi* | [**createUser**](doc//UserApi.md#createuser) | **post** /user | Create user
+*UserApi* | [**createUsersWithArrayInput**](doc//UserApi.md#createuserswitharrayinput) | **post** /user/createWithArray | Creates list of users with given input array
+*UserApi* | [**createUsersWithListInput**](doc//UserApi.md#createuserswithlistinput) | **post** /user/createWithList | Creates list of users with given input array
+*UserApi* | [**deleteUser**](doc//UserApi.md#deleteuser) | **delete** /user/{username} | Delete user
+*UserApi* | [**getUserByName**](doc//UserApi.md#getuserbyname) | **get** /user/{username} | Get user by user name
+*UserApi* | [**loginUser**](doc//UserApi.md#loginuser) | **get** /user/login | Logs user into the system
+*UserApi* | [**logoutUser**](doc//UserApi.md#logoutuser) | **get** /user/logout | Logs out current logged in user session
+*UserApi* | [**updateUser**](doc//UserApi.md#updateuser) | **put** /user/{username} | Updated user
## Documentation For Models
- - [ApiResponse](docs//ApiResponse.md)
- - [Category](docs//Category.md)
- - [Order](docs//Order.md)
- - [Pet](docs//Pet.md)
- - [Tag](docs//Tag.md)
- - [User](docs//User.md)
+ - [ApiResponse](doc//ApiResponse.md)
+ - [Category](doc//Category.md)
+ - [Order](doc//Order.md)
+ - [Pet](doc//Pet.md)
+ - [Tag](doc//Tag.md)
+ - [User](doc//User.md)
## Documentation For Authorization
diff --git a/samples/client/petstore/dart-dio/doc/ApiResponse.md b/samples/client/petstore/dart-dio/doc/ApiResponse.md
new file mode 100644
index 00000000000..92422f0f446
--- /dev/null
+++ b/samples/client/petstore/dart-dio/doc/ApiResponse.md
@@ -0,0 +1,17 @@
+# openapi.model.ApiResponse
+
+## Load the model package
+```dart
+import 'package:openapi/api.dart';
+```
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**code** | **int** | | [optional] [default to null]
+**type** | **String** | | [optional] [default to null]
+**message** | **String** | | [optional] [default to null]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/dart-dio/doc/Category.md b/samples/client/petstore/dart-dio/doc/Category.md
new file mode 100644
index 00000000000..cc0d1633b59
--- /dev/null
+++ b/samples/client/petstore/dart-dio/doc/Category.md
@@ -0,0 +1,16 @@
+# openapi.model.Category
+
+## Load the model package
+```dart
+import 'package:openapi/api.dart';
+```
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **int** | | [optional] [default to null]
+**name** | **String** | | [optional] [default to null]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/dart-dio/doc/Order.md b/samples/client/petstore/dart-dio/doc/Order.md
new file mode 100644
index 00000000000..310ce6c65be
--- /dev/null
+++ b/samples/client/petstore/dart-dio/doc/Order.md
@@ -0,0 +1,20 @@
+# openapi.model.Order
+
+## Load the model package
+```dart
+import 'package:openapi/api.dart';
+```
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **int** | | [optional] [default to null]
+**petId** | **int** | | [optional] [default to null]
+**quantity** | **int** | | [optional] [default to null]
+**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null]
+**status** | **String** | Order Status | [optional] [default to null]
+**complete** | **bool** | | [optional] [default to false]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/dart-dio/doc/Pet.md b/samples/client/petstore/dart-dio/doc/Pet.md
new file mode 100644
index 00000000000..619e45d1848
--- /dev/null
+++ b/samples/client/petstore/dart-dio/doc/Pet.md
@@ -0,0 +1,20 @@
+# openapi.model.Pet
+
+## Load the model package
+```dart
+import 'package:openapi/api.dart';
+```
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **int** | | [optional] [default to null]
+**category** | [**Category**](Category.md) | | [optional] [default to null]
+**name** | **String** | | [default to null]
+**photoUrls** | **BuiltList<String>** | | [default to const []]
+**tags** | [**BuiltList<Tag>**](Tag.md) | | [optional] [default to const []]
+**status** | **String** | pet status in the store | [optional] [default to null]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/dart-dio/doc/PetApi.md b/samples/client/petstore/dart-dio/doc/PetApi.md
new file mode 100644
index 00000000000..e781974607c
--- /dev/null
+++ b/samples/client/petstore/dart-dio/doc/PetApi.md
@@ -0,0 +1,379 @@
+# openapi.api.PetApi
+
+## Load the API package
+```dart
+import 'package:openapi/api.dart';
+```
+
+All URIs are relative to *http://petstore.swagger.io/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**addPet**](PetApi.md#addPet) | **post** /pet | Add a new pet to the store
+[**deletePet**](PetApi.md#deletePet) | **delete** /pet/{petId} | Deletes a pet
+[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **get** /pet/findByStatus | Finds Pets by status
+[**findPetsByTags**](PetApi.md#findPetsByTags) | **get** /pet/findByTags | Finds Pets by tags
+[**getPetById**](PetApi.md#getPetById) | **get** /pet/{petId} | Find pet by ID
+[**updatePet**](PetApi.md#updatePet) | **put** /pet | Update an existing pet
+[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **post** /pet/{petId} | Updates a pet in the store with form data
+[**uploadFile**](PetApi.md#uploadFile) | **post** /pet/{petId}/uploadImage | uploads an image
+
+
+# **addPet**
+> addPet(body)
+
+Add a new pet to the store
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+// TODO Configure OAuth2 access token for authorization: petstore_auth
+//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
+
+var api_instance = new PetApi();
+var body = new Pet(); // Pet | Pet object that needs to be added to the store
+
+try {
+ api_instance.addPet(body);
+} catch (e) {
+ print("Exception when calling PetApi->addPet: $e\n");
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: application/json, application/xml
+ - **Accept**: Not defined
+
+[[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)
+
+# **deletePet**
+> deletePet(petId, apiKey)
+
+Deletes a pet
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+// TODO Configure OAuth2 access token for authorization: petstore_auth
+//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
+
+var api_instance = new PetApi();
+var petId = 789; // int | Pet id to delete
+var apiKey = apiKey_example; // String |
+
+try {
+ api_instance.deletePet(petId, apiKey);
+} catch (e) {
+ print("Exception when calling PetApi->deletePet: $e\n");
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **petId** | **int**| Pet id to delete | [default to null]
+ **apiKey** | **String**| | [optional] [default to null]
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+[[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)
+
+# **findPetsByStatus**
+> List findPetsByStatus(status)
+
+Finds Pets by status
+
+Multiple status values can be provided with comma separated strings
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+// TODO Configure OAuth2 access token for authorization: petstore_auth
+//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
+
+var api_instance = new PetApi();
+var status = []; // List | Status values that need to be considered for filter
+
+try {
+ var result = api_instance.findPetsByStatus(status);
+ print(result);
+} catch (e) {
+ print("Exception when calling PetApi->findPetsByStatus: $e\n");
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to const []]
+
+### Return type
+
+[**List**](Pet.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+[[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)
+
+# **findPetsByTags**
+> List findPetsByTags(tags)
+
+Finds Pets by tags
+
+Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+// TODO Configure OAuth2 access token for authorization: petstore_auth
+//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
+
+var api_instance = new PetApi();
+var tags = []; // List | Tags to filter by
+
+try {
+ var result = api_instance.findPetsByTags(tags);
+ print(result);
+} catch (e) {
+ print("Exception when calling PetApi->findPetsByTags: $e\n");
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **tags** | [**List<String>**](String.md)| Tags to filter by | [default to const []]
+
+### Return type
+
+[**List**](Pet.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+[[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)
+
+# **getPetById**
+> Pet getPetById(petId)
+
+Find pet by ID
+
+Returns a single pet
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+// TODO Configure API key authorization: api_key
+//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY';
+// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
+//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer';
+
+var api_instance = new PetApi();
+var petId = 789; // int | ID of pet to return
+
+try {
+ var result = api_instance.getPetById(petId);
+ print(result);
+} catch (e) {
+ print("Exception when calling PetApi->getPetById: $e\n");
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **petId** | **int**| ID of pet to return | [default to null]
+
+### Return type
+
+[**Pet**](Pet.md)
+
+### Authorization
+
+[api_key](../README.md#api_key)
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+[[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)
+
+# **updatePet**
+> updatePet(body)
+
+Update an existing pet
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+// TODO Configure OAuth2 access token for authorization: petstore_auth
+//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
+
+var api_instance = new PetApi();
+var body = new Pet(); // Pet | Pet object that needs to be added to the store
+
+try {
+ api_instance.updatePet(body);
+} catch (e) {
+ print("Exception when calling PetApi->updatePet: $e\n");
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: application/json, application/xml
+ - **Accept**: Not defined
+
+[[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)
+
+# **updatePetWithForm**
+> updatePetWithForm(petId, name, status)
+
+Updates a pet in the store with form data
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+// TODO Configure OAuth2 access token for authorization: petstore_auth
+//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
+
+var api_instance = new PetApi();
+var petId = 789; // int | ID of pet that needs to be updated
+var name = name_example; // String | Updated name of the pet
+var status = status_example; // String | Updated status of the pet
+
+try {
+ api_instance.updatePetWithForm(petId, name, status);
+} catch (e) {
+ print("Exception when calling PetApi->updatePetWithForm: $e\n");
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **petId** | **int**| ID of pet that needs to be updated | [default to null]
+ **name** | **String**| Updated name of the pet | [optional] [default to null]
+ **status** | **String**| Updated status of the pet | [optional] [default to null]
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: application/x-www-form-urlencoded
+ - **Accept**: Not defined
+
+[[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)
+
+# **uploadFile**
+> ApiResponse uploadFile(petId, additionalMetadata, file)
+
+uploads an image
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+// TODO Configure OAuth2 access token for authorization: petstore_auth
+//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
+
+var api_instance = new PetApi();
+var petId = 789; // int | ID of pet to update
+var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server
+var file = BINARY_DATA_HERE; // Uint8List | file to upload
+
+try {
+ var result = api_instance.uploadFile(petId, additionalMetadata, file);
+ print(result);
+} catch (e) {
+ print("Exception when calling PetApi->uploadFile: $e\n");
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **petId** | **int**| ID of pet to update | [default to null]
+ **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null]
+ **file** | **Uint8List**| file to upload | [optional] [default to null]
+
+### Return type
+
+[**ApiResponse**](ApiResponse.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: multipart/form-data
+ - **Accept**: application/json
+
+[[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)
+
diff --git a/samples/client/petstore/dart-dio/doc/StoreApi.md b/samples/client/petstore/dart-dio/doc/StoreApi.md
new file mode 100644
index 00000000000..33896baac9b
--- /dev/null
+++ b/samples/client/petstore/dart-dio/doc/StoreApi.md
@@ -0,0 +1,186 @@
+# openapi.api.StoreApi
+
+## Load the API package
+```dart
+import 'package:openapi/api.dart';
+```
+
+All URIs are relative to *http://petstore.swagger.io/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**deleteOrder**](StoreApi.md#deleteOrder) | **delete** /store/order/{orderId} | Delete purchase order by ID
+[**getInventory**](StoreApi.md#getInventory) | **get** /store/inventory | Returns pet inventories by status
+[**getOrderById**](StoreApi.md#getOrderById) | **get** /store/order/{orderId} | Find purchase order by ID
+[**placeOrder**](StoreApi.md#placeOrder) | **post** /store/order | Place an order for a pet
+
+
+# **deleteOrder**
+> deleteOrder(orderId)
+
+Delete purchase order by ID
+
+For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+
+var api_instance = new StoreApi();
+var orderId = orderId_example; // String | ID of the order that needs to be deleted
+
+try {
+ api_instance.deleteOrder(orderId);
+} catch (e) {
+ print("Exception when calling StoreApi->deleteOrder: $e\n");
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **orderId** | **String**| ID of the order that needs to be deleted | [default to null]
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+[[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)
+
+# **getInventory**
+> Map getInventory()
+
+Returns pet inventories by status
+
+Returns a map of status codes to quantities
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+// TODO Configure API key authorization: api_key
+//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY';
+// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
+//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer';
+
+var api_instance = new StoreApi();
+
+try {
+ var result = api_instance.getInventory();
+ print(result);
+} catch (e) {
+ print("Exception when calling StoreApi->getInventory: $e\n");
+}
+```
+
+### Parameters
+This endpoint does not need any parameter.
+
+### Return type
+
+**Map**
+
+### Authorization
+
+[api_key](../README.md#api_key)
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+[[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)
+
+# **getOrderById**
+> Order getOrderById(orderId)
+
+Find purchase order by ID
+
+For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+
+var api_instance = new StoreApi();
+var orderId = 789; // int | ID of pet that needs to be fetched
+
+try {
+ var result = api_instance.getOrderById(orderId);
+ print(result);
+} catch (e) {
+ print("Exception when calling StoreApi->getOrderById: $e\n");
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **orderId** | **int**| ID of pet that needs to be fetched | [default to null]
+
+### Return type
+
+[**Order**](Order.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+[[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)
+
+# **placeOrder**
+> Order placeOrder(body)
+
+Place an order for a pet
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+
+var api_instance = new StoreApi();
+var body = new Order(); // Order | order placed for purchasing the pet
+
+try {
+ var result = api_instance.placeOrder(body);
+ print(result);
+} catch (e) {
+ print("Exception when calling StoreApi->placeOrder: $e\n");
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**Order**](Order.md)| order placed for purchasing the pet |
+
+### Return type
+
+[**Order**](Order.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+[[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)
+
diff --git a/samples/client/petstore/dart-dio/doc/Tag.md b/samples/client/petstore/dart-dio/doc/Tag.md
new file mode 100644
index 00000000000..ded7b32ac3d
--- /dev/null
+++ b/samples/client/petstore/dart-dio/doc/Tag.md
@@ -0,0 +1,16 @@
+# openapi.model.Tag
+
+## Load the model package
+```dart
+import 'package:openapi/api.dart';
+```
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **int** | | [optional] [default to null]
+**name** | **String** | | [optional] [default to null]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/dart-dio/doc/User.md b/samples/client/petstore/dart-dio/doc/User.md
new file mode 100644
index 00000000000..3761b70cf0b
--- /dev/null
+++ b/samples/client/petstore/dart-dio/doc/User.md
@@ -0,0 +1,22 @@
+# openapi.model.User
+
+## Load the model package
+```dart
+import 'package:openapi/api.dart';
+```
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **int** | | [optional] [default to null]
+**username** | **String** | | [optional] [default to null]
+**firstName** | **String** | | [optional] [default to null]
+**lastName** | **String** | | [optional] [default to null]
+**email** | **String** | | [optional] [default to null]
+**password** | **String** | | [optional] [default to null]
+**phone** | **String** | | [optional] [default to null]
+**userStatus** | **int** | User Status | [optional] [default to null]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/dart-dio/doc/UserApi.md b/samples/client/petstore/dart-dio/doc/UserApi.md
new file mode 100644
index 00000000000..052dc20aef7
--- /dev/null
+++ b/samples/client/petstore/dart-dio/doc/UserApi.md
@@ -0,0 +1,349 @@
+# openapi.api.UserApi
+
+## Load the API package
+```dart
+import 'package:openapi/api.dart';
+```
+
+All URIs are relative to *http://petstore.swagger.io/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**createUser**](UserApi.md#createUser) | **post** /user | Create user
+[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **post** /user/createWithArray | Creates list of users with given input array
+[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **post** /user/createWithList | Creates list of users with given input array
+[**deleteUser**](UserApi.md#deleteUser) | **delete** /user/{username} | Delete user
+[**getUserByName**](UserApi.md#getUserByName) | **get** /user/{username} | Get user by user name
+[**loginUser**](UserApi.md#loginUser) | **get** /user/login | Logs user into the system
+[**logoutUser**](UserApi.md#logoutUser) | **get** /user/logout | Logs out current logged in user session
+[**updateUser**](UserApi.md#updateUser) | **put** /user/{username} | Updated user
+
+
+# **createUser**
+> createUser(body)
+
+Create user
+
+This can only be done by the logged in user.
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+
+var api_instance = new UserApi();
+var body = new User(); // User | Created user object
+
+try {
+ api_instance.createUser(body);
+} catch (e) {
+ print("Exception when calling UserApi->createUser: $e\n");
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**User**](User.md)| Created user object |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+[[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)
+
+# **createUsersWithArrayInput**
+> createUsersWithArrayInput(body)
+
+Creates list of users with given input array
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+
+var api_instance = new UserApi();
+var body = [new List<User>()]; // List | List of user object
+
+try {
+ api_instance.createUsersWithArrayInput(body);
+} catch (e) {
+ print("Exception when calling UserApi->createUsersWithArrayInput: $e\n");
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**List<User>**](User.md)| List of user object |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+[[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)
+
+# **createUsersWithListInput**
+> createUsersWithListInput(body)
+
+Creates list of users with given input array
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+
+var api_instance = new UserApi();
+var body = [new List<User>()]; // List | List of user object
+
+try {
+ api_instance.createUsersWithListInput(body);
+} catch (e) {
+ print("Exception when calling UserApi->createUsersWithListInput: $e\n");
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**List<User>**](User.md)| List of user object |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+[[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)
+
+# **deleteUser**
+> deleteUser(username)
+
+Delete user
+
+This can only be done by the logged in user.
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+
+var api_instance = new UserApi();
+var username = username_example; // String | The name that needs to be deleted
+
+try {
+ api_instance.deleteUser(username);
+} catch (e) {
+ print("Exception when calling UserApi->deleteUser: $e\n");
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **username** | **String**| The name that needs to be deleted | [default to null]
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+[[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)
+
+# **getUserByName**
+> User getUserByName(username)
+
+Get user by user name
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+
+var api_instance = new UserApi();
+var username = username_example; // String | The name that needs to be fetched. Use user1 for testing.
+
+try {
+ var result = api_instance.getUserByName(username);
+ print(result);
+} catch (e) {
+ print("Exception when calling UserApi->getUserByName: $e\n");
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null]
+
+### Return type
+
+[**User**](User.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+[[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)
+
+# **loginUser**
+> String loginUser(username, password)
+
+Logs user into the system
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+
+var api_instance = new UserApi();
+var username = username_example; // String | The user name for login
+var password = password_example; // String | The password for login in clear text
+
+try {
+ var result = api_instance.loginUser(username, password);
+ print(result);
+} catch (e) {
+ print("Exception when calling UserApi->loginUser: $e\n");
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **username** | **String**| The user name for login | [default to null]
+ **password** | **String**| The password for login in clear text | [default to null]
+
+### Return type
+
+**String**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+[[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)
+
+# **logoutUser**
+> logoutUser()
+
+Logs out current logged in user session
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+
+var api_instance = new UserApi();
+
+try {
+ api_instance.logoutUser();
+} catch (e) {
+ print("Exception when calling UserApi->logoutUser: $e\n");
+}
+```
+
+### Parameters
+This endpoint does not need any parameter.
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+[[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)
+
+# **updateUser**
+> updateUser(username, body)
+
+Updated user
+
+This can only be done by the logged in user.
+
+### Example
+```dart
+import 'package:openapi/api.dart';
+
+var api_instance = new UserApi();
+var username = username_example; // String | name that need to be deleted
+var body = new User(); // User | Updated user object
+
+try {
+ api_instance.updateUser(username, body);
+} catch (e) {
+ print("Exception when calling UserApi->updateUser: $e\n");
+}
+```
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **username** | **String**| name that need to be deleted | [default to null]
+ **body** | [**User**](User.md)| Updated user object |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+[[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)
+
diff --git a/samples/client/petstore/dart-dio/lib/api.dart b/samples/client/petstore/dart-dio/lib/api.dart
index b2575064fbf..8fc03c1fec9 100644
--- a/samples/client/petstore/dart-dio/lib/api.dart
+++ b/samples/client/petstore/dart-dio/lib/api.dart
@@ -8,45 +8,52 @@ import 'package:openapi/api/pet_api.dart';
import 'package:openapi/api/store_api.dart';
import 'package:openapi/api/user_api.dart';
-class Openapi {
- Dio dio;
- Serializers serializers;
- String basePath = "http://petstore.swagger.io/v2";
- Openapi({this.dio, Serializers serializers}) {
+class Openapi {
+
+ Dio dio;
+ Serializers serializers;
+ String basePath = "http://petstore.swagger.io/v2";
+
+ Openapi({this.dio, Serializers serializers}) {
if (dio == null) {
- BaseOptions options = new BaseOptions(
- baseUrl: basePath,
- connectTimeout: 5000,
- receiveTimeout: 3000,
- );
- this.dio = new Dio(options);
+ BaseOptions options = new BaseOptions(
+ baseUrl: basePath,
+ connectTimeout: 5000,
+ receiveTimeout: 3000,
+ );
+ this.dio = new Dio(options);
}
this.serializers = serializers ?? standardSerializers;
- }
+}
- /**
+
+ /**
* Get PetApi instance, base route and serializer can be overridden by a given but be careful,
* by doing that all interceptors will not be executed
*/
- PetApi getPetApi() {
+ PetApi getPetApi() {
return PetApi(dio, serializers);
- }
+ }
- /**
+
+ /**
* Get StoreApi instance, base route and serializer can be overridden by a given but be careful,
* by doing that all interceptors will not be executed
*/
- StoreApi getStoreApi() {
+ StoreApi getStoreApi() {
return StoreApi(dio, serializers);
- }
+ }
- /**
+
+ /**
* Get UserApi instance, base route and serializer can be overridden by a given but be careful,
* by doing that all interceptors will not be executed
*/
- UserApi getUserApi() {
+ UserApi getUserApi() {
return UserApi(dio, serializers);
- }
-}
+ }
+
+
+}
\ No newline at end of file
diff --git a/samples/client/petstore/dart-dio/lib/api/pet_api.dart b/samples/client/petstore/dart-dio/lib/api/pet_api.dart
index e65520ad76c..4b182c95f3e 100644
--- a/samples/client/petstore/dart-dio/lib/api/pet_api.dart
+++ b/samples/client/petstore/dart-dio/lib/api/pet_api.dart
@@ -10,367 +10,322 @@ import 'package:openapi/model/api_response.dart';
import 'dart:typed_data';
class PetApi {
- final Dio _dio;
- Serializers _serializers;
+ final Dio _dio;
+ Serializers _serializers;
- PetApi(this._dio, this._serializers);
+ PetApi(this._dio, this._serializers);
- /// Add a new pet to the store
- ///
- ///
- Future addPet(
- Pet body, {
- CancelToken cancelToken,
- Map headers,
- }) async {
- String path = "/pet";
+ /// Add a new pet to the store
+ ///
+ ///
+ FutureaddPet(Pet body,{ CancelToken cancelToken, Map headers,}) async {
- // query params
- Map queryParams = {};
- Map headerParams = Map.from(headers ?? {});
- Map formParams = {};
+ String path = "/pet";
- queryParams.removeWhere((key, value) => value == null);
- headerParams.removeWhere((key, value) => value == null);
- formParams.removeWhere((key, value) => value == null);
+ // query params
+ Map queryParams = {};
+ Map headerParams = Map.from(headers ?? {});
+ Map formParams = {};
- List contentTypes = ["application/json", "application/xml"];
+ queryParams.removeWhere((key, value) => value == null);
+ headerParams.removeWhere((key, value) => value == null);
+ formParams.removeWhere((key, value) => value == null);
- var serializedBody = _serializers.serialize(body);
- var jsonbody = json.encode(serializedBody);
+ List contentTypes = [
+ "application/json",
+ "application/xml"];
- return _dio.request(
- path,
- queryParameters: queryParams,
- data: jsonbody,
- options: Options(
- method: 'post'.toUpperCase(),
- headers: headerParams,
- contentType:
- contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
- ),
- cancelToken: cancelToken,
- );
- }
+ var serializedBody = _serializers.serialize(body);
+ var jsonbody = json.encode(serializedBody);
- /// Deletes a pet
- ///
- ///
- Future deletePet(
- int petId, {
- String apiKey,
- CancelToken cancelToken,
- Map headers,
- }) async {
- String path =
- "/pet/{petId}".replaceAll("{" + "petId" + "}", petId.toString());
+ return _dio.request(
+ path,
+ queryParameters: queryParams,
+ data: jsonbody,
+ options: Options(
+ method: 'post'.toUpperCase(),
+ headers: headerParams,
+ contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
+ ),
+ cancelToken: cancelToken,
+ );
+ }
+ /// Deletes a pet
+ ///
+ ///
+ FuturedeletePet(int petId,{ String apiKey,CancelToken cancelToken, Map headers,}) async {
- // query params
- Map queryParams = {};
- Map headerParams = Map.from(headers ?? {});
- Map formParams = {};
+ String path = "/pet/{petId}".replaceAll("{" + "petId" + "}", petId.toString());
- headerParams["api_key"] = apiKey;
- queryParams.removeWhere((key, value) => value == null);
- headerParams.removeWhere((key, value) => value == null);
- formParams.removeWhere((key, value) => value == null);
+ // query params
+ Map queryParams = {};
+ Map headerParams = Map.from(headers ?? {});
+ Map formParams = {};
- List contentTypes = [];
+ headerParams["api_key"] = apiKey;
+ queryParams.removeWhere((key, value) => value == null);
+ headerParams.removeWhere((key, value) => value == null);
+ formParams.removeWhere((key, value) => value == null);
- return _dio.request(
- path,
- queryParameters: queryParams,
- options: Options(
- method: 'delete'.toUpperCase(),
- headers: headerParams,
- contentType:
- contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
- ),
- cancelToken: cancelToken,
- );
- }
+ List contentTypes = [];
- /// Finds Pets by status
- ///
- /// Multiple status values can be provided with comma separated strings
- Future>> findPetsByStatus(
- List status, {
- CancelToken cancelToken,
- Map headers,
- }) async {
- String path = "/pet/findByStatus";
- // query params
- Map queryParams = {};
- Map headerParams = Map.from(headers ?? {});
- Map formParams = {};
+ return _dio.request(
+ path,
+ queryParameters: queryParams,
+ options: Options(
+ method: 'delete'.toUpperCase(),
+ headers: headerParams,
+ contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json",
+ ),
+ cancelToken: cancelToken,
+ );
+ }
+ /// Finds Pets by status
+ ///
+ /// Multiple status values can be provided with comma separated strings
+ Future>>findPetsByStatus(List status,{ CancelToken cancelToken, Map headers,}) async {
- queryParams["status"] = status;
- queryParams.removeWhere((key, value) => value == null);
- headerParams.removeWhere((key, value) => value == null);
- formParams.removeWhere((key, value) => value == null);
+ String path = "/pet/findByStatus";
- List contentTypes = [];
+ // query params
+ Map