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 queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + Map formParams = {}; - return _dio - .request( - path, - queryParameters: queryParams, - options: Options( - method: 'get'.toUpperCase(), - headers: headerParams, - contentType: - contentTypes.isNotEmpty ? contentTypes[0] : "application/json", - ), - cancelToken: cancelToken, - ) - .then((response) { - final FullType type = - const FullType(BuiltList, const [const FullType(Pet)]); - BuiltList dataList = - _serializers.deserialize(response.data, specifiedType: type); - var data = dataList.toList(); + queryParams["status"] = status; + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + formParams.removeWhere((key, value) => value == null); - return Response>( - data: data, - headers: response.headers, - request: response.request, - redirects: response.redirects, - statusCode: response.statusCode, - statusMessage: response.statusMessage, - extra: response.extra, - ); - }); - } + List contentTypes = []; - /// Finds Pets by tags - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - Future>> findPetsByTags( - List tags, { - CancelToken cancelToken, - Map headers, - }) async { - String path = "/pet/findByTags"; - // query params - Map queryParams = {}; - Map headerParams = Map.from(headers ?? {}); - Map formParams = {}; + return _dio.request( + path, + queryParameters: queryParams, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + ).then((response) { - queryParams["tags"] = tags; - queryParams.removeWhere((key, value) => value == null); - headerParams.removeWhere((key, value) => value == null); - formParams.removeWhere((key, value) => value == null); + final FullType type = const FullType(BuiltList, const [const FullType(Pet)]); + BuiltList dataList = _serializers.deserialize(response.data, specifiedType: type); + var data = dataList.toList(); - List contentTypes = []; + return Response>( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Finds Pets by tags + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + Future>>findPetsByTags(List tags,{ CancelToken cancelToken, Map headers,}) async { - return _dio - .request( - path, - queryParameters: queryParams, - options: Options( - method: 'get'.toUpperCase(), - headers: headerParams, - contentType: - contentTypes.isNotEmpty ? contentTypes[0] : "application/json", - ), - cancelToken: cancelToken, - ) - .then((response) { - final FullType type = - const FullType(BuiltList, const [const FullType(Pet)]); - BuiltList dataList = - _serializers.deserialize(response.data, specifiedType: type); - var data = dataList.toList(); + String path = "/pet/findByTags"; - return Response>( - data: data, - headers: response.headers, - request: response.request, - redirects: response.redirects, - statusCode: response.statusCode, - statusMessage: response.statusMessage, - extra: response.extra, - ); - }); - } + // query params + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + Map formParams = {}; - /// Find pet by ID - /// - /// Returns a single pet - Future> getPetById( - int petId, { - CancelToken cancelToken, - Map headers, - }) async { - String path = - "/pet/{petId}".replaceAll("{" + "petId" + "}", petId.toString()); + queryParams["tags"] = tags; + 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 = []; - queryParams.removeWhere((key, value) => value == null); - headerParams.removeWhere((key, value) => value == null); - formParams.removeWhere((key, value) => value == null); - List contentTypes = []; + return _dio.request( + path, + queryParameters: queryParams, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + ).then((response) { - return _dio - .request( - path, - queryParameters: queryParams, - options: Options( - method: 'get'.toUpperCase(), - headers: headerParams, - contentType: - contentTypes.isNotEmpty ? contentTypes[0] : "application/json", - ), - cancelToken: cancelToken, - ) - .then((response) { - var serializer = _serializers.serializerForType(Pet); - var data = _serializers.deserializeWith(serializer, response.data); + final FullType type = const FullType(BuiltList, const [const FullType(Pet)]); + BuiltList dataList = _serializers.deserialize(response.data, specifiedType: type); + var data = dataList.toList(); - return Response( - data: data, - headers: response.headers, - request: response.request, - redirects: response.redirects, - statusCode: response.statusCode, - statusMessage: response.statusMessage, - extra: response.extra, - ); - }); - } + return Response>( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Find pet by ID + /// + /// Returns a single pet + Future>getPetById(int petId,{ CancelToken cancelToken, Map headers,}) async { - /// Update an existing pet - /// - /// - Future updatePet( - Pet body, { - CancelToken cancelToken, - Map headers, - }) async { - String path = "/pet"; + String path = "/pet/{petId}".replaceAll("{" + "petId" + "}", petId.toString()); - // query params - Map queryParams = {}; - Map headerParams = Map.from(headers ?? {}); - Map formParams = {}; + // query params + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + Map formParams = {}; - queryParams.removeWhere((key, value) => value == null); - headerParams.removeWhere((key, value) => value == null); - formParams.removeWhere((key, value) => value == null); + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + formParams.removeWhere((key, value) => value == null); - List contentTypes = ["application/json", "application/xml"]; + List contentTypes = []; - var serializedBody = _serializers.serialize(body); - var jsonbody = json.encode(serializedBody); - return _dio.request( - path, - queryParameters: queryParams, - data: jsonbody, - options: Options( - method: 'put'.toUpperCase(), - headers: headerParams, - contentType: - contentTypes.isNotEmpty ? contentTypes[0] : "application/json", - ), - cancelToken: cancelToken, - ); - } + return _dio.request( + path, + queryParameters: queryParams, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + ).then((response) { - /// Updates a pet in the store with form data - /// - /// - Future updatePetWithForm( - int petId, { - String name, - String status, - CancelToken cancelToken, - Map headers, - }) async { - String path = - "/pet/{petId}".replaceAll("{" + "petId" + "}", petId.toString()); + var serializer = _serializers.serializerForType(Pet); + var data = _serializers.deserializeWith(serializer, response.data); - // query params - Map queryParams = {}; - Map headerParams = Map.from(headers ?? {}); - Map formParams = {}; + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Update an existing pet + /// + /// + FutureupdatePet(Pet body,{ CancelToken cancelToken, Map headers,}) async { - queryParams.removeWhere((key, value) => value == null); - headerParams.removeWhere((key, value) => value == null); - formParams.removeWhere((key, value) => value == null); + String path = "/pet"; - List contentTypes = ["application/x-www-form-urlencoded"]; + // query params + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + Map formParams = {}; - return _dio.request( - path, - queryParameters: queryParams, - options: Options( - method: 'post'.toUpperCase(), - headers: headerParams, - contentType: - contentTypes.isNotEmpty ? contentTypes[0] : "application/json", - ), - cancelToken: cancelToken, - ); - } + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + formParams.removeWhere((key, value) => value == null); - /// uploads an image - /// - /// - Future> uploadFile( - int petId, { - String additionalMetadata, - Uint8List file, - CancelToken cancelToken, - Map headers, - }) async { - String path = "/pet/{petId}/uploadImage" - .replaceAll("{" + "petId" + "}", petId.toString()); + List contentTypes = [ + "application/json", + "application/xml"]; - // query params - Map queryParams = {}; - Map headerParams = Map.from(headers ?? {}); - Map formParams = {}; + var serializedBody = _serializers.serialize(body); + var jsonbody = json.encode(serializedBody); - queryParams.removeWhere((key, value) => value == null); - headerParams.removeWhere((key, value) => value == null); - formParams.removeWhere((key, value) => value == null); + return _dio.request( + path, + queryParameters: queryParams, + data: jsonbody, + options: Options( + method: 'put'.toUpperCase(), + headers: headerParams, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + ); + } + /// Updates a pet in the store with form data + /// + /// + FutureupdatePetWithForm(int petId,{ String name,String status,CancelToken cancelToken, Map headers,}) async { - List contentTypes = ["multipart/form-data"]; + String path = "/pet/{petId}".replaceAll("{" + "petId" + "}", petId.toString()); - return _dio - .request( - path, - queryParameters: queryParams, - options: Options( - method: 'post'.toUpperCase(), - headers: headerParams, - contentType: - contentTypes.isNotEmpty ? contentTypes[0] : "application/json", - ), - cancelToken: cancelToken, - ) - .then((response) { - var serializer = _serializers.serializerForType(ApiResponse); - var data = - _serializers.deserializeWith(serializer, response.data); + // query params + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + Map formParams = {}; - return Response( - data: data, - headers: response.headers, - request: response.request, - redirects: response.redirects, - statusCode: response.statusCode, - statusMessage: response.statusMessage, - extra: response.extra, - ); - }); - } -} + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + formParams.removeWhere((key, value) => value == null); + + List contentTypes = [ + "application/x-www-form-urlencoded"]; + + + return _dio.request( + path, + queryParameters: queryParams, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + ); + } + /// uploads an image + /// + /// + Future>uploadFile(int petId,{ String additionalMetadata,Uint8List file,CancelToken cancelToken, Map headers,}) async { + + String path = "/pet/{petId}/uploadImage".replaceAll("{" + "petId" + "}", petId.toString()); + + // query params + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + Map formParams = {}; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + formParams.removeWhere((key, value) => value == null); + + List contentTypes = [ + "multipart/form-data"]; + + + return _dio.request( + path, + queryParameters: queryParams, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + ).then((response) { + + var serializer = _serializers.serializerForType(ApiResponse); + var data = _serializers.deserializeWith(serializer, response.data); + + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + } diff --git a/samples/client/petstore/dart-dio/lib/api/user_api.dart b/samples/client/petstore/dart-dio/lib/api/user_api.dart index d10f5fea593..521be872934 100644 --- a/samples/client/petstore/dart-dio/lib/api/user_api.dart +++ b/samples/client/petstore/dart-dio/lib/api/user_api.dart @@ -8,337 +8,293 @@ import 'package:built_value/serializer.dart'; import 'package:openapi/model/user.dart'; class UserApi { - final Dio _dio; - Serializers _serializers; + final Dio _dio; + Serializers _serializers; - UserApi(this._dio, this._serializers); + UserApi(this._dio, this._serializers); - /// Create user - /// - /// This can only be done by the logged in user. - Future createUser( - User body, { - CancelToken cancelToken, - Map headers, - }) async { - String path = "/user"; + /// Create user + /// + /// This can only be done by the logged in user. + FuturecreateUser(User body,{ CancelToken cancelToken, Map headers,}) async { - // query params - Map queryParams = {}; - Map headerParams = Map.from(headers ?? {}); - Map formParams = {}; + String path = "/user"; - 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 = []; + 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 = []; - 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); - /// Creates list of users with given input array - /// - /// - Future createUsersWithArrayInput( - List body, { - CancelToken cancelToken, - Map headers, - }) async { - String path = "/user/createWithArray"; + return _dio.request( + path, + queryParameters: queryParams, + data: jsonbody, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + ); + } + /// Creates list of users with given input array + /// + /// + FuturecreateUsersWithArrayInput(List body,{ CancelToken cancelToken, Map headers,}) async { - // query params - Map queryParams = {}; - Map headerParams = Map.from(headers ?? {}); - Map formParams = {}; + String path = "/user/createWithArray"; - 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 = []; + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + formParams.removeWhere((key, value) => value == null); - final type = const FullType(BuiltList, const [const FullType(User)]); - var serializedBody = - _serializers.serialize(BuiltList.from(body), specifiedType: type); - var jsonbody = json.encode(serializedBody); + List contentTypes = []; - return _dio.request( - path, - queryParameters: queryParams, - data: jsonbody, - options: Options( - method: 'post'.toUpperCase(), - headers: headerParams, - contentType: - contentTypes.isNotEmpty ? contentTypes[0] : "application/json", - ), - cancelToken: cancelToken, - ); - } + final type = const FullType(BuiltList, const [const FullType(User)]); + var serializedBody = _serializers.serialize(BuiltList.from(body), specifiedType: type); + var jsonbody = json.encode(serializedBody); - /// Creates list of users with given input array - /// - /// - Future createUsersWithListInput( - List body, { - CancelToken cancelToken, - Map headers, - }) async { - String path = "/user/createWithList"; + return _dio.request( + path, + queryParameters: queryParams, + data: jsonbody, + options: Options( + method: 'post'.toUpperCase(), + headers: headerParams, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + ); + } + /// Creates list of users with given input array + /// + /// + FuturecreateUsersWithListInput(List body,{ CancelToken cancelToken, Map headers,}) async { - // query params - Map queryParams = {}; - Map headerParams = Map.from(headers ?? {}); - Map formParams = {}; + String path = "/user/createWithList"; - 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 = []; + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + formParams.removeWhere((key, value) => value == null); - final type = const FullType(BuiltList, const [const FullType(User)]); - var serializedBody = - _serializers.serialize(BuiltList.from(body), specifiedType: type); - var jsonbody = json.encode(serializedBody); + List contentTypes = []; - return _dio.request( - path, - queryParameters: queryParams, - data: jsonbody, - options: Options( - method: 'post'.toUpperCase(), - headers: headerParams, - contentType: - contentTypes.isNotEmpty ? contentTypes[0] : "application/json", - ), - cancelToken: cancelToken, - ); - } + final type = const FullType(BuiltList, const [const FullType(User)]); + var serializedBody = _serializers.serialize(BuiltList.from(body), specifiedType: type); + var jsonbody = json.encode(serializedBody); - /// Delete user - /// - /// This can only be done by the logged in user. - Future deleteUser( - String username, { - CancelToken cancelToken, - Map headers, - }) async { - String path = "/user/{username}" - .replaceAll("{" + "username" + "}", username.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, + ); + } + /// Delete user + /// + /// This can only be done by the logged in user. + FuturedeleteUser(String username,{ CancelToken cancelToken, Map headers,}) async { - // query params - Map queryParams = {}; - Map headerParams = Map.from(headers ?? {}); - Map formParams = {}; + String path = "/user/{username}".replaceAll("{" + "username" + "}", username.toString()); - 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 = []; + 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 = []; - /// Get user by user name - /// - /// - Future> getUserByName( - String username, { - CancelToken cancelToken, - Map headers, - }) async { - String path = "/user/{username}" - .replaceAll("{" + "username" + "}", username.toString()); - // 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, + ); + } + /// Get user by user name + /// + /// + Future>getUserByName(String username,{ CancelToken cancelToken, Map headers,}) async { - queryParams.removeWhere((key, value) => value == null); - headerParams.removeWhere((key, value) => value == null); - formParams.removeWhere((key, value) => value == null); + String path = "/user/{username}".replaceAll("{" + "username" + "}", username.toString()); - List contentTypes = []; + // query params + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + Map formParams = {}; - return _dio - .request( - path, - queryParameters: queryParams, - options: Options( - method: 'get'.toUpperCase(), - headers: headerParams, - contentType: - contentTypes.isNotEmpty ? contentTypes[0] : "application/json", - ), - cancelToken: cancelToken, - ) - .then((response) { - var serializer = _serializers.serializerForType(User); - var data = _serializers.deserializeWith(serializer, response.data); + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + formParams.removeWhere((key, value) => value == null); - return Response( - data: data, - headers: response.headers, - request: response.request, - redirects: response.redirects, - statusCode: response.statusCode, - statusMessage: response.statusMessage, - extra: response.extra, - ); - }); - } + List contentTypes = []; - /// Logs user into the system - /// - /// - Future> loginUser( - String username, - String password, { - CancelToken cancelToken, - Map headers, - }) async { - String path = "/user/login"; - // query params - Map queryParams = {}; - Map headerParams = Map.from(headers ?? {}); - Map formParams = {}; + return _dio.request( + path, + queryParameters: queryParams, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + ).then((response) { - queryParams["username"] = username; - queryParams["password"] = password; - queryParams.removeWhere((key, value) => value == null); - headerParams.removeWhere((key, value) => value == null); - formParams.removeWhere((key, value) => value == null); + var serializer = _serializers.serializerForType(User); + var data = _serializers.deserializeWith(serializer, response.data); - List contentTypes = []; + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Logs user into the system + /// + /// + Future>loginUser(String username,String password,{ CancelToken cancelToken, Map headers,}) async { - return _dio - .request( - path, - queryParameters: queryParams, - options: Options( - method: 'get'.toUpperCase(), - headers: headerParams, - contentType: - contentTypes.isNotEmpty ? contentTypes[0] : "application/json", - ), - cancelToken: cancelToken, - ) - .then((response) { - var serializer = _serializers.serializerForType(String); - var data = - _serializers.deserializeWith(serializer, response.data); + String path = "/user/login"; - return Response( - data: data, - headers: response.headers, - request: response.request, - redirects: response.redirects, - statusCode: response.statusCode, - statusMessage: response.statusMessage, - extra: response.extra, - ); - }); - } + // query params + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + Map formParams = {}; - /// Logs out current logged in user session - /// - /// - Future logoutUser({ - CancelToken cancelToken, - Map headers, - }) async { - String path = "/user/logout"; + queryParams["username"] = username; + queryParams["password"] = password; + 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 = []; - queryParams.removeWhere((key, value) => value == null); - headerParams.removeWhere((key, value) => value == null); - formParams.removeWhere((key, value) => value == null); - List contentTypes = []; + return _dio.request( + path, + queryParameters: queryParams, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + ).then((response) { - return _dio.request( - path, - queryParameters: queryParams, - options: Options( - method: 'get'.toUpperCase(), - headers: headerParams, - contentType: - contentTypes.isNotEmpty ? contentTypes[0] : "application/json", - ), - cancelToken: cancelToken, - ); - } + var serializer = _serializers.serializerForType(String); + var data = _serializers.deserializeWith(serializer, response.data); - /// Updated user - /// - /// This can only be done by the logged in user. - Future updateUser( - String username, - User body, { - CancelToken cancelToken, - Map headers, - }) async { - String path = "/user/{username}" - .replaceAll("{" + "username" + "}", username.toString()); + return Response( + data: data, + headers: response.headers, + request: response.request, + redirects: response.redirects, + statusCode: response.statusCode, + statusMessage: response.statusMessage, + extra: response.extra, + ); + }); + } + /// Logs out current logged in user session + /// + /// + FuturelogoutUser({ CancelToken cancelToken, Map headers,}) async { - // query params - Map queryParams = {}; - Map headerParams = Map.from(headers ?? {}); - Map formParams = {}; + String path = "/user/logout"; - 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 = []; + 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 = []; - return _dio.request( - path, - queryParameters: queryParams, - data: jsonbody, - options: Options( - method: 'put'.toUpperCase(), - headers: headerParams, - contentType: - contentTypes.isNotEmpty ? contentTypes[0] : "application/json", - ), - cancelToken: cancelToken, - ); - } -} + + return _dio.request( + path, + queryParameters: queryParams, + options: Options( + method: 'get'.toUpperCase(), + headers: headerParams, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + ); + } + /// Updated user + /// + /// This can only be done by the logged in user. + FutureupdateUser(String username,User body,{ CancelToken cancelToken, Map headers,}) async { + + String path = "/user/{username}".replaceAll("{" + "username" + "}", username.toString()); + + // query params + Map queryParams = {}; + Map headerParams = Map.from(headers ?? {}); + Map formParams = {}; + + queryParams.removeWhere((key, value) => value == null); + headerParams.removeWhere((key, value) => value == null); + formParams.removeWhere((key, value) => value == null); + + List contentTypes = []; + + var serializedBody = _serializers.serialize(body); + var jsonbody = json.encode(serializedBody); + + return _dio.request( + path, + queryParameters: queryParams, + data: jsonbody, + options: Options( + method: 'put'.toUpperCase(), + headers: headerParams, + contentType: contentTypes.isNotEmpty ? contentTypes[0] : "application/json", + ), + cancelToken: cancelToken, + ); + } + } diff --git a/samples/client/petstore/dart-dio/lib/model/api_response.dart b/samples/client/petstore/dart-dio/lib/model/api_response.dart index 0feebafb005..1463d222b91 100644 --- a/samples/client/petstore/dart-dio/lib/model/api_response.dart +++ b/samples/client/petstore/dart-dio/lib/model/api_response.dart @@ -1,24 +1,28 @@ -import 'package:built_value/built_value.dart'; + import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; part 'api_response.g.dart'; abstract class ApiResponse implements Built { - @nullable - @BuiltValueField(wireName: 'code') - int get code; - @nullable - @BuiltValueField(wireName: 'type') - String get type; + + @nullable + @BuiltValueField(wireName: 'code') + int get code; + + @nullable + @BuiltValueField(wireName: 'type') + String get type; + + @nullable + @BuiltValueField(wireName: 'message') + String get message; - @nullable - @BuiltValueField(wireName: 'message') - String get message; + // Boilerplate code needed to wire-up generated code + ApiResponse._(); - // Boilerplate code needed to wire-up generated code - ApiResponse._(); + factory ApiResponse([updates(ApiResponseBuilder b)]) = _$ApiResponse; + static Serializer get serializer => _$apiResponseSerializer; - factory ApiResponse([updates(ApiResponseBuilder b)]) = _$ApiResponse; - static Serializer get serializer => _$apiResponseSerializer; } + diff --git a/samples/client/petstore/dart-dio/lib/model/category.dart b/samples/client/petstore/dart-dio/lib/model/category.dart index 5d80fb50366..725c0a5c618 100644 --- a/samples/client/petstore/dart-dio/lib/model/category.dart +++ b/samples/client/petstore/dart-dio/lib/model/category.dart @@ -1,20 +1,24 @@ -import 'package:built_value/built_value.dart'; + import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; part 'category.g.dart'; abstract class Category implements Built { - @nullable - @BuiltValueField(wireName: 'id') - int get id; - @nullable - @BuiltValueField(wireName: 'name') - String get name; + + @nullable + @BuiltValueField(wireName: 'id') + int get id; + + @nullable + @BuiltValueField(wireName: 'name') + String get name; - // Boilerplate code needed to wire-up generated code - Category._(); + // Boilerplate code needed to wire-up generated code + Category._(); + + factory Category([updates(CategoryBuilder b)]) = _$Category; + static Serializer get serializer => _$categorySerializer; - factory Category([updates(CategoryBuilder b)]) = _$Category; - static Serializer get serializer => _$categorySerializer; } + diff --git a/samples/client/petstore/dart-dio/lib/model/order.dart b/samples/client/petstore/dart-dio/lib/model/order.dart index c04e3032ce8..01f93031072 100644 --- a/samples/client/petstore/dart-dio/lib/model/order.dart +++ b/samples/client/petstore/dart-dio/lib/model/order.dart @@ -1,39 +1,42 @@ -import 'package:built_value/built_value.dart'; + import 'DateTime'; + import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; part 'order.g.dart'; abstract class Order implements Built { - @nullable - @BuiltValueField(wireName: 'id') - int get id; - @nullable - @BuiltValueField(wireName: 'petId') - int get petId; + + @nullable + @BuiltValueField(wireName: 'id') + int get id; + + @nullable + @BuiltValueField(wireName: 'petId') + int get petId; + + @nullable + @BuiltValueField(wireName: 'quantity') + int get quantity; + + @nullable + @BuiltValueField(wireName: 'shipDate') + DateTime get shipDate; + /* Order Status */ + @nullable + @BuiltValueField(wireName: 'status') + String get status; + //enum statusEnum { placed, approved, delivered, }; + + @nullable + @BuiltValueField(wireName: 'complete') + bool get complete; - @nullable - @BuiltValueField(wireName: 'quantity') - int get quantity; + // Boilerplate code needed to wire-up generated code + Order._(); - @nullable - @BuiltValueField(wireName: 'shipDate') - DateTime get shipDate; - /* Order Status */ - @nullable + factory Order([updates(OrderBuilder b)]) = _$Order; + static Serializer get serializer => _$orderSerializer; - /* Order Status */ - @BuiltValueField(wireName: 'status') - String get status; - //enum statusEnum { placed, approved, delivered, }; - - @nullable - @BuiltValueField(wireName: 'complete') - bool get complete; - - // Boilerplate code needed to wire-up generated code - Order._(); - - factory Order([updates(OrderBuilder b)]) = _$Order; - static Serializer get serializer => _$orderSerializer; } + diff --git a/samples/client/petstore/dart-dio/lib/model/pet.dart b/samples/client/petstore/dart-dio/lib/model/pet.dart index 81441c4f627..e8810fa2e9c 100644 --- a/samples/client/petstore/dart-dio/lib/model/pet.dart +++ b/samples/client/petstore/dart-dio/lib/model/pet.dart @@ -1,42 +1,44 @@ -import 'package:openapi/model/tag.dart'; -import 'package:built_collection/built_collection.dart'; -import 'package:openapi/model/category.dart'; -import 'package:built_value/built_value.dart'; + import 'package:openapi/model/tag.dart'; + import 'package:built_collection/built_collection.dart'; + import 'package:openapi/model/category.dart'; + import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; part 'pet.g.dart'; abstract class Pet implements Built { - @nullable - @BuiltValueField(wireName: 'id') - int get id; - @nullable - @BuiltValueField(wireName: 'category') - Category get category; + + @nullable + @BuiltValueField(wireName: 'id') + int get id; + + @nullable + @BuiltValueField(wireName: 'category') + Category get category; + + @nullable + @BuiltValueField(wireName: 'name') + String get name; + + @nullable + @BuiltValueField(wireName: 'photoUrls') + BuiltList get photoUrls; + + @nullable + @BuiltValueField(wireName: 'tags') + BuiltList get tags; + /* pet status in the store */ + @nullable + @BuiltValueField(wireName: 'status') + String get status; + //enum statusEnum { available, pending, sold, }; - @nullable - @BuiltValueField(wireName: 'name') - String get name; + // Boilerplate code needed to wire-up generated code + Pet._(); - @nullable - @BuiltValueField(wireName: 'photoUrls') - BuiltList get photoUrls; + factory Pet([updates(PetBuilder b)]) = _$Pet; + static Serializer get serializer => _$petSerializer; - @nullable - @BuiltValueField(wireName: 'tags') - BuiltList get tags; - /* pet status in the store */ - @nullable - - /* pet status in the store */ - @BuiltValueField(wireName: 'status') - String get status; - //enum statusEnum { available, pending, sold, }; - - // Boilerplate code needed to wire-up generated code - Pet._(); - - factory Pet([updates(PetBuilder b)]) = _$Pet; - static Serializer get serializer => _$petSerializer; } + diff --git a/samples/client/petstore/dart-dio/lib/model/tag.dart b/samples/client/petstore/dart-dio/lib/model/tag.dart index 9d304767721..ba86002670e 100644 --- a/samples/client/petstore/dart-dio/lib/model/tag.dart +++ b/samples/client/petstore/dart-dio/lib/model/tag.dart @@ -1,20 +1,24 @@ -import 'package:built_value/built_value.dart'; + import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; part 'tag.g.dart'; abstract class Tag implements Built { - @nullable - @BuiltValueField(wireName: 'id') - int get id; - @nullable - @BuiltValueField(wireName: 'name') - String get name; + + @nullable + @BuiltValueField(wireName: 'id') + int get id; + + @nullable + @BuiltValueField(wireName: 'name') + String get name; - // Boilerplate code needed to wire-up generated code - Tag._(); + // Boilerplate code needed to wire-up generated code + Tag._(); + + factory Tag([updates(TagBuilder b)]) = _$Tag; + static Serializer get serializer => _$tagSerializer; - factory Tag([updates(TagBuilder b)]) = _$Tag; - static Serializer get serializer => _$tagSerializer; } + diff --git a/samples/client/petstore/dart-dio/lib/model/user.dart b/samples/client/petstore/dart-dio/lib/model/user.dart index da351b55d89..d6595d4a9d8 100644 --- a/samples/client/petstore/dart-dio/lib/model/user.dart +++ b/samples/client/petstore/dart-dio/lib/model/user.dart @@ -1,46 +1,48 @@ -import 'package:built_value/built_value.dart'; + import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; part 'user.g.dart'; abstract class User implements Built { - @nullable - @BuiltValueField(wireName: 'id') - int get id; - @nullable - @BuiltValueField(wireName: 'username') - String get username; + + @nullable + @BuiltValueField(wireName: 'id') + int get id; + + @nullable + @BuiltValueField(wireName: 'username') + String get username; + + @nullable + @BuiltValueField(wireName: 'firstName') + String get firstName; + + @nullable + @BuiltValueField(wireName: 'lastName') + String get lastName; + + @nullable + @BuiltValueField(wireName: 'email') + String get email; + + @nullable + @BuiltValueField(wireName: 'password') + String get password; + + @nullable + @BuiltValueField(wireName: 'phone') + String get phone; + /* User Status */ + @nullable + @BuiltValueField(wireName: 'userStatus') + int get userStatus; - @nullable - @BuiltValueField(wireName: 'firstName') - String get firstName; + // Boilerplate code needed to wire-up generated code + User._(); - @nullable - @BuiltValueField(wireName: 'lastName') - String get lastName; + factory User([updates(UserBuilder b)]) = _$User; + static Serializer get serializer => _$userSerializer; - @nullable - @BuiltValueField(wireName: 'email') - String get email; - - @nullable - @BuiltValueField(wireName: 'password') - String get password; - - @nullable - @BuiltValueField(wireName: 'phone') - String get phone; - /* User Status */ - @nullable - - /* User Status */ - @BuiltValueField(wireName: 'userStatus') - int get userStatus; - - // Boilerplate code needed to wire-up generated code - User._(); - - factory User([updates(UserBuilder b)]) = _$User; - static Serializer get serializer => _$userSerializer; } + diff --git a/samples/client/petstore/dart-dio/lib/serializers.dart b/samples/client/petstore/dart-dio/lib/serializers.dart index 88a06193f3c..155e4069d2e 100644 --- a/samples/client/petstore/dart-dio/lib/serializers.dart +++ b/samples/client/petstore/dart-dio/lib/serializers.dart @@ -2,6 +2,7 @@ library serializers; import 'package:built_value/serializer.dart'; import 'package:built_collection/built_collection.dart'; +import 'package:built_value/json_object.dart'; import 'package:built_value/standard_json_plugin.dart'; import 'package:openapi/model/api_response.dart'; @@ -11,38 +12,42 @@ import 'package:openapi/model/pet.dart'; import 'package:openapi/model/tag.dart'; import 'package:openapi/model/user.dart'; + part 'serializers.g.dart'; @SerializersFor(const [ - ApiResponse, - Category, - Order, - Pet, - Tag, - User, +ApiResponse, +Category, +Order, +Pet, +Tag, +User, + ]) //allow all models to be serialized within a list Serializers serializers = (_$serializers.toBuilder() - ..addBuilderFactory( - const FullType(BuiltList, const [const FullType(ApiResponse)]), - () => new ListBuilder()) - ..addBuilderFactory( - const FullType(BuiltList, const [const FullType(Category)]), - () => new ListBuilder()) - ..addBuilderFactory( - const FullType(BuiltList, const [const FullType(Order)]), - () => new ListBuilder()) - ..addBuilderFactory( - const FullType(BuiltList, const [const FullType(Pet)]), - () => new ListBuilder()) - ..addBuilderFactory( - const FullType(BuiltList, const [const FullType(Tag)]), - () => new ListBuilder()) - ..addBuilderFactory( - const FullType(BuiltList, const [const FullType(User)]), - () => new ListBuilder())) - .build(); +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(ApiResponse)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Category)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Order)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Pet)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(Tag)]), +() => new ListBuilder()) +..addBuilderFactory( +const FullType(BuiltList, const [const FullType(User)]), +() => new ListBuilder()) + +).build(); Serializers standardSerializers = - (serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build(); +(serializers.toBuilder() +..addPlugin(StandardJsonPlugin())).build(); diff --git a/samples/client/petstore/dart-dio/pubspec.yaml b/samples/client/petstore/dart-dio/pubspec.yaml index 2f3bd0e1255..2b2b55e1f94 100644 --- a/samples/client/petstore/dart-dio/pubspec.yaml +++ b/samples/client/petstore/dart-dio/pubspec.yaml @@ -4,10 +4,10 @@ description: OpenAPI API client environment: sdk: ">=2.3.0 <3.0.0" dependencies: - dio: ^3.0.3 + dio: ^3.0.4 built_value: ^6.8.2 built_collection: ^4.2.2 dev_dependencies: built_value_generator: ^6.8.2 build_runner: ^1.7.1 - test: 1.6.5 \ No newline at end of file + test: 1.6.5 diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/README.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/README.md index 693df464eb0..2568cebe9c7 100644 --- a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/README.md +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/README.md @@ -72,36 +72,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-jaguar/flutter_petstore/openapi/doc/ApiResponse.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/doc/ApiResponse.md new file mode 100644 index 00000000000..92422f0f446 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/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-jaguar/flutter_petstore/openapi/doc/Category.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/doc/Category.md new file mode 100644 index 00000000000..cc0d1633b59 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/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-jaguar/flutter_petstore/openapi/doc/Order.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/doc/Order.md new file mode 100644 index 00000000000..310ce6c65be --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/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-jaguar/flutter_petstore/openapi/doc/Pet.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/doc/Pet.md new file mode 100644 index 00000000000..ce5708cc134 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/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** | **List<String>** | | [default to const []] +**tags** | [**List<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-jaguar/flutter_petstore/openapi/doc/PetApi.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/doc/PetApi.md new file mode 100644 index 00000000000..3e4ef1cedb2 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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; // MultipartFile | 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** | **MultipartFile****MultipartFile**| 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-jaguar/flutter_petstore/openapi/doc/StoreApi.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/doc/StoreApi.md new file mode 100644 index 00000000000..c40c0eff43f --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/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 +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "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-jaguar/flutter_petstore/openapi/doc/Tag.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/doc/Tag.md new file mode 100644 index 00000000000..ded7b32ac3d --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/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-jaguar/flutter_petstore/openapi/doc/User.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/doc/User.md new file mode 100644 index 00000000000..3761b70cf0b --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/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-jaguar/flutter_petstore/openapi/doc/UserApi.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/doc/UserApi.md new file mode 100644 index 00000000000..24494bd8757 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/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-jaguar/flutter_proto_petstore/openapi/README.md b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/README.md index 693df464eb0..2568cebe9c7 100644 --- a/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/README.md +++ b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/README.md @@ -72,36 +72,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-jaguar/flutter_proto_petstore/openapi/doc/ApiResponse.md b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/doc/ApiResponse.md new file mode 100644 index 00000000000..92422f0f446 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/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-jaguar/flutter_proto_petstore/openapi/doc/Category.md b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/doc/Category.md new file mode 100644 index 00000000000..cc0d1633b59 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/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-jaguar/flutter_proto_petstore/openapi/doc/Order.md b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/doc/Order.md new file mode 100644 index 00000000000..310ce6c65be --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/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-jaguar/flutter_proto_petstore/openapi/doc/Pet.md b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/doc/Pet.md new file mode 100644 index 00000000000..ce5708cc134 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/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** | **List<String>** | | [default to const []] +**tags** | [**List<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-jaguar/flutter_proto_petstore/openapi/doc/PetApi.md b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/doc/PetApi.md new file mode 100644 index 00000000000..3e4ef1cedb2 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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; // MultipartFile | 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** | **MultipartFile****MultipartFile**| 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-jaguar/flutter_proto_petstore/openapi/doc/StoreApi.md b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/doc/StoreApi.md new file mode 100644 index 00000000000..d6e8ed69343 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/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 +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "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**: application/octet-stream + - **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-jaguar/flutter_proto_petstore/openapi/doc/Tag.md b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/doc/Tag.md new file mode 100644 index 00000000000..ded7b32ac3d --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/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-jaguar/flutter_proto_petstore/openapi/doc/User.md b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/doc/User.md new file mode 100644 index 00000000000..3761b70cf0b --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/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-jaguar/flutter_proto_petstore/openapi/doc/UserApi.md b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/doc/UserApi.md new file mode 100644 index 00000000000..91cad43d7a1 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi/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**: application/octet-stream + - **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**: application/octet-stream + - **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**: application/octet-stream + - **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**: application/octet-stream + - **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-jaguar/openapi/README.md b/samples/client/petstore/dart-jaguar/openapi/README.md index 693df464eb0..2568cebe9c7 100644 --- a/samples/client/petstore/dart-jaguar/openapi/README.md +++ b/samples/client/petstore/dart-jaguar/openapi/README.md @@ -72,36 +72,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-jaguar/openapi/doc/ApiResponse.md b/samples/client/petstore/dart-jaguar/openapi/doc/ApiResponse.md new file mode 100644 index 00000000000..92422f0f446 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/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-jaguar/openapi/doc/Category.md b/samples/client/petstore/dart-jaguar/openapi/doc/Category.md new file mode 100644 index 00000000000..cc0d1633b59 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/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-jaguar/openapi/doc/Order.md b/samples/client/petstore/dart-jaguar/openapi/doc/Order.md new file mode 100644 index 00000000000..310ce6c65be --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/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-jaguar/openapi/doc/Pet.md b/samples/client/petstore/dart-jaguar/openapi/doc/Pet.md new file mode 100644 index 00000000000..ce5708cc134 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/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** | **List<String>** | | [default to const []] +**tags** | [**List<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-jaguar/openapi/doc/PetApi.md b/samples/client/petstore/dart-jaguar/openapi/doc/PetApi.md new file mode 100644 index 00000000000..3e4ef1cedb2 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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; // MultipartFile | 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** | **MultipartFile****MultipartFile**| 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-jaguar/openapi/doc/StoreApi.md b/samples/client/petstore/dart-jaguar/openapi/doc/StoreApi.md new file mode 100644 index 00000000000..c40c0eff43f --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/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 +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "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-jaguar/openapi/doc/Tag.md b/samples/client/petstore/dart-jaguar/openapi/doc/Tag.md new file mode 100644 index 00000000000..ded7b32ac3d --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/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-jaguar/openapi/doc/User.md b/samples/client/petstore/dart-jaguar/openapi/doc/User.md new file mode 100644 index 00000000000..3761b70cf0b --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/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-jaguar/openapi/doc/UserApi.md b/samples/client/petstore/dart-jaguar/openapi/doc/UserApi.md new file mode 100644 index 00000000000..24494bd8757 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/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-jaguar/openapi_proto/README.md b/samples/client/petstore/dart-jaguar/openapi_proto/README.md index 693df464eb0..2568cebe9c7 100644 --- a/samples/client/petstore/dart-jaguar/openapi_proto/README.md +++ b/samples/client/petstore/dart-jaguar/openapi_proto/README.md @@ -72,36 +72,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-jaguar/openapi_proto/doc/ApiResponse.md b/samples/client/petstore/dart-jaguar/openapi_proto/doc/ApiResponse.md new file mode 100644 index 00000000000..92422f0f446 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi_proto/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-jaguar/openapi_proto/doc/Category.md b/samples/client/petstore/dart-jaguar/openapi_proto/doc/Category.md new file mode 100644 index 00000000000..cc0d1633b59 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi_proto/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-jaguar/openapi_proto/doc/Order.md b/samples/client/petstore/dart-jaguar/openapi_proto/doc/Order.md new file mode 100644 index 00000000000..310ce6c65be --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi_proto/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-jaguar/openapi_proto/doc/Pet.md b/samples/client/petstore/dart-jaguar/openapi_proto/doc/Pet.md new file mode 100644 index 00000000000..ce5708cc134 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi_proto/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** | **List<String>** | | [default to const []] +**tags** | [**List<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-jaguar/openapi_proto/doc/PetApi.md b/samples/client/petstore/dart-jaguar/openapi_proto/doc/PetApi.md new file mode 100644 index 00000000000..3e4ef1cedb2 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi_proto/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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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; // MultipartFile | 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** | **MultipartFile****MultipartFile**| 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-jaguar/openapi_proto/doc/StoreApi.md b/samples/client/petstore/dart-jaguar/openapi_proto/doc/StoreApi.md new file mode 100644 index 00000000000..d6e8ed69343 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi_proto/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 +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "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**: application/octet-stream + - **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-jaguar/openapi_proto/doc/Tag.md b/samples/client/petstore/dart-jaguar/openapi_proto/doc/Tag.md new file mode 100644 index 00000000000..ded7b32ac3d --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi_proto/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-jaguar/openapi_proto/doc/User.md b/samples/client/petstore/dart-jaguar/openapi_proto/doc/User.md new file mode 100644 index 00000000000..3761b70cf0b --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi_proto/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-jaguar/openapi_proto/doc/UserApi.md b/samples/client/petstore/dart-jaguar/openapi_proto/doc/UserApi.md new file mode 100644 index 00000000000..91cad43d7a1 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi_proto/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**: application/octet-stream + - **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**: application/octet-stream + - **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**: application/octet-stream + - **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**: application/octet-stream + - **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/flutter_petstore/openapi/README.md b/samples/client/petstore/dart/flutter_petstore/openapi/README.md index 8520a219f88..79b7a9edc28 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/README.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/README.md @@ -63,36 +63,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/flutter_petstore/openapi/doc/ApiResponse.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/ApiResponse.md new file mode 100644 index 00000000000..92422f0f446 --- /dev/null +++ b/samples/client/petstore/dart/flutter_petstore/openapi/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/flutter_petstore/openapi/doc/Category.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/Category.md new file mode 100644 index 00000000000..cc0d1633b59 --- /dev/null +++ b/samples/client/petstore/dart/flutter_petstore/openapi/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/flutter_petstore/openapi/doc/Order.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/Order.md new file mode 100644 index 00000000000..310ce6c65be --- /dev/null +++ b/samples/client/petstore/dart/flutter_petstore/openapi/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/flutter_petstore/openapi/doc/Pet.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/Pet.md new file mode 100644 index 00000000000..191e1fc66a9 --- /dev/null +++ b/samples/client/petstore/dart/flutter_petstore/openapi/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** | **List<String>** | | [default to []] +**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to []] +**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/flutter_petstore/openapi/doc/PetApi.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/PetApi.md new file mode 100644 index 00000000000..5780e7f3802 --- /dev/null +++ b/samples/client/petstore/dart/flutter_petstore/openapi/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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 []] + +### 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 +//openapi.api.Configuration.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 []] + +### 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 +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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; // MultipartFile | 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** | **MultipartFile**| 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/flutter_petstore/openapi/doc/StoreApi.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/StoreApi.md new file mode 100644 index 00000000000..df76647f11a --- /dev/null +++ b/samples/client/petstore/dart/flutter_petstore/openapi/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 +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "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/flutter_petstore/openapi/doc/Tag.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/Tag.md new file mode 100644 index 00000000000..ded7b32ac3d --- /dev/null +++ b/samples/client/petstore/dart/flutter_petstore/openapi/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/flutter_petstore/openapi/doc/User.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/User.md new file mode 100644 index 00000000000..3761b70cf0b --- /dev/null +++ b/samples/client/petstore/dart/flutter_petstore/openapi/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/flutter_petstore/openapi/doc/UserApi.md b/samples/client/petstore/dart/flutter_petstore/openapi/doc/UserApi.md new file mode 100644 index 00000000000..d3bb61265e9 --- /dev/null +++ b/samples/client/petstore/dart/flutter_petstore/openapi/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/openapi-browser-client/README.md b/samples/client/petstore/dart/openapi-browser-client/README.md index 8520a219f88..79b7a9edc28 100644 --- a/samples/client/petstore/dart/openapi-browser-client/README.md +++ b/samples/client/petstore/dart/openapi-browser-client/README.md @@ -63,36 +63,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/openapi-browser-client/doc/ApiResponse.md b/samples/client/petstore/dart/openapi-browser-client/doc/ApiResponse.md new file mode 100644 index 00000000000..92422f0f446 --- /dev/null +++ b/samples/client/petstore/dart/openapi-browser-client/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/openapi-browser-client/doc/Category.md b/samples/client/petstore/dart/openapi-browser-client/doc/Category.md new file mode 100644 index 00000000000..cc0d1633b59 --- /dev/null +++ b/samples/client/petstore/dart/openapi-browser-client/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/openapi-browser-client/doc/Order.md b/samples/client/petstore/dart/openapi-browser-client/doc/Order.md new file mode 100644 index 00000000000..310ce6c65be --- /dev/null +++ b/samples/client/petstore/dart/openapi-browser-client/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/openapi-browser-client/doc/Pet.md b/samples/client/petstore/dart/openapi-browser-client/doc/Pet.md new file mode 100644 index 00000000000..191e1fc66a9 --- /dev/null +++ b/samples/client/petstore/dart/openapi-browser-client/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** | **List<String>** | | [default to []] +**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to []] +**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/openapi-browser-client/doc/PetApi.md b/samples/client/petstore/dart/openapi-browser-client/doc/PetApi.md new file mode 100644 index 00000000000..5780e7f3802 --- /dev/null +++ b/samples/client/petstore/dart/openapi-browser-client/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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 []] + +### 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 +//openapi.api.Configuration.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 []] + +### 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 +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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; // MultipartFile | 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** | **MultipartFile**| 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/openapi-browser-client/doc/StoreApi.md b/samples/client/petstore/dart/openapi-browser-client/doc/StoreApi.md new file mode 100644 index 00000000000..df76647f11a --- /dev/null +++ b/samples/client/petstore/dart/openapi-browser-client/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 +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "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/openapi-browser-client/doc/Tag.md b/samples/client/petstore/dart/openapi-browser-client/doc/Tag.md new file mode 100644 index 00000000000..ded7b32ac3d --- /dev/null +++ b/samples/client/petstore/dart/openapi-browser-client/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/openapi-browser-client/doc/User.md b/samples/client/petstore/dart/openapi-browser-client/doc/User.md new file mode 100644 index 00000000000..3761b70cf0b --- /dev/null +++ b/samples/client/petstore/dart/openapi-browser-client/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/openapi-browser-client/doc/UserApi.md b/samples/client/petstore/dart/openapi-browser-client/doc/UserApi.md new file mode 100644 index 00000000000..d3bb61265e9 --- /dev/null +++ b/samples/client/petstore/dart/openapi-browser-client/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/openapi/README.md b/samples/client/petstore/dart/openapi/README.md index 8520a219f88..79b7a9edc28 100644 --- a/samples/client/petstore/dart/openapi/README.md +++ b/samples/client/petstore/dart/openapi/README.md @@ -63,36 +63,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/openapi/doc/ApiResponse.md b/samples/client/petstore/dart/openapi/doc/ApiResponse.md new file mode 100644 index 00000000000..92422f0f446 --- /dev/null +++ b/samples/client/petstore/dart/openapi/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/openapi/doc/Category.md b/samples/client/petstore/dart/openapi/doc/Category.md new file mode 100644 index 00000000000..cc0d1633b59 --- /dev/null +++ b/samples/client/petstore/dart/openapi/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/openapi/doc/Order.md b/samples/client/petstore/dart/openapi/doc/Order.md new file mode 100644 index 00000000000..310ce6c65be --- /dev/null +++ b/samples/client/petstore/dart/openapi/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/openapi/doc/Pet.md b/samples/client/petstore/dart/openapi/doc/Pet.md new file mode 100644 index 00000000000..191e1fc66a9 --- /dev/null +++ b/samples/client/petstore/dart/openapi/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** | **List<String>** | | [default to []] +**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to []] +**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/openapi/doc/PetApi.md b/samples/client/petstore/dart/openapi/doc/PetApi.md new file mode 100644 index 00000000000..5780e7f3802 --- /dev/null +++ b/samples/client/petstore/dart/openapi/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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 []] + +### 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 +//openapi.api.Configuration.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 []] + +### 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 +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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 +//openapi.api.Configuration.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; // MultipartFile | 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** | **MultipartFile**| 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/openapi/doc/StoreApi.md b/samples/client/petstore/dart/openapi/doc/StoreApi.md new file mode 100644 index 00000000000..df76647f11a --- /dev/null +++ b/samples/client/petstore/dart/openapi/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 +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "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/openapi/doc/Tag.md b/samples/client/petstore/dart/openapi/doc/Tag.md new file mode 100644 index 00000000000..ded7b32ac3d --- /dev/null +++ b/samples/client/petstore/dart/openapi/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/openapi/doc/User.md b/samples/client/petstore/dart/openapi/doc/User.md new file mode 100644 index 00000000000..3761b70cf0b --- /dev/null +++ b/samples/client/petstore/dart/openapi/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/openapi/doc/UserApi.md b/samples/client/petstore/dart/openapi/doc/UserApi.md new file mode 100644 index 00000000000..d3bb61265e9 --- /dev/null +++ b/samples/client/petstore/dart/openapi/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/dart2/petstore_client_lib/README.md b/samples/client/petstore/dart2/petstore_client_lib/README.md index a32c667b4ee..1cf4ca28f0a 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/README.md +++ b/samples/client/petstore/dart2/petstore_client_lib/README.md @@ -59,36 +59,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/dart2/petstore_client_lib/doc/ApiResponse.md b/samples/client/petstore/dart2/petstore_client_lib/doc/ApiResponse.md new file mode 100644 index 00000000000..92422f0f446 --- /dev/null +++ b/samples/client/petstore/dart2/petstore_client_lib/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/dart2/petstore_client_lib/doc/Category.md b/samples/client/petstore/dart2/petstore_client_lib/doc/Category.md new file mode 100644 index 00000000000..cc0d1633b59 --- /dev/null +++ b/samples/client/petstore/dart2/petstore_client_lib/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/dart2/petstore_client_lib/doc/Order.md b/samples/client/petstore/dart2/petstore_client_lib/doc/Order.md new file mode 100644 index 00000000000..310ce6c65be --- /dev/null +++ b/samples/client/petstore/dart2/petstore_client_lib/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/dart2/petstore_client_lib/doc/Pet.md b/samples/client/petstore/dart2/petstore_client_lib/doc/Pet.md new file mode 100644 index 00000000000..191e1fc66a9 --- /dev/null +++ b/samples/client/petstore/dart2/petstore_client_lib/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** | **List<String>** | | [default to []] +**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to []] +**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/dart2/petstore_client_lib/doc/PetApi.md b/samples/client/petstore/dart2/petstore_client_lib/doc/PetApi.md new file mode 100644 index 00000000000..7b5de3894a9 --- /dev/null +++ b/samples/client/petstore/dart2/petstore_client_lib/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 = PetApi(); +var body = 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 = 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 = 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 []] + +### 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 = 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 []] + +### 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 = 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 = PetApi(); +var body = 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 = 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 = 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; // MultipartFile | 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** | **MultipartFile**| 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/dart2/petstore_client_lib/doc/StoreApi.md b/samples/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md new file mode 100644 index 00000000000..1cc37e2a47a --- /dev/null +++ b/samples/client/petstore/dart2/petstore_client_lib/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 = 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 = 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 = 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 = StoreApi(); +var body = 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/dart2/petstore_client_lib/doc/Tag.md b/samples/client/petstore/dart2/petstore_client_lib/doc/Tag.md new file mode 100644 index 00000000000..ded7b32ac3d --- /dev/null +++ b/samples/client/petstore/dart2/petstore_client_lib/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/dart2/petstore_client_lib/doc/User.md b/samples/client/petstore/dart2/petstore_client_lib/doc/User.md new file mode 100644 index 00000000000..3761b70cf0b --- /dev/null +++ b/samples/client/petstore/dart2/petstore_client_lib/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/dart2/petstore_client_lib/doc/UserApi.md b/samples/client/petstore/dart2/petstore_client_lib/doc/UserApi.md new file mode 100644 index 00000000000..1ee5f6fced6 --- /dev/null +++ b/samples/client/petstore/dart2/petstore_client_lib/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 = UserApi(); +var body = 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 = UserApi(); +var body = [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 = UserApi(); +var body = [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 = 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 = 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 = 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 = 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 = UserApi(); +var username = username_example; // String | name that need to be deleted +var body = 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/dart2/petstore_client_lib/pubspec.yaml b/samples/client/petstore/dart2/petstore_client_lib/pubspec.yaml index be7bf663b8f..58c44ac9eb5 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/pubspec.yaml +++ b/samples/client/petstore/dart2/petstore_client_lib/pubspec.yaml @@ -1,6 +1,9 @@ name: openapi version: 1.0.0 description: OpenAPI API client +authors: + - Author +homepage: homepage environment: sdk: '>=2.0.0 <3.0.0' dependencies: diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/big_cat.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/big_cat.ex new file mode 100644 index 00000000000..46d755bde72 --- /dev/null +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/big_cat.ex @@ -0,0 +1,31 @@ +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# https://openapi-generator.tech +# Do not edit the class manually. + +defmodule OpenapiPetstore.Model.BigCat do + @moduledoc """ + + """ + + @derive [Poison.Encoder] + defstruct [ + :"className", + :"color", + :"declawed", + :"kind" + ] + + @type t :: %__MODULE__{ + :"className" => String.t, + :"color" => String.t | nil, + :"declawed" => boolean() | nil, + :"kind" => String.t | nil + } +end + +defimpl Poison.Decoder, for: OpenapiPetstore.Model.BigCat do + def decode(value, _options) do + value + end +end + diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/big_cat_all_of.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/big_cat_all_of.ex new file mode 100644 index 00000000000..739bdd5ee4d --- /dev/null +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/big_cat_all_of.ex @@ -0,0 +1,25 @@ +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# https://openapi-generator.tech +# Do not edit the class manually. + +defmodule OpenapiPetstore.Model.BigCatAllOf do + @moduledoc """ + + """ + + @derive [Poison.Encoder] + defstruct [ + :"kind" + ] + + @type t :: %__MODULE__{ + :"kind" => String.t | nil + } +end + +defimpl Poison.Decoder, for: OpenapiPetstore.Model.BigCatAllOf do + def decode(value, _options) do + value + end +end + diff --git a/samples/client/petstore/go-experimental/go-petstore/README.md b/samples/client/petstore/go-experimental/go-petstore/README.md index a39c8c25075..1c8be349e65 100644 --- a/samples/client/petstore/go-experimental/go-petstore/README.md +++ b/samples/client/petstore/go-experimental/go-petstore/README.md @@ -127,6 +127,8 @@ Class | Method | HTTP request | Description - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [ArrayTest](docs/ArrayTest.md) + - [BigCat](docs/BigCat.md) + - [BigCatAllOf](docs/BigCatAllOf.md) - [Capitalization](docs/Capitalization.md) - [Cat](docs/Cat.md) - [CatAllOf](docs/CatAllOf.md) diff --git a/samples/client/petstore/go-experimental/go-petstore/api/openapi.yaml b/samples/client/petstore/go-experimental/go-petstore/api/openapi.yaml index 94c46a5bb5d..be551305339 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api/openapi.yaml +++ b/samples/client/petstore/go-experimental/go-petstore/api/openapi.yaml @@ -1422,6 +1422,10 @@ components: allOf: - $ref: '#/components/schemas/Animal' - $ref: '#/components/schemas/Cat_allOf' + BigCat: + allOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/BigCat_allOf' Animal: discriminator: propertyName: className @@ -2086,6 +2090,15 @@ components: properties: declawed: type: boolean + BigCat_allOf: + properties: + kind: + enum: + - lions + - tigers + - leopards + - jaguars + type: string securitySchemes: petstore_auth: flows: diff --git a/samples/client/petstore/go-experimental/go-petstore/docs/BigCat.md b/samples/client/petstore/go-experimental/go-petstore/docs/BigCat.md new file mode 100644 index 00000000000..dd23b619342 --- /dev/null +++ b/samples/client/petstore/go-experimental/go-petstore/docs/BigCat.md @@ -0,0 +1,117 @@ +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | Pointer to **string** | | +**Color** | Pointer to **string** | | [optional] [default to red] +**Declawed** | Pointer to **bool** | | [optional] +**Kind** | Pointer to **string** | | [optional] + +## Methods + +### GetClassName + +`func (o *BigCat) GetClassName() string` + +GetClassName returns the ClassName field if non-nil, zero value otherwise. + +### GetClassNameOk + +`func (o *BigCat) GetClassNameOk() (string, bool)` + +GetClassNameOk returns a tuple with the ClassName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### HasClassName + +`func (o *BigCat) HasClassName() bool` + +HasClassName returns a boolean if a field has been set. + +### SetClassName + +`func (o *BigCat) SetClassName(v string)` + +SetClassName gets a reference to the given string and assigns it to the ClassName field. + +### GetColor + +`func (o *BigCat) GetColor() string` + +GetColor returns the Color field if non-nil, zero value otherwise. + +### GetColorOk + +`func (o *BigCat) GetColorOk() (string, bool)` + +GetColorOk returns a tuple with the Color field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### HasColor + +`func (o *BigCat) HasColor() bool` + +HasColor returns a boolean if a field has been set. + +### SetColor + +`func (o *BigCat) SetColor(v string)` + +SetColor gets a reference to the given string and assigns it to the Color field. + +### GetDeclawed + +`func (o *BigCat) GetDeclawed() bool` + +GetDeclawed returns the Declawed field if non-nil, zero value otherwise. + +### GetDeclawedOk + +`func (o *BigCat) GetDeclawedOk() (bool, bool)` + +GetDeclawedOk returns a tuple with the Declawed field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### HasDeclawed + +`func (o *BigCat) HasDeclawed() bool` + +HasDeclawed returns a boolean if a field has been set. + +### SetDeclawed + +`func (o *BigCat) SetDeclawed(v bool)` + +SetDeclawed gets a reference to the given bool and assigns it to the Declawed field. + +### GetKind + +`func (o *BigCat) GetKind() string` + +GetKind returns the Kind field if non-nil, zero value otherwise. + +### GetKindOk + +`func (o *BigCat) GetKindOk() (string, bool)` + +GetKindOk returns a tuple with the Kind field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### HasKind + +`func (o *BigCat) HasKind() bool` + +HasKind returns a boolean if a field has been set. + +### SetKind + +`func (o *BigCat) SetKind(v string)` + +SetKind gets a reference to the given string and assigns it to the Kind field. + + +[[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/go-experimental/go-petstore/docs/BigCatAllOf.md b/samples/client/petstore/go-experimental/go-petstore/docs/BigCatAllOf.md new file mode 100644 index 00000000000..c886448d38d --- /dev/null +++ b/samples/client/petstore/go-experimental/go-petstore/docs/BigCatAllOf.md @@ -0,0 +1,39 @@ +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Kind** | Pointer to **string** | | [optional] + +## Methods + +### GetKind + +`func (o *BigCatAllOf) GetKind() string` + +GetKind returns the Kind field if non-nil, zero value otherwise. + +### GetKindOk + +`func (o *BigCatAllOf) GetKindOk() (string, bool)` + +GetKindOk returns a tuple with the Kind field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### HasKind + +`func (o *BigCatAllOf) HasKind() bool` + +HasKind returns a boolean if a field has been set. + +### SetKind + +`func (o *BigCatAllOf) SetKind(v string)` + +SetKind gets a reference to the given string and assigns it to the Kind field. + + +[[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/go-experimental/go-petstore/model_big_cat.go b/samples/client/petstore/go-experimental/go-petstore/model_big_cat.go new file mode 100644 index 00000000000..c9a0a1b6978 --- /dev/null +++ b/samples/client/petstore/go-experimental/go-petstore/model_big_cat.go @@ -0,0 +1,160 @@ +/* + * 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: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "bytes" + "encoding/json" +) + +// BigCat struct for BigCat +type BigCat struct { + ClassName string `json:"className"` + Color *string `json:"color,omitempty"` + Declawed *bool `json:"declawed,omitempty"` + Kind *string `json:"kind,omitempty"` +} + +// GetClassName returns the ClassName field value +func (o *BigCat) GetClassName() string { + if o == nil { + var ret string + return ret + } + + return o.ClassName +} + +// SetClassName sets field value +func (o *BigCat) SetClassName(v string) { + o.ClassName = v +} + +// GetColor returns the Color field value if set, zero value otherwise. +func (o *BigCat) GetColor() string { + if o == nil || o.Color == nil { + var ret string + return ret + } + return *o.Color +} + +// GetColorOk returns a tuple with the Color field value if set, zero value otherwise +// and a boolean to check if the value has been set. +func (o *BigCat) GetColorOk() (string, bool) { + if o == nil || o.Color == nil { + var ret string + return ret, false + } + return *o.Color, true +} + +// HasColor returns a boolean if a field has been set. +func (o *BigCat) HasColor() bool { + if o != nil && o.Color != nil { + return true + } + + return false +} + +// SetColor gets a reference to the given string and assigns it to the Color field. +func (o *BigCat) SetColor(v string) { + o.Color = &v +} + +// GetDeclawed returns the Declawed field value if set, zero value otherwise. +func (o *BigCat) GetDeclawed() bool { + if o == nil || o.Declawed == nil { + var ret bool + return ret + } + return *o.Declawed +} + +// GetDeclawedOk returns a tuple with the Declawed field value if set, zero value otherwise +// and a boolean to check if the value has been set. +func (o *BigCat) GetDeclawedOk() (bool, bool) { + if o == nil || o.Declawed == nil { + var ret bool + return ret, false + } + return *o.Declawed, true +} + +// HasDeclawed returns a boolean if a field has been set. +func (o *BigCat) HasDeclawed() bool { + if o != nil && o.Declawed != nil { + return true + } + + return false +} + +// SetDeclawed gets a reference to the given bool and assigns it to the Declawed field. +func (o *BigCat) SetDeclawed(v bool) { + o.Declawed = &v +} + +// GetKind returns the Kind field value if set, zero value otherwise. +func (o *BigCat) GetKind() string { + if o == nil || o.Kind == nil { + var ret string + return ret + } + return *o.Kind +} + +// GetKindOk returns a tuple with the Kind field value if set, zero value otherwise +// and a boolean to check if the value has been set. +func (o *BigCat) GetKindOk() (string, bool) { + if o == nil || o.Kind == nil { + var ret string + return ret, false + } + return *o.Kind, true +} + +// HasKind returns a boolean if a field has been set. +func (o *BigCat) HasKind() bool { + if o != nil && o.Kind != nil { + return true + } + + return false +} + +// SetKind gets a reference to the given string and assigns it to the Kind field. +func (o *BigCat) SetKind(v string) { + o.Kind = &v +} + +type NullableBigCat struct { + Value BigCat + ExplicitNull bool +} + +func (v NullableBigCat) MarshalJSON() ([]byte, error) { + switch { + case v.ExplicitNull: + return []byte("null"), nil + default: + return json.Marshal(v.Value) + } +} + +func (v *NullableBigCat) UnmarshalJSON(src []byte) error { + if bytes.Equal(src, []byte("null")) { + v.ExplicitNull = true + return nil + } + + return json.Unmarshal(src, &v.Value) +} diff --git a/samples/client/petstore/go-experimental/go-petstore/model_big_cat_all_of.go b/samples/client/petstore/go-experimental/go-petstore/model_big_cat_all_of.go new file mode 100644 index 00000000000..2b1c83d7739 --- /dev/null +++ b/samples/client/petstore/go-experimental/go-petstore/model_big_cat_all_of.go @@ -0,0 +1,76 @@ +/* + * 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: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +import ( + "bytes" + "encoding/json" +) + +// BigCatAllOf struct for BigCatAllOf +type BigCatAllOf struct { + Kind *string `json:"kind,omitempty"` +} + +// GetKind returns the Kind field value if set, zero value otherwise. +func (o *BigCatAllOf) GetKind() string { + if o == nil || o.Kind == nil { + var ret string + return ret + } + return *o.Kind +} + +// GetKindOk returns a tuple with the Kind field value if set, zero value otherwise +// and a boolean to check if the value has been set. +func (o *BigCatAllOf) GetKindOk() (string, bool) { + if o == nil || o.Kind == nil { + var ret string + return ret, false + } + return *o.Kind, true +} + +// HasKind returns a boolean if a field has been set. +func (o *BigCatAllOf) HasKind() bool { + if o != nil && o.Kind != nil { + return true + } + + return false +} + +// SetKind gets a reference to the given string and assigns it to the Kind field. +func (o *BigCatAllOf) SetKind(v string) { + o.Kind = &v +} + +type NullableBigCatAllOf struct { + Value BigCatAllOf + ExplicitNull bool +} + +func (v NullableBigCatAllOf) MarshalJSON() ([]byte, error) { + switch { + case v.ExplicitNull: + return []byte("null"), nil + default: + return json.Marshal(v.Value) + } +} + +func (v *NullableBigCatAllOf) UnmarshalJSON(src []byte) error { + if bytes.Equal(src, []byte("null")) { + v.ExplicitNull = true + return nil + } + + return json.Unmarshal(src, &v.Value) +} diff --git a/samples/client/petstore/go/go-petstore-withXml/README.md b/samples/client/petstore/go/go-petstore-withXml/README.md index 052b43c30a6..b4fd0109ce2 100644 --- a/samples/client/petstore/go/go-petstore-withXml/README.md +++ b/samples/client/petstore/go/go-petstore-withXml/README.md @@ -86,6 +86,8 @@ Class | Method | HTTP request | Description - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [ArrayTest](docs/ArrayTest.md) + - [BigCat](docs/BigCat.md) + - [BigCatAllOf](docs/BigCatAllOf.md) - [Capitalization](docs/Capitalization.md) - [Cat](docs/Cat.md) - [CatAllOf](docs/CatAllOf.md) @@ -200,6 +202,7 @@ r, err := client.Service.Operation(auth, args) ``` + ## Author diff --git a/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml b/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml index 94c46a5bb5d..be551305339 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml +++ b/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml @@ -1422,6 +1422,10 @@ components: allOf: - $ref: '#/components/schemas/Animal' - $ref: '#/components/schemas/Cat_allOf' + BigCat: + allOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/BigCat_allOf' Animal: discriminator: propertyName: className @@ -2086,6 +2090,15 @@ components: properties: declawed: type: boolean + BigCat_allOf: + properties: + kind: + enum: + - lions + - tigers + - leopards + - jaguars + type: string securitySchemes: petstore_auth: flows: diff --git a/samples/client/petstore/go/go-petstore-withXml/client.go b/samples/client/petstore/go/go-petstore-withXml/client.go index cc5ffa09cc6..5a5a4c85293 100644 --- a/samples/client/petstore/go/go-petstore-withXml/client.go +++ b/samples/client/petstore/go/go-petstore-withXml/client.go @@ -364,6 +364,7 @@ func (c *APIClient) prepareRequest( if auth, ok := ctx.Value(ContextAccessToken).(string); ok { localVarRequest.Header.Add("Authorization", "Bearer "+auth) } + } for header, value := range c.cfg.DefaultHeader { diff --git a/samples/client/petstore/go/go-petstore-withXml/configuration.go b/samples/client/petstore/go/go-petstore-withXml/configuration.go index 59728f054c7..f0134476c59 100644 --- a/samples/client/petstore/go/go-petstore-withXml/configuration.go +++ b/samples/client/petstore/go/go-petstore-withXml/configuration.go @@ -38,6 +38,7 @@ var ( // ContextAPIKey takes an APIKey as authentication for the request ContextAPIKey = contextKey("apikey") + ) // BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth @@ -52,6 +53,7 @@ type APIKey struct { Prefix string } + // ServerVariable stores the information about a server variable type ServerVariable struct { Description string diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/BigCat.md b/samples/client/petstore/go/go-petstore-withXml/docs/BigCat.md new file mode 100644 index 00000000000..a23cd724fb9 --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/docs/BigCat.md @@ -0,0 +1,14 @@ +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to red] +**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/go/go-petstore-withXml/docs/BigCatAllOf.md b/samples/client/petstore/go/go-petstore-withXml/docs/BigCatAllOf.md new file mode 100644 index 00000000000..03d37ee1031 --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/docs/BigCatAllOf.md @@ -0,0 +1,11 @@ +# 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/go/go-petstore-withXml/go.mod b/samples/client/petstore/go/go-petstore-withXml/go.mod index 1af1846f985..f55c1461f84 100644 --- a/samples/client/petstore/go/go-petstore-withXml/go.mod +++ b/samples/client/petstore/go/go-petstore-withXml/go.mod @@ -3,4 +3,5 @@ module github.com/GIT_USER_ID/GIT_REPO_ID require ( github.com/antihax/optional v1.0.0 golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 + ) diff --git a/samples/client/petstore/go/go-petstore-withXml/go.sum b/samples/client/petstore/go/go-petstore-withXml/go.sum index ce55b3c6a08..ee695202297 100644 --- a/samples/client/petstore/go/go-petstore-withXml/go.sum +++ b/samples/client/petstore/go/go-petstore-withXml/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/samples/client/petstore/go/go-petstore-withXml/model_big_cat.go b/samples/client/petstore/go/go-petstore-withXml/model_big_cat.go new file mode 100644 index 00000000000..a0a9c70fd86 --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/model_big_cat.go @@ -0,0 +1,18 @@ +/* + * 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: \" \\ + * + * API version: 1.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package petstore +// BigCat struct for BigCat +type BigCat struct { + ClassName string `json:"className" xml:"className"` + Color string `json:"color,omitempty" xml:"color"` + Declawed bool `json:"declawed,omitempty" xml:"declawed"` + Kind string `json:"kind,omitempty" xml:"kind"` +} diff --git a/samples/client/petstore/go/go-petstore-withXml/model_big_cat_all_of.go b/samples/client/petstore/go/go-petstore-withXml/model_big_cat_all_of.go new file mode 100644 index 00000000000..49e5fa32504 --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/model_big_cat_all_of.go @@ -0,0 +1,15 @@ +/* + * 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: \" \\ + * + * API version: 1.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package petstore +// BigCatAllOf struct for BigCatAllOf +type BigCatAllOf struct { + Kind string `json:"kind,omitempty" xml:"kind"` +} diff --git a/samples/client/petstore/go/go-petstore/README.md b/samples/client/petstore/go/go-petstore/README.md index 052b43c30a6..b4fd0109ce2 100644 --- a/samples/client/petstore/go/go-petstore/README.md +++ b/samples/client/petstore/go/go-petstore/README.md @@ -86,6 +86,8 @@ Class | Method | HTTP request | Description - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [ArrayTest](docs/ArrayTest.md) + - [BigCat](docs/BigCat.md) + - [BigCatAllOf](docs/BigCatAllOf.md) - [Capitalization](docs/Capitalization.md) - [Cat](docs/Cat.md) - [CatAllOf](docs/CatAllOf.md) @@ -200,6 +202,7 @@ r, err := client.Service.Operation(auth, args) ``` + ## Author diff --git a/samples/client/petstore/go/go-petstore/api/openapi.yaml b/samples/client/petstore/go/go-petstore/api/openapi.yaml index 94c46a5bb5d..be551305339 100644 --- a/samples/client/petstore/go/go-petstore/api/openapi.yaml +++ b/samples/client/petstore/go/go-petstore/api/openapi.yaml @@ -1422,6 +1422,10 @@ components: allOf: - $ref: '#/components/schemas/Animal' - $ref: '#/components/schemas/Cat_allOf' + BigCat: + allOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/BigCat_allOf' Animal: discriminator: propertyName: className @@ -2086,6 +2090,15 @@ components: properties: declawed: type: boolean + BigCat_allOf: + properties: + kind: + enum: + - lions + - tigers + - leopards + - jaguars + type: string securitySchemes: petstore_auth: flows: diff --git a/samples/client/petstore/go/go-petstore/client.go b/samples/client/petstore/go/go-petstore/client.go index 0c97916457d..53343904149 100644 --- a/samples/client/petstore/go/go-petstore/client.go +++ b/samples/client/petstore/go/go-petstore/client.go @@ -363,6 +363,7 @@ func (c *APIClient) prepareRequest( if auth, ok := ctx.Value(ContextAccessToken).(string); ok { localVarRequest.Header.Add("Authorization", "Bearer "+auth) } + } for header, value := range c.cfg.DefaultHeader { diff --git a/samples/client/petstore/go/go-petstore/configuration.go b/samples/client/petstore/go/go-petstore/configuration.go index 34f8f242922..e3159c328b4 100644 --- a/samples/client/petstore/go/go-petstore/configuration.go +++ b/samples/client/petstore/go/go-petstore/configuration.go @@ -37,6 +37,7 @@ var ( // ContextAPIKey takes an APIKey as authentication for the request ContextAPIKey = contextKey("apikey") + ) // BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth @@ -51,6 +52,7 @@ type APIKey struct { Prefix string } + // ServerVariable stores the information about a server variable type ServerVariable struct { Description string diff --git a/samples/client/petstore/go/go-petstore/docs/BigCat.md b/samples/client/petstore/go/go-petstore/docs/BigCat.md new file mode 100644 index 00000000000..a23cd724fb9 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/BigCat.md @@ -0,0 +1,14 @@ +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to red] +**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/go/go-petstore/docs/BigCatAllOf.md b/samples/client/petstore/go/go-petstore/docs/BigCatAllOf.md new file mode 100644 index 00000000000..03d37ee1031 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/BigCatAllOf.md @@ -0,0 +1,11 @@ +# 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/go/go-petstore/go.mod b/samples/client/petstore/go/go-petstore/go.mod index 1af1846f985..f55c1461f84 100644 --- a/samples/client/petstore/go/go-petstore/go.mod +++ b/samples/client/petstore/go/go-petstore/go.mod @@ -3,4 +3,5 @@ module github.com/GIT_USER_ID/GIT_REPO_ID require ( github.com/antihax/optional v1.0.0 golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 + ) diff --git a/samples/client/petstore/go/go-petstore/go.sum b/samples/client/petstore/go/go-petstore/go.sum index ce55b3c6a08..ee695202297 100644 --- a/samples/client/petstore/go/go-petstore/go.sum +++ b/samples/client/petstore/go/go-petstore/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/samples/client/petstore/go/go-petstore/model_big_cat.go b/samples/client/petstore/go/go-petstore/model_big_cat.go new file mode 100644 index 00000000000..70d790c6542 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/model_big_cat.go @@ -0,0 +1,17 @@ +/* + * 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: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore +// BigCat struct for BigCat +type BigCat struct { + ClassName string `json:"className"` + Color string `json:"color,omitempty"` + Declawed bool `json:"declawed,omitempty"` + Kind string `json:"kind,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/model_big_cat_all_of.go b/samples/client/petstore/go/go-petstore/model_big_cat_all_of.go new file mode 100644 index 00000000000..93e796483ac --- /dev/null +++ b/samples/client/petstore/go/go-petstore/model_big_cat_all_of.go @@ -0,0 +1,14 @@ +/* + * 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: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore +// BigCatAllOf struct for BigCatAllOf +type BigCatAllOf struct { + Kind string `json:"kind,omitempty"` +} diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs index 8bfb741aeb1..1331ed4b237 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs @@ -653,6 +653,75 @@ mkArrayTest = , arrayTestArrayArrayOfModel = Nothing } +-- ** BigCat +-- | BigCat +data BigCat = BigCat + { bigCatClassName :: !(Text) -- ^ /Required/ "className" + , bigCatColor :: !(Maybe Text) -- ^ "color" + , bigCatDeclawed :: !(Maybe Bool) -- ^ "declawed" + , bigCatKind :: !(Maybe E'Kind) -- ^ "kind" + } deriving (P.Show, P.Eq, P.Typeable) + +-- | FromJSON BigCat +instance A.FromJSON BigCat where + parseJSON = A.withObject "BigCat" $ \o -> + BigCat + <$> (o .: "className") + <*> (o .:? "color") + <*> (o .:? "declawed") + <*> (o .:? "kind") + +-- | ToJSON BigCat +instance A.ToJSON BigCat where + toJSON BigCat {..} = + _omitNulls + [ "className" .= bigCatClassName + , "color" .= bigCatColor + , "declawed" .= bigCatDeclawed + , "kind" .= bigCatKind + ] + + +-- | Construct a value of type 'BigCat' (by applying it's required fields, if any) +mkBigCat + :: Text -- ^ 'bigCatClassName' + -> BigCat +mkBigCat bigCatClassName = + BigCat + { bigCatClassName + , bigCatColor = Nothing + , bigCatDeclawed = Nothing + , bigCatKind = Nothing + } + +-- ** BigCatAllOf +-- | BigCatAllOf +data BigCatAllOf = BigCatAllOf + { bigCatAllOfKind :: !(Maybe E'Kind) -- ^ "kind" + } deriving (P.Show, P.Eq, P.Typeable) + +-- | FromJSON BigCatAllOf +instance A.FromJSON BigCatAllOf where + parseJSON = A.withObject "BigCatAllOf" $ \o -> + BigCatAllOf + <$> (o .:? "kind") + +-- | ToJSON BigCatAllOf +instance A.ToJSON BigCatAllOf where + toJSON BigCatAllOf {..} = + _omitNulls + [ "kind" .= bigCatAllOfKind + ] + + +-- | Construct a value of type 'BigCatAllOf' (by applying it's required fields, if any) +mkBigCatAllOf + :: BigCatAllOf +mkBigCatAllOf = + BigCatAllOf + { bigCatAllOfKind = Nothing + } + -- ** Capitalization -- | Capitalization data Capitalization = Capitalization @@ -2199,6 +2268,40 @@ toE'JustSymbol = \case s -> P.Left $ "toE'JustSymbol: enum parse failure: " P.++ P.show s +-- ** E'Kind + +-- | Enum of 'Text' +data E'Kind + = E'Kind'Lions -- ^ @"lions"@ + | E'Kind'Tigers -- ^ @"tigers"@ + | E'Kind'Leopards -- ^ @"leopards"@ + | E'Kind'Jaguars -- ^ @"jaguars"@ + deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum) + +instance A.ToJSON E'Kind where toJSON = A.toJSON . fromE'Kind +instance A.FromJSON E'Kind where parseJSON o = P.either P.fail (pure . P.id) . toE'Kind =<< A.parseJSON o +instance WH.ToHttpApiData E'Kind where toQueryParam = WH.toQueryParam . fromE'Kind +instance WH.FromHttpApiData E'Kind where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . toE'Kind +instance MimeRender MimeMultipartFormData E'Kind where mimeRender _ = mimeRenderDefaultMultipartFormData + +-- | unwrap 'E'Kind' enum +fromE'Kind :: E'Kind -> Text +fromE'Kind = \case + E'Kind'Lions -> "lions" + E'Kind'Tigers -> "tigers" + E'Kind'Leopards -> "leopards" + E'Kind'Jaguars -> "jaguars" + +-- | parse 'E'Kind' enum +toE'Kind :: Text -> P.Either String E'Kind +toE'Kind = \case + "lions" -> P.Right E'Kind'Lions + "tigers" -> P.Right E'Kind'Tigers + "leopards" -> P.Right E'Kind'Leopards + "jaguars" -> P.Right E'Kind'Jaguars + s -> P.Left $ "toE'Kind: enum parse failure: " P.++ P.show s + + -- ** E'Status -- | Enum of 'Text' . diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/ModelLens.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/ModelLens.hs index 4926ee6c830..32c3b215980 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/ModelLens.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/ModelLens.hs @@ -228,6 +228,39 @@ arrayTestArrayArrayOfModelL f ArrayTest{..} = (\arrayTestArrayArrayOfModel -> Ar +-- * BigCat + +-- | 'bigCatClassName' Lens +bigCatClassNameL :: Lens_' BigCat (Text) +bigCatClassNameL f BigCat{..} = (\bigCatClassName -> BigCat { bigCatClassName, ..} ) <$> f bigCatClassName +{-# INLINE bigCatClassNameL #-} + +-- | 'bigCatColor' Lens +bigCatColorL :: Lens_' BigCat (Maybe Text) +bigCatColorL f BigCat{..} = (\bigCatColor -> BigCat { bigCatColor, ..} ) <$> f bigCatColor +{-# INLINE bigCatColorL #-} + +-- | 'bigCatDeclawed' Lens +bigCatDeclawedL :: Lens_' BigCat (Maybe Bool) +bigCatDeclawedL f BigCat{..} = (\bigCatDeclawed -> BigCat { bigCatDeclawed, ..} ) <$> f bigCatDeclawed +{-# INLINE bigCatDeclawedL #-} + +-- | 'bigCatKind' Lens +bigCatKindL :: Lens_' BigCat (Maybe E'Kind) +bigCatKindL f BigCat{..} = (\bigCatKind -> BigCat { bigCatKind, ..} ) <$> f bigCatKind +{-# INLINE bigCatKindL #-} + + + +-- * BigCatAllOf + +-- | 'bigCatAllOfKind' Lens +bigCatAllOfKindL :: Lens_' BigCatAllOf (Maybe E'Kind) +bigCatAllOfKindL f BigCatAllOf{..} = (\bigCatAllOfKind -> BigCatAllOf { bigCatAllOfKind, ..} ) <$> f bigCatAllOfKind +{-# INLINE bigCatAllOfKindL #-} + + + -- * Capitalization -- | 'capitalizationSmallCamel' Lens diff --git a/samples/client/petstore/haskell-http-client/openapi.yaml b/samples/client/petstore/haskell-http-client/openapi.yaml index 94c46a5bb5d..be551305339 100644 --- a/samples/client/petstore/haskell-http-client/openapi.yaml +++ b/samples/client/petstore/haskell-http-client/openapi.yaml @@ -1422,6 +1422,10 @@ components: allOf: - $ref: '#/components/schemas/Animal' - $ref: '#/components/schemas/Cat_allOf' + BigCat: + allOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/BigCat_allOf' Animal: discriminator: propertyName: className @@ -2086,6 +2090,15 @@ components: properties: declawed: type: boolean + BigCat_allOf: + properties: + kind: + enum: + - lions + - tigers + - leopards + - jaguars + type: string securitySchemes: petstore_auth: flows: diff --git a/samples/client/petstore/haskell-http-client/tests/Instances.hs b/samples/client/petstore/haskell-http-client/tests/Instances.hs index 3b5bf7a9842..bb674c55b3a 100644 --- a/samples/client/petstore/haskell-http-client/tests/Instances.hs +++ b/samples/client/petstore/haskell-http-client/tests/Instances.hs @@ -223,6 +223,25 @@ genArrayTest n = <*> arbitraryReducedMaybe n -- arrayTestArrayArrayOfInteger :: Maybe [[Integer]] <*> arbitraryReducedMaybe n -- arrayTestArrayArrayOfModel :: Maybe [[ReadOnlyFirst]] +instance Arbitrary BigCat where + arbitrary = sized genBigCat + +genBigCat :: Int -> Gen BigCat +genBigCat n = + BigCat + <$> arbitrary -- bigCatClassName :: Text + <*> arbitraryReducedMaybe n -- bigCatColor :: Maybe Text + <*> arbitraryReducedMaybe n -- bigCatDeclawed :: Maybe Bool + <*> arbitraryReducedMaybe n -- bigCatKind :: Maybe E'Kind + +instance Arbitrary BigCatAllOf where + arbitrary = sized genBigCatAllOf + +genBigCatAllOf :: Int -> Gen BigCatAllOf +genBigCatAllOf n = + BigCatAllOf + <$> arbitraryReducedMaybe n -- bigCatAllOfKind :: Maybe E'Kind + instance Arbitrary Capitalization where arbitrary = sized genCapitalization @@ -598,6 +617,9 @@ instance Arbitrary E'Inner where instance Arbitrary E'JustSymbol where arbitrary = arbitraryBoundedEnum +instance Arbitrary E'Kind where + arbitrary = arbitraryBoundedEnum + instance Arbitrary E'Status where arbitrary = arbitraryBoundedEnum diff --git a/samples/client/petstore/haskell-http-client/tests/Test.hs b/samples/client/petstore/haskell-http-client/tests/Test.hs index 6db1f28e4d6..bcb0761e838 100644 --- a/samples/client/petstore/haskell-http-client/tests/Test.hs +++ b/samples/client/petstore/haskell-http-client/tests/Test.hs @@ -33,6 +33,8 @@ main = propMimeEq MimeJSON (Proxy :: Proxy ArrayOfArrayOfNumberOnly) propMimeEq MimeJSON (Proxy :: Proxy ArrayOfNumberOnly) propMimeEq MimeJSON (Proxy :: Proxy ArrayTest) + propMimeEq MimeJSON (Proxy :: Proxy BigCat) + propMimeEq MimeJSON (Proxy :: Proxy BigCatAllOf) propMimeEq MimeJSON (Proxy :: Proxy Capitalization) propMimeEq MimeJSON (Proxy :: Proxy Cat) propMimeEq MimeJSON (Proxy :: Proxy CatAllOf) diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java index 845a10ecb10..714c03c8e78 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/Animal.java @@ -38,6 +38,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..26058804c75 --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,146 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) +@javax.annotation.concurrent.Immutable + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..d430edae189 --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,142 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) +@javax.annotation.concurrent.Immutable + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..a9b13011f00 --- /dev/null +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..006c8070742 --- /dev/null +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,75 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Animal.java index ff1d1f941ae..a17f713859c 100644 --- a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Animal.java @@ -37,6 +37,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..84b3f05703b --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,145 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..7ce0ddb21f5 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,141 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..a9b13011f00 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..006c8070742 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,75 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/google-api-client/docs/BigCat.md b/samples/client/petstore/java/google-api-client/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/google-api-client/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/google-api-client/docs/BigCatAllOf.md b/samples/client/petstore/java/google-api-client/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/google-api-client/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Animal.java index ff1d1f941ae..a17f713859c 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Animal.java @@ -37,6 +37,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..84b3f05703b --- /dev/null +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,145 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..7ce0ddb21f5 --- /dev/null +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,141 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/google-api-client/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/google-api-client/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..a9b13011f00 --- /dev/null +++ b/samples/client/petstore/java/google-api-client/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/google-api-client/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/google-api-client/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..006c8070742 --- /dev/null +++ b/samples/client/petstore/java/google-api-client/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,75 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/jersey1/docs/BigCat.md b/samples/client/petstore/java/jersey1/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/jersey1/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/jersey1/docs/BigCatAllOf.md b/samples/client/petstore/java/jersey1/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/jersey1/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Animal.java index ff1d1f941ae..a17f713859c 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Animal.java @@ -37,6 +37,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..84b3f05703b --- /dev/null +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,145 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..7ce0ddb21f5 --- /dev/null +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,141 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey1/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/jersey1/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..a9b13011f00 --- /dev/null +++ b/samples/client/petstore/java/jersey1/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/jersey1/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/jersey1/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..006c8070742 --- /dev/null +++ b/samples/client/petstore/java/jersey1/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,75 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/jersey2-java6/docs/BigCat.md b/samples/client/petstore/java/jersey2-java6/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/jersey2-java6/docs/BigCatAllOf.md b/samples/client/petstore/java/jersey2-java6/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiClient.java index 07915c2fafe..c92e4584cb2 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiClient.java @@ -699,6 +699,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/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Animal.java index cb94f281e85..741e51b2a6e 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Animal.java @@ -36,6 +36,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..a3e0b8be2e1 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,144 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.ObjectUtils; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return ObjectUtils.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return ObjectUtils.hashCodeMulti(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..c3b5efaddd3 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,140 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import org.apache.commons.lang3.ObjectUtils; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return ObjectUtils.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return ObjectUtils.hashCodeMulti(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-java6/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/jersey2-java6/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..a9b13011f00 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/jersey2-java6/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/jersey2-java6/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..006c8070742 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,75 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/jersey2-java8/docs/BigCat.md b/samples/client/petstore/java/jersey2-java8/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/jersey2-java8/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/jersey2-java8/docs/BigCatAllOf.md b/samples/client/petstore/java/jersey2-java8/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java8/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java index 8fa20fb9795..bd0facace11 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java @@ -699,6 +699,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/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java index ff1d1f941ae..a17f713859c 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java @@ -37,6 +37,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..84b3f05703b --- /dev/null +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,145 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..7ce0ddb21f5 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,141 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..a9b13011f00 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..006c8070742 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,75 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/jersey2/docs/BigCat.md b/samples/client/petstore/java/jersey2/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/jersey2/docs/BigCatAllOf.md b/samples/client/petstore/java/jersey2/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/ApiClient.java index 8fa20fb9795..bd0facace11 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/ApiClient.java @@ -699,6 +699,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/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Animal.java index ff1d1f941ae..a17f713859c 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Animal.java @@ -37,6 +37,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..84b3f05703b --- /dev/null +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,145 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..7ce0ddb21f5 --- /dev/null +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,141 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..a9b13011f00 --- /dev/null +++ b/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..006c8070742 --- /dev/null +++ b/samples/client/petstore/java/jersey2/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,75 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/native/docs/BigCat.md b/samples/client/petstore/java/native/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/native/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/native/docs/BigCatAllOf.md b/samples/client/petstore/java/native/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/native/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Animal.java index ff1d1f941ae..a17f713859c 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/Animal.java @@ -37,6 +37,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..84b3f05703b --- /dev/null +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,145 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..7ce0ddb21f5 --- /dev/null +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,141 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/native/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/native/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..a9b13011f00 --- /dev/null +++ b/samples/client/petstore/java/native/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/native/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/native/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..006c8070742 --- /dev/null +++ b/samples/client/petstore/java/native/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,75 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/BigCat.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/BigCatAllOf.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/JSON.java index e23989865e0..3f214bf1fbf 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/JSON.java @@ -58,6 +58,7 @@ public class JSON { Map classByDiscriminatorValue = new HashMap(); classByDiscriminatorValue.put("Dog".toUpperCase(Locale.ROOT), Dog.class); classByDiscriminatorValue.put("Cat".toUpperCase(Locale.ROOT), Cat.class); + classByDiscriminatorValue.put("BigCat".toUpperCase(Locale.ROOT), BigCat.class); classByDiscriminatorValue.put("Animal".toUpperCase(Locale.ROOT), Animal.class); return getClassByDiscriminator(classByDiscriminatorValue, getDiscriminatorValue(readElement, "className")); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..d3bc09ea37f --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,182 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import android.os.Parcelable; +import android.os.Parcel; + +/** + * BigCat + */ + +public class BigCat extends Cat implements Parcelable { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + private KindEnum kind; + + public BigCat() { + super(); + } + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + super.writeToParcel(out, flags); + out.writeValue(kind); + } + + BigCat(Parcel in) { + super(in); + kind = (KindEnum)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public BigCat createFromParcel(Parcel in) { + return new BigCat(in); + } + public BigCat[] newArray(int size) { + return new BigCat[size]; + } + }; +} + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..1cc92cea52c --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,175 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import android.os.Parcelable; +import android.os.Parcel; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf implements Parcelable { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + private KindEnum kind; + + public BigCatAllOf() { + } + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public void writeToParcel(Parcel out, int flags) { + out.writeValue(kind); + } + + BigCatAllOf(Parcel in) { + kind = (KindEnum)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public BigCatAllOf createFromParcel(Parcel in) { + return new BigCatAllOf(in); + } + public BigCatAllOf[] newArray(int size) { + return new BigCatAllOf[size]; + } + }; +} + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..f7f725106d1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,51 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..0cb50249725 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,77 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/okhttp-gson/docs/BigCat.md b/samples/client/petstore/java/okhttp-gson/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/okhttp-gson/docs/BigCatAllOf.md b/samples/client/petstore/java/okhttp-gson/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java index e23989865e0..3f214bf1fbf 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java @@ -58,6 +58,7 @@ public class JSON { Map classByDiscriminatorValue = new HashMap(); classByDiscriminatorValue.put("Dog".toUpperCase(Locale.ROOT), Dog.class); classByDiscriminatorValue.put("Cat".toUpperCase(Locale.ROOT), Cat.class); + classByDiscriminatorValue.put("BigCat".toUpperCase(Locale.ROOT), BigCat.class); classByDiscriminatorValue.put("Animal".toUpperCase(Locale.ROOT), Animal.class); return getClassByDiscriminator(classByDiscriminatorValue, getDiscriminatorValue(readElement, "className")); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..74b7ddc8135 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,154 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; + +/** + * BigCat + */ + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..cd2207704bd --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,150 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..f7f725106d1 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,51 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..0cb50249725 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,77 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/rest-assured/docs/BigCat.md b/samples/client/petstore/java/rest-assured/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/rest-assured/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/rest-assured/docs/BigCatAllOf.md b/samples/client/petstore/java/rest-assured/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/rest-assured/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/JSON.java index e23989865e0..3f214bf1fbf 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/JSON.java @@ -58,6 +58,7 @@ public class JSON { Map classByDiscriminatorValue = new HashMap(); classByDiscriminatorValue.put("Dog".toUpperCase(Locale.ROOT), Dog.class); classByDiscriminatorValue.put("Cat".toUpperCase(Locale.ROOT), Cat.class); + classByDiscriminatorValue.put("BigCat".toUpperCase(Locale.ROOT), BigCat.class); classByDiscriminatorValue.put("Animal".toUpperCase(Locale.ROOT), Animal.class); return getClassByDiscriminator(classByDiscriminatorValue, getDiscriminatorValue(readElement, "className")); diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..74b7ddc8135 --- /dev/null +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,154 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; + +/** + * BigCat + */ + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..cd2207704bd --- /dev/null +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,150 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/rest-assured/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/rest-assured/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..f7f725106d1 --- /dev/null +++ b/samples/client/petstore/java/rest-assured/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,51 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/rest-assured/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/rest-assured/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..0cb50249725 --- /dev/null +++ b/samples/client/petstore/java/rest-assured/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,77 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/resteasy/docs/BigCat.md b/samples/client/petstore/java/resteasy/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/resteasy/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/resteasy/docs/BigCatAllOf.md b/samples/client/petstore/java/resteasy/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/resteasy/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Animal.java index ff1d1f941ae..a17f713859c 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Animal.java @@ -37,6 +37,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..84b3f05703b --- /dev/null +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,145 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..7ce0ddb21f5 --- /dev/null +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,141 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/resteasy/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/resteasy/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..a9b13011f00 --- /dev/null +++ b/samples/client/petstore/java/resteasy/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/resteasy/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/resteasy/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..006c8070742 --- /dev/null +++ b/samples/client/petstore/java/resteasy/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,75 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/BigCat.md b/samples/client/petstore/java/resttemplate-withXml/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/resttemplate-withXml/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/BigCatAllOf.md b/samples/client/petstore/java/resttemplate-withXml/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/resttemplate-withXml/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/ApiClient.java index dbdccb6d1d8..74cb8673436 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/ApiClient.java @@ -647,14 +647,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/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Animal.java index 38646431b45..9b0fa3ff89d 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Animal.java @@ -39,6 +39,7 @@ import javax.xml.bind.annotation.*; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) @XmlRootElement(name = "Animal") diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..a578309d5b5 --- /dev/null +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,152 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.dataformat.xml.annotation.*; +import javax.xml.bind.annotation.*; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +@XmlRootElement(name = "BigCat") +@XmlAccessorType(XmlAccessType.FIELD) +@JacksonXmlRootElement(localName = "BigCat") +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + @XmlElement(name = "kind") + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JacksonXmlProperty(localName = "kind") + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..65817c4f4c8 --- /dev/null +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.dataformat.xml.annotation.*; +import javax.xml.bind.annotation.*; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +@XmlRootElement(name = "BigCatAllOf") +@XmlAccessorType(XmlAccessType.FIELD) +@JacksonXmlRootElement(localName = "BigCatAllOf") +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + @XmlElement(name = "kind") + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JacksonXmlProperty(localName = "kind") + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/resttemplate-withXml/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/resttemplate-withXml/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..a9b13011f00 --- /dev/null +++ b/samples/client/petstore/java/resttemplate-withXml/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/resttemplate-withXml/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/resttemplate-withXml/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..006c8070742 --- /dev/null +++ b/samples/client/petstore/java/resttemplate-withXml/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,75 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/resttemplate/docs/BigCat.md b/samples/client/petstore/java/resttemplate/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/resttemplate/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/resttemplate/docs/BigCatAllOf.md b/samples/client/petstore/java/resttemplate/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/resttemplate/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/ApiClient.java index 7210077ec81..0be41bbbf7a 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/ApiClient.java @@ -642,14 +642,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/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java index ff1d1f941ae..a17f713859c 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java @@ -37,6 +37,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..84b3f05703b --- /dev/null +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,145 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..7ce0ddb21f5 --- /dev/null +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,141 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/resttemplate/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/resttemplate/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..a9b13011f00 --- /dev/null +++ b/samples/client/petstore/java/resttemplate/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/resttemplate/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/resttemplate/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..006c8070742 --- /dev/null +++ b/samples/client/petstore/java/resttemplate/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,75 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..74b7ddc8135 --- /dev/null +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,154 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; + +/** + * BigCat + */ + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..cd2207704bd --- /dev/null +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,150 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/retrofit/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..f7f725106d1 --- /dev/null +++ b/samples/client/petstore/java/retrofit/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,51 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/retrofit/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/retrofit/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..0cb50249725 --- /dev/null +++ b/samples/client/petstore/java/retrofit/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,77 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/retrofit2-play24/docs/BigCat.md b/samples/client/petstore/java/retrofit2-play24/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play24/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/retrofit2-play24/docs/BigCatAllOf.md b/samples/client/petstore/java/retrofit2-play24/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play24/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Animal.java index fa37d558448..6f607263996 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Animal.java @@ -39,6 +39,7 @@ import javax.validation.Valid; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..fa4339d591b --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,147 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..754e37125b3 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,143 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play24/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/retrofit2-play24/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..a9b13011f00 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play24/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/retrofit2-play24/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/retrofit2-play24/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..006c8070742 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play24/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,75 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/retrofit2-play25/docs/BigCat.md b/samples/client/petstore/java/retrofit2-play25/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play25/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/retrofit2-play25/docs/BigCatAllOf.md b/samples/client/petstore/java/retrofit2-play25/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play25/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Animal.java index fa37d558448..6f607263996 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Animal.java @@ -39,6 +39,7 @@ import javax.validation.Valid; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..fa4339d591b --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,147 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..754e37125b3 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,143 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play25/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/retrofit2-play25/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..a9b13011f00 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play25/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/retrofit2-play25/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/retrofit2-play25/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..006c8070742 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play25/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,75 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/retrofit2-play26/docs/BigCat.md b/samples/client/petstore/java/retrofit2-play26/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/BigCatAllOf.md b/samples/client/petstore/java/retrofit2-play26/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Animal.java index fa37d558448..6f607263996 100644 --- a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Animal.java @@ -39,6 +39,7 @@ import javax.validation.Valid; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..fa4339d591b --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,147 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..754e37125b3 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,143 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..a9b13011f00 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..006c8070742 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,75 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/retrofit2/docs/BigCat.md b/samples/client/petstore/java/retrofit2/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/retrofit2/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/retrofit2/docs/BigCatAllOf.md b/samples/client/petstore/java/retrofit2/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/retrofit2/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/JSON.java index 607f7de40b2..f5933046f94 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/JSON.java @@ -55,6 +55,7 @@ public class JSON { Map classByDiscriminatorValue = new HashMap(); classByDiscriminatorValue.put("Dog".toUpperCase(Locale.ROOT), Dog.class); classByDiscriminatorValue.put("Cat".toUpperCase(Locale.ROOT), Cat.class); + classByDiscriminatorValue.put("BigCat".toUpperCase(Locale.ROOT), BigCat.class); classByDiscriminatorValue.put("Animal".toUpperCase(Locale.ROOT), Animal.class); return getClassByDiscriminator( classByDiscriminatorValue, diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..74b7ddc8135 --- /dev/null +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,154 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; + +/** + * BigCat + */ + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..cd2207704bd --- /dev/null +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,150 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/retrofit2/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..f7f725106d1 --- /dev/null +++ b/samples/client/petstore/java/retrofit2/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,51 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/retrofit2/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/retrofit2/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..0cb50249725 --- /dev/null +++ b/samples/client/petstore/java/retrofit2/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,77 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/retrofit2rx/docs/BigCat.md b/samples/client/petstore/java/retrofit2rx/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/retrofit2rx/docs/BigCatAllOf.md b/samples/client/petstore/java/retrofit2rx/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/JSON.java index 607f7de40b2..f5933046f94 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/JSON.java @@ -55,6 +55,7 @@ public class JSON { Map classByDiscriminatorValue = new HashMap(); classByDiscriminatorValue.put("Dog".toUpperCase(Locale.ROOT), Dog.class); classByDiscriminatorValue.put("Cat".toUpperCase(Locale.ROOT), Cat.class); + classByDiscriminatorValue.put("BigCat".toUpperCase(Locale.ROOT), BigCat.class); classByDiscriminatorValue.put("Animal".toUpperCase(Locale.ROOT), Animal.class); return getClassByDiscriminator( classByDiscriminatorValue, diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..74b7ddc8135 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,154 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; + +/** + * BigCat + */ + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..cd2207704bd --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,150 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2rx/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/retrofit2rx/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..f7f725106d1 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,51 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/retrofit2rx/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/retrofit2rx/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..0cb50249725 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,77 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/retrofit2rx2/docs/BigCat.md b/samples/client/petstore/java/retrofit2rx2/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx2/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/retrofit2rx2/docs/BigCatAllOf.md b/samples/client/petstore/java/retrofit2rx2/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx2/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/JSON.java index 607f7de40b2..f5933046f94 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/JSON.java @@ -55,6 +55,7 @@ public class JSON { Map classByDiscriminatorValue = new HashMap(); classByDiscriminatorValue.put("Dog".toUpperCase(Locale.ROOT), Dog.class); classByDiscriminatorValue.put("Cat".toUpperCase(Locale.ROOT), Cat.class); + classByDiscriminatorValue.put("BigCat".toUpperCase(Locale.ROOT), BigCat.class); classByDiscriminatorValue.put("Animal".toUpperCase(Locale.ROOT), Animal.class); return getClassByDiscriminator( classByDiscriminatorValue, diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..74b7ddc8135 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,154 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; + +/** + * BigCat + */ + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..cd2207704bd --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,150 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + @JsonAdapter(KindEnum.Adapter.class) + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final KindEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public KindEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KindEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_KIND = "kind"; + @SerializedName(SERIALIZED_NAME_KIND) + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2rx2/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/retrofit2rx2/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..f7f725106d1 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx2/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,51 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/retrofit2rx2/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/retrofit2rx2/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..0cb50249725 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx2/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,77 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/vertx/docs/BigCat.md b/samples/client/petstore/java/vertx/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/vertx/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/vertx/docs/BigCatAllOf.md b/samples/client/petstore/java/vertx/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/vertx/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Animal.java index ff1d1f941ae..a17f713859c 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Animal.java @@ -37,6 +37,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..84b3f05703b --- /dev/null +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,145 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..7ce0ddb21f5 --- /dev/null +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,141 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/vertx/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/vertx/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..a9b13011f00 --- /dev/null +++ b/samples/client/petstore/java/vertx/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/vertx/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/vertx/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..006c8070742 --- /dev/null +++ b/samples/client/petstore/java/vertx/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,75 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/webclient/docs/BigCat.md b/samples/client/petstore/java/webclient/docs/BigCat.md new file mode 100644 index 00000000000..8a075304abf --- /dev/null +++ b/samples/client/petstore/java/webclient/docs/BigCat.md @@ -0,0 +1,23 @@ + + +# BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/webclient/docs/BigCatAllOf.md b/samples/client/petstore/java/webclient/docs/BigCatAllOf.md new file mode 100644 index 00000000000..21177dbf089 --- /dev/null +++ b/samples/client/petstore/java/webclient/docs/BigCatAllOf.md @@ -0,0 +1,23 @@ + + +# BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | [**KindEnum**](#KindEnum) | | [optional] + + + +## Enum: KindEnum + +Name | Value +---- | ----- +LIONS | "lions" +TIGERS | "tigers" +LEOPARDS | "leopards" +JAGUARS | "jaguars" + + + diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java index ff1d1f941ae..a17f713859c 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java @@ -37,6 +37,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/BigCat.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/BigCat.java new file mode 100644 index 00000000000..84b3f05703b --- /dev/null +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/BigCat.java @@ -0,0 +1,145 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCat kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/BigCatAllOf.java new file mode 100644 index 00000000000..7ce0ddb21f5 --- /dev/null +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/BigCatAllOf.java @@ -0,0 +1,141 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + private KindEnum kind; + + + public BigCatAllOf kind(KindEnum kind) { + + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_KIND) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public KindEnum getKind() { + return kind; + } + + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java new file mode 100644 index 00000000000..a9b13011f00 --- /dev/null +++ b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java @@ -0,0 +1,49 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCatAllOf + */ +public class BigCatAllOfTest { + private final BigCatAllOf model = new BigCatAllOf(); + + /** + * Model tests for BigCatAllOf + */ + @Test + public void testBigCatAllOf() { + // TODO: test BigCatAllOf + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/model/BigCatTest.java new file mode 100644 index 00000000000..006c8070742 --- /dev/null +++ b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/model/BigCatTest.java @@ -0,0 +1,75 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BigCatAllOf; +import org.openapitools.client.model.Cat; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for BigCat + */ +public class BigCatTest { + private final BigCat model = new BigCat(); + + /** + * Model tests for BigCat + */ + @Test + public void testBigCat() { + // TODO: test BigCat + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + + /** + * Test the property 'color' + */ + @Test + public void colorTest() { + // TODO: test color + } + + /** + * Test the property 'declawed' + */ + @Test + public void declawedTest() { + // TODO: test declawed + } + + /** + * Test the property 'kind' + */ + @Test + public void kindTest() { + // TODO: test kind + } + +} diff --git a/samples/client/petstore/javascript-es6/README.md b/samples/client/petstore/javascript-es6/README.md index 711b08bb799..09bc0b0ffe9 100644 --- a/samples/client/petstore/javascript-es6/README.md +++ b/samples/client/petstore/javascript-es6/README.md @@ -174,6 +174,8 @@ Class | Method | HTTP request | Description - [OpenApiPetstore.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [OpenApiPetstore.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [OpenApiPetstore.ArrayTest](docs/ArrayTest.md) + - [OpenApiPetstore.BigCat](docs/BigCat.md) + - [OpenApiPetstore.BigCatAllOf](docs/BigCatAllOf.md) - [OpenApiPetstore.Capitalization](docs/Capitalization.md) - [OpenApiPetstore.Cat](docs/Cat.md) - [OpenApiPetstore.CatAllOf](docs/CatAllOf.md) diff --git a/samples/client/petstore/javascript-es6/docs/BigCat.md b/samples/client/petstore/javascript-es6/docs/BigCat.md new file mode 100644 index 00000000000..bbd79b2ba1b --- /dev/null +++ b/samples/client/petstore/javascript-es6/docs/BigCat.md @@ -0,0 +1,24 @@ +# OpenApiPetstore.BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **String** | | [optional] + + + +## Enum: KindEnum + + +* `lions` (value: `"lions"`) + +* `tigers` (value: `"tigers"`) + +* `leopards` (value: `"leopards"`) + +* `jaguars` (value: `"jaguars"`) + + + + diff --git a/samples/client/petstore/javascript-es6/docs/BigCatAllOf.md b/samples/client/petstore/javascript-es6/docs/BigCatAllOf.md new file mode 100644 index 00000000000..c5e83bfdaeb --- /dev/null +++ b/samples/client/petstore/javascript-es6/docs/BigCatAllOf.md @@ -0,0 +1,24 @@ +# OpenApiPetstore.BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **String** | | [optional] + + + +## Enum: KindEnum + + +* `lions` (value: `"lions"`) + +* `tigers` (value: `"tigers"`) + +* `leopards` (value: `"leopards"`) + +* `jaguars` (value: `"jaguars"`) + + + + diff --git a/samples/client/petstore/javascript-es6/src/index.js b/samples/client/petstore/javascript-es6/src/index.js index 105b2767803..e4dc27efbc3 100644 --- a/samples/client/petstore/javascript-es6/src/index.js +++ b/samples/client/petstore/javascript-es6/src/index.js @@ -26,6 +26,8 @@ import ApiResponse from './model/ApiResponse'; import ArrayOfArrayOfNumberOnly from './model/ArrayOfArrayOfNumberOnly'; import ArrayOfNumberOnly from './model/ArrayOfNumberOnly'; import ArrayTest from './model/ArrayTest'; +import BigCat from './model/BigCat'; +import BigCatAllOf from './model/BigCatAllOf'; import Capitalization from './model/Capitalization'; import Cat from './model/Cat'; import CatAllOf from './model/CatAllOf'; @@ -183,6 +185,18 @@ export { */ ArrayTest, + /** + * The BigCat model constructor. + * @property {module:model/BigCat} + */ + BigCat, + + /** + * The BigCatAllOf model constructor. + * @property {module:model/BigCatAllOf} + */ + BigCatAllOf, + /** * The Capitalization model constructor. * @property {module:model/Capitalization} diff --git a/samples/client/petstore/javascript-es6/src/model/BigCat.js b/samples/client/petstore/javascript-es6/src/model/BigCat.js new file mode 100644 index 00000000000..764e45d31dc --- /dev/null +++ b/samples/client/petstore/javascript-es6/src/model/BigCat.js @@ -0,0 +1,132 @@ +/** + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; +import BigCatAllOf from './BigCatAllOf'; +import Cat from './Cat'; + +/** + * The BigCat model module. + * @module model/BigCat + * @version 1.0.0 + */ +class BigCat { + /** + * Constructs a new BigCat. + * @alias module:model/BigCat + * @extends module:model/Cat + * @implements module:model/Cat + * @implements module:model/BigCatAllOf + * @param className {String} + */ + constructor(className) { + Cat.initialize(this, className);BigCatAllOf.initialize(this); + BigCat.initialize(this, className); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj, className) { + } + + /** + * Constructs a BigCat from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/BigCat} obj Optional instance to populate. + * @return {module:model/BigCat} The populated BigCat instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new BigCat(); + Cat.constructFromObject(data, obj); + Cat.constructFromObject(data, obj); + BigCatAllOf.constructFromObject(data, obj); + + if (data.hasOwnProperty('kind')) { + obj['kind'] = ApiClient.convertToType(data['kind'], 'String'); + } + } + return obj; + } + + +} + +/** + * @member {module:model/BigCat.KindEnum} kind + */ +BigCat.prototype['kind'] = undefined; + + +// Implement Cat interface: +/** + * @member {String} className + */ +Cat.prototype['className'] = undefined; +/** + * @member {String} color + * @default 'red' + */ +Cat.prototype['color'] = 'red'; +/** + * @member {Boolean} declawed + */ +Cat.prototype['declawed'] = undefined; +// Implement BigCatAllOf interface: +/** + * @member {module:model/BigCatAllOf.KindEnum} kind + */ +BigCatAllOf.prototype['kind'] = undefined; + + + +/** + * Allowed values for the kind property. + * @enum {String} + * @readonly + */ +BigCat['KindEnum'] = { + + /** + * value: "lions" + * @const + */ + "lions": "lions", + + /** + * value: "tigers" + * @const + */ + "tigers": "tigers", + + /** + * value: "leopards" + * @const + */ + "leopards": "leopards", + + /** + * value: "jaguars" + * @const + */ + "jaguars": "jaguars" +}; + + + +export default BigCat; + diff --git a/samples/client/petstore/javascript-es6/src/model/BigCatAllOf.js b/samples/client/petstore/javascript-es6/src/model/BigCatAllOf.js new file mode 100644 index 00000000000..1b79f1a2849 --- /dev/null +++ b/samples/client/petstore/javascript-es6/src/model/BigCatAllOf.js @@ -0,0 +1,104 @@ +/** + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; + +/** + * The BigCatAllOf model module. + * @module model/BigCatAllOf + * @version 1.0.0 + */ +class BigCatAllOf { + /** + * Constructs a new BigCatAllOf. + * @alias module:model/BigCatAllOf + */ + constructor() { + + BigCatAllOf.initialize(this); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj) { + } + + /** + * Constructs a BigCatAllOf from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/BigCatAllOf} obj Optional instance to populate. + * @return {module:model/BigCatAllOf} The populated BigCatAllOf instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new BigCatAllOf(); + + if (data.hasOwnProperty('kind')) { + obj['kind'] = ApiClient.convertToType(data['kind'], 'String'); + } + } + return obj; + } + + +} + +/** + * @member {module:model/BigCatAllOf.KindEnum} kind + */ +BigCatAllOf.prototype['kind'] = undefined; + + + + + +/** + * Allowed values for the kind property. + * @enum {String} + * @readonly + */ +BigCatAllOf['KindEnum'] = { + + /** + * value: "lions" + * @const + */ + "lions": "lions", + + /** + * value: "tigers" + * @const + */ + "tigers": "tigers", + + /** + * value: "leopards" + * @const + */ + "leopards": "leopards", + + /** + * value: "jaguars" + * @const + */ + "jaguars": "jaguars" +}; + + + +export default BigCatAllOf; + diff --git a/samples/client/petstore/javascript-es6/test/model/BigCat.spec.js b/samples/client/petstore/javascript-es6/test/model/BigCat.spec.js new file mode 100644 index 00000000000..c21833ff229 --- /dev/null +++ b/samples/client/petstore/javascript-es6/test/model/BigCat.spec.js @@ -0,0 +1,65 @@ +/** + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.OpenApiPetstore); + } +}(this, function(expect, OpenApiPetstore) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new OpenApiPetstore.BigCat(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('BigCat', function() { + it('should create an instance of BigCat', function() { + // uncomment below and update the code to test BigCat + //var instane = new OpenApiPetstore.BigCat(); + //expect(instance).to.be.a(OpenApiPetstore.BigCat); + }); + + it('should have the property kind (base name: "kind")', function() { + // uncomment below and update the code to test the property kind + //var instane = new OpenApiPetstore.BigCat(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/samples/client/petstore/javascript-es6/test/model/BigCatAllOf.spec.js b/samples/client/petstore/javascript-es6/test/model/BigCatAllOf.spec.js new file mode 100644 index 00000000000..c27440b42c3 --- /dev/null +++ b/samples/client/petstore/javascript-es6/test/model/BigCatAllOf.spec.js @@ -0,0 +1,65 @@ +/** + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.OpenApiPetstore); + } +}(this, function(expect, OpenApiPetstore) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new OpenApiPetstore.BigCatAllOf(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('BigCatAllOf', function() { + it('should create an instance of BigCatAllOf', function() { + // uncomment below and update the code to test BigCatAllOf + //var instane = new OpenApiPetstore.BigCatAllOf(); + //expect(instance).to.be.a(OpenApiPetstore.BigCatAllOf); + }); + + it('should have the property kind (base name: "kind")', function() { + // uncomment below and update the code to test the property kind + //var instane = new OpenApiPetstore.BigCatAllOf(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/samples/client/petstore/javascript-promise-es6/README.md b/samples/client/petstore/javascript-promise-es6/README.md index b325aae5404..ed1a7dcbddf 100644 --- a/samples/client/petstore/javascript-promise-es6/README.md +++ b/samples/client/petstore/javascript-promise-es6/README.md @@ -172,6 +172,8 @@ Class | Method | HTTP request | Description - [OpenApiPetstore.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [OpenApiPetstore.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [OpenApiPetstore.ArrayTest](docs/ArrayTest.md) + - [OpenApiPetstore.BigCat](docs/BigCat.md) + - [OpenApiPetstore.BigCatAllOf](docs/BigCatAllOf.md) - [OpenApiPetstore.Capitalization](docs/Capitalization.md) - [OpenApiPetstore.Cat](docs/Cat.md) - [OpenApiPetstore.CatAllOf](docs/CatAllOf.md) diff --git a/samples/client/petstore/javascript-promise-es6/docs/BigCat.md b/samples/client/petstore/javascript-promise-es6/docs/BigCat.md new file mode 100644 index 00000000000..bbd79b2ba1b --- /dev/null +++ b/samples/client/petstore/javascript-promise-es6/docs/BigCat.md @@ -0,0 +1,24 @@ +# OpenApiPetstore.BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **String** | | [optional] + + + +## Enum: KindEnum + + +* `lions` (value: `"lions"`) + +* `tigers` (value: `"tigers"`) + +* `leopards` (value: `"leopards"`) + +* `jaguars` (value: `"jaguars"`) + + + + diff --git a/samples/client/petstore/javascript-promise-es6/docs/BigCatAllOf.md b/samples/client/petstore/javascript-promise-es6/docs/BigCatAllOf.md new file mode 100644 index 00000000000..c5e83bfdaeb --- /dev/null +++ b/samples/client/petstore/javascript-promise-es6/docs/BigCatAllOf.md @@ -0,0 +1,24 @@ +# OpenApiPetstore.BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **String** | | [optional] + + + +## Enum: KindEnum + + +* `lions` (value: `"lions"`) + +* `tigers` (value: `"tigers"`) + +* `leopards` (value: `"leopards"`) + +* `jaguars` (value: `"jaguars"`) + + + + diff --git a/samples/client/petstore/javascript-promise-es6/src/index.js b/samples/client/petstore/javascript-promise-es6/src/index.js index 105b2767803..e4dc27efbc3 100644 --- a/samples/client/petstore/javascript-promise-es6/src/index.js +++ b/samples/client/petstore/javascript-promise-es6/src/index.js @@ -26,6 +26,8 @@ import ApiResponse from './model/ApiResponse'; import ArrayOfArrayOfNumberOnly from './model/ArrayOfArrayOfNumberOnly'; import ArrayOfNumberOnly from './model/ArrayOfNumberOnly'; import ArrayTest from './model/ArrayTest'; +import BigCat from './model/BigCat'; +import BigCatAllOf from './model/BigCatAllOf'; import Capitalization from './model/Capitalization'; import Cat from './model/Cat'; import CatAllOf from './model/CatAllOf'; @@ -183,6 +185,18 @@ export { */ ArrayTest, + /** + * The BigCat model constructor. + * @property {module:model/BigCat} + */ + BigCat, + + /** + * The BigCatAllOf model constructor. + * @property {module:model/BigCatAllOf} + */ + BigCatAllOf, + /** * The Capitalization model constructor. * @property {module:model/Capitalization} diff --git a/samples/client/petstore/javascript-promise-es6/src/model/BigCat.js b/samples/client/petstore/javascript-promise-es6/src/model/BigCat.js new file mode 100644 index 00000000000..764e45d31dc --- /dev/null +++ b/samples/client/petstore/javascript-promise-es6/src/model/BigCat.js @@ -0,0 +1,132 @@ +/** + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; +import BigCatAllOf from './BigCatAllOf'; +import Cat from './Cat'; + +/** + * The BigCat model module. + * @module model/BigCat + * @version 1.0.0 + */ +class BigCat { + /** + * Constructs a new BigCat. + * @alias module:model/BigCat + * @extends module:model/Cat + * @implements module:model/Cat + * @implements module:model/BigCatAllOf + * @param className {String} + */ + constructor(className) { + Cat.initialize(this, className);BigCatAllOf.initialize(this); + BigCat.initialize(this, className); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj, className) { + } + + /** + * Constructs a BigCat from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/BigCat} obj Optional instance to populate. + * @return {module:model/BigCat} The populated BigCat instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new BigCat(); + Cat.constructFromObject(data, obj); + Cat.constructFromObject(data, obj); + BigCatAllOf.constructFromObject(data, obj); + + if (data.hasOwnProperty('kind')) { + obj['kind'] = ApiClient.convertToType(data['kind'], 'String'); + } + } + return obj; + } + + +} + +/** + * @member {module:model/BigCat.KindEnum} kind + */ +BigCat.prototype['kind'] = undefined; + + +// Implement Cat interface: +/** + * @member {String} className + */ +Cat.prototype['className'] = undefined; +/** + * @member {String} color + * @default 'red' + */ +Cat.prototype['color'] = 'red'; +/** + * @member {Boolean} declawed + */ +Cat.prototype['declawed'] = undefined; +// Implement BigCatAllOf interface: +/** + * @member {module:model/BigCatAllOf.KindEnum} kind + */ +BigCatAllOf.prototype['kind'] = undefined; + + + +/** + * Allowed values for the kind property. + * @enum {String} + * @readonly + */ +BigCat['KindEnum'] = { + + /** + * value: "lions" + * @const + */ + "lions": "lions", + + /** + * value: "tigers" + * @const + */ + "tigers": "tigers", + + /** + * value: "leopards" + * @const + */ + "leopards": "leopards", + + /** + * value: "jaguars" + * @const + */ + "jaguars": "jaguars" +}; + + + +export default BigCat; + diff --git a/samples/client/petstore/javascript-promise-es6/src/model/BigCatAllOf.js b/samples/client/petstore/javascript-promise-es6/src/model/BigCatAllOf.js new file mode 100644 index 00000000000..1b79f1a2849 --- /dev/null +++ b/samples/client/petstore/javascript-promise-es6/src/model/BigCatAllOf.js @@ -0,0 +1,104 @@ +/** + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; + +/** + * The BigCatAllOf model module. + * @module model/BigCatAllOf + * @version 1.0.0 + */ +class BigCatAllOf { + /** + * Constructs a new BigCatAllOf. + * @alias module:model/BigCatAllOf + */ + constructor() { + + BigCatAllOf.initialize(this); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj) { + } + + /** + * Constructs a BigCatAllOf from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/BigCatAllOf} obj Optional instance to populate. + * @return {module:model/BigCatAllOf} The populated BigCatAllOf instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new BigCatAllOf(); + + if (data.hasOwnProperty('kind')) { + obj['kind'] = ApiClient.convertToType(data['kind'], 'String'); + } + } + return obj; + } + + +} + +/** + * @member {module:model/BigCatAllOf.KindEnum} kind + */ +BigCatAllOf.prototype['kind'] = undefined; + + + + + +/** + * Allowed values for the kind property. + * @enum {String} + * @readonly + */ +BigCatAllOf['KindEnum'] = { + + /** + * value: "lions" + * @const + */ + "lions": "lions", + + /** + * value: "tigers" + * @const + */ + "tigers": "tigers", + + /** + * value: "leopards" + * @const + */ + "leopards": "leopards", + + /** + * value: "jaguars" + * @const + */ + "jaguars": "jaguars" +}; + + + +export default BigCatAllOf; + diff --git a/samples/client/petstore/javascript-promise-es6/test/model/BigCat.spec.js b/samples/client/petstore/javascript-promise-es6/test/model/BigCat.spec.js new file mode 100644 index 00000000000..c21833ff229 --- /dev/null +++ b/samples/client/petstore/javascript-promise-es6/test/model/BigCat.spec.js @@ -0,0 +1,65 @@ +/** + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.OpenApiPetstore); + } +}(this, function(expect, OpenApiPetstore) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new OpenApiPetstore.BigCat(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('BigCat', function() { + it('should create an instance of BigCat', function() { + // uncomment below and update the code to test BigCat + //var instane = new OpenApiPetstore.BigCat(); + //expect(instance).to.be.a(OpenApiPetstore.BigCat); + }); + + it('should have the property kind (base name: "kind")', function() { + // uncomment below and update the code to test the property kind + //var instane = new OpenApiPetstore.BigCat(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/samples/client/petstore/javascript-promise-es6/test/model/BigCatAllOf.spec.js b/samples/client/petstore/javascript-promise-es6/test/model/BigCatAllOf.spec.js new file mode 100644 index 00000000000..c27440b42c3 --- /dev/null +++ b/samples/client/petstore/javascript-promise-es6/test/model/BigCatAllOf.spec.js @@ -0,0 +1,65 @@ +/** + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.OpenApiPetstore); + } +}(this, function(expect, OpenApiPetstore) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new OpenApiPetstore.BigCatAllOf(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('BigCatAllOf', function() { + it('should create an instance of BigCatAllOf', function() { + // uncomment below and update the code to test BigCatAllOf + //var instane = new OpenApiPetstore.BigCatAllOf(); + //expect(instance).to.be.a(OpenApiPetstore.BigCatAllOf); + }); + + it('should have the property kind (base name: "kind")', function() { + // uncomment below and update the code to test the property kind + //var instane = new OpenApiPetstore.BigCatAllOf(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/samples/client/petstore/javascript-promise/README.md b/samples/client/petstore/javascript-promise/README.md index 95124df4284..0f3fb9b8afc 100644 --- a/samples/client/petstore/javascript-promise/README.md +++ b/samples/client/petstore/javascript-promise/README.md @@ -160,6 +160,8 @@ Class | Method | HTTP request | Description - [OpenApiPetstore.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [OpenApiPetstore.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [OpenApiPetstore.ArrayTest](docs/ArrayTest.md) + - [OpenApiPetstore.BigCat](docs/BigCat.md) + - [OpenApiPetstore.BigCatAllOf](docs/BigCatAllOf.md) - [OpenApiPetstore.Capitalization](docs/Capitalization.md) - [OpenApiPetstore.Cat](docs/Cat.md) - [OpenApiPetstore.CatAllOf](docs/CatAllOf.md) diff --git a/samples/client/petstore/javascript-promise/docs/BigCat.md b/samples/client/petstore/javascript-promise/docs/BigCat.md new file mode 100644 index 00000000000..bbd79b2ba1b --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/BigCat.md @@ -0,0 +1,24 @@ +# OpenApiPetstore.BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **String** | | [optional] + + + +## Enum: KindEnum + + +* `lions` (value: `"lions"`) + +* `tigers` (value: `"tigers"`) + +* `leopards` (value: `"leopards"`) + +* `jaguars` (value: `"jaguars"`) + + + + diff --git a/samples/client/petstore/javascript-promise/docs/BigCatAllOf.md b/samples/client/petstore/javascript-promise/docs/BigCatAllOf.md new file mode 100644 index 00000000000..c5e83bfdaeb --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/BigCatAllOf.md @@ -0,0 +1,24 @@ +# OpenApiPetstore.BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **String** | | [optional] + + + +## Enum: KindEnum + + +* `lions` (value: `"lions"`) + +* `tigers` (value: `"tigers"`) + +* `leopards` (value: `"leopards"`) + +* `jaguars` (value: `"jaguars"`) + + + + diff --git a/samples/client/petstore/javascript-promise/src/index.js b/samples/client/petstore/javascript-promise/src/index.js index c28e7c0f4e0..5e2e71cca85 100644 --- a/samples/client/petstore/javascript-promise/src/index.js +++ b/samples/client/petstore/javascript-promise/src/index.js @@ -16,12 +16,12 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['ApiClient', 'model/AdditionalPropertiesAnyType', 'model/AdditionalPropertiesArray', 'model/AdditionalPropertiesBoolean', 'model/AdditionalPropertiesClass', 'model/AdditionalPropertiesInteger', 'model/AdditionalPropertiesNumber', 'model/AdditionalPropertiesObject', 'model/AdditionalPropertiesString', 'model/Animal', 'model/ApiResponse', 'model/ArrayOfArrayOfNumberOnly', 'model/ArrayOfNumberOnly', 'model/ArrayTest', 'model/Capitalization', 'model/Cat', 'model/CatAllOf', 'model/Category', 'model/ClassModel', 'model/Client', 'model/Dog', 'model/DogAllOf', 'model/EnumArrays', 'model/EnumClass', 'model/EnumTest', 'model/File', 'model/FileSchemaTestClass', 'model/FormatTest', 'model/HasOnlyReadOnly', 'model/List', 'model/MapTest', 'model/MixedPropertiesAndAdditionalPropertiesClass', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/NumberOnly', 'model/Order', 'model/OuterComposite', 'model/OuterEnum', 'model/Pet', 'model/ReadOnlyFirst', 'model/SpecialModelName', 'model/Tag', 'model/TypeHolderDefault', 'model/TypeHolderExample', 'model/User', 'model/XmlItem', 'api/AnotherFakeApi', 'api/FakeApi', 'api/FakeClassnameTags123Api', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); + define(['ApiClient', 'model/AdditionalPropertiesAnyType', 'model/AdditionalPropertiesArray', 'model/AdditionalPropertiesBoolean', 'model/AdditionalPropertiesClass', 'model/AdditionalPropertiesInteger', 'model/AdditionalPropertiesNumber', 'model/AdditionalPropertiesObject', 'model/AdditionalPropertiesString', 'model/Animal', 'model/ApiResponse', 'model/ArrayOfArrayOfNumberOnly', 'model/ArrayOfNumberOnly', 'model/ArrayTest', 'model/BigCat', 'model/BigCatAllOf', 'model/Capitalization', 'model/Cat', 'model/CatAllOf', 'model/Category', 'model/ClassModel', 'model/Client', 'model/Dog', 'model/DogAllOf', 'model/EnumArrays', 'model/EnumClass', 'model/EnumTest', 'model/File', 'model/FileSchemaTestClass', 'model/FormatTest', 'model/HasOnlyReadOnly', 'model/List', 'model/MapTest', 'model/MixedPropertiesAndAdditionalPropertiesClass', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/NumberOnly', 'model/Order', 'model/OuterComposite', 'model/OuterEnum', 'model/Pet', 'model/ReadOnlyFirst', 'model/SpecialModelName', 'model/Tag', 'model/TypeHolderDefault', 'model/TypeHolderExample', 'model/User', 'model/XmlItem', 'api/AnotherFakeApi', 'api/FakeApi', 'api/FakeClassnameTags123Api', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('./ApiClient'), require('./model/AdditionalPropertiesAnyType'), require('./model/AdditionalPropertiesArray'), require('./model/AdditionalPropertiesBoolean'), require('./model/AdditionalPropertiesClass'), require('./model/AdditionalPropertiesInteger'), require('./model/AdditionalPropertiesNumber'), require('./model/AdditionalPropertiesObject'), require('./model/AdditionalPropertiesString'), require('./model/Animal'), require('./model/ApiResponse'), require('./model/ArrayOfArrayOfNumberOnly'), require('./model/ArrayOfNumberOnly'), require('./model/ArrayTest'), require('./model/Capitalization'), require('./model/Cat'), require('./model/CatAllOf'), require('./model/Category'), require('./model/ClassModel'), require('./model/Client'), require('./model/Dog'), require('./model/DogAllOf'), require('./model/EnumArrays'), require('./model/EnumClass'), require('./model/EnumTest'), require('./model/File'), require('./model/FileSchemaTestClass'), require('./model/FormatTest'), require('./model/HasOnlyReadOnly'), require('./model/List'), require('./model/MapTest'), require('./model/MixedPropertiesAndAdditionalPropertiesClass'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/NumberOnly'), require('./model/Order'), require('./model/OuterComposite'), require('./model/OuterEnum'), require('./model/Pet'), require('./model/ReadOnlyFirst'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/TypeHolderDefault'), require('./model/TypeHolderExample'), require('./model/User'), require('./model/XmlItem'), require('./api/AnotherFakeApi'), require('./api/FakeApi'), require('./api/FakeClassnameTags123Api'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); + module.exports = factory(require('./ApiClient'), require('./model/AdditionalPropertiesAnyType'), require('./model/AdditionalPropertiesArray'), require('./model/AdditionalPropertiesBoolean'), require('./model/AdditionalPropertiesClass'), require('./model/AdditionalPropertiesInteger'), require('./model/AdditionalPropertiesNumber'), require('./model/AdditionalPropertiesObject'), require('./model/AdditionalPropertiesString'), require('./model/Animal'), require('./model/ApiResponse'), require('./model/ArrayOfArrayOfNumberOnly'), require('./model/ArrayOfNumberOnly'), require('./model/ArrayTest'), require('./model/BigCat'), require('./model/BigCatAllOf'), require('./model/Capitalization'), require('./model/Cat'), require('./model/CatAllOf'), require('./model/Category'), require('./model/ClassModel'), require('./model/Client'), require('./model/Dog'), require('./model/DogAllOf'), require('./model/EnumArrays'), require('./model/EnumClass'), require('./model/EnumTest'), require('./model/File'), require('./model/FileSchemaTestClass'), require('./model/FormatTest'), require('./model/HasOnlyReadOnly'), require('./model/List'), require('./model/MapTest'), require('./model/MixedPropertiesAndAdditionalPropertiesClass'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/NumberOnly'), require('./model/Order'), require('./model/OuterComposite'), require('./model/OuterEnum'), require('./model/Pet'), require('./model/ReadOnlyFirst'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/TypeHolderDefault'), require('./model/TypeHolderExample'), require('./model/User'), require('./model/XmlItem'), require('./api/AnotherFakeApi'), require('./api/FakeApi'), require('./api/FakeClassnameTags123Api'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); } -}(function(ApiClient, AdditionalPropertiesAnyType, AdditionalPropertiesArray, AdditionalPropertiesBoolean, AdditionalPropertiesClass, AdditionalPropertiesInteger, AdditionalPropertiesNumber, AdditionalPropertiesObject, AdditionalPropertiesString, Animal, ApiResponse, ArrayOfArrayOfNumberOnly, ArrayOfNumberOnly, ArrayTest, Capitalization, Cat, CatAllOf, Category, ClassModel, Client, Dog, DogAllOf, EnumArrays, EnumClass, EnumTest, File, FileSchemaTestClass, FormatTest, HasOnlyReadOnly, List, MapTest, MixedPropertiesAndAdditionalPropertiesClass, Model200Response, ModelReturn, Name, NumberOnly, Order, OuterComposite, OuterEnum, Pet, ReadOnlyFirst, SpecialModelName, Tag, TypeHolderDefault, TypeHolderExample, User, XmlItem, AnotherFakeApi, FakeApi, FakeClassnameTags123Api, PetApi, StoreApi, UserApi) { +}(function(ApiClient, AdditionalPropertiesAnyType, AdditionalPropertiesArray, AdditionalPropertiesBoolean, AdditionalPropertiesClass, AdditionalPropertiesInteger, AdditionalPropertiesNumber, AdditionalPropertiesObject, AdditionalPropertiesString, Animal, ApiResponse, ArrayOfArrayOfNumberOnly, ArrayOfNumberOnly, ArrayTest, BigCat, BigCatAllOf, Capitalization, Cat, CatAllOf, Category, ClassModel, Client, Dog, DogAllOf, EnumArrays, EnumClass, EnumTest, File, FileSchemaTestClass, FormatTest, HasOnlyReadOnly, List, MapTest, MixedPropertiesAndAdditionalPropertiesClass, Model200Response, ModelReturn, Name, NumberOnly, Order, OuterComposite, OuterEnum, Pet, ReadOnlyFirst, SpecialModelName, Tag, TypeHolderDefault, TypeHolderExample, User, XmlItem, AnotherFakeApi, FakeApi, FakeClassnameTags123Api, PetApi, StoreApi, UserApi) { 'use strict'; /** @@ -126,6 +126,16 @@ * @property {module:model/ArrayTest} */ ArrayTest: ArrayTest, + /** + * The BigCat model constructor. + * @property {module:model/BigCat} + */ + BigCat: BigCat, + /** + * The BigCatAllOf model constructor. + * @property {module:model/BigCatAllOf} + */ + BigCatAllOf: BigCatAllOf, /** * The Capitalization model constructor. * @property {module:model/Capitalization} diff --git a/samples/client/petstore/javascript-promise/src/model/BigCat.js b/samples/client/petstore/javascript-promise/src/model/BigCat.js new file mode 100644 index 00000000000..160d712bd60 --- /dev/null +++ b/samples/client/petstore/javascript-promise/src/model/BigCat.js @@ -0,0 +1,137 @@ +/** + * 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 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * + * OpenAPI Generator version: 4.2.3-SNAPSHOT + * + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient', 'model/BigCatAllOf', 'model/Cat'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient'), require('./BigCatAllOf'), require('./Cat')); + } else { + // Browser globals (root is window) + if (!root.OpenApiPetstore) { + root.OpenApiPetstore = {}; + } + root.OpenApiPetstore.BigCat = factory(root.OpenApiPetstore.ApiClient, root.OpenApiPetstore.BigCatAllOf, root.OpenApiPetstore.Cat); + } +}(this, function(ApiClient, BigCatAllOf, Cat) { + 'use strict'; + + + + /** + * The BigCat model module. + * @module model/BigCat + * @version 1.0.0 + */ + + /** + * Constructs a new BigCat. + * @alias module:model/BigCat + * @class + * @extends module:model/Cat + * @implements module:model/Cat + * @implements module:model/BigCatAllOf + * @param className {String} + */ + var exports = function(className) { + var _this = this; + + Cat.call(_this, className); + }; + + /** + * Constructs a BigCat from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/BigCat} obj Optional instance to populate. + * @return {module:model/BigCat} The populated BigCat instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + Cat.constructFromObject(data, obj); + if (data.hasOwnProperty('kind')) { + obj['kind'] = ApiClient.convertToType(data['kind'], 'String'); + } + } + return obj; + } + + exports.prototype = Object.create(Cat.prototype); + exports.prototype.constructor = exports; + + /** + * @member {module:model/BigCat.KindEnum} kind + */ + exports.prototype['kind'] = undefined; + + // Implement Cat interface: + /** + * @member {String} className + */ +exports.prototype['className'] = undefined; + + /** + * @member {String} color + * @default 'red' + */ +exports.prototype['color'] = 'red'; + + /** + * @member {Boolean} declawed + */ +exports.prototype['declawed'] = undefined; + + // Implement BigCatAllOf interface: + /** + * @member {module:model/BigCatAllOf.KindEnum} kind + */ +exports.prototype['kind'] = undefined; + + + /** + * Allowed values for the kind property. + * @enum {String} + * @readonly + */ + exports.KindEnum = { + /** + * value: "lions" + * @const + */ + "lions": "lions", + /** + * value: "tigers" + * @const + */ + "tigers": "tigers", + /** + * value: "leopards" + * @const + */ + "leopards": "leopards", + /** + * value: "jaguars" + * @const + */ + "jaguars": "jaguars" }; + + + return exports; +})); + + diff --git a/samples/client/petstore/javascript-promise/src/model/BigCatAllOf.js b/samples/client/petstore/javascript-promise/src/model/BigCatAllOf.js new file mode 100644 index 00000000000..3d22270bf17 --- /dev/null +++ b/samples/client/petstore/javascript-promise/src/model/BigCatAllOf.js @@ -0,0 +1,105 @@ +/** + * 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 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * + * OpenAPI Generator version: 4.2.3-SNAPSHOT + * + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.OpenApiPetstore) { + root.OpenApiPetstore = {}; + } + root.OpenApiPetstore.BigCatAllOf = factory(root.OpenApiPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + + + /** + * The BigCatAllOf model module. + * @module model/BigCatAllOf + * @version 1.0.0 + */ + + /** + * Constructs a new BigCatAllOf. + * @alias module:model/BigCatAllOf + * @class + */ + var exports = function() { + var _this = this; + + }; + + /** + * Constructs a BigCatAllOf from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/BigCatAllOf} obj Optional instance to populate. + * @return {module:model/BigCatAllOf} The populated BigCatAllOf instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + if (data.hasOwnProperty('kind')) { + obj['kind'] = ApiClient.convertToType(data['kind'], 'String'); + } + } + return obj; + } + + /** + * @member {module:model/BigCatAllOf.KindEnum} kind + */ + exports.prototype['kind'] = undefined; + + + /** + * Allowed values for the kind property. + * @enum {String} + * @readonly + */ + exports.KindEnum = { + /** + * value: "lions" + * @const + */ + "lions": "lions", + /** + * value: "tigers" + * @const + */ + "tigers": "tigers", + /** + * value: "leopards" + * @const + */ + "leopards": "leopards", + /** + * value: "jaguars" + * @const + */ + "jaguars": "jaguars" }; + + + return exports; +})); + + diff --git a/samples/client/petstore/javascript-promise/test/model/BigCat.spec.js b/samples/client/petstore/javascript-promise/test/model/BigCat.spec.js new file mode 100644 index 00000000000..2001b0a31fc --- /dev/null +++ b/samples/client/petstore/javascript-promise/test/model/BigCat.spec.js @@ -0,0 +1,67 @@ +/** + * 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 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * + * OpenAPI Generator version: 4.2.2-SNAPSHOT + * + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.OpenApiPetstore); + } +}(this, function(expect, OpenApiPetstore) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new OpenApiPetstore.BigCat(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('BigCat', function() { + it('should create an instance of BigCat', function() { + // uncomment below and update the code to test BigCat + //var instance = new OpenApiPetstore.BigCat(); + //expect(instance).to.be.a(OpenApiPetstore.BigCat); + }); + + it('should have the property kind (base name: "kind")', function() { + // uncomment below and update the code to test the property kind + //var instance = new OpenApiPetstore.BigCat(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/samples/client/petstore/javascript-promise/test/model/BigCatAllOf.spec.js b/samples/client/petstore/javascript-promise/test/model/BigCatAllOf.spec.js new file mode 100644 index 00000000000..50d3277f5a6 --- /dev/null +++ b/samples/client/petstore/javascript-promise/test/model/BigCatAllOf.spec.js @@ -0,0 +1,67 @@ +/** + * 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 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * + * OpenAPI Generator version: 4.2.2-SNAPSHOT + * + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.OpenApiPetstore); + } +}(this, function(expect, OpenApiPetstore) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new OpenApiPetstore.BigCatAllOf(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('BigCatAllOf', function() { + it('should create an instance of BigCatAllOf', function() { + // uncomment below and update the code to test BigCatAllOf + //var instance = new OpenApiPetstore.BigCatAllOf(); + //expect(instance).to.be.a(OpenApiPetstore.BigCatAllOf); + }); + + it('should have the property kind (base name: "kind")', function() { + // uncomment below and update the code to test the property kind + //var instance = new OpenApiPetstore.BigCatAllOf(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index c11860f7675..6b9b593afa0 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -163,6 +163,8 @@ Class | Method | HTTP request | Description - [OpenApiPetstore.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [OpenApiPetstore.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [OpenApiPetstore.ArrayTest](docs/ArrayTest.md) + - [OpenApiPetstore.BigCat](docs/BigCat.md) + - [OpenApiPetstore.BigCatAllOf](docs/BigCatAllOf.md) - [OpenApiPetstore.Capitalization](docs/Capitalization.md) - [OpenApiPetstore.Cat](docs/Cat.md) - [OpenApiPetstore.CatAllOf](docs/CatAllOf.md) diff --git a/samples/client/petstore/javascript/docs/BigCat.md b/samples/client/petstore/javascript/docs/BigCat.md new file mode 100644 index 00000000000..bbd79b2ba1b --- /dev/null +++ b/samples/client/petstore/javascript/docs/BigCat.md @@ -0,0 +1,24 @@ +# OpenApiPetstore.BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **String** | | [optional] + + + +## Enum: KindEnum + + +* `lions` (value: `"lions"`) + +* `tigers` (value: `"tigers"`) + +* `leopards` (value: `"leopards"`) + +* `jaguars` (value: `"jaguars"`) + + + + diff --git a/samples/client/petstore/javascript/docs/BigCatAllOf.md b/samples/client/petstore/javascript/docs/BigCatAllOf.md new file mode 100644 index 00000000000..c5e83bfdaeb --- /dev/null +++ b/samples/client/petstore/javascript/docs/BigCatAllOf.md @@ -0,0 +1,24 @@ +# OpenApiPetstore.BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **String** | | [optional] + + + +## Enum: KindEnum + + +* `lions` (value: `"lions"`) + +* `tigers` (value: `"tigers"`) + +* `leopards` (value: `"leopards"`) + +* `jaguars` (value: `"jaguars"`) + + + + diff --git a/samples/client/petstore/javascript/src/index.js b/samples/client/petstore/javascript/src/index.js index c28e7c0f4e0..5e2e71cca85 100644 --- a/samples/client/petstore/javascript/src/index.js +++ b/samples/client/petstore/javascript/src/index.js @@ -16,12 +16,12 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['ApiClient', 'model/AdditionalPropertiesAnyType', 'model/AdditionalPropertiesArray', 'model/AdditionalPropertiesBoolean', 'model/AdditionalPropertiesClass', 'model/AdditionalPropertiesInteger', 'model/AdditionalPropertiesNumber', 'model/AdditionalPropertiesObject', 'model/AdditionalPropertiesString', 'model/Animal', 'model/ApiResponse', 'model/ArrayOfArrayOfNumberOnly', 'model/ArrayOfNumberOnly', 'model/ArrayTest', 'model/Capitalization', 'model/Cat', 'model/CatAllOf', 'model/Category', 'model/ClassModel', 'model/Client', 'model/Dog', 'model/DogAllOf', 'model/EnumArrays', 'model/EnumClass', 'model/EnumTest', 'model/File', 'model/FileSchemaTestClass', 'model/FormatTest', 'model/HasOnlyReadOnly', 'model/List', 'model/MapTest', 'model/MixedPropertiesAndAdditionalPropertiesClass', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/NumberOnly', 'model/Order', 'model/OuterComposite', 'model/OuterEnum', 'model/Pet', 'model/ReadOnlyFirst', 'model/SpecialModelName', 'model/Tag', 'model/TypeHolderDefault', 'model/TypeHolderExample', 'model/User', 'model/XmlItem', 'api/AnotherFakeApi', 'api/FakeApi', 'api/FakeClassnameTags123Api', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); + define(['ApiClient', 'model/AdditionalPropertiesAnyType', 'model/AdditionalPropertiesArray', 'model/AdditionalPropertiesBoolean', 'model/AdditionalPropertiesClass', 'model/AdditionalPropertiesInteger', 'model/AdditionalPropertiesNumber', 'model/AdditionalPropertiesObject', 'model/AdditionalPropertiesString', 'model/Animal', 'model/ApiResponse', 'model/ArrayOfArrayOfNumberOnly', 'model/ArrayOfNumberOnly', 'model/ArrayTest', 'model/BigCat', 'model/BigCatAllOf', 'model/Capitalization', 'model/Cat', 'model/CatAllOf', 'model/Category', 'model/ClassModel', 'model/Client', 'model/Dog', 'model/DogAllOf', 'model/EnumArrays', 'model/EnumClass', 'model/EnumTest', 'model/File', 'model/FileSchemaTestClass', 'model/FormatTest', 'model/HasOnlyReadOnly', 'model/List', 'model/MapTest', 'model/MixedPropertiesAndAdditionalPropertiesClass', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/NumberOnly', 'model/Order', 'model/OuterComposite', 'model/OuterEnum', 'model/Pet', 'model/ReadOnlyFirst', 'model/SpecialModelName', 'model/Tag', 'model/TypeHolderDefault', 'model/TypeHolderExample', 'model/User', 'model/XmlItem', 'api/AnotherFakeApi', 'api/FakeApi', 'api/FakeClassnameTags123Api', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('./ApiClient'), require('./model/AdditionalPropertiesAnyType'), require('./model/AdditionalPropertiesArray'), require('./model/AdditionalPropertiesBoolean'), require('./model/AdditionalPropertiesClass'), require('./model/AdditionalPropertiesInteger'), require('./model/AdditionalPropertiesNumber'), require('./model/AdditionalPropertiesObject'), require('./model/AdditionalPropertiesString'), require('./model/Animal'), require('./model/ApiResponse'), require('./model/ArrayOfArrayOfNumberOnly'), require('./model/ArrayOfNumberOnly'), require('./model/ArrayTest'), require('./model/Capitalization'), require('./model/Cat'), require('./model/CatAllOf'), require('./model/Category'), require('./model/ClassModel'), require('./model/Client'), require('./model/Dog'), require('./model/DogAllOf'), require('./model/EnumArrays'), require('./model/EnumClass'), require('./model/EnumTest'), require('./model/File'), require('./model/FileSchemaTestClass'), require('./model/FormatTest'), require('./model/HasOnlyReadOnly'), require('./model/List'), require('./model/MapTest'), require('./model/MixedPropertiesAndAdditionalPropertiesClass'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/NumberOnly'), require('./model/Order'), require('./model/OuterComposite'), require('./model/OuterEnum'), require('./model/Pet'), require('./model/ReadOnlyFirst'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/TypeHolderDefault'), require('./model/TypeHolderExample'), require('./model/User'), require('./model/XmlItem'), require('./api/AnotherFakeApi'), require('./api/FakeApi'), require('./api/FakeClassnameTags123Api'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); + module.exports = factory(require('./ApiClient'), require('./model/AdditionalPropertiesAnyType'), require('./model/AdditionalPropertiesArray'), require('./model/AdditionalPropertiesBoolean'), require('./model/AdditionalPropertiesClass'), require('./model/AdditionalPropertiesInteger'), require('./model/AdditionalPropertiesNumber'), require('./model/AdditionalPropertiesObject'), require('./model/AdditionalPropertiesString'), require('./model/Animal'), require('./model/ApiResponse'), require('./model/ArrayOfArrayOfNumberOnly'), require('./model/ArrayOfNumberOnly'), require('./model/ArrayTest'), require('./model/BigCat'), require('./model/BigCatAllOf'), require('./model/Capitalization'), require('./model/Cat'), require('./model/CatAllOf'), require('./model/Category'), require('./model/ClassModel'), require('./model/Client'), require('./model/Dog'), require('./model/DogAllOf'), require('./model/EnumArrays'), require('./model/EnumClass'), require('./model/EnumTest'), require('./model/File'), require('./model/FileSchemaTestClass'), require('./model/FormatTest'), require('./model/HasOnlyReadOnly'), require('./model/List'), require('./model/MapTest'), require('./model/MixedPropertiesAndAdditionalPropertiesClass'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/NumberOnly'), require('./model/Order'), require('./model/OuterComposite'), require('./model/OuterEnum'), require('./model/Pet'), require('./model/ReadOnlyFirst'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/TypeHolderDefault'), require('./model/TypeHolderExample'), require('./model/User'), require('./model/XmlItem'), require('./api/AnotherFakeApi'), require('./api/FakeApi'), require('./api/FakeClassnameTags123Api'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); } -}(function(ApiClient, AdditionalPropertiesAnyType, AdditionalPropertiesArray, AdditionalPropertiesBoolean, AdditionalPropertiesClass, AdditionalPropertiesInteger, AdditionalPropertiesNumber, AdditionalPropertiesObject, AdditionalPropertiesString, Animal, ApiResponse, ArrayOfArrayOfNumberOnly, ArrayOfNumberOnly, ArrayTest, Capitalization, Cat, CatAllOf, Category, ClassModel, Client, Dog, DogAllOf, EnumArrays, EnumClass, EnumTest, File, FileSchemaTestClass, FormatTest, HasOnlyReadOnly, List, MapTest, MixedPropertiesAndAdditionalPropertiesClass, Model200Response, ModelReturn, Name, NumberOnly, Order, OuterComposite, OuterEnum, Pet, ReadOnlyFirst, SpecialModelName, Tag, TypeHolderDefault, TypeHolderExample, User, XmlItem, AnotherFakeApi, FakeApi, FakeClassnameTags123Api, PetApi, StoreApi, UserApi) { +}(function(ApiClient, AdditionalPropertiesAnyType, AdditionalPropertiesArray, AdditionalPropertiesBoolean, AdditionalPropertiesClass, AdditionalPropertiesInteger, AdditionalPropertiesNumber, AdditionalPropertiesObject, AdditionalPropertiesString, Animal, ApiResponse, ArrayOfArrayOfNumberOnly, ArrayOfNumberOnly, ArrayTest, BigCat, BigCatAllOf, Capitalization, Cat, CatAllOf, Category, ClassModel, Client, Dog, DogAllOf, EnumArrays, EnumClass, EnumTest, File, FileSchemaTestClass, FormatTest, HasOnlyReadOnly, List, MapTest, MixedPropertiesAndAdditionalPropertiesClass, Model200Response, ModelReturn, Name, NumberOnly, Order, OuterComposite, OuterEnum, Pet, ReadOnlyFirst, SpecialModelName, Tag, TypeHolderDefault, TypeHolderExample, User, XmlItem, AnotherFakeApi, FakeApi, FakeClassnameTags123Api, PetApi, StoreApi, UserApi) { 'use strict'; /** @@ -126,6 +126,16 @@ * @property {module:model/ArrayTest} */ ArrayTest: ArrayTest, + /** + * The BigCat model constructor. + * @property {module:model/BigCat} + */ + BigCat: BigCat, + /** + * The BigCatAllOf model constructor. + * @property {module:model/BigCatAllOf} + */ + BigCatAllOf: BigCatAllOf, /** * The Capitalization model constructor. * @property {module:model/Capitalization} diff --git a/samples/client/petstore/javascript/src/model/BigCat.js b/samples/client/petstore/javascript/src/model/BigCat.js new file mode 100644 index 00000000000..160d712bd60 --- /dev/null +++ b/samples/client/petstore/javascript/src/model/BigCat.js @@ -0,0 +1,137 @@ +/** + * 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 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * + * OpenAPI Generator version: 4.2.3-SNAPSHOT + * + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient', 'model/BigCatAllOf', 'model/Cat'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient'), require('./BigCatAllOf'), require('./Cat')); + } else { + // Browser globals (root is window) + if (!root.OpenApiPetstore) { + root.OpenApiPetstore = {}; + } + root.OpenApiPetstore.BigCat = factory(root.OpenApiPetstore.ApiClient, root.OpenApiPetstore.BigCatAllOf, root.OpenApiPetstore.Cat); + } +}(this, function(ApiClient, BigCatAllOf, Cat) { + 'use strict'; + + + + /** + * The BigCat model module. + * @module model/BigCat + * @version 1.0.0 + */ + + /** + * Constructs a new BigCat. + * @alias module:model/BigCat + * @class + * @extends module:model/Cat + * @implements module:model/Cat + * @implements module:model/BigCatAllOf + * @param className {String} + */ + var exports = function(className) { + var _this = this; + + Cat.call(_this, className); + }; + + /** + * Constructs a BigCat from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/BigCat} obj Optional instance to populate. + * @return {module:model/BigCat} The populated BigCat instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + Cat.constructFromObject(data, obj); + if (data.hasOwnProperty('kind')) { + obj['kind'] = ApiClient.convertToType(data['kind'], 'String'); + } + } + return obj; + } + + exports.prototype = Object.create(Cat.prototype); + exports.prototype.constructor = exports; + + /** + * @member {module:model/BigCat.KindEnum} kind + */ + exports.prototype['kind'] = undefined; + + // Implement Cat interface: + /** + * @member {String} className + */ +exports.prototype['className'] = undefined; + + /** + * @member {String} color + * @default 'red' + */ +exports.prototype['color'] = 'red'; + + /** + * @member {Boolean} declawed + */ +exports.prototype['declawed'] = undefined; + + // Implement BigCatAllOf interface: + /** + * @member {module:model/BigCatAllOf.KindEnum} kind + */ +exports.prototype['kind'] = undefined; + + + /** + * Allowed values for the kind property. + * @enum {String} + * @readonly + */ + exports.KindEnum = { + /** + * value: "lions" + * @const + */ + "lions": "lions", + /** + * value: "tigers" + * @const + */ + "tigers": "tigers", + /** + * value: "leopards" + * @const + */ + "leopards": "leopards", + /** + * value: "jaguars" + * @const + */ + "jaguars": "jaguars" }; + + + return exports; +})); + + diff --git a/samples/client/petstore/javascript/src/model/BigCatAllOf.js b/samples/client/petstore/javascript/src/model/BigCatAllOf.js new file mode 100644 index 00000000000..3d22270bf17 --- /dev/null +++ b/samples/client/petstore/javascript/src/model/BigCatAllOf.js @@ -0,0 +1,105 @@ +/** + * 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 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * + * OpenAPI Generator version: 4.2.3-SNAPSHOT + * + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.OpenApiPetstore) { + root.OpenApiPetstore = {}; + } + root.OpenApiPetstore.BigCatAllOf = factory(root.OpenApiPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + + + /** + * The BigCatAllOf model module. + * @module model/BigCatAllOf + * @version 1.0.0 + */ + + /** + * Constructs a new BigCatAllOf. + * @alias module:model/BigCatAllOf + * @class + */ + var exports = function() { + var _this = this; + + }; + + /** + * Constructs a BigCatAllOf from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/BigCatAllOf} obj Optional instance to populate. + * @return {module:model/BigCatAllOf} The populated BigCatAllOf instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + if (data.hasOwnProperty('kind')) { + obj['kind'] = ApiClient.convertToType(data['kind'], 'String'); + } + } + return obj; + } + + /** + * @member {module:model/BigCatAllOf.KindEnum} kind + */ + exports.prototype['kind'] = undefined; + + + /** + * Allowed values for the kind property. + * @enum {String} + * @readonly + */ + exports.KindEnum = { + /** + * value: "lions" + * @const + */ + "lions": "lions", + /** + * value: "tigers" + * @const + */ + "tigers": "tigers", + /** + * value: "leopards" + * @const + */ + "leopards": "leopards", + /** + * value: "jaguars" + * @const + */ + "jaguars": "jaguars" }; + + + return exports; +})); + + diff --git a/samples/client/petstore/javascript/test/model/BigCat.spec.js b/samples/client/petstore/javascript/test/model/BigCat.spec.js new file mode 100644 index 00000000000..2001b0a31fc --- /dev/null +++ b/samples/client/petstore/javascript/test/model/BigCat.spec.js @@ -0,0 +1,67 @@ +/** + * 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 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * + * OpenAPI Generator version: 4.2.2-SNAPSHOT + * + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.OpenApiPetstore); + } +}(this, function(expect, OpenApiPetstore) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new OpenApiPetstore.BigCat(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('BigCat', function() { + it('should create an instance of BigCat', function() { + // uncomment below and update the code to test BigCat + //var instance = new OpenApiPetstore.BigCat(); + //expect(instance).to.be.a(OpenApiPetstore.BigCat); + }); + + it('should have the property kind (base name: "kind")', function() { + // uncomment below and update the code to test the property kind + //var instance = new OpenApiPetstore.BigCat(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/samples/client/petstore/javascript/test/model/BigCatAllOf.spec.js b/samples/client/petstore/javascript/test/model/BigCatAllOf.spec.js new file mode 100644 index 00000000000..50d3277f5a6 --- /dev/null +++ b/samples/client/petstore/javascript/test/model/BigCatAllOf.spec.js @@ -0,0 +1,67 @@ +/** + * 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 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * + * OpenAPI Generator version: 4.2.2-SNAPSHOT + * + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.OpenApiPetstore); + } +}(this, function(expect, OpenApiPetstore) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new OpenApiPetstore.BigCatAllOf(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('BigCatAllOf', function() { + it('should create an instance of BigCatAllOf', function() { + // uncomment below and update the code to test BigCatAllOf + //var instance = new OpenApiPetstore.BigCatAllOf(); + //expect(instance).to.be.a(OpenApiPetstore.BigCatAllOf); + }); + + it('should have the property kind (base name: "kind")', function() { + // uncomment below and update the code to test the property kind + //var instance = new OpenApiPetstore.BigCatAllOf(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/samples/client/petstore/kotlin-uppercase-enum/.openapi-generator-ignore b/samples/client/petstore/kotlin-uppercase-enum/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/kotlin-uppercase-enum/.openapi-generator/VERSION b/samples/client/petstore/kotlin-uppercase-enum/.openapi-generator/VERSION new file mode 100644 index 00000000000..58592f031f6 --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/kotlin-uppercase-enum/README.md b/samples/client/petstore/kotlin-uppercase-enum/README.md new file mode 100644 index 00000000000..9d5f9e7e33e --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/README.md @@ -0,0 +1,50 @@ +# org.openapitools.client - Kotlin client library for OpenAPI Petstore + +## Requires + +* Kotlin 1.3.41 +* Gradle 4.9 + +## Build + +First, create the gradle wrapper script: + +``` +gradle wrapper +``` + +Then, run: + +``` +./gradlew check assemble +``` + +This runs all tests and packages the library. + +## Features/Implementation Notes + +* Supports JSON inputs/outputs, File inputs, and Form inputs. +* Supports collection formats for query parameters: csv, tsv, ssv, pipes. +* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions. +* Implementation of ApiClient is intended to reduce method counts, specifically to benefit Android targets. + + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*EnumApi* | [**getEnum**](docs/EnumApi.md#getenum) | **GET** /enum | Get enums + + + +## Documentation for Models + + - [org.openapitools.client.models.PetEnum](docs/PetEnum.md) + + + +## Documentation for Authorization + +All endpoints do not require authorization. diff --git a/samples/client/petstore/kotlin-uppercase-enum/build.gradle b/samples/client/petstore/kotlin-uppercase-enum/build.gradle new file mode 100644 index 00000000000..ed72aa19d9e --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/build.gradle @@ -0,0 +1,37 @@ +group 'org.openapitools' +version '1.0.0' + +wrapper { + gradleVersion = '4.9' + distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" +} + +buildscript { + ext.kotlin_version = '1.3.61' + + repositories { + mavenCentral() + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +apply plugin: 'kotlin' + +repositories { + mavenCentral() +} + +test { + useJUnitPlatform() +} + +dependencies { + compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + compile "com.squareup.moshi:moshi-kotlin:1.9.2" + compile "com.squareup.moshi:moshi-adapters:1.9.2" + compile "com.squareup.okhttp3:okhttp:4.2.2" + testCompile "io.kotlintest:kotlintest-runner-junit5:3.1.0" +} diff --git a/samples/client/petstore/kotlin-uppercase-enum/docs/EnumApi.md b/samples/client/petstore/kotlin-uppercase-enum/docs/EnumApi.md new file mode 100644 index 00000000000..7eaa182a4a5 --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/docs/EnumApi.md @@ -0,0 +1,50 @@ +# EnumApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**getEnum**](EnumApi.md#getEnum) | **GET** /enum | Get enums + + + +# **getEnum** +> PetEnum getEnum() + +Get enums + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = EnumApi() +try { + val result : PetEnum = apiInstance.getEnum() + println(result) +} catch (e: ClientException) { + println("4xx response calling EnumApi#getEnum") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling EnumApi#getEnum") + e.printStackTrace() +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**PetEnum**](PetEnum.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + diff --git a/samples/client/petstore/kotlin-uppercase-enum/docs/PetEnum.md b/samples/client/petstore/kotlin-uppercase-enum/docs/PetEnum.md new file mode 100644 index 00000000000..d970c3dd862 --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/docs/PetEnum.md @@ -0,0 +1,12 @@ + +# PetEnum + +## Enum + + + * `MY_FIRST_VALUE` (value: `"myFirstValue"`) + + * `MY_SECOND_VALUE` (value: `"MY_SECOND_VALUE"`) + + + diff --git a/samples/client/petstore/kotlin-uppercase-enum/settings.gradle b/samples/client/petstore/kotlin-uppercase-enum/settings.gradle new file mode 100644 index 00000000000..cc08df3bfdc --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/settings.gradle @@ -0,0 +1,2 @@ + +rootProject.name = 'kotlin-uppercase-enum' \ No newline at end of file diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/apis/EnumApi.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/apis/EnumApi.kt new file mode 100644 index 00000000000..8ed4de2768f --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/apis/EnumApi.kt @@ -0,0 +1,70 @@ +/** +* OpenAPI Petstore +* Test for issue 4062 +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.client.apis + +import org.openapitools.client.models.PetEnum + +import org.openapitools.client.infrastructure.ApiClient +import org.openapitools.client.infrastructure.ClientException +import org.openapitools.client.infrastructure.ClientError +import org.openapitools.client.infrastructure.ServerException +import org.openapitools.client.infrastructure.ServerError +import org.openapitools.client.infrastructure.MultiValueMap +import org.openapitools.client.infrastructure.RequestConfig +import org.openapitools.client.infrastructure.RequestMethod +import org.openapitools.client.infrastructure.ResponseType +import org.openapitools.client.infrastructure.Success +import org.openapitools.client.infrastructure.toMultiValue + +class EnumApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiClient(basePath) { + + /** + * Get enums + * + * @return PetEnum + * @throws UnsupportedOperationException If the API returns an informational or redirection response + * @throws ClientException If the API returns a client error response + * @throws ServerException If the API returns a server error response + */ + @Suppress("UNCHECKED_CAST") + @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class) + fun getEnum() : PetEnum { + val localVariableBody: kotlin.Any? = null + val localVariableQuery: MultiValueMap = mutableMapOf() + val localVariableHeaders: MutableMap = mutableMapOf() + val localVariableConfig = RequestConfig( + RequestMethod.GET, + "/enum", + query = localVariableQuery, + headers = localVariableHeaders + ) + val localVarResponse = request( + localVariableConfig, + localVariableBody + ) + + return when (localVarResponse.responseType) { + ResponseType.Success -> (localVarResponse as Success<*>).data as PetEnum + ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.") + ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.") + ResponseType.ClientError -> { + val localVarError = localVarResponse as ClientError<*> + throw ClientException(localVarError.body as? String ?: "Client error", localVarError.statusCode) + } + ResponseType.ServerError -> { + val localVarError = localVarResponse as ServerError<*> + throw ServerException(localVarError.message ?: "Server error", localVarError.statusCode) + } + } + } + +} diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt new file mode 100644 index 00000000000..ef7a8f1e1a6 --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -0,0 +1,23 @@ +package org.openapitools.client.infrastructure + +typealias MultiValueMap = MutableMap> + +fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { + "csv" -> "," + "tsv" -> "\t" + "pipe" -> "|" + "space" -> " " + else -> "" +} + +val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } + +fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) + = toMultiValue(items.asIterable(), collectionFormat, map) + +fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { + return when(collectionFormat) { + "multi" -> items.map(map) + else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt new file mode 100644 index 00000000000..d1d58ffd0e9 --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -0,0 +1,158 @@ +package org.openapitools.client.infrastructure + +import okhttp3.Credentials +import okhttp3.OkHttpClient +import okhttp3.RequestBody +import okhttp3.RequestBody.Companion.asRequestBody +import okhttp3.RequestBody.Companion.toRequestBody +import okhttp3.FormBody +import okhttp3.HttpUrl.Companion.toHttpUrlOrNull +import okhttp3.ResponseBody +import okhttp3.MediaType.Companion.toMediaTypeOrNull +import okhttp3.Request +import java.io.File + +open class ApiClient(val baseUrl: String) { + companion object { + protected const val ContentType = "Content-Type" + protected const val Accept = "Accept" + protected const val Authorization = "Authorization" + protected const val JsonMediaType = "application/json" + protected const val FormDataMediaType = "multipart/form-data" + protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded" + protected const val XmlMediaType = "application/xml" + + val apiKey: MutableMap = mutableMapOf() + val apiKeyPrefix: MutableMap = mutableMapOf() + var username: String? = null + var password: String? = null + var accessToken: String? = null + + @JvmStatic + val client: OkHttpClient by lazy { + builder.build() + } + + @JvmStatic + val builder: OkHttpClient.Builder = OkHttpClient.Builder() + } + + protected inline fun requestBody(content: T, mediaType: String = JsonMediaType): RequestBody = + when { + content is File -> content.asRequestBody( + mediaType.toMediaTypeOrNull() + ) + mediaType == FormDataMediaType || mediaType == FormUrlEncMediaType -> { + FormBody.Builder().apply { + // content's type *must* be Map + @Suppress("UNCHECKED_CAST") + (content as Map).forEach { (key, value) -> + add(key, value) + } + }.build() + } + mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody( + mediaType.toMediaTypeOrNull() + ) + mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.") + // TODO: this should be extended with other serializers + else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.") + } + + protected inline fun responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { + if(body == null) { + return null + } + val bodyContent = body.string() + if (bodyContent.isEmpty()) { + return null + } + return when(mediaType) { + JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent) + else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") + } + } + + + protected inline fun request(requestConfig: RequestConfig, body : Any? = null): ApiInfrastructureResponse { + val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.") + + val url = httpUrl.newBuilder() + .addPathSegments(requestConfig.path.trimStart('/')) + .apply { + requestConfig.query.forEach { query -> + query.value.forEach { queryValue -> + addQueryParameter(query.key, queryValue) + } + } + }.build() + + // take content-type/accept from spec or set to default (application/json) if not defined + if (requestConfig.headers[ContentType].isNullOrEmpty()) { + requestConfig.headers[ContentType] = JsonMediaType + } + if (requestConfig.headers[Accept].isNullOrEmpty()) { + requestConfig.headers[Accept] = JsonMediaType + } + val headers = requestConfig.headers + + if(headers[ContentType] ?: "" == "") { + throw kotlin.IllegalStateException("Missing Content-Type header. This is required.") + } + + if(headers[Accept] ?: "" == "") { + throw kotlin.IllegalStateException("Missing Accept header. This is required.") + } + + // TODO: support multiple contentType options here. + val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase() + + val request = when (requestConfig.method) { + RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(body, contentType)) + RequestMethod.GET -> Request.Builder().url(url) + RequestMethod.HEAD -> Request.Builder().url(url).head() + RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(body, contentType)) + RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(body, contentType)) + RequestMethod.POST -> Request.Builder().url(url).post(requestBody(body, contentType)) + RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null) + }.apply { + headers.forEach { header -> addHeader(header.key, header.value) } + }.build() + + val response = client.newCall(request).execute() + val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase() + + // TODO: handle specific mapping types. e.g. Map> + when { + response.isRedirect -> return Redirection( + response.code, + response.headers.toMultimap() + ) + response.isInformational -> return Informational( + response.message, + response.code, + response.headers.toMultimap() + ) + response.isSuccessful -> return Success( + responseBody(response.body, accept), + response.code, + response.headers.toMultimap() + ) + response.isClientError -> return ClientError( + response.body?.string(), + response.code, + response.headers.toMultimap() + ) + else -> return ServerError( + null, + response.body?.string(), + response.code, + response.headers.toMultimap() + ) + } + } + + protected inline fun parseDateToQueryString(value : T): String { + return value.toString() + } +} diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt new file mode 100644 index 00000000000..f1a8aecc914 --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt @@ -0,0 +1,40 @@ +package org.openapitools.client.infrastructure + +enum class ResponseType { + Success, Informational, Redirection, ClientError, ServerError +} + +abstract class ApiInfrastructureResponse(val responseType: ResponseType) { + abstract val statusCode: Int + abstract val headers: Map> +} + +class Success( + val data: T, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +): ApiInfrastructureResponse(ResponseType.Success) + +class Informational( + val statusText: String, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiInfrastructureResponse(ResponseType.Informational) + +class Redirection( + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiInfrastructureResponse(ResponseType.Redirection) + +class ClientError( + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> = mapOf() +) : ApiInfrastructureResponse(ResponseType.ClientError) + +class ServerError( + val message: String? = null, + val body: Any? = null, + override val statusCode: Int = -1, + override val headers: Map> +): ApiInfrastructureResponse(ResponseType.ServerError) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt new file mode 100644 index 00000000000..dd34bd48b2c --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ApplicationDelegates.kt @@ -0,0 +1,29 @@ +package org.openapitools.client.infrastructure + +import kotlin.properties.ReadWriteProperty +import kotlin.reflect.KProperty + +object ApplicationDelegates { + /** + * Provides a property delegate, allowing the property to be set once and only once. + * + * If unset (no default value), a get on the property will throw [IllegalStateException]. + */ + fun setOnce(defaultValue: T? = null) : ReadWriteProperty = SetOnce(defaultValue) + + private class SetOnce(defaultValue: T? = null) : ReadWriteProperty { + private var isSet = false + private var value: T? = defaultValue + + override fun getValue(thisRef: Any?, property: KProperty<*>): T { + return value ?: throw IllegalStateException("${property.name} not initialized") + } + + override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) { + if (!isSet) { + this.value = value + isSet = true + } + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt new file mode 100644 index 00000000000..ff5e2a81ee8 --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ByteArrayAdapter.kt @@ -0,0 +1,12 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson + +class ByteArrayAdapter { + @ToJson + fun toJson(data: ByteArray): String = String(data) + + @FromJson + fun fromJson(data: String): ByteArray = data.toByteArray() +} diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt new file mode 100644 index 00000000000..41f529a5f36 --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/Errors.kt @@ -0,0 +1,18 @@ +@file:Suppress("unused") +package org.openapitools.client.infrastructure + +import java.lang.RuntimeException + +open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1) : RuntimeException(message) { + + companion object { + private const val serialVersionUID: Long = 123L + } +} + +open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1) : RuntimeException(message) { + + companion object { + private const val serialVersionUID: Long = 456L + } +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt new file mode 100644 index 00000000000..b2e1654479a --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateAdapter.kt @@ -0,0 +1,19 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.time.LocalDate +import java.time.format.DateTimeFormatter + +class LocalDateAdapter { + @ToJson + fun toJson(value: LocalDate): String { + return DateTimeFormatter.ISO_LOCAL_DATE.format(value) + } + + @FromJson + fun fromJson(value: String): LocalDate { + return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE) + } + +} diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt new file mode 100644 index 00000000000..e082db94811 --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt @@ -0,0 +1,19 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.time.LocalDateTime +import java.time.format.DateTimeFormatter + +class LocalDateTimeAdapter { + @ToJson + fun toJson(value: LocalDateTime): String { + return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value) + } + + @FromJson + fun fromJson(value: String): LocalDateTime { + return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME) + } + +} diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt new file mode 100644 index 00000000000..87437871a31 --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt @@ -0,0 +1,19 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter + +class OffsetDateTimeAdapter { + @ToJson + fun toJson(value: OffsetDateTime): String { + return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value) + } + + @FromJson + fun fromJson(value: String): OffsetDateTime { + return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME) + } + +} diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt new file mode 100644 index 00000000000..9c22257e223 --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -0,0 +1,16 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given request. + * NOTE: This object doesn't include 'body' because it + * allows for caching of the constructed object + * for many request definitions. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class RequestConfig( + val method: RequestMethod, + val path: String, + val headers: MutableMap = mutableMapOf(), + val query: MutableMap> = mutableMapOf() +) \ No newline at end of file diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt new file mode 100644 index 00000000000..931b12b8bd7 --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt @@ -0,0 +1,8 @@ +package org.openapitools.client.infrastructure + +/** + * Provides enumerated HTTP verbs + */ +enum class RequestMethod { + GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT +} \ No newline at end of file diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt new file mode 100644 index 00000000000..69b562becb0 --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/ResponseExtensions.kt @@ -0,0 +1,23 @@ +package org.openapitools.client.infrastructure + +import okhttp3.Response + +/** + * Provides an extension to evaluation whether the response is a 1xx code + */ +val Response.isInformational : Boolean get() = this.code in 100..199 + +/** + * Provides an extension to evaluation whether the response is a 3xx code + */ +val Response.isRedirect : Boolean get() = this.code in 300..399 + +/** + * Provides an extension to evaluation whether the response is a 4xx code + */ +val Response.isClientError : Boolean get() = this.code in 400..499 + +/** + * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code + */ +val Response.isServerError : Boolean get() = this.code in 500..999 diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt new file mode 100644 index 00000000000..697559b2ec1 --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -0,0 +1,23 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.Moshi +import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter +import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory +import java.util.Date + +object Serializer { + @JvmStatic + val moshiBuilder: Moshi.Builder = Moshi.Builder() + .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe()) + .add(OffsetDateTimeAdapter()) + .add(LocalDateTimeAdapter()) + .add(LocalDateAdapter()) + .add(UUIDAdapter()) + .add(ByteArrayAdapter()) + .add(KotlinJsonAdapterFactory()) + + @JvmStatic + val moshi: Moshi by lazy { + moshiBuilder.build() + } +} diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt new file mode 100644 index 00000000000..a4a44cc18b7 --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/infrastructure/UUIDAdapter.kt @@ -0,0 +1,13 @@ +package org.openapitools.client.infrastructure + +import com.squareup.moshi.FromJson +import com.squareup.moshi.ToJson +import java.util.UUID + +class UUIDAdapter { + @ToJson + fun toJson(uuid: UUID) = uuid.toString() + + @FromJson + fun fromJson(s: String) = UUID.fromString(s) +} diff --git a/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/models/PetEnum.kt b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/models/PetEnum.kt new file mode 100644 index 00000000000..14d9c16c408 --- /dev/null +++ b/samples/client/petstore/kotlin-uppercase-enum/src/main/kotlin/org/openapitools/client/models/PetEnum.kt @@ -0,0 +1,35 @@ +/** +* OpenAPI Petstore +* Test for issue 4062 +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +package org.openapitools.client.models + + +import com.squareup.moshi.Json + +/** +* An enum with complex-ish naming +* Values: MY_FIRST_VALUE,MY_SECOND_VALUE +*/ + +enum class PetEnum(val value: kotlin.String){ + + + @Json(name = "myFirstValue") + MY_FIRST_VALUE("myFirstValue"), + + + @Json(name = "MY_SECOND_VALUE") + MY_SECOND_VALUE("MY_SECOND_VALUE"); + + + +} + diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index 6f5090566a9..c3c9c8ab683 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -245,6 +245,8 @@ use WWW::OpenAPIClient::Object::ApiResponse; use WWW::OpenAPIClient::Object::ArrayOfArrayOfNumberOnly; use WWW::OpenAPIClient::Object::ArrayOfNumberOnly; use WWW::OpenAPIClient::Object::ArrayTest; +use WWW::OpenAPIClient::Object::BigCat; +use WWW::OpenAPIClient::Object::BigCatAllOf; use WWW::OpenAPIClient::Object::Capitalization; use WWW::OpenAPIClient::Object::Cat; use WWW::OpenAPIClient::Object::CatAllOf; @@ -310,6 +312,8 @@ use WWW::OpenAPIClient::Object::ApiResponse; use WWW::OpenAPIClient::Object::ArrayOfArrayOfNumberOnly; use WWW::OpenAPIClient::Object::ArrayOfNumberOnly; use WWW::OpenAPIClient::Object::ArrayTest; +use WWW::OpenAPIClient::Object::BigCat; +use WWW::OpenAPIClient::Object::BigCatAllOf; use WWW::OpenAPIClient::Object::Capitalization; use WWW::OpenAPIClient::Object::Cat; use WWW::OpenAPIClient::Object::CatAllOf; @@ -422,6 +426,8 @@ Class | Method | HTTP request | Description - [WWW::OpenAPIClient::Object::ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [WWW::OpenAPIClient::Object::ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [WWW::OpenAPIClient::Object::ArrayTest](docs/ArrayTest.md) + - [WWW::OpenAPIClient::Object::BigCat](docs/BigCat.md) + - [WWW::OpenAPIClient::Object::BigCatAllOf](docs/BigCatAllOf.md) - [WWW::OpenAPIClient::Object::Capitalization](docs/Capitalization.md) - [WWW::OpenAPIClient::Object::Cat](docs/Cat.md) - [WWW::OpenAPIClient::Object::CatAllOf](docs/CatAllOf.md) diff --git a/samples/client/petstore/perl/docs/BigCat.md b/samples/client/petstore/perl/docs/BigCat.md new file mode 100644 index 00000000000..131eb61c20b --- /dev/null +++ b/samples/client/petstore/perl/docs/BigCat.md @@ -0,0 +1,15 @@ +# WWW::OpenAPIClient::Object::BigCat + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::BigCat; +``` + +## 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/perl/docs/BigCatAllOf.md b/samples/client/petstore/perl/docs/BigCatAllOf.md new file mode 100644 index 00000000000..d6561af7868 --- /dev/null +++ b/samples/client/petstore/perl/docs/BigCatAllOf.md @@ -0,0 +1,15 @@ +# WWW::OpenAPIClient::Object::BigCatAllOf + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::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/perl/lib/WWW/OpenAPIClient/Object/BigCat.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/BigCat.pm new file mode 100644 index 00000000000..f1cebb8ec7b --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/BigCat.pm @@ -0,0 +1,198 @@ +=begin comment + +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://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::BigCat; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use WWW::OpenAPIClient::Object::BigCatAllOf; +use WWW::OpenAPIClient::Object::Cat; + +use base ("Class::Accessor", "Class::Data::Inheritable", "WWW::OpenAPIClient::Object::Cat"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +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://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } + + # initialize parent object Cat + $self->WWW::OpenAPIClient::Object::Cat::init(%args); +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + # call Cat to_hash and then combine hash + $_hash = { %$_hash, %$self->WWW::OpenAPIClient::Object::Cat::to_hash }; + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + # combine parent (Cat) TO_JSON + $_data = { %$_data, %$self->WWW::OpenAPIClient::Object::Cat::TO_JSON }; + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + # call parent (Cat) from_hash + $self->WWW::OpenAPIClient::Object::Cat::from_hash($hash); + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'BigCat', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'kind' => { + datatype => 'string', + base_name => 'kind', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->openapi_types( { + 'kind' => 'string' +} ); + +__PACKAGE__->attribute_map( { + 'kind' => 'kind' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/BigCatAllOf.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/BigCatAllOf.pm new file mode 100644 index 00000000000..8a36a3e02f6 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/BigCatAllOf.pm @@ -0,0 +1,184 @@ +=begin comment + +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://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::BigCatAllOf; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +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://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'BigCatAllOf', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'kind' => { + datatype => 'string', + base_name => 'kind', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->openapi_types( { + 'kind' => 'string' +} ); + +__PACKAGE__->attribute_map( { + 'kind' => 'kind' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/t/BigCatAllOfTest.t b/samples/client/petstore/perl/t/BigCatAllOfTest.t new file mode 100644 index 00000000000..5708cbf3346 --- /dev/null +++ b/samples/client/petstore/perl/t/BigCatAllOfTest.t @@ -0,0 +1,33 @@ +=begin comment + +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://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::BigCatAllOf'); + +my $instance = WWW::OpenAPIClient::Object::BigCatAllOf->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::BigCatAllOf'); + diff --git a/samples/client/petstore/perl/t/BigCatTest.t b/samples/client/petstore/perl/t/BigCatTest.t new file mode 100644 index 00000000000..b1d4d7966bf --- /dev/null +++ b/samples/client/petstore/perl/t/BigCatTest.t @@ -0,0 +1,33 @@ +=begin comment + +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://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::BigCat'); + +my $instance = WWW::OpenAPIClient::Object::BigCat->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::BigCat'); + diff --git a/samples/client/petstore/php/OpenAPIClient-php/README.md b/samples/client/petstore/php/OpenAPIClient-php/README.md index f84c670fa30..87ba21d247f 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/README.md +++ b/samples/client/petstore/php/OpenAPIClient-php/README.md @@ -137,6 +137,8 @@ Class | Method | HTTP request | Description - [ArrayOfArrayOfNumberOnly](docs/Model/ArrayOfArrayOfNumberOnly.md) - [ArrayOfNumberOnly](docs/Model/ArrayOfNumberOnly.md) - [ArrayTest](docs/Model/ArrayTest.md) + - [BigCat](docs/Model/BigCat.md) + - [BigCatAllOf](docs/Model/BigCatAllOf.md) - [Capitalization](docs/Model/Capitalization.md) - [Cat](docs/Model/Cat.md) - [CatAllOf](docs/Model/CatAllOf.md) diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Model/BigCat.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/BigCat.md new file mode 100644 index 00000000000..8aa1c543ea3 --- /dev/null +++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/BigCat.md @@ -0,0 +1,11 @@ +# # BigCat + +## 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/php/OpenAPIClient-php/docs/Model/BigCatAllOf.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/BigCatAllOf.md new file mode 100644 index 00000000000..7241eb08435 --- /dev/null +++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/BigCatAllOf.md @@ -0,0 +1,11 @@ +# # 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/php/OpenAPIClient-php/lib/Model/BigCat.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/BigCat.php new file mode 100644 index 00000000000..3ea2a571c5f --- /dev/null +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/BigCat.php @@ -0,0 +1,337 @@ + 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'kind' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes + parent::openAPITypes(); + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats + parent::openAPIFormats(); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'kind' => 'kind' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'kind' => 'setKind' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'kind' => 'getKind' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return parent::attributeMap() + self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return parent::setters() + self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return parent::getters() + self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + const KIND_LIONS = 'lions'; + const KIND_TIGERS = 'tigers'; + const KIND_LEOPARDS = 'leopards'; + const KIND_JAGUARS = 'jaguars'; + + + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getKindAllowableValues() + { + return [ + self::KIND_LIONS, + self::KIND_TIGERS, + self::KIND_LEOPARDS, + self::KIND_JAGUARS, + ]; + } + + + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + parent::__construct($data); + + $this->container['kind'] = isset($data['kind']) ? $data['kind'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = parent::listInvalidProperties(); + + $allowedValues = $this->getKindAllowableValues(); + if (!is_null($this->container['kind']) && !in_array($this->container['kind'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'kind', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets kind + * + * @return string|null + */ + public function getKind() + { + return $this->container['kind']; + } + + /** + * Sets kind + * + * @param string|null $kind kind + * + * @return $this + */ + public function setKind($kind) + { + $allowedValues = $this->getKindAllowableValues(); + if (!is_null($kind) && !in_array($kind, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'kind', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['kind'] = $kind; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/BigCatAllOf.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/BigCatAllOf.php new file mode 100644 index 00000000000..20bed1d2362 --- /dev/null +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/BigCatAllOf.php @@ -0,0 +1,343 @@ + 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'kind' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'kind' => 'kind' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'kind' => 'setKind' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'kind' => 'getKind' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + const KIND_LIONS = 'lions'; + const KIND_TIGERS = 'tigers'; + const KIND_LEOPARDS = 'leopards'; + const KIND_JAGUARS = 'jaguars'; + + + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getKindAllowableValues() + { + return [ + self::KIND_LIONS, + self::KIND_TIGERS, + self::KIND_LEOPARDS, + self::KIND_JAGUARS, + ]; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['kind'] = isset($data['kind']) ? $data['kind'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getKindAllowableValues(); + if (!is_null($this->container['kind']) && !in_array($this->container['kind'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value for 'kind', must be one of '%s'", + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets kind + * + * @return string|null + */ + public function getKind() + { + return $this->container['kind']; + } + + /** + * Sets kind + * + * @param string|null $kind kind + * + * @return $this + */ + public function setKind($kind) + { + $allowedValues = $this->getKindAllowableValues(); + if (!is_null($kind) && !in_array($kind, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'kind', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['kind'] = $kind; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/samples/client/petstore/php/OpenAPIClient-php/test/Model/BigCatAllOfTest.php b/samples/client/petstore/php/OpenAPIClient-php/test/Model/BigCatAllOfTest.php new file mode 100644 index 00000000000..791dcecd5d4 --- /dev/null +++ b/samples/client/petstore/php/OpenAPIClient-php/test/Model/BigCatAllOfTest.php @@ -0,0 +1,87 @@ +=3.6.0 -pytest-cov>=2.6.1 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +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 diff --git a/samples/client/petstore/python-asyncio/test/test_big_cat.py b/samples/client/petstore/python-asyncio/test/test_big_cat.py new file mode 100644 index 00000000000..be428433ad4 --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_big_cat.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + 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: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.big_cat import BigCat # noqa: E501 +from petstore_api.rest import ApiException + + +class TestBigCat(unittest.TestCase): + """BigCat unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testBigCat(self): + """Test BigCat""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.big_cat.BigCat() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test/test_big_cat_all_of.py b/samples/client/petstore/python-asyncio/test/test_big_cat_all_of.py new file mode 100644 index 00000000000..c0e71dbfcde --- /dev/null +++ b/samples/client/petstore/python-asyncio/test/test_big_cat_all_of.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + 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: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.big_cat_all_of import BigCatAllOf # noqa: E501 +from petstore_api.rest import ApiException + + +class TestBigCatAllOf(unittest.TestCase): + """BigCatAllOf unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testBigCatAllOf(self): + """Test BigCatAllOf""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.big_cat_all_of.BigCatAllOf() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-asyncio/test_python3.sh b/samples/client/petstore/python-asyncio/test_python3.sh index 9160e25714a..1a8e712f73c 100755 --- a/samples/client/petstore/python-asyncio/test_python3.sh +++ b/samples/client/petstore/python-asyncio/test_python3.sh @@ -18,7 +18,6 @@ fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -python setup.py develop ### run tests tox || exit 1 diff --git a/samples/client/petstore/python-asyncio/tox.ini b/samples/client/petstore/python-asyncio/tox.ini index 65f5351ddcc..8989fc3c4d9 100644 --- a/samples/client/petstore/python-asyncio/tox.ini +++ b/samples/client/petstore/python-asyncio/tox.ini @@ -6,4 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - pytest -v --cov petstore_api + pytest --cov=petstore_api diff --git a/samples/client/petstore/python-experimental/.gitignore b/samples/client/petstore/python-experimental/.gitignore index a655050c263..43995bd42fa 100644 --- a/samples/client/petstore/python-experimental/.gitignore +++ b/samples/client/petstore/python-experimental/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/client/petstore/python-experimental/dev-requirements.txt b/samples/client/petstore/python-experimental/dev-requirements.txt index f50c13b5c50..ccdfca62949 100644 --- a/samples/client/petstore/python-experimental/dev-requirements.txt +++ b/samples/client/petstore/python-experimental/dev-requirements.txt @@ -1,5 +1,2 @@ -nose tox -coverage -randomize flake8 diff --git a/samples/client/petstore/python-experimental/pom.xml b/samples/client/petstore/python-experimental/pom.xml index 3c946333186..742451c23b2 100644 --- a/samples/client/petstore/python-experimental/pom.xml +++ b/samples/client/petstore/python-experimental/pom.xml @@ -27,7 +27,7 @@ 1.2.1 - nose-test + test integration-test exec diff --git a/samples/client/petstore/python-experimental/setup.cfg b/samples/client/petstore/python-experimental/setup.cfg index 26b7a359d58..11433ee875a 100644 --- a/samples/client/petstore/python-experimental/setup.cfg +++ b/samples/client/petstore/python-experimental/setup.cfg @@ -1,11 +1,2 @@ -[nosetests] -logging-clear-handlers=true -verbosity=2 -randomize=true -exe=true -with-coverage=true -cover-package=petstore_api -cover-erase=true - [flake8] max-line-length=99 diff --git a/samples/client/petstore/python-experimental/test-requirements.txt b/samples/client/petstore/python-experimental/test-requirements.txt index 5816b874953..06f7754d204 100644 --- a/samples/client/petstore/python-experimental/test-requirements.txt +++ b/samples/client/petstore/python-experimental/test-requirements.txt @@ -1,7 +1,4 @@ -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 -mock; python_version<="2.7" - +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 +mock; python_version<="2.7" \ No newline at end of file diff --git a/samples/client/petstore/python-experimental/test_python2.sh b/samples/client/petstore/python-experimental/test_python2.sh index 35de07deec7..b2f344ec897 100644 --- a/samples/client/petstore/python-experimental/test_python2.sh +++ b/samples/client/petstore/python-experimental/test_python2.sh @@ -19,11 +19,9 @@ fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -pip install -r test-requirements.txt -python setup.py develop ### run tests -nosetests || exit 1 +tox -e py27 || exit 1 ### static analysis of code flake8 --show-source petstore_api/ diff --git a/samples/client/petstore/python-experimental/test_python2_and_3.sh b/samples/client/petstore/python-experimental/test_python2_and_3.sh index 8511d46cd79..3205dfd07da 100644 --- a/samples/client/petstore/python-experimental/test_python2_and_3.sh +++ b/samples/client/petstore/python-experimental/test_python2_and_3.sh @@ -18,7 +18,6 @@ fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -python setup.py develop ### run tests tox || exit 1 diff --git a/samples/client/petstore/python-experimental/tox.ini b/samples/client/petstore/python-experimental/tox.ini index 3d0be613cfc..169d895329b 100644 --- a/samples/client/petstore/python-experimental/tox.ini +++ b/samples/client/petstore/python-experimental/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] + pytest --cov=petstore_api diff --git a/samples/client/petstore/python-tornado/.gitignore b/samples/client/petstore/python-tornado/.gitignore index a655050c263..43995bd42fa 100644 --- a/samples/client/petstore/python-tornado/.gitignore +++ b/samples/client/petstore/python-tornado/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/client/petstore/python-tornado/README.md b/samples/client/petstore/python-tornado/README.md index b92f4eecf8d..e031b59c9f6 100644 --- a/samples/client/petstore/python-tornado/README.md +++ b/samples/client/petstore/python-tornado/README.md @@ -127,6 +127,8 @@ Class | Method | HTTP request | Description - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [ArrayTest](docs/ArrayTest.md) + - [BigCat](docs/BigCat.md) + - [BigCatAllOf](docs/BigCatAllOf.md) - [Capitalization](docs/Capitalization.md) - [Cat](docs/Cat.md) - [CatAllOf](docs/CatAllOf.md) diff --git a/samples/client/petstore/python-tornado/dev-requirements.txt b/samples/client/petstore/python-tornado/dev-requirements.txt index f50c13b5c50..ccdfca62949 100644 --- a/samples/client/petstore/python-tornado/dev-requirements.txt +++ b/samples/client/petstore/python-tornado/dev-requirements.txt @@ -1,5 +1,2 @@ -nose tox -coverage -randomize flake8 diff --git a/samples/client/petstore/python-tornado/docs/BigCat.md b/samples/client/petstore/python-tornado/docs/BigCat.md new file mode 100644 index 00000000000..000271f832a --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/BigCat.md @@ -0,0 +1,10 @@ +# BigCat + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **str** | | [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/python-tornado/docs/BigCatAllOf.md b/samples/client/petstore/python-tornado/docs/BigCatAllOf.md new file mode 100644 index 00000000000..621bda6d35a --- /dev/null +++ b/samples/client/petstore/python-tornado/docs/BigCatAllOf.md @@ -0,0 +1,10 @@ +# BigCatAllOf + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **str** | | [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/python-tornado/petstore_api/__init__.py b/samples/client/petstore/python-tornado/petstore_api/__init__.py index 45d51fe90b8..513eaf779de 100644 --- a/samples/client/petstore/python-tornado/petstore_api/__init__.py +++ b/samples/client/petstore/python-tornado/petstore_api/__init__.py @@ -46,6 +46,8 @@ from petstore_api.models.api_response import ApiResponse from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly from petstore_api.models.array_of_number_only import ArrayOfNumberOnly from petstore_api.models.array_test import ArrayTest +from petstore_api.models.big_cat import BigCat +from petstore_api.models.big_cat_all_of import BigCatAllOf from petstore_api.models.capitalization import Capitalization from petstore_api.models.cat import Cat from petstore_api.models.cat_all_of import CatAllOf diff --git a/samples/client/petstore/python-tornado/petstore_api/models/__init__.py b/samples/client/petstore/python-tornado/petstore_api/models/__init__.py index 96fd17471f1..ddef3dea4fd 100644 --- a/samples/client/petstore/python-tornado/petstore_api/models/__init__.py +++ b/samples/client/petstore/python-tornado/petstore_api/models/__init__.py @@ -27,6 +27,8 @@ from petstore_api.models.api_response import ApiResponse from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly from petstore_api.models.array_of_number_only import ArrayOfNumberOnly from petstore_api.models.array_test import ArrayTest +from petstore_api.models.big_cat import BigCat +from petstore_api.models.big_cat_all_of import BigCatAllOf from petstore_api.models.capitalization import Capitalization from petstore_api.models.cat import Cat from petstore_api.models.cat_all_of import CatAllOf diff --git a/samples/client/petstore/python-tornado/petstore_api/models/animal.py b/samples/client/petstore/python-tornado/petstore_api/models/animal.py index 65cef1a6088..b338e0eb18e 100644 --- a/samples/client/petstore/python-tornado/petstore_api/models/animal.py +++ b/samples/client/petstore/python-tornado/petstore_api/models/animal.py @@ -44,7 +44,8 @@ class Animal(object): discriminator_value_class_map = { 'Dog': 'Dog', - 'Cat': 'Cat' + 'Cat': 'Cat', + 'BigCat': 'BigCat' } def __init__(self, class_name=None, color='red', local_vars_configuration=None): # noqa: E501 diff --git a/samples/client/petstore/python-tornado/petstore_api/models/big_cat.py b/samples/client/petstore/python-tornado/petstore_api/models/big_cat.py new file mode 100644 index 00000000000..fe52c3650ac --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/big_cat.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + 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: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from petstore_api.configuration import Configuration + + +class BigCat(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'kind': 'str' + } + + attribute_map = { + 'kind': 'kind' + } + + def __init__(self, kind=None, local_vars_configuration=None): # noqa: E501 + """BigCat - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._kind = None + self.discriminator = None + + if kind is not None: + self.kind = kind + + @property + def kind(self): + """Gets the kind of this BigCat. # noqa: E501 + + + :return: The kind of this BigCat. # noqa: E501 + :rtype: str + """ + return self._kind + + @kind.setter + def kind(self, kind): + """Sets the kind of this BigCat. + + + :param kind: The kind of this BigCat. # noqa: E501 + :type: str + """ + allowed_values = ["lions", "tigers", "leopards", "jaguars"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and kind not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `kind` ({0}), must be one of {1}" # noqa: E501 + .format(kind, allowed_values) + ) + + self._kind = kind + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BigCat): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, BigCat): + return True + + return self.to_dict() != other.to_dict() diff --git a/samples/client/petstore/python-tornado/petstore_api/models/big_cat_all_of.py b/samples/client/petstore/python-tornado/petstore_api/models/big_cat_all_of.py new file mode 100644 index 00000000000..b75500db987 --- /dev/null +++ b/samples/client/petstore/python-tornado/petstore_api/models/big_cat_all_of.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + 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: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from petstore_api.configuration import Configuration + + +class BigCatAllOf(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'kind': 'str' + } + + attribute_map = { + 'kind': 'kind' + } + + def __init__(self, kind=None, local_vars_configuration=None): # noqa: E501 + """BigCatAllOf - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._kind = None + self.discriminator = None + + if kind is not None: + self.kind = kind + + @property + def kind(self): + """Gets the kind of this BigCatAllOf. # noqa: E501 + + + :return: The kind of this BigCatAllOf. # noqa: E501 + :rtype: str + """ + return self._kind + + @kind.setter + def kind(self, kind): + """Sets the kind of this BigCatAllOf. + + + :param kind: The kind of this BigCatAllOf. # noqa: E501 + :type: str + """ + allowed_values = ["lions", "tigers", "leopards", "jaguars"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and kind not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `kind` ({0}), must be one of {1}" # noqa: E501 + .format(kind, allowed_values) + ) + + self._kind = kind + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BigCatAllOf): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, BigCatAllOf): + return True + + return self.to_dict() != other.to_dict() diff --git a/samples/client/petstore/python-tornado/pom.xml b/samples/client/petstore/python-tornado/pom.xml index 821e12dfe8d..9aae57304fc 100644 --- a/samples/client/petstore/python-tornado/pom.xml +++ b/samples/client/petstore/python-tornado/pom.xml @@ -27,7 +27,7 @@ 1.2.1 - nose-test + test integration-test exec diff --git a/samples/client/petstore/python-tornado/setup.cfg b/samples/client/petstore/python-tornado/setup.cfg new file mode 100644 index 00000000000..11433ee875a --- /dev/null +++ b/samples/client/petstore/python-tornado/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/samples/client/petstore/python-tornado/test-requirements.txt b/samples/client/petstore/python-tornado/test-requirements.txt index 2702246c0e6..4ed3991cbec 100644 --- a/samples/client/petstore/python-tornado/test-requirements.txt +++ b/samples/client/petstore/python-tornado/test-requirements.txt @@ -1,5 +1,3 @@ -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +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 diff --git a/samples/client/petstore/python-tornado/test/test_big_cat.py b/samples/client/petstore/python-tornado/test/test_big_cat.py new file mode 100644 index 00000000000..be428433ad4 --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_big_cat.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + 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: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.big_cat import BigCat # noqa: E501 +from petstore_api.rest import ApiException + + +class TestBigCat(unittest.TestCase): + """BigCat unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testBigCat(self): + """Test BigCat""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.big_cat.BigCat() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test/test_big_cat_all_of.py b/samples/client/petstore/python-tornado/test/test_big_cat_all_of.py new file mode 100644 index 00000000000..c0e71dbfcde --- /dev/null +++ b/samples/client/petstore/python-tornado/test/test_big_cat_all_of.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + 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: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.big_cat_all_of import BigCatAllOf # noqa: E501 +from petstore_api.rest import ApiException + + +class TestBigCatAllOf(unittest.TestCase): + """BigCatAllOf unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testBigCatAllOf(self): + """Test BigCatAllOf""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.big_cat_all_of.BigCatAllOf() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python-tornado/test_python2_and_3.sh b/samples/client/petstore/python-tornado/test_python2_and_3.sh index 7b5795ec24a..3118c449124 100755 --- a/samples/client/petstore/python-tornado/test_python2_and_3.sh +++ b/samples/client/petstore/python-tornado/test_python2_and_3.sh @@ -18,7 +18,6 @@ fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -python setup.py develop ### run tests tox || exit 1 diff --git a/samples/client/petstore/python-tornado/tox.ini b/samples/client/petstore/python-tornado/tox.ini index 3d0be613cfc..169d895329b 100644 --- a/samples/client/petstore/python-tornado/tox.ini +++ b/samples/client/petstore/python-tornado/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] + pytest --cov=petstore_api diff --git a/samples/client/petstore/python/.gitignore b/samples/client/petstore/python/.gitignore index a655050c263..43995bd42fa 100644 --- a/samples/client/petstore/python/.gitignore +++ b/samples/client/petstore/python/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index b92f4eecf8d..e031b59c9f6 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -127,6 +127,8 @@ Class | Method | HTTP request | Description - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [ArrayTest](docs/ArrayTest.md) + - [BigCat](docs/BigCat.md) + - [BigCatAllOf](docs/BigCatAllOf.md) - [Capitalization](docs/Capitalization.md) - [Cat](docs/Cat.md) - [CatAllOf](docs/CatAllOf.md) diff --git a/samples/client/petstore/python/dev-requirements.txt b/samples/client/petstore/python/dev-requirements.txt index f50c13b5c50..ccdfca62949 100644 --- a/samples/client/petstore/python/dev-requirements.txt +++ b/samples/client/petstore/python/dev-requirements.txt @@ -1,5 +1,2 @@ -nose tox -coverage -randomize flake8 diff --git a/samples/client/petstore/python/docs/BigCat.md b/samples/client/petstore/python/docs/BigCat.md new file mode 100644 index 00000000000..000271f832a --- /dev/null +++ b/samples/client/petstore/python/docs/BigCat.md @@ -0,0 +1,10 @@ +# BigCat + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **str** | | [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/python/docs/BigCatAllOf.md b/samples/client/petstore/python/docs/BigCatAllOf.md new file mode 100644 index 00000000000..621bda6d35a --- /dev/null +++ b/samples/client/petstore/python/docs/BigCatAllOf.md @@ -0,0 +1,10 @@ +# BigCatAllOf + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **str** | | [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/python/petstore_api/__init__.py b/samples/client/petstore/python/petstore_api/__init__.py index 45d51fe90b8..513eaf779de 100644 --- a/samples/client/petstore/python/petstore_api/__init__.py +++ b/samples/client/petstore/python/petstore_api/__init__.py @@ -46,6 +46,8 @@ from petstore_api.models.api_response import ApiResponse from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly from petstore_api.models.array_of_number_only import ArrayOfNumberOnly from petstore_api.models.array_test import ArrayTest +from petstore_api.models.big_cat import BigCat +from petstore_api.models.big_cat_all_of import BigCatAllOf from petstore_api.models.capitalization import Capitalization from petstore_api.models.cat import Cat from petstore_api.models.cat_all_of import CatAllOf diff --git a/samples/client/petstore/python/petstore_api/models/__init__.py b/samples/client/petstore/python/petstore_api/models/__init__.py index 96fd17471f1..ddef3dea4fd 100644 --- a/samples/client/petstore/python/petstore_api/models/__init__.py +++ b/samples/client/petstore/python/petstore_api/models/__init__.py @@ -27,6 +27,8 @@ from petstore_api.models.api_response import ApiResponse from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly from petstore_api.models.array_of_number_only import ArrayOfNumberOnly from petstore_api.models.array_test import ArrayTest +from petstore_api.models.big_cat import BigCat +from petstore_api.models.big_cat_all_of import BigCatAllOf from petstore_api.models.capitalization import Capitalization from petstore_api.models.cat import Cat from petstore_api.models.cat_all_of import CatAllOf diff --git a/samples/client/petstore/python/petstore_api/models/animal.py b/samples/client/petstore/python/petstore_api/models/animal.py index 65cef1a6088..b338e0eb18e 100644 --- a/samples/client/petstore/python/petstore_api/models/animal.py +++ b/samples/client/petstore/python/petstore_api/models/animal.py @@ -44,7 +44,8 @@ class Animal(object): discriminator_value_class_map = { 'Dog': 'Dog', - 'Cat': 'Cat' + 'Cat': 'Cat', + 'BigCat': 'BigCat' } def __init__(self, class_name=None, color='red', local_vars_configuration=None): # noqa: E501 diff --git a/samples/client/petstore/python/petstore_api/models/big_cat.py b/samples/client/petstore/python/petstore_api/models/big_cat.py new file mode 100644 index 00000000000..fe52c3650ac --- /dev/null +++ b/samples/client/petstore/python/petstore_api/models/big_cat.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + 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: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from petstore_api.configuration import Configuration + + +class BigCat(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'kind': 'str' + } + + attribute_map = { + 'kind': 'kind' + } + + def __init__(self, kind=None, local_vars_configuration=None): # noqa: E501 + """BigCat - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._kind = None + self.discriminator = None + + if kind is not None: + self.kind = kind + + @property + def kind(self): + """Gets the kind of this BigCat. # noqa: E501 + + + :return: The kind of this BigCat. # noqa: E501 + :rtype: str + """ + return self._kind + + @kind.setter + def kind(self, kind): + """Sets the kind of this BigCat. + + + :param kind: The kind of this BigCat. # noqa: E501 + :type: str + """ + allowed_values = ["lions", "tigers", "leopards", "jaguars"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and kind not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `kind` ({0}), must be one of {1}" # noqa: E501 + .format(kind, allowed_values) + ) + + self._kind = kind + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BigCat): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, BigCat): + return True + + return self.to_dict() != other.to_dict() diff --git a/samples/client/petstore/python/petstore_api/models/big_cat_all_of.py b/samples/client/petstore/python/petstore_api/models/big_cat_all_of.py new file mode 100644 index 00000000000..b75500db987 --- /dev/null +++ b/samples/client/petstore/python/petstore_api/models/big_cat_all_of.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + 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: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from petstore_api.configuration import Configuration + + +class BigCatAllOf(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'kind': 'str' + } + + attribute_map = { + 'kind': 'kind' + } + + def __init__(self, kind=None, local_vars_configuration=None): # noqa: E501 + """BigCatAllOf - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._kind = None + self.discriminator = None + + if kind is not None: + self.kind = kind + + @property + def kind(self): + """Gets the kind of this BigCatAllOf. # noqa: E501 + + + :return: The kind of this BigCatAllOf. # noqa: E501 + :rtype: str + """ + return self._kind + + @kind.setter + def kind(self, kind): + """Sets the kind of this BigCatAllOf. + + + :param kind: The kind of this BigCatAllOf. # noqa: E501 + :type: str + """ + allowed_values = ["lions", "tigers", "leopards", "jaguars"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and kind not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `kind` ({0}), must be one of {1}" # noqa: E501 + .format(kind, allowed_values) + ) + + self._kind = kind + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, BigCatAllOf): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, BigCatAllOf): + return True + + return self.to_dict() != other.to_dict() diff --git a/samples/client/petstore/python/pom.xml b/samples/client/petstore/python/pom.xml index db2d09246c3..71814d4388d 100644 --- a/samples/client/petstore/python/pom.xml +++ b/samples/client/petstore/python/pom.xml @@ -27,7 +27,7 @@ 1.2.1 - nose-test + test integration-test exec diff --git a/samples/client/petstore/python/setup.cfg b/samples/client/petstore/python/setup.cfg index 26b7a359d58..11433ee875a 100644 --- a/samples/client/petstore/python/setup.cfg +++ b/samples/client/petstore/python/setup.cfg @@ -1,11 +1,2 @@ -[nosetests] -logging-clear-handlers=true -verbosity=2 -randomize=true -exe=true -with-coverage=true -cover-package=petstore_api -cover-erase=true - [flake8] max-line-length=99 diff --git a/samples/client/petstore/python/test-requirements.txt b/samples/client/petstore/python/test-requirements.txt index 2702246c0e6..4ed3991cbec 100644 --- a/samples/client/petstore/python/test-requirements.txt +++ b/samples/client/petstore/python/test-requirements.txt @@ -1,5 +1,3 @@ -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +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 diff --git a/samples/client/petstore/python/test/test_big_cat.py b/samples/client/petstore/python/test/test_big_cat.py new file mode 100644 index 00000000000..be428433ad4 --- /dev/null +++ b/samples/client/petstore/python/test/test_big_cat.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + 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: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.big_cat import BigCat # noqa: E501 +from petstore_api.rest import ApiException + + +class TestBigCat(unittest.TestCase): + """BigCat unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testBigCat(self): + """Test BigCat""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.big_cat.BigCat() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python/test/test_big_cat_all_of.py b/samples/client/petstore/python/test/test_big_cat_all_of.py new file mode 100644 index 00000000000..c0e71dbfcde --- /dev/null +++ b/samples/client/petstore/python/test/test_big_cat_all_of.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + 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: \" \\ # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import petstore_api +from petstore_api.models.big_cat_all_of import BigCatAllOf # noqa: E501 +from petstore_api.rest import ApiException + + +class TestBigCatAllOf(unittest.TestCase): + """BigCatAllOf unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testBigCatAllOf(self): + """Test BigCatAllOf""" + # FIXME: construct object with mandatory attributes with example values + # model = petstore_api.models.big_cat_all_of.BigCatAllOf() # noqa: E501 + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python/test_python2.sh b/samples/client/petstore/python/test_python2.sh index fb0eaed6ffa..4c9488a3329 100755 --- a/samples/client/petstore/python/test_python2.sh +++ b/samples/client/petstore/python/test_python2.sh @@ -11,17 +11,16 @@ export LANG=en_US.UTF-8 ### set virtualenv if [ -z "$VIRTUAL_ENV" ]; then - virtualenv $VENV --no-site-packages --always-copy + virtualenv $VENV --no-site-packages --always-copy --python python source $VENV/bin/activate DEACTIVE=true fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -python setup.py develop ### run tests -nosetests || exit 1 +tox -e py27 || exit 1 ### static analysis of code flake8 --show-source petstore_api/ @@ -30,4 +29,3 @@ flake8 --show-source petstore_api/ #if [ $DEACTIVE == true ]; then # deactivate #fi - diff --git a/samples/client/petstore/python/test_python2_and_3.sh b/samples/client/petstore/python/test_python2_and_3.sh index 7b5795ec24a..3118c449124 100755 --- a/samples/client/petstore/python/test_python2_and_3.sh +++ b/samples/client/petstore/python/test_python2_and_3.sh @@ -18,7 +18,6 @@ fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -python setup.py develop ### run tests tox || exit 1 diff --git a/samples/client/petstore/python/tests/test_pet_api.py b/samples/client/petstore/python/tests/test_pet_api.py index 80d34f6b5f2..b7650f042eb 100644 --- a/samples/client/petstore/python/tests/test_pet_api.py +++ b/samples/client/petstore/python/tests/test_pet_api.py @@ -157,7 +157,7 @@ class PetApiTests(unittest.TestCase): response = thread.get() response2 = thread2.get() - self.assertEquals(response.id, self.pet.id) + self.assertEqual(response.id, self.pet.id) self.assertIsNotNone(response2.id, self.pet.id) def test_async_with_http_info(self): @@ -167,7 +167,7 @@ class PetApiTests(unittest.TestCase): data, status, headers = thread.get() self.assertIsInstance(data, petstore_api.Pet) - self.assertEquals(status, 200) + self.assertEqual(status, 200) def test_async_exception(self): self.pet_api.add_pet(self.pet) diff --git a/samples/client/petstore/python/tox.ini b/samples/client/petstore/python/tox.ini index 3d0be613cfc..169d895329b 100644 --- a/samples/client/petstore/python/tox.ini +++ b/samples/client/petstore/python/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] + pytest --cov=petstore_api diff --git a/samples/client/petstore/ruby-faraday/README.md b/samples/client/petstore/ruby-faraday/README.md index c3cbbb05666..0e684d1ce3e 100644 --- a/samples/client/petstore/ruby-faraday/README.md +++ b/samples/client/petstore/ruby-faraday/README.md @@ -129,6 +129,8 @@ Class | Method | HTTP request | Description - [Petstore::ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [Petstore::ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [Petstore::ArrayTest](docs/ArrayTest.md) + - [Petstore::BigCat](docs/BigCat.md) + - [Petstore::BigCatAllOf](docs/BigCatAllOf.md) - [Petstore::Capitalization](docs/Capitalization.md) - [Petstore::Cat](docs/Cat.md) - [Petstore::CatAllOf](docs/CatAllOf.md) diff --git a/samples/client/petstore/ruby-faraday/docs/BigCat.md b/samples/client/petstore/ruby-faraday/docs/BigCat.md new file mode 100644 index 00000000000..7c48311d422 --- /dev/null +++ b/samples/client/petstore/ruby-faraday/docs/BigCat.md @@ -0,0 +1,17 @@ +# Petstore::BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **String** | | [optional] + +## Code Sample + +```ruby +require 'Petstore' + +instance = Petstore::BigCat.new(kind: null) +``` + + diff --git a/samples/client/petstore/ruby-faraday/docs/BigCatAllOf.md b/samples/client/petstore/ruby-faraday/docs/BigCatAllOf.md new file mode 100644 index 00000000000..101cad0da23 --- /dev/null +++ b/samples/client/petstore/ruby-faraday/docs/BigCatAllOf.md @@ -0,0 +1,17 @@ +# Petstore::BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **String** | | [optional] + +## Code Sample + +```ruby +require 'Petstore' + +instance = Petstore::BigCatAllOf.new(kind: null) +``` + + diff --git a/samples/client/petstore/ruby-faraday/lib/petstore.rb b/samples/client/petstore/ruby-faraday/lib/petstore.rb index b379be4fa1c..98abe76abcb 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore.rb @@ -30,6 +30,8 @@ require 'petstore/models/api_response' require 'petstore/models/array_of_array_of_number_only' require 'petstore/models/array_of_number_only' require 'petstore/models/array_test' +require 'petstore/models/big_cat' +require 'petstore/models/big_cat_all_of' require 'petstore/models/capitalization' require 'petstore/models/cat' require 'petstore/models/cat_all_of' diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/big_cat.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/big_cat.rb new file mode 100644 index 00000000000..0c82b915950 --- /dev/null +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/big_cat.rb @@ -0,0 +1,252 @@ +=begin +#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://openapi-generator.tech +OpenAPI Generator version: 4.2.3-SNAPSHOT + +=end + +require 'date' + +module Petstore + class BigCat < Cat + attr_accessor :kind + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'kind' => :'kind' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'kind' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'BigCatAllOf', + :'Cat' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::BigCat` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::BigCat`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'kind') + self.kind = attributes[:'kind'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + kind_validator = EnumAttributeValidator.new('String', ["lions", "tigers", "leopards", "jaguars"]) + return false unless kind_validator.valid?(@kind) + true && super + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] kind Object to be assigned + def kind=(kind) + validator = EnumAttributeValidator.new('String', ["lions", "tigers", "leopards", "jaguars"]) + unless validator.valid?(kind) + fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}." + end + @kind = kind + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + kind == o.kind && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [kind].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Petstore.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/big_cat_all_of.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/big_cat_all_of.rb new file mode 100644 index 00000000000..0e136ae8660 --- /dev/null +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/big_cat_all_of.rb @@ -0,0 +1,240 @@ +=begin +#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://openapi-generator.tech +OpenAPI Generator version: 4.2.3-SNAPSHOT + +=end + +require 'date' + +module Petstore + class BigCatAllOf + attr_accessor :kind + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'kind' => :'kind' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'kind' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::BigCatAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::BigCatAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'kind') + self.kind = attributes[:'kind'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + kind_validator = EnumAttributeValidator.new('String', ["lions", "tigers", "leopards", "jaguars"]) + return false unless kind_validator.valid?(@kind) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] kind Object to be assigned + def kind=(kind) + validator = EnumAttributeValidator.new('String', ["lions", "tigers", "leopards", "jaguars"]) + unless validator.valid?(kind) + fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}." + end + @kind = kind + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + kind == o.kind + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [kind].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Petstore.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/samples/client/petstore/ruby-faraday/spec/models/big_cat_all_of_spec.rb b/samples/client/petstore/ruby-faraday/spec/models/big_cat_all_of_spec.rb new file mode 100644 index 00000000000..4a547a5ac50 --- /dev/null +++ b/samples/client/petstore/ruby-faraday/spec/models/big_cat_all_of_spec.rb @@ -0,0 +1,45 @@ +=begin +#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://openapi-generator.tech +OpenAPI Generator version: 4.2.2-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::BigCatAllOf +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BigCatAllOf' do + before do + # run before each test + @instance = Petstore::BigCatAllOf.new + end + + after do + # run after each test + end + + describe 'test an instance of BigCatAllOf' do + it 'should create an instance of BigCatAllOf' do + expect(@instance).to be_instance_of(Petstore::BigCatAllOf) + end + end + describe 'test attribute "kind"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["lions", "tigers", "leopards", "jaguars"]) + # validator.allowable_values.each do |value| + # expect { @instance.kind = value }.not_to raise_error + # end + end + end + +end diff --git a/samples/client/petstore/ruby-faraday/spec/models/big_cat_spec.rb b/samples/client/petstore/ruby-faraday/spec/models/big_cat_spec.rb new file mode 100644 index 00000000000..c6e0cfbce68 --- /dev/null +++ b/samples/client/petstore/ruby-faraday/spec/models/big_cat_spec.rb @@ -0,0 +1,45 @@ +=begin +#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://openapi-generator.tech +OpenAPI Generator version: 4.2.2-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::BigCat +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BigCat' do + before do + # run before each test + @instance = Petstore::BigCat.new + end + + after do + # run after each test + end + + describe 'test an instance of BigCat' do + it 'should create an instance of BigCat' do + expect(@instance).to be_instance_of(Petstore::BigCat) + end + end + describe 'test attribute "kind"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["lions", "tigers", "leopards", "jaguars"]) + # validator.allowable_values.each do |value| + # expect { @instance.kind = value }.not_to raise_error + # end + end + end + +end diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index c3cbbb05666..0e684d1ce3e 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -129,6 +129,8 @@ Class | Method | HTTP request | Description - [Petstore::ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [Petstore::ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [Petstore::ArrayTest](docs/ArrayTest.md) + - [Petstore::BigCat](docs/BigCat.md) + - [Petstore::BigCatAllOf](docs/BigCatAllOf.md) - [Petstore::Capitalization](docs/Capitalization.md) - [Petstore::Cat](docs/Cat.md) - [Petstore::CatAllOf](docs/CatAllOf.md) diff --git a/samples/client/petstore/ruby/docs/BigCat.md b/samples/client/petstore/ruby/docs/BigCat.md new file mode 100644 index 00000000000..7c48311d422 --- /dev/null +++ b/samples/client/petstore/ruby/docs/BigCat.md @@ -0,0 +1,17 @@ +# Petstore::BigCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **String** | | [optional] + +## Code Sample + +```ruby +require 'Petstore' + +instance = Petstore::BigCat.new(kind: null) +``` + + diff --git a/samples/client/petstore/ruby/docs/BigCatAllOf.md b/samples/client/petstore/ruby/docs/BigCatAllOf.md new file mode 100644 index 00000000000..101cad0da23 --- /dev/null +++ b/samples/client/petstore/ruby/docs/BigCatAllOf.md @@ -0,0 +1,17 @@ +# Petstore::BigCatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **String** | | [optional] + +## Code Sample + +```ruby +require 'Petstore' + +instance = Petstore::BigCatAllOf.new(kind: null) +``` + + diff --git a/samples/client/petstore/ruby/lib/petstore.rb b/samples/client/petstore/ruby/lib/petstore.rb index b379be4fa1c..98abe76abcb 100644 --- a/samples/client/petstore/ruby/lib/petstore.rb +++ b/samples/client/petstore/ruby/lib/petstore.rb @@ -30,6 +30,8 @@ require 'petstore/models/api_response' require 'petstore/models/array_of_array_of_number_only' require 'petstore/models/array_of_number_only' require 'petstore/models/array_test' +require 'petstore/models/big_cat' +require 'petstore/models/big_cat_all_of' require 'petstore/models/capitalization' require 'petstore/models/cat' require 'petstore/models/cat_all_of' diff --git a/samples/client/petstore/ruby/lib/petstore/models/big_cat.rb b/samples/client/petstore/ruby/lib/petstore/models/big_cat.rb new file mode 100644 index 00000000000..0c82b915950 --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/models/big_cat.rb @@ -0,0 +1,252 @@ +=begin +#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://openapi-generator.tech +OpenAPI Generator version: 4.2.3-SNAPSHOT + +=end + +require 'date' + +module Petstore + class BigCat < Cat + attr_accessor :kind + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'kind' => :'kind' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'kind' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'BigCatAllOf', + :'Cat' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::BigCat` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::BigCat`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'kind') + self.kind = attributes[:'kind'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + kind_validator = EnumAttributeValidator.new('String', ["lions", "tigers", "leopards", "jaguars"]) + return false unless kind_validator.valid?(@kind) + true && super + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] kind Object to be assigned + def kind=(kind) + validator = EnumAttributeValidator.new('String', ["lions", "tigers", "leopards", "jaguars"]) + unless validator.valid?(kind) + fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}." + end + @kind = kind + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + kind == o.kind && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [kind].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Petstore.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/samples/client/petstore/ruby/lib/petstore/models/big_cat_all_of.rb b/samples/client/petstore/ruby/lib/petstore/models/big_cat_all_of.rb new file mode 100644 index 00000000000..0e136ae8660 --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/models/big_cat_all_of.rb @@ -0,0 +1,240 @@ +=begin +#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://openapi-generator.tech +OpenAPI Generator version: 4.2.3-SNAPSHOT + +=end + +require 'date' + +module Petstore + class BigCatAllOf + attr_accessor :kind + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'kind' => :'kind' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'kind' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::BigCatAllOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::BigCatAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'kind') + self.kind = attributes[:'kind'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + kind_validator = EnumAttributeValidator.new('String', ["lions", "tigers", "leopards", "jaguars"]) + return false unless kind_validator.valid?(@kind) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] kind Object to be assigned + def kind=(kind) + validator = EnumAttributeValidator.new('String', ["lions", "tigers", "leopards", "jaguars"]) + unless validator.valid?(kind) + fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}." + end + @kind = kind + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + kind == o.kind + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [kind].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Petstore.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/samples/client/petstore/ruby/spec/models/big_cat_all_of_spec.rb b/samples/client/petstore/ruby/spec/models/big_cat_all_of_spec.rb new file mode 100644 index 00000000000..54caa8c1626 --- /dev/null +++ b/samples/client/petstore/ruby/spec/models/big_cat_all_of_spec.rb @@ -0,0 +1,45 @@ +=begin +#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://openapi-generator.tech +OpenAPI Generator version: 4.2.3-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::BigCatAllOf +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BigCatAllOf' do + before do + # run before each test + @instance = Petstore::BigCatAllOf.new + end + + after do + # run after each test + end + + describe 'test an instance of BigCatAllOf' do + it 'should create an instance of BigCatAllOf' do + expect(@instance).to be_instance_of(Petstore::BigCatAllOf) + end + end + describe 'test attribute "kind"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["lions", "tigers", "leopards", "jaguars"]) + # validator.allowable_values.each do |value| + # expect { @instance.kind = value }.not_to raise_error + # end + end + end + +end diff --git a/samples/client/petstore/ruby/spec/models/big_cat_spec.rb b/samples/client/petstore/ruby/spec/models/big_cat_spec.rb new file mode 100644 index 00000000000..b1869d3e5cf --- /dev/null +++ b/samples/client/petstore/ruby/spec/models/big_cat_spec.rb @@ -0,0 +1,45 @@ +=begin +#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://openapi-generator.tech +OpenAPI Generator version: 4.2.3-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::BigCat +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BigCat' do + before do + # run before each test + @instance = Petstore::BigCat.new + end + + after do + # run after each test + end + + describe 'test an instance of BigCat' do + it 'should create an instance of BigCat' do + expect(@instance).to be_instance_of(Petstore::BigCat) + end + end + describe 'test attribute "kind"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["lions", "tigers", "leopards", "jaguars"]) + # validator.allowable_values.each do |value| + # expect { @instance.kind = value }.not_to raise_error + # end + end + end + +end diff --git a/samples/client/petstore/scalaz/project/build.properties b/samples/client/petstore/scalaz/project/build.properties index cf19fd026fd..64317fdae59 100644 --- a/samples/client/petstore/scalaz/project/build.properties +++ b/samples/client/petstore/scalaz/project/build.properties @@ -1 +1 @@ -sbt.version=0.13.15 \ No newline at end of file +sbt.version=0.13.15 diff --git a/samples/documentation/asciidoc/.openapi-generator/VERSION b/samples/documentation/asciidoc/.openapi-generator/VERSION index e4955748d3e..58592f031f6 100644 --- a/samples/documentation/asciidoc/.openapi-generator/VERSION +++ b/samples/documentation/asciidoc/.openapi-generator/VERSION @@ -1 +1 @@ -4.2.2-SNAPSHOT \ No newline at end of file +4.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/documentation/asciidoc/index.adoc b/samples/documentation/asciidoc/index.adoc index 295ff335844..200288b5a5a 100644 --- a/samples/documentation/asciidoc/index.adoc +++ b/samples/documentation/asciidoc/index.adoc @@ -1,4 +1,4 @@ -= OpenAPI Petstore += OpenAPI Petstore team@openapitools.org 1.0.0 :toc: left @@ -6,9 +6,9 @@ team@openapitools.org :toclevels: 3 :source-highlighter: highlightjs :keywords: openapi, rest, OpenAPI Petstore -:specDir: modules\openapi-generator\src\main\resources\asciidoc-documentation +:specDir: modules/openapi-generator/src/main/resources/asciidoc-documentation :snippetDir: . -:generator-template: v1 2019-11-19 +:generator-template: v1 2019-12-20 :info-url: https://openapi-generator.tech :app-name: OpenAPI Petstore diff --git a/samples/openapi3/client/petstore/go/go-petstore/README.md b/samples/openapi3/client/petstore/go/go-petstore/README.md index a50a23f7d4a..c0f191d001d 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/README.md +++ b/samples/openapi3/client/petstore/go/go-petstore/README.md @@ -219,6 +219,7 @@ r, err := client.Service.Operation(auth, args) ``` + ## Author diff --git a/samples/openapi3/client/petstore/go/go-petstore/client.go b/samples/openapi3/client/petstore/go/go-petstore/client.go index 1b8eae88daa..730e67621ed 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/client.go +++ b/samples/openapi3/client/petstore/go/go-petstore/client.go @@ -366,6 +366,7 @@ func (c *APIClient) prepareRequest( if auth, ok := ctx.Value(ContextAccessToken).(string); ok { localVarRequest.Header.Add("Authorization", "Bearer "+auth) } + } for header, value := range c.cfg.DefaultHeader { diff --git a/samples/openapi3/client/petstore/go/go-petstore/configuration.go b/samples/openapi3/client/petstore/go/go-petstore/configuration.go index 333de81350d..c2ea841704a 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/configuration.go +++ b/samples/openapi3/client/petstore/go/go-petstore/configuration.go @@ -37,6 +37,7 @@ var ( // ContextAPIKey takes an APIKey as authentication for the request ContextAPIKey = contextKey("apikey") + ) // BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth @@ -51,6 +52,7 @@ type APIKey struct { Prefix string } + // ServerVariable stores the information about a server variable type ServerVariable struct { Description string diff --git a/samples/openapi3/client/petstore/go/go-petstore/go.mod b/samples/openapi3/client/petstore/go/go-petstore/go.mod index 1af1846f985..f55c1461f84 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/go.mod +++ b/samples/openapi3/client/petstore/go/go-petstore/go.mod @@ -3,4 +3,5 @@ module github.com/GIT_USER_ID/GIT_REPO_ID require ( github.com/antihax/optional v1.0.0 golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 + ) diff --git a/samples/openapi3/client/petstore/go/go-petstore/go.sum b/samples/openapi3/client/petstore/go/go-petstore/go.sum index ce55b3c6a08..ee695202297 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/go.sum +++ b/samples/openapi3/client/petstore/go/go-petstore/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/samples/openapi3/client/petstore/python/.gitignore b/samples/openapi3/client/petstore/python/.gitignore index a655050c263..43995bd42fa 100644 --- a/samples/openapi3/client/petstore/python/.gitignore +++ b/samples/openapi3/client/petstore/python/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/openapi3/client/petstore/python/dev-requirements.txt b/samples/openapi3/client/petstore/python/dev-requirements.txt new file mode 100644 index 00000000000..ccdfca62949 --- /dev/null +++ b/samples/openapi3/client/petstore/python/dev-requirements.txt @@ -0,0 +1,2 @@ +tox +flake8 diff --git a/samples/openapi3/client/petstore/python/pom.xml b/samples/openapi3/client/petstore/python/pom.xml index 2fa7d0a113f..98955483eb8 100644 --- a/samples/openapi3/client/petstore/python/pom.xml +++ b/samples/openapi3/client/petstore/python/pom.xml @@ -27,7 +27,7 @@ 1.2.1 - nose-test + test integration-test exec diff --git a/samples/openapi3/client/petstore/python/setup.cfg b/samples/openapi3/client/petstore/python/setup.cfg new file mode 100644 index 00000000000..11433ee875a --- /dev/null +++ b/samples/openapi3/client/petstore/python/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/samples/openapi3/client/petstore/python/test-requirements.txt b/samples/openapi3/client/petstore/python/test-requirements.txt index 2702246c0e6..4ed3991cbec 100644 --- a/samples/openapi3/client/petstore/python/test-requirements.txt +++ b/samples/openapi3/client/petstore/python/test-requirements.txt @@ -1,5 +1,3 @@ -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +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 diff --git a/samples/openapi3/client/petstore/python/test_python2.sh b/samples/openapi3/client/petstore/python/test_python2.sh index fb0eaed6ffa..24c3cbdd496 100644 --- a/samples/openapi3/client/petstore/python/test_python2.sh +++ b/samples/openapi3/client/petstore/python/test_python2.sh @@ -18,10 +18,9 @@ fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -python setup.py develop ### run tests -nosetests || exit 1 +tox -e py27 || exit 1 ### static analysis of code flake8 --show-source petstore_api/ diff --git a/samples/openapi3/client/petstore/python/test_python2_and_3.sh b/samples/openapi3/client/petstore/python/test_python2_and_3.sh index daf08d5bacb..ab02e6e4080 100644 --- a/samples/openapi3/client/petstore/python/test_python2_and_3.sh +++ b/samples/openapi3/client/petstore/python/test_python2_and_3.sh @@ -18,7 +18,6 @@ fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -python setup.py develop ### run tests tox || exit 1 diff --git a/samples/openapi3/client/petstore/python/tox.ini b/samples/openapi3/client/petstore/python/tox.ini index 3d0be613cfc..169d895329b 100644 --- a/samples/openapi3/client/petstore/python/tox.ini +++ b/samples/openapi3/client/petstore/python/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] + pytest --cov=petstore_api diff --git a/samples/openapi3/server/petstore/go-api-server/.openapi-generator/VERSION b/samples/openapi3/server/petstore/go-api-server/.openapi-generator/VERSION index c3a2c7076fa..58592f031f6 100644 --- a/samples/openapi3/server/petstore/go-api-server/.openapi-generator/VERSION +++ b/samples/openapi3/server/petstore/go-api-server/.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/openapi3/server/petstore/go-api-server/go/api_another_fake.go b/samples/openapi3/server/petstore/go-api-server/go/api_another_fake.go index b30ab1a1acb..804316ecb21 100644 --- a/samples/openapi3/server/petstore/go-api-server/go/api_another_fake.go +++ b/samples/openapi3/server/petstore/go-api-server/go/api_another_fake.go @@ -10,11 +10,48 @@ package petstoreserver import ( + "encoding/json" "net/http" + "strings" + + "github.com/gorilla/mux" ) -// Call123TestSpecialTags - To test special tags -func Call123TestSpecialTags(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +// A AnotherFakeApiController binds http requests to an api service and writes the service results to the http response +type AnotherFakeApiController struct { + service AnotherFakeApiServicer +} + +// NewAnotherFakeApiController creates a default api controller +func NewAnotherFakeApiController(s AnotherFakeApiServicer) Router { + return &AnotherFakeApiController{ service: s } +} + +// Routes returns all of the api route for the AnotherFakeApiController +func (c *AnotherFakeApiController) Routes() Routes { + return Routes{ + { + "Call123TestSpecialTags", + strings.ToUpper("Patch"), + "/v2/another-fake/dummy", + c.Call123TestSpecialTags, + }, + } +} + +// Call123TestSpecialTags - To test special tags +func (c *AnotherFakeApiController) Call123TestSpecialTags(w http.ResponseWriter, r *http.Request) { + client := &Client{} + if err := json.NewDecoder(r.Body).Decode(&client); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.Call123TestSpecialTags(*client) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } diff --git a/samples/openapi3/server/petstore/go-api-server/go/api_default.go b/samples/openapi3/server/petstore/go-api-server/go/api_default.go index 8de510a0dd8..c1618f26c9c 100644 --- a/samples/openapi3/server/petstore/go-api-server/go/api_default.go +++ b/samples/openapi3/server/petstore/go-api-server/go/api_default.go @@ -10,11 +10,42 @@ package petstoreserver import ( + "encoding/json" "net/http" + "strings" + + "github.com/gorilla/mux" ) -// FooGet - -func FooGet(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +// A DefaultApiController binds http requests to an api service and writes the service results to the http response +type DefaultApiController struct { + service DefaultApiServicer +} + +// NewDefaultApiController creates a default api controller +func NewDefaultApiController(s DefaultApiServicer) Router { + return &DefaultApiController{ service: s } +} + +// Routes returns all of the api route for the DefaultApiController +func (c *DefaultApiController) Routes() Routes { + return Routes{ + { + "FooGet", + strings.ToUpper("Get"), + "/v2/foo", + c.FooGet, + }, + } +} + +// FooGet - +func (c *DefaultApiController) FooGet(w http.ResponseWriter, r *http.Request) { + result, err := c.service.FooGet() + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } diff --git a/samples/openapi3/server/petstore/go-api-server/go/api_fake.go b/samples/openapi3/server/petstore/go-api-server/go/api_fake.go index 07ebda735bd..94b55953254 100644 --- a/samples/openapi3/server/petstore/go-api-server/go/api_fake.go +++ b/samples/openapi3/server/petstore/go-api-server/go/api_fake.go @@ -10,89 +10,389 @@ package petstoreserver import ( + "encoding/json" "net/http" + "strings" + + "github.com/gorilla/mux" ) +// A FakeApiController binds http requests to an api service and writes the service results to the http response +type FakeApiController struct { + service FakeApiServicer +} + +// NewFakeApiController creates a default api controller +func NewFakeApiController(s FakeApiServicer) Router { + return &FakeApiController{ service: s } +} + +// Routes returns all of the api route for the FakeApiController +func (c *FakeApiController) Routes() Routes { + return Routes{ + { + "FakeHealthGet", + strings.ToUpper("Get"), + "/v2/fake/health", + c.FakeHealthGet, + }, + { + "FakeOuterBooleanSerialize", + strings.ToUpper("Post"), + "/v2/fake/outer/boolean", + c.FakeOuterBooleanSerialize, + }, + { + "FakeOuterCompositeSerialize", + strings.ToUpper("Post"), + "/v2/fake/outer/composite", + c.FakeOuterCompositeSerialize, + }, + { + "FakeOuterNumberSerialize", + strings.ToUpper("Post"), + "/v2/fake/outer/number", + c.FakeOuterNumberSerialize, + }, + { + "FakeOuterStringSerialize", + strings.ToUpper("Post"), + "/v2/fake/outer/string", + c.FakeOuterStringSerialize, + }, + { + "TestBodyWithFileSchema", + strings.ToUpper("Put"), + "/v2/fake/body-with-file-schema", + c.TestBodyWithFileSchema, + }, + { + "TestBodyWithQueryParams", + strings.ToUpper("Put"), + "/v2/fake/body-with-query-params", + c.TestBodyWithQueryParams, + }, + { + "TestClientModel", + strings.ToUpper("Patch"), + "/v2/fake", + c.TestClientModel, + }, + { + "TestEndpointParameters", + strings.ToUpper("Post"), + "/v2/fake", + c.TestEndpointParameters, + }, + { + "TestEnumParameters", + strings.ToUpper("Get"), + "/v2/fake", + c.TestEnumParameters, + }, + { + "TestGroupParameters", + strings.ToUpper("Delete"), + "/v2/fake", + c.TestGroupParameters, + }, + { + "TestInlineAdditionalProperties", + strings.ToUpper("Post"), + "/v2/fake/inline-additionalProperties", + c.TestInlineAdditionalProperties, + }, + { + "TestJsonFormData", + strings.ToUpper("Get"), + "/v2/fake/jsonFormData", + c.TestJsonFormData, + }, + { + "TestQueryParameterCollectionFormat", + strings.ToUpper("Put"), + "/v2/fake/test-query-paramters", + c.TestQueryParameterCollectionFormat, + }, + } +} + // FakeHealthGet - Health check endpoint -func FakeHealthGet(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *FakeApiController) FakeHealthGet(w http.ResponseWriter, r *http.Request) { + result, err := c.service.FakeHealthGet() + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // FakeOuterBooleanSerialize - -func FakeOuterBooleanSerialize(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *FakeApiController) FakeOuterBooleanSerialize(w http.ResponseWriter, r *http.Request) { + body := &bool{} + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.FakeOuterBooleanSerialize(*body) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // FakeOuterCompositeSerialize - -func FakeOuterCompositeSerialize(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *FakeApiController) FakeOuterCompositeSerialize(w http.ResponseWriter, r *http.Request) { + outerComposite := &OuterComposite{} + if err := json.NewDecoder(r.Body).Decode(&outerComposite); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.FakeOuterCompositeSerialize(*outerComposite) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // FakeOuterNumberSerialize - -func FakeOuterNumberSerialize(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *FakeApiController) FakeOuterNumberSerialize(w http.ResponseWriter, r *http.Request) { + body := &float32{} + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.FakeOuterNumberSerialize(*body) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // FakeOuterStringSerialize - -func FakeOuterStringSerialize(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *FakeApiController) FakeOuterStringSerialize(w http.ResponseWriter, r *http.Request) { + body := &string{} + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.FakeOuterStringSerialize(*body) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // TestBodyWithFileSchema - -func TestBodyWithFileSchema(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *FakeApiController) TestBodyWithFileSchema(w http.ResponseWriter, r *http.Request) { + fileSchemaTestClass := &FileSchemaTestClass{} + if err := json.NewDecoder(r.Body).Decode(&fileSchemaTestClass); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.TestBodyWithFileSchema(*fileSchemaTestClass) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // TestBodyWithQueryParams - -func TestBodyWithQueryParams(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *FakeApiController) TestBodyWithQueryParams(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + query := query.Get("query") + user := &User{} + if err := json.NewDecoder(r.Body).Decode(&user); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.TestBodyWithQueryParams(query, *user) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // TestClientModel - To test \"client\" model -func TestClientModel(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *FakeApiController) TestClientModel(w http.ResponseWriter, r *http.Request) { + client := &Client{} + if err := json.NewDecoder(r.Body).Decode(&client); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.TestClientModel(*client) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // TestEndpointParameters - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -func TestEndpointParameters(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *FakeApiController) TestEndpointParameters(w http.ResponseWriter, r *http.Request) { + err := r.ParseForm() + if err != nil { + w.WriteHeader(500) + return + } + + number := r.FormValue("number") + double := r.FormValue("double") + patternWithoutDelimiter := r.FormValue("patternWithoutDelimiter") + byte_ := r.FormValue("byte_") + integer := r.FormValue("integer") + int32_ := r.FormValue("int32_") + int64_, err := parseIntParameter( r.FormValue("int64_")) + if err != nil { + w.WriteHeader(500) + return + } + + float := r.FormValue("float") + string_ := r.FormValue("string_") + binary, err := ReadFormFileToTempFile(r, "binary") + if err != nil { + w.WriteHeader(500) + return + } + + date := r.FormValue("date") + dateTime := r.FormValue("dateTime") + password := r.FormValue("password") + callback := r.FormValue("callback") + result, err := c.service.TestEndpointParameters(number, double, patternWithoutDelimiter, byte_, integer, int32_, int64_, float, string_, binary, date, dateTime, password, callback) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // TestEnumParameters - To test enum parameters -func TestEnumParameters(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *FakeApiController) TestEnumParameters(w http.ResponseWriter, r *http.Request) { + err := r.ParseForm() + if err != nil { + w.WriteHeader(500) + return + } + + query := r.URL.Query() + enumHeaderStringArray := r.Header.Get("enumHeaderStringArray") + enumHeaderString := r.Header.Get("enumHeaderString") + enumQueryStringArray := strings.Split(query.Get("enumQueryStringArray"), ",") + enumQueryString := query.Get("enumQueryString") + enumQueryInteger := query.Get("enumQueryInteger") + enumQueryDouble := query.Get("enumQueryDouble") + enumFormStringArray := r.FormValue("enumFormStringArray") + enumFormString := r.FormValue("enumFormString") + result, err := c.service.TestEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // TestGroupParameters - Fake endpoint to test group parameters (optional) -func TestGroupParameters(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *FakeApiController) TestGroupParameters(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + requiredStringGroup := query.Get("requiredStringGroup") + requiredBooleanGroup := r.Header.Get("requiredBooleanGroup") + requiredInt64Group, err := parseIntParameter(query.Get("requiredInt64Group")) + if err != nil { + w.WriteHeader(500) + return + } + + stringGroup := query.Get("stringGroup") + booleanGroup := r.Header.Get("booleanGroup") + int64Group, err := parseIntParameter(query.Get("int64Group")) + if err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.TestGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // TestInlineAdditionalProperties - test inline additionalProperties -func TestInlineAdditionalProperties(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *FakeApiController) TestInlineAdditionalProperties(w http.ResponseWriter, r *http.Request) { + requestBody := &map[string]string{} + if err := json.NewDecoder(r.Body).Decode(&requestBody); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.TestInlineAdditionalProperties(*requestBody) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // TestJsonFormData - test json serialization of form data -func TestJsonFormData(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *FakeApiController) TestJsonFormData(w http.ResponseWriter, r *http.Request) { + err := r.ParseForm() + if err != nil { + w.WriteHeader(500) + return + } + + param := r.FormValue("param") + param2 := r.FormValue("param2") + result, err := c.service.TestJsonFormData(param, param2) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // TestQueryParameterCollectionFormat - -func TestQueryParameterCollectionFormat(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *FakeApiController) TestQueryParameterCollectionFormat(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + pipe := strings.Split(query.Get("pipe"), ",") + ioutil := strings.Split(query.Get("ioutil"), ",") + http := strings.Split(query.Get("http"), ",") + url := strings.Split(query.Get("url"), ",") + context := strings.Split(query.Get("context"), ",") + result, err := c.service.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } diff --git a/samples/openapi3/server/petstore/go-api-server/go/api_fake_classname_tags123.go b/samples/openapi3/server/petstore/go-api-server/go/api_fake_classname_tags123.go index 395c1b25346..998465c23a4 100644 --- a/samples/openapi3/server/petstore/go-api-server/go/api_fake_classname_tags123.go +++ b/samples/openapi3/server/petstore/go-api-server/go/api_fake_classname_tags123.go @@ -10,11 +10,48 @@ package petstoreserver import ( + "encoding/json" "net/http" + "strings" + + "github.com/gorilla/mux" ) -// TestClassname - To test class name in snake case -func TestClassname(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +// A FakeClassnameTags123ApiController binds http requests to an api service and writes the service results to the http response +type FakeClassnameTags123ApiController struct { + service FakeClassnameTags123ApiServicer +} + +// NewFakeClassnameTags123ApiController creates a default api controller +func NewFakeClassnameTags123ApiController(s FakeClassnameTags123ApiServicer) Router { + return &FakeClassnameTags123ApiController{ service: s } +} + +// Routes returns all of the api route for the FakeClassnameTags123ApiController +func (c *FakeClassnameTags123ApiController) Routes() Routes { + return Routes{ + { + "TestClassname", + strings.ToUpper("Patch"), + "/v2/fake_classname_test", + c.TestClassname, + }, + } +} + +// TestClassname - To test class name in snake case +func (c *FakeClassnameTags123ApiController) TestClassname(w http.ResponseWriter, r *http.Request) { + client := &Client{} + if err := json.NewDecoder(r.Body).Decode(&client); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.TestClassname(*client) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } diff --git a/samples/openapi3/server/petstore/go-api-server/go/api_pet.go b/samples/openapi3/server/petstore/go-api-server/go/api_pet.go index fc0d47c146c..867c12e0895 100644 --- a/samples/openapi3/server/petstore/go-api-server/go/api_pet.go +++ b/samples/openapi3/server/petstore/go-api-server/go/api_pet.go @@ -10,59 +10,264 @@ package petstoreserver import ( + "encoding/json" "net/http" + "strings" + + "github.com/gorilla/mux" ) +// A PetApiController binds http requests to an api service and writes the service results to the http response +type PetApiController struct { + service PetApiServicer +} + +// NewPetApiController creates a default api controller +func NewPetApiController(s PetApiServicer) Router { + return &PetApiController{ service: s } +} + +// Routes returns all of the api route for the PetApiController +func (c *PetApiController) Routes() Routes { + return Routes{ + { + "AddPet", + strings.ToUpper("Post"), + "/v2/pet", + c.AddPet, + }, + { + "DeletePet", + strings.ToUpper("Delete"), + "/v2/pet/{petId}", + c.DeletePet, + }, + { + "FindPetsByStatus", + strings.ToUpper("Get"), + "/v2/pet/findByStatus", + c.FindPetsByStatus, + }, + { + "FindPetsByTags", + strings.ToUpper("Get"), + "/v2/pet/findByTags", + c.FindPetsByTags, + }, + { + "GetPetById", + strings.ToUpper("Get"), + "/v2/pet/{petId}", + c.GetPetById, + }, + { + "UpdatePet", + strings.ToUpper("Put"), + "/v2/pet", + c.UpdatePet, + }, + { + "UpdatePetWithForm", + strings.ToUpper("Post"), + "/v2/pet/{petId}", + c.UpdatePetWithForm, + }, + { + "UploadFile", + strings.ToUpper("Post"), + "/v2/pet/{petId}/uploadImage", + c.UploadFile, + }, + { + "UploadFileWithRequiredFile", + strings.ToUpper("Post"), + "/v2/fake/{petId}/uploadImageWithRequiredFile", + c.UploadFileWithRequiredFile, + }, + } +} + // AddPet - Add a new pet to the store -func AddPet(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *PetApiController) AddPet(w http.ResponseWriter, r *http.Request) { + pet := &Pet{} + if err := json.NewDecoder(r.Body).Decode(&pet); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.AddPet(*pet) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // DeletePet - Deletes a pet -func DeletePet(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *PetApiController) DeletePet(w http.ResponseWriter, r *http.Request) { + params := mux.Vars(r) + petId, err := parseIntParameter(params["petId"]) + if err != nil { + w.WriteHeader(500) + return + } + + apiKey := r.Header.Get("apiKey") + result, err := c.service.DeletePet(petId, apiKey) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // FindPetsByStatus - Finds Pets by status -func FindPetsByStatus(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *PetApiController) FindPetsByStatus(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + status := strings.Split(query.Get("status"), ",") + result, err := c.service.FindPetsByStatus(status) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // FindPetsByTags - Finds Pets by tags -func FindPetsByTags(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *PetApiController) FindPetsByTags(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + tags := strings.Split(query.Get("tags"), ",") + result, err := c.service.FindPetsByTags(tags) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // GetPetById - Find pet by ID -func GetPetById(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *PetApiController) GetPetById(w http.ResponseWriter, r *http.Request) { + params := mux.Vars(r) + petId, err := parseIntParameter(params["petId"]) + if err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.GetPetById(petId) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // UpdatePet - Update an existing pet -func UpdatePet(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *PetApiController) UpdatePet(w http.ResponseWriter, r *http.Request) { + pet := &Pet{} + if err := json.NewDecoder(r.Body).Decode(&pet); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.UpdatePet(*pet) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // UpdatePetWithForm - Updates a pet in the store with form data -func UpdatePetWithForm(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *PetApiController) UpdatePetWithForm(w http.ResponseWriter, r *http.Request) { + err := r.ParseForm() + if err != nil { + w.WriteHeader(500) + return + } + + params := mux.Vars(r) + petId, err := parseIntParameter(params["petId"]) + if err != nil { + w.WriteHeader(500) + return + } + + name := r.FormValue("name") + status := r.FormValue("status") + result, err := c.service.UpdatePetWithForm(petId, name, status) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // UploadFile - uploads an image -func UploadFile(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *PetApiController) UploadFile(w http.ResponseWriter, r *http.Request) { + err := r.ParseForm() + if err != nil { + w.WriteHeader(500) + return + } + + params := mux.Vars(r) + petId, err := parseIntParameter(params["petId"]) + if err != nil { + w.WriteHeader(500) + return + } + + additionalMetadata := r.FormValue("additionalMetadata") + file, err := ReadFormFileToTempFile(r, "file") + if err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.UploadFile(petId, additionalMetadata, file) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // UploadFileWithRequiredFile - uploads an image (required) -func UploadFileWithRequiredFile(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *PetApiController) UploadFileWithRequiredFile(w http.ResponseWriter, r *http.Request) { + err := r.ParseForm() + if err != nil { + w.WriteHeader(500) + return + } + + params := mux.Vars(r) + petId, err := parseIntParameter(params["petId"]) + if err != nil { + w.WriteHeader(500) + return + } + + requiredFile, err := ReadFormFileToTempFile(r, "requiredFile") + if err != nil { + w.WriteHeader(500) + return + } + + additionalMetadata := r.FormValue("additionalMetadata") + result, err := c.service.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } diff --git a/samples/openapi3/server/petstore/go-api-server/go/api_store.go b/samples/openapi3/server/petstore/go-api-server/go/api_store.go index aa5d01548b8..5867035964e 100644 --- a/samples/openapi3/server/petstore/go-api-server/go/api_store.go +++ b/samples/openapi3/server/petstore/go-api-server/go/api_store.go @@ -10,29 +10,108 @@ package petstoreserver import ( + "encoding/json" "net/http" + "strings" + + "github.com/gorilla/mux" ) +// A StoreApiController binds http requests to an api service and writes the service results to the http response +type StoreApiController struct { + service StoreApiServicer +} + +// NewStoreApiController creates a default api controller +func NewStoreApiController(s StoreApiServicer) Router { + return &StoreApiController{ service: s } +} + +// Routes returns all of the api route for the StoreApiController +func (c *StoreApiController) Routes() Routes { + return Routes{ + { + "DeleteOrder", + strings.ToUpper("Delete"), + "/v2/store/order/{order_id}", + c.DeleteOrder, + }, + { + "GetInventory", + strings.ToUpper("Get"), + "/v2/store/inventory", + c.GetInventory, + }, + { + "GetOrderById", + strings.ToUpper("Get"), + "/v2/store/order/{order_id}", + c.GetOrderById, + }, + { + "PlaceOrder", + strings.ToUpper("Post"), + "/v2/store/order", + c.PlaceOrder, + }, + } +} + // DeleteOrder - Delete purchase order by ID -func DeleteOrder(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *StoreApiController) DeleteOrder(w http.ResponseWriter, r *http.Request) { + params := mux.Vars(r) + orderId := params["orderId"] + result, err := c.service.DeleteOrder(orderId) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // GetInventory - Returns pet inventories by status -func GetInventory(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *StoreApiController) GetInventory(w http.ResponseWriter, r *http.Request) { + result, err := c.service.GetInventory() + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // GetOrderById - Find purchase order by ID -func GetOrderById(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *StoreApiController) GetOrderById(w http.ResponseWriter, r *http.Request) { + params := mux.Vars(r) + orderId, err := parseIntParameter(params["orderId"]) + if err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.GetOrderById(orderId) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // PlaceOrder - Place an order for a pet -func PlaceOrder(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *StoreApiController) PlaceOrder(w http.ResponseWriter, r *http.Request) { + order := &Order{} + if err := json.NewDecoder(r.Body).Decode(&order); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.PlaceOrder(*order) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } diff --git a/samples/openapi3/server/petstore/go-api-server/go/api_user.go b/samples/openapi3/server/petstore/go-api-server/go/api_user.go index aca15233a09..35fd6713eb7 100644 --- a/samples/openapi3/server/petstore/go-api-server/go/api_user.go +++ b/samples/openapi3/server/petstore/go-api-server/go/api_user.go @@ -10,53 +10,194 @@ package petstoreserver import ( + "encoding/json" "net/http" + "strings" + + "github.com/gorilla/mux" ) +// A UserApiController binds http requests to an api service and writes the service results to the http response +type UserApiController struct { + service UserApiServicer +} + +// NewUserApiController creates a default api controller +func NewUserApiController(s UserApiServicer) Router { + return &UserApiController{ service: s } +} + +// Routes returns all of the api route for the UserApiController +func (c *UserApiController) Routes() Routes { + return Routes{ + { + "CreateUser", + strings.ToUpper("Post"), + "/v2/user", + c.CreateUser, + }, + { + "CreateUsersWithArrayInput", + strings.ToUpper("Post"), + "/v2/user/createWithArray", + c.CreateUsersWithArrayInput, + }, + { + "CreateUsersWithListInput", + strings.ToUpper("Post"), + "/v2/user/createWithList", + c.CreateUsersWithListInput, + }, + { + "DeleteUser", + strings.ToUpper("Delete"), + "/v2/user/{username}", + c.DeleteUser, + }, + { + "GetUserByName", + strings.ToUpper("Get"), + "/v2/user/{username}", + c.GetUserByName, + }, + { + "LoginUser", + strings.ToUpper("Get"), + "/v2/user/login", + c.LoginUser, + }, + { + "LogoutUser", + strings.ToUpper("Get"), + "/v2/user/logout", + c.LogoutUser, + }, + { + "UpdateUser", + strings.ToUpper("Put"), + "/v2/user/{username}", + c.UpdateUser, + }, + } +} + // CreateUser - Create user -func CreateUser(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *UserApiController) CreateUser(w http.ResponseWriter, r *http.Request) { + user := &User{} + if err := json.NewDecoder(r.Body).Decode(&user); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.CreateUser(*user) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // CreateUsersWithArrayInput - Creates list of users with given input array -func CreateUsersWithArrayInput(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *UserApiController) CreateUsersWithArrayInput(w http.ResponseWriter, r *http.Request) { + user := &[]User{} + if err := json.NewDecoder(r.Body).Decode(&user); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.CreateUsersWithArrayInput(*user) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // CreateUsersWithListInput - Creates list of users with given input array -func CreateUsersWithListInput(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *UserApiController) CreateUsersWithListInput(w http.ResponseWriter, r *http.Request) { + user := &[]User{} + if err := json.NewDecoder(r.Body).Decode(&user); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.CreateUsersWithListInput(*user) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // DeleteUser - Delete user -func DeleteUser(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *UserApiController) DeleteUser(w http.ResponseWriter, r *http.Request) { + params := mux.Vars(r) + username := params["username"] + result, err := c.service.DeleteUser(username) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // GetUserByName - Get user by user name -func GetUserByName(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *UserApiController) GetUserByName(w http.ResponseWriter, r *http.Request) { + params := mux.Vars(r) + username := params["username"] + result, err := c.service.GetUserByName(username) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // LoginUser - Logs user into the system -func LoginUser(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *UserApiController) LoginUser(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + username := query.Get("username") + password := query.Get("password") + result, err := c.service.LoginUser(username, password) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // LogoutUser - Logs out current logged in user session -func LogoutUser(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *UserApiController) LogoutUser(w http.ResponseWriter, r *http.Request) { + result, err := c.service.LogoutUser() + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } // UpdateUser - Updated user -func UpdateUser(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "application/json; charset=UTF-8") - w.WriteHeader(http.StatusOK) +func (c *UserApiController) UpdateUser(w http.ResponseWriter, r *http.Request) { + params := mux.Vars(r) + username := params["username"] + user := &User{} + if err := json.NewDecoder(r.Body).Decode(&user); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.UpdateUser(username, *user) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) } diff --git a/samples/openapi3/server/petstore/go-api-server/go/routers.go b/samples/openapi3/server/petstore/go-api-server/go/routers.go index 616ae81843d..1a166f390e8 100644 --- a/samples/openapi3/server/petstore/go-api-server/go/routers.go +++ b/samples/openapi3/server/petstore/go-api-server/go/routers.go @@ -10,13 +10,15 @@ package petstoreserver import ( - "fmt" + "encoding/json" + "io/ioutil" "net/http" - "strings" - + "os" + "strconv" "github.com/gorilla/mux" ) +// A Route defines the parameters for an api endpoint type Route struct { Name string Method string @@ -24,300 +26,71 @@ type Route struct { HandlerFunc http.HandlerFunc } +// Routes are a collection of defined api endpoints type Routes []Route -func NewRouter() *mux.Router { - router := mux.NewRouter().StrictSlash(true) - for _, route := range routes { - var handler http.Handler - handler = route.HandlerFunc - handler = Logger(handler, route.Name) +// Router defines the required methods for retrieving api routes +type Router interface { + Routes() Routes +} - router. - Methods(route.Method). - Path(route.Pattern). - Name(route.Name). - Handler(handler) +// NewRouter creates a new router for any number of api routers +func NewRouter(routers ...Router) *mux.Router { + router := mux.NewRouter().StrictSlash(true) + for _, api := range routers { + for _, route := range api.Routes() { + var handler http.Handler + handler = route.HandlerFunc + handler = Logger(handler, route.Name) + + router. + Methods(route.Method). + Path(route.Pattern). + Name(route.Name). + Handler(handler) + } } return router } -func Index(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, "Hello World!") +// EncodeJSONResponse uses the json encoder to write an interface to the http response with an optional status code +func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + if status != nil { + w.WriteHeader(*status) + } else { + w.WriteHeader(http.StatusOK) + } + + return json.NewEncoder(w).Encode(i) } -var routes = Routes{ - { - "Index", - "GET", - "/v2/", - Index, - }, +// ReadFormFileToTempFile reads file data from a request form and writes it to a temporary file +func ReadFormFileToTempFile(r *http.Request, key string) (*os.File, error) { + r.ParseForm() + formFile, _, err := r.FormFile(key) + if err != nil { + return nil, err + } - { - "Call123TestSpecialTags", - strings.ToUpper("Patch"), - "/v2/another-fake/dummy", - Call123TestSpecialTags, - }, + defer formFile.Close() + file, err := ioutil.TempFile("tmp", key) + if err != nil { + return nil, err + } - { - "FooGet", - strings.ToUpper("Get"), - "/v2/foo", - FooGet, - }, + defer file.Close() + fileBytes, err := ioutil.ReadAll(formFile) + if err != nil { + return nil, err + } - { - "FakeHealthGet", - strings.ToUpper("Get"), - "/v2/fake/health", - FakeHealthGet, - }, - - { - "FakeOuterBooleanSerialize", - strings.ToUpper("Post"), - "/v2/fake/outer/boolean", - FakeOuterBooleanSerialize, - }, - - { - "FakeOuterCompositeSerialize", - strings.ToUpper("Post"), - "/v2/fake/outer/composite", - FakeOuterCompositeSerialize, - }, - - { - "FakeOuterNumberSerialize", - strings.ToUpper("Post"), - "/v2/fake/outer/number", - FakeOuterNumberSerialize, - }, - - { - "FakeOuterStringSerialize", - strings.ToUpper("Post"), - "/v2/fake/outer/string", - FakeOuterStringSerialize, - }, - - { - "TestBodyWithFileSchema", - strings.ToUpper("Put"), - "/v2/fake/body-with-file-schema", - TestBodyWithFileSchema, - }, - - { - "TestBodyWithQueryParams", - strings.ToUpper("Put"), - "/v2/fake/body-with-query-params", - TestBodyWithQueryParams, - }, - - { - "TestClientModel", - strings.ToUpper("Patch"), - "/v2/fake", - TestClientModel, - }, - - { - "TestEndpointParameters", - strings.ToUpper("Post"), - "/v2/fake", - TestEndpointParameters, - }, - - { - "TestEnumParameters", - strings.ToUpper("Get"), - "/v2/fake", - TestEnumParameters, - }, - - { - "TestGroupParameters", - strings.ToUpper("Delete"), - "/v2/fake", - TestGroupParameters, - }, - - { - "TestInlineAdditionalProperties", - strings.ToUpper("Post"), - "/v2/fake/inline-additionalProperties", - TestInlineAdditionalProperties, - }, - - { - "TestJsonFormData", - strings.ToUpper("Get"), - "/v2/fake/jsonFormData", - TestJsonFormData, - }, - - { - "TestQueryParameterCollectionFormat", - strings.ToUpper("Put"), - "/v2/fake/test-query-paramters", - TestQueryParameterCollectionFormat, - }, - - { - "TestClassname", - strings.ToUpper("Patch"), - "/v2/fake_classname_test", - TestClassname, - }, - - { - "AddPet", - strings.ToUpper("Post"), - "/v2/pet", - AddPet, - }, - - { - "DeletePet", - strings.ToUpper("Delete"), - "/v2/pet/{petId}", - DeletePet, - }, - - { - "FindPetsByStatus", - strings.ToUpper("Get"), - "/v2/pet/findByStatus", - FindPetsByStatus, - }, - - { - "FindPetsByTags", - strings.ToUpper("Get"), - "/v2/pet/findByTags", - FindPetsByTags, - }, - - { - "GetPetById", - strings.ToUpper("Get"), - "/v2/pet/{petId}", - GetPetById, - }, - - { - "UpdatePet", - strings.ToUpper("Put"), - "/v2/pet", - UpdatePet, - }, - - { - "UpdatePetWithForm", - strings.ToUpper("Post"), - "/v2/pet/{petId}", - UpdatePetWithForm, - }, - - { - "UploadFile", - strings.ToUpper("Post"), - "/v2/pet/{petId}/uploadImage", - UploadFile, - }, - - { - "UploadFileWithRequiredFile", - strings.ToUpper("Post"), - "/v2/fake/{petId}/uploadImageWithRequiredFile", - UploadFileWithRequiredFile, - }, - - { - "DeleteOrder", - strings.ToUpper("Delete"), - "/v2/store/order/{order_id}", - DeleteOrder, - }, - - { - "GetInventory", - strings.ToUpper("Get"), - "/v2/store/inventory", - GetInventory, - }, - - { - "GetOrderById", - strings.ToUpper("Get"), - "/v2/store/order/{order_id}", - GetOrderById, - }, - - { - "PlaceOrder", - strings.ToUpper("Post"), - "/v2/store/order", - PlaceOrder, - }, - - { - "CreateUser", - strings.ToUpper("Post"), - "/v2/user", - CreateUser, - }, - - { - "CreateUsersWithArrayInput", - strings.ToUpper("Post"), - "/v2/user/createWithArray", - CreateUsersWithArrayInput, - }, - - { - "CreateUsersWithListInput", - strings.ToUpper("Post"), - "/v2/user/createWithList", - CreateUsersWithListInput, - }, - - { - "DeleteUser", - strings.ToUpper("Delete"), - "/v2/user/{username}", - DeleteUser, - }, - - { - "GetUserByName", - strings.ToUpper("Get"), - "/v2/user/{username}", - GetUserByName, - }, - - { - "LoginUser", - strings.ToUpper("Get"), - "/v2/user/login", - LoginUser, - }, - - { - "LogoutUser", - strings.ToUpper("Get"), - "/v2/user/logout", - LogoutUser, - }, - - { - "UpdateUser", - strings.ToUpper("Put"), - "/v2/user/{username}", - UpdateUser, - }, + file.Write(fileBytes) + return file, nil +} + +// parseIntParameter parses a sting parameter to an int64 +func parseIntParameter(param string) (int64, error) { + return strconv.ParseInt(param, 10, 64) } diff --git a/samples/openapi3/server/petstore/go-api-server/main.go b/samples/openapi3/server/petstore/go-api-server/main.go index 235915e27a2..d4444720003 100644 --- a/samples/openapi3/server/petstore/go-api-server/main.go +++ b/samples/openapi3/server/petstore/go-api-server/main.go @@ -13,20 +13,34 @@ import ( "log" "net/http" - // WARNING! - // Change this to a fully-qualified import path - // once you place this file into your project. - // For example, - // - // sw "github.com/myname/myrepo/go" - // - sw "./go" + petstoreserver "github.com/GIT_USER_ID/GIT_REPO_ID/go" ) func main() { log.Printf("Server started") - router := sw.NewRouter() + AnotherFakeApiService := petstoreserver.NewAnotherFakeApiService() + AnotherFakeApiController := petstoreserver.NewAnotherFakeApiController(AnotherFakeApiService) + + DefaultApiService := petstoreserver.NewDefaultApiService() + DefaultApiController := petstoreserver.NewDefaultApiController(DefaultApiService) + + FakeApiService := petstoreserver.NewFakeApiService() + FakeApiController := petstoreserver.NewFakeApiController(FakeApiService) + + FakeClassnameTags123ApiService := petstoreserver.NewFakeClassnameTags123ApiService() + FakeClassnameTags123ApiController := petstoreserver.NewFakeClassnameTags123ApiController(FakeClassnameTags123ApiService) + + PetApiService := petstoreserver.NewPetApiService() + PetApiController := petstoreserver.NewPetApiController(PetApiService) + + StoreApiService := petstoreserver.NewStoreApiService() + StoreApiController := petstoreserver.NewStoreApiController(StoreApiService) + + UserApiService := petstoreserver.NewUserApiService() + UserApiController := petstoreserver.NewUserApiController(UserApiService) + + router := petstoreserver.NewRouter(AnotherFakeApiController, DefaultApiController, FakeApiController, FakeClassnameTags123ApiController, PetApiController, StoreApiController, UserApiController) log.Fatal(http.ListenAndServe(":8080", router)) } diff --git a/samples/openapi3/server/petstore/go-gin-api-server/.openapi-generator/VERSION b/samples/openapi3/server/petstore/go-gin-api-server/.openapi-generator/VERSION index c3a2c7076fa..58592f031f6 100644 --- a/samples/openapi3/server/petstore/go-gin-api-server/.openapi-generator/VERSION +++ b/samples/openapi3/server/petstore/go-gin-api-server/.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/openapi3/server/petstore/python-flask-python2/.gitignore b/samples/openapi3/server/petstore/python-flask-python2/.gitignore index a655050c263..43995bd42fa 100644 --- a/samples/openapi3/server/petstore/python-flask-python2/.gitignore +++ b/samples/openapi3/server/petstore/python-flask-python2/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/openapi3/server/petstore/python-flask-python2/requirements.txt b/samples/openapi3/server/petstore/python-flask-python2/requirements.txt index bc535706622..5c5ce2a1a26 100644 --- a/samples/openapi3/server/petstore/python-flask-python2/requirements.txt +++ b/samples/openapi3/server/petstore/python-flask-python2/requirements.txt @@ -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 typing >= 3.5.2.2 diff --git a/samples/openapi3/server/petstore/python-flask-python2/test-requirements.txt b/samples/openapi3/server/petstore/python-flask-python2/test-requirements.txt index 7f8d96e6b40..a2626d875ff 100644 --- a/samples/openapi3/server/petstore/python-flask-python2/test-requirements.txt +++ b/samples/openapi3/server/petstore/python-flask-python2/test-requirements.txt @@ -1,6 +1,4 @@ -flask_testing==0.6.1 -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +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 +flask_testing==0.6.1 \ No newline at end of file diff --git a/samples/openapi3/server/petstore/python-flask-python2/tox.ini b/samples/openapi3/server/petstore/python-flask-python2/tox.ini index 26985414c88..d05c607610c 100644 --- a/samples/openapi3/server/petstore/python-flask-python2/tox.ini +++ b/samples/openapi3/server/petstore/python-flask-python2/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] \ No newline at end of file + pytest --cov=openapi_server \ No newline at end of file diff --git a/samples/openapi3/server/petstore/python-flask/.gitignore b/samples/openapi3/server/petstore/python-flask/.gitignore index a655050c263..43995bd42fa 100644 --- a/samples/openapi3/server/petstore/python-flask/.gitignore +++ b/samples/openapi3/server/petstore/python-flask/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/openapi3/server/petstore/python-flask/requirements.txt b/samples/openapi3/server/petstore/python-flask/requirements.txt index 1a01b580490..029a9dae4cd 100644 --- a/samples/openapi3/server/petstore/python-flask/requirements.txt +++ b/samples/openapi3/server/petstore/python-flask/requirements.txt @@ -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 setuptools >= 21.0.0 diff --git a/samples/openapi3/server/petstore/python-flask/test-requirements.txt b/samples/openapi3/server/petstore/python-flask/test-requirements.txt index 7f8d96e6b40..a2626d875ff 100644 --- a/samples/openapi3/server/petstore/python-flask/test-requirements.txt +++ b/samples/openapi3/server/petstore/python-flask/test-requirements.txt @@ -1,6 +1,4 @@ -flask_testing==0.6.1 -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +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 +flask_testing==0.6.1 \ No newline at end of file diff --git a/samples/openapi3/server/petstore/python-flask/tox.ini b/samples/openapi3/server/petstore/python-flask/tox.ini index ab4dfbb81b8..cff71191e6c 100644 --- a/samples/openapi3/server/petstore/python-flask/tox.ini +++ b/samples/openapi3/server/petstore/python-flask/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] \ No newline at end of file + pytest --cov=openapi_server \ No newline at end of file diff --git a/samples/schema/petstore/mysql/mysql_schema.sql b/samples/schema/petstore/mysql/mysql_schema.sql index e08b704631a..21145731600 100644 --- a/samples/schema/petstore/mysql/mysql_schema.sql +++ b/samples/schema/petstore/mysql/mysql_schema.sql @@ -142,6 +142,25 @@ CREATE TABLE IF NOT EXISTS `ArrayTest` ( `array_array_of_model` JSON DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +-- +-- Table structure for table `BigCat` generated from model 'BigCat' +-- + +CREATE TABLE IF NOT EXISTS `BigCat` ( + `className` TEXT NOT NULL, + `color` TEXT, + `declawed` TINYINT(1) DEFAULT NULL, + `kind` ENUM('lions', 'tigers', 'leopards', 'jaguars') DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `BigCat_allOf` generated from model 'BigCatUnderscoreallOf' +-- + +CREATE TABLE IF NOT EXISTS `BigCat_allOf` ( + `kind` ENUM('lions', 'tigers', 'leopards', 'jaguars') DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + -- -- Table structure for table `Capitalization` generated from model 'Capitalization' -- diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/BigCat.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..10e898679c9 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/BigCat.java @@ -0,0 +1,113 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; + +/** + * BigCat + */ + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String text) { + for (KindEnum b : KindEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @ApiModelProperty(value = "") + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..ca787eb1f21 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,110 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String text) { + for (KindEnum b : KindEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @ApiModelProperty(value = "") + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/BigCat.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/BigCat.java new file mode 100644 index 00000000000..0d6ca05971f --- /dev/null +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/BigCat.java @@ -0,0 +1,112 @@ +package apimodels; + +import apimodels.BigCatAllOf; +import apimodels.Cat; +import com.fasterxml.jackson.annotation.*; +import java.util.Set; +import javax.validation.*; +import java.util.Objects; +import javax.validation.constraints.*; +/** + * BigCat + */ + +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private final String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + @SuppressWarnings("StringBufferReplaceableByString") + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/BigCatAllOf.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/BigCatAllOf.java new file mode 100644 index 00000000000..b0efcc1fc70 --- /dev/null +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/BigCatAllOf.java @@ -0,0 +1,109 @@ +package apimodels; + +import com.fasterxml.jackson.annotation.*; +import java.util.Set; +import javax.validation.*; +import java.util.Objects; +import javax.validation.constraints.*; +/** + * BigCatAllOf + */ + +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private final String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + @SuppressWarnings("StringBufferReplaceableByString") + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/public/openapi.json b/samples/server/petstore/java-play-framework-fake-endpoints/public/openapi.json index d3100df48a1..a41ef03feb1 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/public/openapi.json +++ b/samples/server/petstore/java-play-framework-fake-endpoints/public/openapi.json @@ -1934,6 +1934,13 @@ "$ref" : "#/components/schemas/Cat_allOf" } ] }, + "BigCat" : { + "allOf" : [ { + "$ref" : "#/components/schemas/Cat" + }, { + "$ref" : "#/components/schemas/BigCat_allOf" + } ] + }, "Animal" : { "discriminator" : { "propertyName" : "className" @@ -2828,6 +2835,14 @@ "type" : "boolean" } } + }, + "BigCat_allOf" : { + "properties" : { + "kind" : { + "enum" : [ "lions", "tigers", "leopards", "jaguars" ], + "type" : "string" + } + } } }, "securitySchemes" : { diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Animal.java index cac03555be3..1e9de17e442 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Animal.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/BigCat.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..b325b3016b1 --- /dev/null +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/BigCat.java @@ -0,0 +1,97 @@ +package org.openapitools.model; + +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class BigCat extends Cat { + +@XmlType(name="KindEnum") +@XmlEnum(String.class) +public enum KindEnum { + +@XmlEnumValue("lions") LIONS(String.valueOf("lions")), @XmlEnumValue("tigers") TIGERS(String.valueOf("tigers")), @XmlEnumValue("leopards") LEOPARDS(String.valueOf("leopards")), @XmlEnumValue("jaguars") JAGUARS(String.valueOf("jaguars")); + + + private String value; + + KindEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + @ApiModelProperty(value = "") + private KindEnum kind; + /** + * Get kind + * @return kind + **/ + @JsonProperty("kind") + public String getKind() { + if (kind == null) { + return null; + } + return kind.value(); + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..be03a0209d2 --- /dev/null +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,95 @@ +package org.openapitools.model; + +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class BigCatAllOf { + +@XmlType(name="KindEnum") +@XmlEnum(String.class) +public enum KindEnum { + +@XmlEnumValue("lions") LIONS(String.valueOf("lions")), @XmlEnumValue("tigers") TIGERS(String.valueOf("tigers")), @XmlEnumValue("leopards") LEOPARDS(String.valueOf("leopards")), @XmlEnumValue("jaguars") JAGUARS(String.valueOf("jaguars")); + + + private String value; + + KindEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + @ApiModelProperty(value = "") + private KindEnum kind; + /** + * Get kind + * @return kind + **/ + @JsonProperty("kind") + public String getKind() { + if (kind == null) { + return null; + } + return kind.value(); + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Animal.java index 841c01f67b8..aa2b0ea26b3 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Animal.java @@ -36,6 +36,7 @@ import javax.validation.Valid; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal implements Serializable { diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/BigCat.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..45a515a2355 --- /dev/null +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/BigCat.java @@ -0,0 +1,137 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat implements Serializable { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + @JsonProperty(JSON_PROPERTY_KIND) + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @JsonProperty("kind") + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..adc84d7897a --- /dev/null +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,134 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf implements Serializable { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + @JsonProperty(JSON_PROPERTY_KIND) + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @JsonProperty("kind") + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Animal.java index 48269bab57d..43bfbb7fd24 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Animal.java @@ -18,6 +18,7 @@ import com.fasterxml.jackson.annotation.JsonValue; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/BigCat.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..c3c4bfcfb59 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/BigCat.java @@ -0,0 +1,113 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + + + +public class BigCat extends Cat implements Serializable { + + +public enum KindEnum { + + LIONS(String.valueOf("lions")), TIGERS(String.valueOf("tigers")), LEOPARDS(String.valueOf("leopards")), JAGUARS(String.valueOf("jaguars")); + + + private String value; + + KindEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private @Valid KindEnum kind; + + /** + **/ + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("kind") + public KindEnum getKind() { + return kind; + } + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..d3eb97becef --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,110 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + + + +public class BigCatAllOf implements Serializable { + + +public enum KindEnum { + + LIONS(String.valueOf("lions")), TIGERS(String.valueOf("tigers")), LEOPARDS(String.valueOf("leopards")), JAGUARS(String.valueOf("jaguars")); + + + private String value; + + KindEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private @Valid KindEnum kind; + + /** + **/ + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("kind") + public KindEnum getKind() { + return kind; + } + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml b/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml index ccb16e949ad..79ba65f66ee 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml +++ b/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml @@ -1557,6 +1557,10 @@ components: allOf: - $ref: '#/components/schemas/Animal' - $ref: '#/components/schemas/Cat_allOf' + BigCat: + allOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/BigCat_allOf' Animal: discriminator: propertyName: className @@ -2221,6 +2225,15 @@ components: properties: declawed: type: boolean + BigCat_allOf: + properties: + kind: + enum: + - lions + - tigers + - leopards + - jaguars + type: string securitySchemes: petstore_auth: flows: diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Animal.java index 48269bab57d..43bfbb7fd24 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Animal.java @@ -18,6 +18,7 @@ import com.fasterxml.jackson.annotation.JsonValue; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/BigCat.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..c3c4bfcfb59 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/BigCat.java @@ -0,0 +1,113 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + + + +public class BigCat extends Cat implements Serializable { + + +public enum KindEnum { + + LIONS(String.valueOf("lions")), TIGERS(String.valueOf("tigers")), LEOPARDS(String.valueOf("leopards")), JAGUARS(String.valueOf("jaguars")); + + + private String value; + + KindEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private @Valid KindEnum kind; + + /** + **/ + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("kind") + public KindEnum getKind() { + return kind; + } + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..d3eb97becef --- /dev/null +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,110 @@ +package org.openapitools.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import io.swagger.annotations.*; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + + + +public class BigCatAllOf implements Serializable { + + +public enum KindEnum { + + LIONS(String.valueOf("lions")), TIGERS(String.valueOf("tigers")), LEOPARDS(String.valueOf("leopards")), JAGUARS(String.valueOf("jaguars")); + + + private String value; + + KindEnum (String v) { + value = v; + } + + public String value() { + return value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + + private @Valid KindEnum kind; + + /** + **/ + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("kind") + public KindEnum getKind() { + return kind; + } + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml b/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml index ccb16e949ad..79ba65f66ee 100644 --- a/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml +++ b/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml @@ -1557,6 +1557,10 @@ components: allOf: - $ref: '#/components/schemas/Animal' - $ref: '#/components/schemas/Cat_allOf' + BigCat: + allOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/BigCat_allOf' Animal: discriminator: propertyName: className @@ -2221,6 +2225,15 @@ components: properties: declawed: type: boolean + BigCat_allOf: + properties: + kind: + enum: + - lions + - tigers + - leopards + - jaguars + type: string securitySchemes: petstore_auth: flows: diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Animal.java index b92746816fe..f06a0e2b135 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Animal.java @@ -35,6 +35,7 @@ import javax.validation.Valid; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/BigCat.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..8316a86f884 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/BigCat.java @@ -0,0 +1,136 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + @JsonProperty(JSON_PROPERTY_KIND) + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @JsonProperty("kind") + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..e5088ac43df --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,133 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + @JsonProperty(JSON_PROPERTY_KIND) + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @JsonProperty("kind") + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Animal.java index b92746816fe..f06a0e2b135 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Animal.java @@ -35,6 +35,7 @@ import javax.validation.Valid; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/BigCat.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..8316a86f884 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/BigCat.java @@ -0,0 +1,136 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + @JsonProperty(JSON_PROPERTY_KIND) + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @JsonProperty("kind") + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..e5088ac43df --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,133 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + @JsonProperty(JSON_PROPERTY_KIND) + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @JsonProperty("kind") + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Animal.java index b92746816fe..f06a0e2b135 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Animal.java @@ -35,6 +35,7 @@ import javax.validation.Valid; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/BigCat.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..8316a86f884 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/BigCat.java @@ -0,0 +1,136 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + @JsonProperty(JSON_PROPERTY_KIND) + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @JsonProperty("kind") + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..e5088ac43df --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,133 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + @JsonProperty(JSON_PROPERTY_KIND) + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @JsonProperty("kind") + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Animal.java index b92746816fe..f06a0e2b135 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Animal.java @@ -35,6 +35,7 @@ import javax.validation.Valid; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/BigCat.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..8316a86f884 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/BigCat.java @@ -0,0 +1,136 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * BigCat + */ +@JsonPropertyOrder({ + BigCat.JSON_PROPERTY_KIND +}) + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + @JsonProperty(JSON_PROPERTY_KIND) + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @JsonProperty("kind") + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..e5088ac43df --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,133 @@ +/* + * 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 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * BigCatAllOf + */ +@JsonPropertyOrder({ + BigCatAllOf.JSON_PROPERTY_KIND +}) + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_KIND = "kind"; + @JsonProperty(JSON_PROPERTY_KIND) + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + **/ + @JsonProperty("kind") + @ApiModelProperty(value = "") + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/php-slim/README.md b/samples/server/petstore/php-slim/README.md index 0d639b32a11..8e7f235f0e0 100644 --- a/samples/server/petstore/php-slim/README.md +++ b/samples/server/petstore/php-slim/README.md @@ -173,6 +173,8 @@ Class | Method | HTTP request | Description * OpenAPIServer\Model\ArrayOfArrayOfNumberOnly * OpenAPIServer\Model\ArrayOfNumberOnly * OpenAPIServer\Model\ArrayTest +* OpenAPIServer\Model\BigCat +* OpenAPIServer\Model\BigCatAllOf * OpenAPIServer\Model\Capitalization * OpenAPIServer\Model\Cat * OpenAPIServer\Model\CatAllOf diff --git a/samples/server/petstore/php-slim/lib/Model/BigCat.php b/samples/server/petstore/php-slim/lib/Model/BigCat.php new file mode 100644 index 00000000000..33cb8342e5a --- /dev/null +++ b/samples/server/petstore/php-slim/lib/Model/BigCat.php @@ -0,0 +1,39 @@ +=7.1" - }, - "require-dev": { - "equip/dispatch": "^2.0", - "phpunit/phpunit": "^6.5", - "slim/psr7": "^0.4.0", - "slim/slim": "^4.0", - "squizlabs/php_codesniffer": "~2.3" - }, - "type": "library", - "autoload": { - "psr-4": { - "Dyorg\\": "src" - } - }, - "autoload-dev": { - "psr-4": { - "Dyorg\\": "tests", - "Dyorg\\TokenAuthentication\\Example\\": "example" - } - }, - "scripts": { - "test": [ - "phpunit" - ] - }, - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dyorg Almeida", - "email": "dyorg@rabbiit.com", - "homepage": "https://rabbiit.com/", - "role": "Developer" - } - ], - "description": "Slim 4.0+ Token Authentication Middleware", - "homepage": "https://github.com/dyorg/slim-token-authentication", - "keywords": [ - "auth", - "authentication", - "authorization", - "middleware", - "slim", - "token" - ], - "support": { - "source": "https://github.com/ybelenko/slim-token-authentication/tree/slim4" - }, - "time": "2019-08-11T03:59:16+00:00" - }, - { - "name": "fig/http-message-util", - "version": "1.1.3", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-message-util.git", - "reference": "35b19404371b31b3a43823c755398c48c9966db4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message-util/zipball/35b19404371b31b3a43823c755398c48c9966db4", - "reference": "35b19404371b31b3a43823c755398c48c9966db4", - "shasum": "" - }, - "require": { - "php": "^5.3 || ^7.0", - "psr/http-message": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Fig\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Utility classes and constants for use with PSR-7 (psr/http-message)", - "keywords": [ - "http", - "http-message", - "psr", - "psr-7", - "request", - "response" - ], - "time": "2018-11-19T16:19:58+00:00" - }, - { - "name": "nikic/fast-route", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/nikic/FastRoute.git", - "reference": "181d480e08d9476e61381e04a71b34dc0432e812" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/FastRoute/zipball/181d480e08d9476e61381e04a71b34dc0432e812", - "reference": "181d480e08d9476e61381e04a71b34dc0432e812", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35|~5.7" - }, - "type": "library", - "autoload": { - "psr-4": { - "FastRoute\\": "src/" - }, - "files": [ - "src/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov", - "email": "nikic@php.net" - } - ], - "description": "Fast request router for PHP", - "keywords": [ - "router", - "routing" - ], - "time": "2018-02-13T20:26:39+00:00" - }, - { - "name": "psr/container", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "time": "2017-02-14T16:28:37+00:00" - }, - { - "name": "psr/http-factory", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-factory.git", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", - "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", - "shasum": "" - }, - "require": { - "php": ">=7.0.0", - "psr/http-message": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interfaces for PSR-7 HTTP message factories", - "keywords": [ - "factory", - "http", - "message", - "psr", - "psr-17", - "psr-7", - "request", - "response" - ], - "time": "2019-04-30T12:38:16+00:00" - }, - { - "name": "psr/http-message", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", - "keywords": [ - "http", - "http-message", - "psr", - "psr-7", - "request", - "response" - ], - "time": "2016-08-06T14:39:51+00:00" - }, - { - "name": "psr/http-server-handler", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-server-handler.git", - "reference": "aff2f80e33b7f026ec96bb42f63242dc50ffcae7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-server-handler/zipball/aff2f80e33b7f026ec96bb42f63242dc50ffcae7", - "reference": "aff2f80e33b7f026ec96bb42f63242dc50ffcae7", - "shasum": "" - }, - "require": { - "php": ">=7.0", - "psr/http-message": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Server\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP server-side request handler", - "keywords": [ - "handler", - "http", - "http-interop", - "psr", - "psr-15", - "psr-7", - "request", - "response", - "server" - ], - "time": "2018-10-30T16:46:14+00:00" - }, - { - "name": "psr/http-server-middleware", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-server-middleware.git", - "reference": "2296f45510945530b9dceb8bcedb5cb84d40c5f5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-server-middleware/zipball/2296f45510945530b9dceb8bcedb5cb84d40c5f5", - "reference": "2296f45510945530b9dceb8bcedb5cb84d40c5f5", - "shasum": "" - }, - "require": { - "php": ">=7.0", - "psr/http-message": "^1.0", - "psr/http-server-handler": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Server\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP server-side middleware", - "keywords": [ - "http", - "http-interop", - "middleware", - "psr", - "psr-15", - "psr-7", - "request", - "response" - ], - "time": "2018-10-30T17:12:04+00:00" - }, - { - "name": "ralouphie/getallheaders", - "version": "2.0.5", - "source": { - "type": "git", - "url": "https://github.com/ralouphie/getallheaders.git", - "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/5601c8a83fbba7ef674a7369456d12f1e0d0eafa", - "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "require-dev": { - "phpunit/phpunit": "~3.7.0", - "satooshi/php-coveralls": ">=1.0" - }, - "type": "library", - "autoload": { - "files": [ - "src/getallheaders.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ralph Khattar", - "email": "ralph.khattar@gmail.com" - } - ], - "description": "A polyfill for getallheaders.", - "time": "2016-02-11T07:05:27+00:00" - }, - { - "name": "slim/psr7", - "version": "0.4.0", - "source": { - "type": "git", - "url": "https://github.com/slimphp/Slim-Psr7.git", - "reference": "d312896b7cd4aca7d4b86b64acdfcb5cc3da758f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/slimphp/Slim-Psr7/zipball/d312896b7cd4aca7d4b86b64acdfcb5cc3da758f", - "reference": "d312896b7cd4aca7d4b86b64acdfcb5cc3da758f", - "shasum": "" - }, - "require": { - "fig/http-message-util": "^1.1", - "php": "^7.1", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", - "ralouphie/getallheaders": "^2" - }, - "provide": { - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "ext-json": "*", - "http-interop/http-factory-tests": "^0.5.0", - "php-http/psr7-integration-tests": "dev-master", - "phpstan/phpstan": "^0.10", - "phpunit/phpunit": "^6.0|^7.0", - "squizlabs/php_codesniffer": "^3.3" - }, - "type": "library", - "autoload": { - "psr-4": { - "Slim\\Psr7\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Josh Lockhart", - "email": "hello@joshlockhart.com", - "homepage": "http://joshlockhart.com" - }, - { - "name": "Andrew Smith", - "email": "a.smith@silentworks.co.uk", - "homepage": "http://silentworks.co.uk" - }, - { - "name": "Rob Allen", - "email": "rob@akrabat.com", - "homepage": "http://akrabat.com" - }, - { - "name": "Pierre Berube", - "email": "pierre@lgse.com", - "homepage": "http://www.lgse.com" - } - ], - "description": "Strict PSR-7 implementation", - "homepage": "https://www.slimframework.com", - "keywords": [ - "http", - "psr-7", - "psr7" - ], - "time": "2019-08-02T17:06:08+00:00" - }, - { - "name": "slim/slim", - "version": "4.3.0", - "source": { - "type": "git", - "url": "https://github.com/slimphp/Slim.git", - "reference": "26020e9a099e69b0b12918115894f7106364dcb7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/slimphp/Slim/zipball/26020e9a099e69b0b12918115894f7106364dcb7", - "reference": "26020e9a099e69b0b12918115894f7106364dcb7", - "shasum": "" - }, - "require": { - "ext-json": "*", - "nikic/fast-route": "^1.3", - "php": "^7.1", - "psr/container": "^1.0", - "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", - "psr/http-server-handler": "^1.0", - "psr/http-server-middleware": "^1.0" - }, - "require-dev": { - "ext-simplexml": "*", - "guzzlehttp/psr7": "^1.5", - "http-interop/http-factory-guzzle": "^1.0", - "nyholm/psr7": "^1.1", - "nyholm/psr7-server": "^0.3.0", - "phpspec/prophecy": "^1.8", - "phpstan/phpstan": "^0.11.5", - "phpunit/phpunit": "^7.5", - "slim/http": "^0.7", - "slim/psr7": "^0.3", - "squizlabs/php_codesniffer": "^3.4.2", - "zendframework/zend-diactoros": "^2.1" - }, - "suggest": { - "ext-simplexml": "Needed to support XML format in BodyParsingMiddleware", - "ext-xml": "Needed to support XML format in BodyParsingMiddleware", - "slim/psr7": "Slim PSR-7 implementation. See http://www.slimframework.com/docs/v4/start/installation.html for more information." - }, - "type": "library", - "autoload": { - "psr-4": { - "Slim\\": "Slim", - "Slim\\Tests\\": "tests" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Josh Lockhart", - "email": "hello@joshlockhart.com", - "homepage": "https://joshlockhart.com" - }, - { - "name": "Andrew Smith", - "email": "a.smith@silentworks.co.uk", - "homepage": "http://silentworks.co.uk" - }, - { - "name": "Rob Allen", - "email": "rob@akrabat.com", - "homepage": "http://akrabat.com" - }, - { - "name": "Pierre Berube", - "email": "pierre@lgse.com", - "homepage": "http://www.lgse.com" - }, - { - "name": "Gabriel Manricks", - "email": "gmanricks@me.com", - "homepage": "http://gabrielmanricks.com" - } - ], - "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", - "homepage": "https://www.slimframework.com", - "keywords": [ - "api", - "framework", - "micro", - "router" - ], - "time": "2019-10-05T21:24:58+00:00" - } - ], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.3.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", - "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "doctrine/coding-standard": "^6.0", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.13", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-shim": "^0.11", - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2019-10-21T16:45:58+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.9.3", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "replace": { - "myclabs/deep-copy": "self.version" - }, - "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, - "files": [ - "src/DeepCopy/deep_copy.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2019-08-09T12:45:53+00:00" - }, - { - "name": "overtrue/phplint", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/overtrue/phplint.git", - "reference": "deaee8c3459087ea5d17031206b8722a96dd330b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/overtrue/phplint/zipball/deaee8c3459087ea5d17031206b8722a96dd330b", - "reference": "deaee8c3459087ea5d17031206b8722a96dd330b", - "shasum": "" - }, - "require": { - "ext-json": "*", - "php": ">=5.5.9", - "symfony/console": "^3.2|^4.0|^5.0", - "symfony/finder": "^3.0|^4.0|^5.0", - "symfony/process": "^3.0|^4.0|^5.0", - "symfony/yaml": "^3.0|^4.0|^5.0" - }, - "require-dev": { - "jakub-onderka/php-console-highlighter": "^0.3.2 || ^0.4" - }, - "bin": [ - "bin/phplint" - ], - "type": "library", - "autoload": { - "psr-4": { - "Overtrue\\PHPLint\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "overtrue", - "email": "anzhengchao@gmail.com" - } - ], - "description": "a php syntax check tool.", - "keywords": [ - "check", - "lint", - "phplint", - "syntax" - ], - "time": "2019-12-07T13:46:15+00:00" - }, - { - "name": "phar-io/manifest", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2018-07-08T19:23:20+00:00" - }, - { - "name": "phar-io/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "time": "2018-07-08T19:19:57+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "~6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2018-08-07T13:53:10+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "4.3.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/b83ff7cfcfee7827e1e78b637a5904fe6a96698e", - "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e", - "shasum": "" - }, - "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0", - "phpdocumentor/type-resolver": "~0.4 || ^1.0.0", - "webmozart/assert": "^1.0" - }, - "require-dev": { - "doctrine/instantiator": "^1.0.5", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2019-09-12T14:27:41+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", - "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", - "shasum": "" - }, - "require": { - "php": "^7.1", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "^7.1", - "mockery/mockery": "~1", - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2019-08-22T18:11:29+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "1.9.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203", - "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2019-10-03T11:07:50+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "6.1.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "suggest": { - "ext-xdebug": "^2.6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2018-10-31T16:06:48+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "050bedf145a257b1ff02746c31894800e5122946" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", - "reference": "050bedf145a257b1ff02746c31894800e5122946", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2018-09-13T20:33:42+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "2.1.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2019-06-07T04:22:29+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2019-09-17T06:23:10+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "7.5.18", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "fcf6c4bfafaadc07785528b06385cce88935474d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fcf6c4bfafaadc07785528b06385cce88935474d", - "reference": "fcf6c4bfafaadc07785528b06385cce88935474d", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.1", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", - "sebastian/version": "^2.0.1" - }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "7.5-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2019-12-06T05:14:37+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" - }, - { - "name": "sebastian/comparator", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "shasum": "" - }, - "require": { - "php": "^7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2018-07-12T15:12:46+00:00" - }, - { - "name": "sebastian/diff", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], - "time": "2019-02-04T06:01:07+00:00" - }, - { - "name": "sebastian/environment", - "version": "4.2.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5" - }, - "suggest": { - "ext-posix": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2019-11-20T08:46:58+00:00" - }, - { - "name": "sebastian/exporter", - "version": "3.1.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2019-09-14T09:02:43+00:00" - }, - { - "name": "sebastian/global-state", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2017-04-27T15:39:26+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2018-10-04T04:07:39+00:00" - }, - { - "name": "sebastian/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" - }, - { - "name": "squizlabs/php_codesniffer", - "version": "3.5.3", - "source": { - "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "557a1fc7ac702c66b0bbfe16ab3d55839ef724cb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/557a1fc7ac702c66b0bbfe16ab3d55839ef724cb", - "reference": "557a1fc7ac702c66b0bbfe16ab3d55839ef724cb", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" - }, - "bin": [ - "bin/phpcs", - "bin/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", - "keywords": [ - "phpcs", - "standards" - ], - "time": "2019-12-04T04:46:47+00:00" - }, - { - "name": "symfony/console", - "version": "v5.0.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "dae5ef273d700771168ab889d9f8a19b2d206656" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/dae5ef273d700771168ab889d9f8a19b2d206656", - "reference": "dae5ef273d700771168ab889d9f8a19b2d206656", - "shasum": "" - }, - "require": { - "php": "^7.2.5", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/service-contracts": "^1.1|^2" - }, - "conflict": { - "symfony/dependency-injection": "<4.4", - "symfony/event-dispatcher": "<4.4", - "symfony/lock": "<4.4", - "symfony/process": "<4.4" - }, - "provide": { - "psr/log-implementation": "1.0" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2019-12-01T10:51:15+00:00" - }, - { - "name": "symfony/finder", - "version": "v5.0.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "17874dd8ab9a19422028ad56172fb294287a701b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/17874dd8ab9a19422028ad56172fb294287a701b", - "reference": "17874dd8ab9a19422028ad56172fb294287a701b", - "shasum": "" - }, - "require": { - "php": "^7.2.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2019-11-18T17:27:11+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.13.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.13-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "time": "2019-11-27T13:56:44+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.13.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.13-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2019-11-27T14:18:11+00:00" - }, - { - "name": "symfony/polyfill-php73", - "version": "v1.13.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/4b0e2222c55a25b4541305a053013d5647d3a25f", - "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.13-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2019-11-27T16:25:15+00:00" - }, - { - "name": "symfony/process", - "version": "v5.0.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "1568a2e8370fbc7416ef64eb5a698e4a05db5ff4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/1568a2e8370fbc7416ef64eb5a698e4a05db5ff4", - "reference": "1568a2e8370fbc7416ef64eb5a698e4a05db5ff4", - "shasum": "" - }, - "require": { - "php": "^7.2.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2019-11-28T14:20:16+00:00" - }, - { - "name": "symfony/service-contracts", - "version": "v2.0.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "144c5e51266b281231e947b51223ba14acf1a749" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749", - "reference": "144c5e51266b281231e947b51223ba14acf1a749", - "shasum": "" - }, - "require": { - "php": "^7.2.5", - "psr/container": "^1.0" - }, - "suggest": { - "symfony/service-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Service\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to writing services", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "time": "2019-11-18T17:27:11+00:00" - }, - { - "name": "symfony/yaml", - "version": "v5.0.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "51b684480184fa767b97e28eaca67664e48dd3e9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/51b684480184fa767b97e28eaca67664e48dd3e9", - "reference": "51b684480184fa767b97e28eaca67664e48dd3e9", - "shasum": "" - }, - "require": { - "php": "^7.2.5", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/console": "<4.4" - }, - "require-dev": { - "symfony/console": "^4.4|^5.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2019-11-18T17:27:11+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.1.3", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2019-06-13T22:48:21+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.6.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", - "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "vimeo/psalm": "<3.6.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" - }, - "type": "library", - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2019-11-24T13:36:37+00:00" - } - ], - "aliases": [], - "minimum-stability": "RC", - "stability-flags": { - "dyorg/slim-token-authentication": 20 - }, - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": "^7.1" - }, - "platform-dev": [] -} diff --git a/samples/server/petstore/php-slim4/lib/Mock/OpenApiDataMocker.php b/samples/server/petstore/php-slim4/lib/Mock/OpenApiDataMocker.php index fe0b10f2db7..a780debbdb8 100644 --- a/samples/server/petstore/php-slim4/lib/Mock/OpenApiDataMocker.php +++ b/samples/server/petstore/php-slim4/lib/Mock/OpenApiDataMocker.php @@ -26,6 +26,7 @@ namespace OpenAPIServer\Mock; use OpenAPIServer\Mock\OpenApiDataMockerInterface as IMocker; +use StdClass; use InvalidArgumentException; /** @@ -74,6 +75,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, @@ -81,6 +89,7 @@ final class OpenApiDataMocker implements IMocker IMocker::DATA_TYPE_STRING, IMocker::DATA_TYPE_BOOLEAN, IMocker::DATA_TYPE_ARRAY, + IMocker::DATA_TYPE_OBJECT, ])); } } @@ -212,10 +221,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 * @@ -231,8 +240,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) { @@ -252,9 +265,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); @@ -265,17 +278,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', @@ -296,8 +396,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; @@ -305,6 +407,7 @@ final class OpenApiDataMocker implements IMocker /** * @internal + * @codeCoverageIgnore * * @return float|int */ diff --git a/samples/server/petstore/php-slim4/lib/Mock/OpenApiDataMockerInterface.php b/samples/server/petstore/php-slim4/lib/Mock/OpenApiDataMockerInterface.php index fc6e28986d7..78fd9a859a5 100644 --- a/samples/server/petstore/php-slim4/lib/Mock/OpenApiDataMockerInterface.php +++ b/samples/server/petstore/php-slim4/lib/Mock/OpenApiDataMockerInterface.php @@ -55,6 +55,9 @@ interface OpenApiDataMockerInterface /** @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'; @@ -186,10 +189,10 @@ interface OpenApiDataMockerInterface * 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 * @@ -201,4 +204,29 @@ interface OpenApiDataMockerInterface $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 + ); } diff --git a/samples/server/petstore/php-slim4/lib/Model/BigCat.php b/samples/server/petstore/php-slim4/lib/Model/BigCat.php new file mode 100644 index 00000000000..39eec7cbfa1 --- /dev/null +++ b/samples/server/petstore/php-slim4/lib/Model/BigCat.php @@ -0,0 +1,40 @@ + 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); + } +} diff --git a/samples/server/petstore/php-slim4/lib/Utils/StringUtilsTrait.php b/samples/server/petstore/php-slim4/lib/Utils/StringUtilsTrait.php new file mode 100644 index 00000000000..bd0464fa598 --- /dev/null +++ b/samples/server/petstore/php-slim4/lib/Utils/StringUtilsTrait.php @@ -0,0 +1,132 @@ + 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'] + ); + } +} diff --git a/samples/server/petstore/php-slim4/php_syntax_checker.bash b/samples/server/petstore/php-slim4/php_syntax_checker.bash deleted file mode 100755 index 09c32c89511..00000000000 --- a/samples/server/petstore/php-slim4/php_syntax_checker.bash +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# a simple script to perform a syntax check on php files using "php -l" - -for i in $( find . -name "*.php" ); do - result=`php -l $i | grep "No syntax errors detected"` - exit_status=$? - if [ $exit_status -eq 1 ]; then - echo "Syntax errors with $i" - exit 1; - fi -done diff --git a/samples/server/petstore/php-slim4/phpunit.xml.dist b/samples/server/petstore/php-slim4/phpunit.xml.dist index 50cde966d40..d0904268796 100644 --- a/samples/server/petstore/php-slim4/phpunit.xml.dist +++ b/samples/server/petstore/php-slim4/phpunit.xml.dist @@ -20,12 +20,16 @@ ./test/Mock + + ./test/Utils + ./lib/Api ./lib/Model ./lib/Mock + ./lib/Utils diff --git a/samples/server/petstore/php-slim4/pom.xml b/samples/server/petstore/php-slim4/pom.xml index 30f1410a70c..cde894e9582 100644 --- a/samples/server/petstore/php-slim4/pom.xml +++ b/samples/server/petstore/php-slim4/pom.xml @@ -26,6 +26,19 @@ exec-maven-plugin 1.2.1 + + bundle-install + pre-integration-test + + exec + + + composer + + install + + + syntax-check integration-test @@ -33,7 +46,23 @@ exec - ./php_syntax_checker.bash + composer + + phplint + + + + + bundle-test + integration-test + + exec + + + composer + + test + diff --git a/samples/server/petstore/php-slim4/test/Mock/OpenApiDataMockerTest.php b/samples/server/petstore/php-slim4/test/Mock/OpenApiDataMockerTest.php index 221e6c6bf66..2b925cddeff 100644 --- a/samples/server/petstore/php-slim4/test/Mock/OpenApiDataMockerTest.php +++ b/samples/server/petstore/php-slim4/test/Mock/OpenApiDataMockerTest.php @@ -29,6 +29,7 @@ use OpenAPIServer\Mock\OpenApiDataMocker; use OpenAPIServer\Mock\OpenApiDataMockerInterface as IMocker; use PHPUnit\Framework\TestCase; use PHPUnit\Framework\Constraint\IsType; +use StdClass; /** * OpenApiDataMockerTest Class Doc Comment @@ -47,7 +48,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() @@ -57,6 +59,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], ]; } @@ -432,28 +467,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; @@ -478,13 +539,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' => [ @@ -523,6 +586,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 + ], ]; } @@ -575,4 +641,124 @@ 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], + ], + ]; + } } diff --git a/samples/server/petstore/php-slim4/test/Model/BigCatAllOfTest.php b/samples/server/petstore/php-slim4/test/Model/BigCatAllOfTest.php new file mode 100644 index 00000000000..2f3518d5bb8 --- /dev/null +++ b/samples/server/petstore/php-slim4/test/Model/BigCatAllOfTest.php @@ -0,0 +1,85 @@ +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], + ]; + } +} diff --git a/samples/server/petstore/php-slim4/test/Utils/StringUtilsTraitTest.php b/samples/server/petstore/php-slim4/test/Utils/StringUtilsTraitTest.php new file mode 100644 index 00000000000..d06aa405eeb --- /dev/null +++ b/samples/server/petstore/php-slim4/test/Utils/StringUtilsTraitTest.php @@ -0,0 +1,99 @@ +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], + ]; + } +} diff --git a/samples/server/petstore/php-ze-ph/src/App/DTO/BigCat.php b/samples/server/petstore/php-ze-ph/src/App/DTO/BigCat.php new file mode 100644 index 00000000000..5ac4027bad6 --- /dev/null +++ b/samples/server/petstore/php-ze-ph/src/App/DTO/BigCat.php @@ -0,0 +1,36 @@ +1.2.1 - pytest-test + test integration-test exec diff --git a/samples/server/petstore/python-aiohttp/test-requirements.txt b/samples/server/petstore/python-aiohttp/test-requirements.txt index 1cb425f6551..31b28baaf28 100644 --- a/samples/server/petstore/python-aiohttp/test-requirements.txt +++ b/samples/server/petstore/python-aiohttp/test-requirements.txt @@ -1,6 +1,4 @@ -coverage>=4.0.3 -pytest>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +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 diff --git a/samples/server/petstore/python-aiohttp/test_python3.sh b/samples/server/petstore/python-aiohttp/test_python3.sh index c6a92d00aed..65d96267d4f 100755 --- a/samples/server/petstore/python-aiohttp/test_python3.sh +++ b/samples/server/petstore/python-aiohttp/test_python3.sh @@ -1,8 +1,7 @@ #!/bin/bash -REQUIREMENTS_FILE=requirements.txt -TEST_REQUIREMENTS_FILE=test-requirements.txt -REQUIREMENTS_OUT=requirements.txt.log +REQUIREMENTS_FILE=dev-requirements.txt +REQUIREMENTS_OUT=dev-requirements.txt.log SETUP_OUT=*.egg-info VENV=.venv DEACTIVE=false @@ -12,16 +11,16 @@ export LANG=en_US.UTF-8 ### set virtualenv if [ -z "$VIRTUAL_ENV" ]; then - virtualenv $VENV --no-site-packages --always-copy --python python3 + virtualenv $VENV --no-site-packages --always-copy --python python3 source $VENV/bin/activate DEACTIVE=true fi ### install dependencies -pip install -r $REQUIREMENTS_FILE -r $TEST_REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT +pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT ### run tests -pytest || exit 1 +tox || exit 1 ### static analysis of code flake8 --show-source petstore_api/ diff --git a/samples/server/petstore/python-aiohttp/tox.ini b/samples/server/petstore/python-aiohttp/tox.ini new file mode 100644 index 00000000000..0f7cd42b8a8 --- /dev/null +++ b/samples/server/petstore/python-aiohttp/tox.ini @@ -0,0 +1,10 @@ +[tox] +envlist = py3 +skipsdist=True + +[testenv] +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + pytest --cov=openapi_server \ No newline at end of file diff --git a/samples/server/petstore/python-blueplanet/.openapi-generator/VERSION b/samples/server/petstore/python-blueplanet/.openapi-generator/VERSION index 0c89fc927e3..58592f031f6 100644 --- a/samples/server/petstore/python-blueplanet/.openapi-generator/VERSION +++ b/samples/server/petstore/python-blueplanet/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.0 \ No newline at end of file +4.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/python-blueplanet/app/.gitignore b/samples/server/petstore/python-blueplanet/app/.gitignore index a655050c263..a77a0ebd166 100644 --- a/samples/server/petstore/python-blueplanet/app/.gitignore +++ b/samples/server/petstore/python-blueplanet/app/.gitignore @@ -46,6 +46,7 @@ coverage.xml .hypothesis/ venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/server/petstore/python-blueplanet/app/test-requirements.txt b/samples/server/petstore/python-blueplanet/app/test-requirements.txt index 7f8d96e6b40..a2626d875ff 100644 --- a/samples/server/petstore/python-blueplanet/app/test-requirements.txt +++ b/samples/server/petstore/python-blueplanet/app/test-requirements.txt @@ -1,6 +1,4 @@ -flask_testing==0.6.1 -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +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 +flask_testing==0.6.1 \ No newline at end of file diff --git a/samples/server/petstore/python-blueplanet/app/tox.ini b/samples/server/petstore/python-blueplanet/app/tox.ini index 3e0b644eec4..d2eb61d57c7 100644 --- a/samples/server/petstore/python-blueplanet/app/tox.ini +++ b/samples/server/petstore/python-blueplanet/app/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] \ No newline at end of file + pytest --cov=openapi_server \ No newline at end of file diff --git a/samples/server/petstore/python-flask-python2/.gitignore b/samples/server/petstore/python-flask-python2/.gitignore index a655050c263..43995bd42fa 100644 --- a/samples/server/petstore/python-flask-python2/.gitignore +++ b/samples/server/petstore/python-flask-python2/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/server/petstore/python-flask-python2/dev-requirements.txt b/samples/server/petstore/python-flask-python2/dev-requirements.txt new file mode 100644 index 00000000000..ccdfca62949 --- /dev/null +++ b/samples/server/petstore/python-flask-python2/dev-requirements.txt @@ -0,0 +1,2 @@ +tox +flake8 diff --git a/samples/server/petstore/python-flask-python2/pom.xml b/samples/server/petstore/python-flask-python2/pom.xml index 113c387d5f2..430bddf2ed3 100644 --- a/samples/server/petstore/python-flask-python2/pom.xml +++ b/samples/server/petstore/python-flask-python2/pom.xml @@ -27,7 +27,7 @@ 1.2.1 - nose-test + test integration-test exec diff --git a/samples/server/petstore/python-flask-python2/requirements.txt b/samples/server/petstore/python-flask-python2/requirements.txt index bc535706622..5c5ce2a1a26 100644 --- a/samples/server/petstore/python-flask-python2/requirements.txt +++ b/samples/server/petstore/python-flask-python2/requirements.txt @@ -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 typing >= 3.5.2.2 diff --git a/samples/server/petstore/python-flask-python2/test-requirements.txt b/samples/server/petstore/python-flask-python2/test-requirements.txt index 7f8d96e6b40..a2626d875ff 100644 --- a/samples/server/petstore/python-flask-python2/test-requirements.txt +++ b/samples/server/petstore/python-flask-python2/test-requirements.txt @@ -1,6 +1,4 @@ -flask_testing==0.6.1 -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +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 +flask_testing==0.6.1 \ No newline at end of file diff --git a/samples/server/petstore/python-flask-python2/test_python2.sh b/samples/server/petstore/python-flask-python2/test_python2.sh index e579f4d7f55..89e56c485de 100755 --- a/samples/server/petstore/python-flask-python2/test_python2.sh +++ b/samples/server/petstore/python-flask-python2/test_python2.sh @@ -1,7 +1,7 @@ #!/bin/bash -REQUIREMENTS_FILE=test-requirements.txt -REQUIREMENTS_OUT=test-requirements.txt.log +REQUIREMENTS_FILE=dev-requirements.txt +REQUIREMENTS_OUT=dev-requirements.txt.log SETUP_OUT=*.egg-info VENV=.venv DEACTIVE=false @@ -18,15 +18,14 @@ fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -python setup.py develop ### run tests -tox || exit 1 +tox -e py27 || exit 1 ### static analysis of code flake8 --show-source petstore_api/ ### deactivate virtualenv -#if [ $DEACTIVE == true ]; then -# deactivate -#fi +# if [ $DEACTIVE == true ]; then +# deactivate +# fi diff --git a/samples/server/petstore/python-flask-python2/tox.ini b/samples/server/petstore/python-flask-python2/tox.ini index 26985414c88..d05c607610c 100644 --- a/samples/server/petstore/python-flask-python2/tox.ini +++ b/samples/server/petstore/python-flask-python2/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] \ No newline at end of file + pytest --cov=openapi_server \ No newline at end of file diff --git a/samples/server/petstore/python-flask/.gitignore b/samples/server/petstore/python-flask/.gitignore index a655050c263..43995bd42fa 100644 --- a/samples/server/petstore/python-flask/.gitignore +++ b/samples/server/petstore/python-flask/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/samples/server/petstore/python-flask/dev-requirements.txt b/samples/server/petstore/python-flask/dev-requirements.txt new file mode 100644 index 00000000000..ccdfca62949 --- /dev/null +++ b/samples/server/petstore/python-flask/dev-requirements.txt @@ -0,0 +1,2 @@ +tox +flake8 diff --git a/samples/server/petstore/python-flask/pom.xml b/samples/server/petstore/python-flask/pom.xml index 2834d92dbc7..542458a0e48 100644 --- a/samples/server/petstore/python-flask/pom.xml +++ b/samples/server/petstore/python-flask/pom.xml @@ -27,7 +27,7 @@ 1.2.1 - nose-test + test integration-test exec diff --git a/samples/server/petstore/python-flask/requirements.txt b/samples/server/petstore/python-flask/requirements.txt index 1a01b580490..029a9dae4cd 100644 --- a/samples/server/petstore/python-flask/requirements.txt +++ b/samples/server/petstore/python-flask/requirements.txt @@ -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 setuptools >= 21.0.0 diff --git a/samples/server/petstore/python-flask/test-requirements.txt b/samples/server/petstore/python-flask/test-requirements.txt index 7f8d96e6b40..a2626d875ff 100644 --- a/samples/server/petstore/python-flask/test-requirements.txt +++ b/samples/server/petstore/python-flask/test-requirements.txt @@ -1,6 +1,4 @@ -flask_testing==0.6.1 -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +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 +flask_testing==0.6.1 \ No newline at end of file diff --git a/samples/server/petstore/python-flask/test_python3.sh b/samples/server/petstore/python-flask/test_python3.sh index 9bd589401cd..32fb184fdd8 100755 --- a/samples/server/petstore/python-flask/test_python3.sh +++ b/samples/server/petstore/python-flask/test_python3.sh @@ -1,7 +1,7 @@ #!/bin/bash -REQUIREMENTS_FILE=test-requirements.txt -REQUIREMENTS_OUT=test-requirements.txt.log +REQUIREMENTS_FILE=dev-requirements.txt +REQUIREMENTS_OUT=dev-requirements.txt.log SETUP_OUT=*.egg-info VENV=.venv DEACTIVE=false @@ -18,7 +18,6 @@ fi ### install dependencies pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT -python setup.py develop ### run tests tox || exit 1 @@ -27,6 +26,6 @@ tox || exit 1 flake8 --show-source petstore_api/ ### deactivate virtualenv -#if [ $DEACTIVE == true ]; then -# deactivate -#fi +# if [ $DEACTIVE == true ]; then +# deactivate +# fi diff --git a/samples/server/petstore/python-flask/tox.ini b/samples/server/petstore/python-flask/tox.ini index ab4dfbb81b8..cff71191e6c 100644 --- a/samples/server/petstore/python-flask/tox.ini +++ b/samples/server/petstore/python-flask/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] \ No newline at end of file + pytest --cov=openapi_server \ No newline at end of file diff --git a/samples/server/petstore/rust-server/output/multipart-v3/Cargo.toml b/samples/server/petstore/rust-server/output/multipart-v3/Cargo.toml index 742d7fd21f8..7243310bec2 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/Cargo.toml +++ b/samples/server/petstore/rust-server/output/multipart-v3/Cargo.toml @@ -16,7 +16,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/samples/server/petstore/rust-server/output/multipart-v3/examples/client.rs b/samples/server/petstore/rust-server/output/multipart-v3/examples/client.rs index c4dcae3ed8c..ba8396ab939 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/examples/client.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/examples/client.rs @@ -71,7 +71,7 @@ fn main() { Some("MultipartRequestPost") => { let result = core.run(client.multipart_request_post("string_field_example".to_string(), swagger::ByteArray(Vec::from("BYTE_ARRAY_DATA_HERE")), Some("optional_string_field_example".to_string()), None)); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, _ => { diff --git a/samples/server/petstore/rust-server/output/multipart-v3/examples/server_lib/server.rs b/samples/server/petstore/rust-server/output/multipart-v3/examples/server_lib/server.rs index 82b6ee7938a..504a702bd60 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/examples/server_lib/server.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/examples/server_lib/server.rs @@ -28,7 +28,7 @@ impl Server { impl Api for Server where C: Has{ - fn multipart_request_post(&self, string_field: String, binary_field: swagger::ByteArray, optional_string_field: Option, object_field: Option, context: &C) -> Box> { + fn multipart_request_post(&self, string_field: String, binary_field: swagger::ByteArray, optional_string_field: Option, object_field: Option, context: &C) -> Box> { let context = context.clone(); println!("multipart_request_post(\"{}\", {:?}, {:?}, {:?}) - X-Span-ID: {:?}", string_field, binary_field, optional_string_field, object_field, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/client/mod.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/client/mod.rs index 42e60bdf200..22d89d8542b 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/client/mod.rs @@ -73,7 +73,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, } @@ -184,7 +184,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, @@ -211,7 +211,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> @@ -229,7 +229,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> @@ -245,7 +245,7 @@ impl Api for Client where F: Future + 'static, C: Has { - fn multipart_request_post(&self, param_string_field: String, param_binary_field: swagger::ByteArray, param_optional_string_field: Option, param_object_field: Option, context: &C) -> Box> { + fn multipart_request_post(&self, param_string_field: String, param_binary_field: swagger::ByteArray, param_optional_string_field: Option, param_object_field: Option, context: &C) -> Box> { let mut uri = format!( "{}/multipart_request", self.base_path @@ -344,7 +344,7 @@ impl Api for Client where request.headers_mut().set(ContentType(multipart_header)); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -356,7 +356,7 @@ impl Api for Client where future::ok( MultipartRequestPostResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -375,7 +375,7 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) @@ -406,7 +406,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/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs index 7b6384ed112..64a79fbb83c 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/lib.rs @@ -61,7 +61,7 @@ pub enum MultipartRequestPostResponse { pub trait Api { - fn multipart_request_post(&self, string_field: String, binary_field: swagger::ByteArray, optional_string_field: Option, object_field: Option, context: &C) -> Box>; + fn multipart_request_post(&self, string_field: String, binary_field: swagger::ByteArray, optional_string_field: Option, object_field: Option, context: &C) -> Box>; } @@ -69,7 +69,7 @@ pub trait Api { pub trait ApiNoContext { - fn multipart_request_post(&self, string_field: String, binary_field: swagger::ByteArray, optional_string_field: Option, object_field: Option) -> Box>; + fn multipart_request_post(&self, string_field: String, binary_field: swagger::ByteArray, optional_string_field: Option, object_field: Option) -> Box>; } @@ -88,7 +88,7 @@ impl<'a, T: Api + Sized, C> ContextWrapperExt<'a, C> for T { impl<'a, T: Api, C> ApiNoContext for ContextWrapper<'a, T, C> { - fn multipart_request_post(&self, string_field: String, binary_field: swagger::ByteArray, optional_string_field: Option, object_field: Option) -> Box> { + fn multipart_request_post(&self, string_field: String, binary_field: swagger::ByteArray, optional_string_field: Option, object_field: Option) -> Box> { self.api().multipart_request_post(string_field, binary_field, optional_string_field, object_field, &self.context()) } diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs index ddd86a025ad..4bd030b24d2 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs @@ -109,7 +109,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(); @@ -130,7 +130,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 @@ -203,7 +203,7 @@ where Box::new(api_impl.multipart_request_post(param_string_field, param_binary_field, param_optional_string_field, param_object_field, &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())); match result { Ok(rsp) => match rsp { @@ -226,7 +226,7 @@ where future::ok(response) } )) - as Box> + as Box> }, Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read multipart body")))), } @@ -234,7 +234,7 @@ where ) }, - _ => 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/samples/server/petstore/rust-server/output/openapi-v3/Cargo.toml b/samples/server/petstore/rust-server/output/openapi-v3/Cargo.toml index a402ec1472c..846d7d087e1 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/Cargo.toml +++ b/samples/server/petstore/rust-server/output/openapi-v3/Cargo.toml @@ -16,7 +16,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/samples/server/petstore/rust-server/output/openapi-v3/README.md b/samples/server/petstore/rust-server/output/openapi-v3/README.md index d51e1c48832..248f4335fac 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/README.md +++ b/samples/server/petstore/rust-server/output/openapi-v3/README.md @@ -61,6 +61,7 @@ cargo run --example server To run a client, follow one of the following simple steps: ``` +cargo run --example client MultigetGet cargo run --example client MultipleAuthSchemeGet cargo run --example client ReadonlyAuthSchemeGet cargo run --example client RequiredOctetStreamPut @@ -104,6 +105,7 @@ All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- +[****](docs/default_api.md#) | **GET** /multiget | Get some stuff. [****](docs/default_api.md#) | **GET** /multiple_auth_scheme | [****](docs/default_api.md#) | **GET** /readonly_auth_scheme | [****](docs/default_api.md#) | **PUT** /required_octet_stream | @@ -122,6 +124,7 @@ Method | HTTP request | Description - [AnotherXmlInner](docs/AnotherXmlInner.md) - [AnotherXmlObject](docs/AnotherXmlObject.md) - [DuplicateXmlObject](docs/DuplicateXmlObject.md) + - [InlineResponse201](docs/InlineResponse201.md) - [UuidObject](docs/UuidObject.md) - [XmlArray](docs/XmlArray.md) - [XmlInner](docs/XmlInner.md) diff --git a/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml b/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml index e903c1c2fe5..8181f26db03 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml +++ b/samples/server/petstore/rust-server/output/openapi-v3/api/openapi.yaml @@ -30,6 +30,53 @@ paths: description: OK 400: description: Bad Request + /multiget: + get: + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/anotherXmlObject' + description: JSON rsp + 201: + content: + application/xml: + schema: + $ref: '#/components/schemas/inline_response_201' + description: XML rsp + 202: + content: + application/octet-stream: + schema: + format: binary + type: string + description: octet rsp + 203: + content: + text/plain: + schema: + type: string + description: string rsp + 204: + content: + application/json: + schema: + $ref: '#/components/schemas/anotherXmlObject' + description: Duplicate Response long text. One. + 205: + content: + application/json: + schema: + $ref: '#/components/schemas/anotherXmlObject' + description: Duplicate Response long text. Two. + 206: + content: + application/json: + schema: + $ref: '#/components/schemas/anotherXmlObject' + description: Duplicate Response long text. Three. + summary: Get some stuff. /xml_other: post: requestBody: @@ -186,6 +233,8 @@ components: name: snake_another_xml_inner anotherXmlObject: description: An XML object + example: + inner_string: inner_string properties: inner_string: type: string @@ -193,6 +242,10 @@ components: xml: name: snake_another_xml_object namespace: http://foo.bar + inline_response_201: + properties: + foo: + type: string securitySchemes: authScheme: flows: diff --git a/samples/server/petstore/rust-server/output/openapi-v3/docs/InlineResponse201.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/InlineResponse201.md new file mode 100644 index 00000000000..142fba46356 --- /dev/null +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/InlineResponse201.md @@ -0,0 +1,10 @@ +# InlineResponse201 + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foo** | **String** | | [optional] [default to None] + +[[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/server/petstore/rust-server/output/openapi-v3/docs/default_api.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/default_api.md index 82b8c773ff4..1322f643838 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/docs/default_api.md +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/default_api.md @@ -4,6 +4,7 @@ All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- +****](default_api.md#) | **GET** /multiget | Get some stuff. ****](default_api.md#) | **GET** /multiple_auth_scheme | ****](default_api.md#) | **GET** /readonly_auth_scheme | ****](default_api.md#) | **PUT** /required_octet_stream | @@ -16,6 +17,28 @@ Method | HTTP request | Description ****](default_api.md#) | **PUT** /xml | +# **** +> models::AnotherXmlObject () +Get some stuff. + +### Required Parameters +This endpoint does not need any parameter. + +### Return type + +[**models::AnotherXmlObject**](anotherXmlObject.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/octet-stream, application/xml, text/plain, + +[[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) + # **** > (ctx, ) diff --git a/samples/server/petstore/rust-server/output/openapi-v3/examples/client.rs b/samples/server/petstore/rust-server/output/openapi-v3/examples/client.rs index dcbe006993a..f03022c8129 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/examples/client.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/examples/client.rs @@ -19,6 +19,7 @@ use tokio_core::reactor; #[allow(unused_imports)] use openapi_v3::{ApiNoContext, ContextWrapperExt, ApiError, + MultigetGetResponse, MultipleAuthSchemeGetResponse, ReadonlyAuthSchemeGetResponse, RequiredOctetStreamPutResponse, @@ -37,6 +38,7 @@ fn main() { .arg(Arg::with_name("operation") .help("Sets the operation to run") .possible_values(&[ + "MultigetGet", "MultipleAuthSchemeGet", "ReadonlyAuthSchemeGet", "RequiredOctetStreamPut", @@ -87,54 +89,59 @@ fn main() { match matches.value_of("operation") { + Some("MultigetGet") => { + let result = core.run(client.multiget_get()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); + }, + Some("MultipleAuthSchemeGet") => { let result = core.run(client.multiple_auth_scheme_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("ReadonlyAuthSchemeGet") => { let result = core.run(client.readonly_auth_scheme_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("RequiredOctetStreamPut") => { let result = core.run(client.required_octet_stream_put(swagger::ByteArray(Vec::from("BYTE_ARRAY_DATA_HERE")))); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("ResponsesWithHeadersGet") => { let result = core.run(client.responses_with_headers_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("UuidGet") => { let result = core.run(client.uuid_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("XmlExtraPost") => { let result = core.run(client.xml_extra_post(None)); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("XmlOtherPost") => { let result = core.run(client.xml_other_post(None)); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("XmlOtherPut") => { let result = core.run(client.xml_other_put(None)); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("XmlPost") => { let result = core.run(client.xml_post(None)); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("XmlPut") => { let result = core.run(client.xml_put(None)); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, _ => { diff --git a/samples/server/petstore/rust-server/output/openapi-v3/examples/server_lib/server.rs b/samples/server/petstore/rust-server/output/openapi-v3/examples/server_lib/server.rs index 56c76018177..c2a10af6c24 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/examples/server_lib/server.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/examples/server_lib/server.rs @@ -11,6 +11,7 @@ use swagger::{Has, XSpanIdString}; use uuid; use openapi_v3::{Api, ApiError, + MultigetGetResponse, MultipleAuthSchemeGetResponse, ReadonlyAuthSchemeGetResponse, RequiredOctetStreamPutResponse, @@ -37,71 +38,78 @@ impl Server { impl Api for Server where C: Has{ + /// Get some stuff. + fn multiget_get(&self, context: &C) -> Box> { + let context = context.clone(); + println!("multiget_get() - X-Span-ID: {:?}", context.get().0.clone()); + Box::new(futures::failed("Generic failure".into())) + } - fn multiple_auth_scheme_get(&self, context: &C) -> Box> { + + fn multiple_auth_scheme_get(&self, context: &C) -> Box> { let context = context.clone(); println!("multiple_auth_scheme_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn readonly_auth_scheme_get(&self, context: &C) -> Box> { + fn readonly_auth_scheme_get(&self, context: &C) -> Box> { let context = context.clone(); println!("readonly_auth_scheme_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn required_octet_stream_put(&self, body: swagger::ByteArray, context: &C) -> Box> { + fn required_octet_stream_put(&self, body: swagger::ByteArray, context: &C) -> Box> { let context = context.clone(); println!("required_octet_stream_put({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn responses_with_headers_get(&self, context: &C) -> Box> { + fn responses_with_headers_get(&self, context: &C) -> Box> { let context = context.clone(); println!("responses_with_headers_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn uuid_get(&self, context: &C) -> Box> { + fn uuid_get(&self, context: &C) -> Box> { let context = context.clone(); println!("uuid_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn xml_extra_post(&self, duplicate_xml_object: Option, context: &C) -> Box> { + fn xml_extra_post(&self, duplicate_xml_object: Option, context: &C) -> Box> { let context = context.clone(); println!("xml_extra_post({:?}) - X-Span-ID: {:?}", duplicate_xml_object, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn xml_other_post(&self, another_xml_object: Option, context: &C) -> Box> { + fn xml_other_post(&self, another_xml_object: Option, context: &C) -> Box> { let context = context.clone(); println!("xml_other_post({:?}) - X-Span-ID: {:?}", another_xml_object, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn xml_other_put(&self, string: Option, context: &C) -> Box> { + fn xml_other_put(&self, string: Option, context: &C) -> Box> { let context = context.clone(); println!("xml_other_put({:?}) - X-Span-ID: {:?}", string, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Post an array - fn xml_post(&self, string: Option, context: &C) -> Box> { + fn xml_post(&self, string: Option, context: &C) -> Box> { let context = context.clone(); println!("xml_post({:?}) - X-Span-ID: {:?}", string, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn xml_put(&self, xml_object: Option, context: &C) -> Box> { + fn xml_put(&self, xml_object: Option, context: &C) -> Box> { let context = context.clone(); println!("xml_put({:?}) - X-Span-ID: {:?}", xml_object, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs index b67f0353b29..1fce126e4ba 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/client/mod.rs @@ -37,6 +37,7 @@ use swagger; use swagger::{ApiError, XSpanId, XSpanIdString, Has, AuthData}; use {Api, + MultigetGetResponse, MultipleAuthSchemeGetResponse, ReadonlyAuthSchemeGetResponse, RequiredOctetStreamPutResponse, @@ -80,7 +81,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, } @@ -191,7 +192,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, @@ -218,7 +219,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> @@ -236,7 +237,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> @@ -252,7 +253,188 @@ impl Api for Client where F: Future + 'static, C: Has + Has>{ - fn multiple_auth_scheme_get(&self, context: &C) -> Box> { + fn multiget_get(&self, context: &C) -> Box> { + let mut uri = format!( + "{}/multiget", + self.base_path + ); + + let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); + + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri += "?"; + uri += &query_string_str; + } + + let uri = match Uri::from_str(&uri) { + Ok(uri) => uri, + Err(err) => return Box::new(futures::done(Err(ApiError(format!("Unable to build URI: {}", err))))), + }; + + let mut request = hyper::Request::new(hyper::Method::Get, uri); + + + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); + Box::new(self.client_service.call(request) + .map_err(|e| ApiError(format!("No response received: {}", e))) + .and_then(|mut response| { + match response.status().as_u16() { + 200 => { + let body = response.body(); + Box::new( + body + .concat2() + .map_err(|e| ApiError(format!("Failed to read response: {}", e))) + .and_then(|body| + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + serde_json::from_str::(body) + .map_err(|e| e.into()) + ) + ) + .map(move |body| { + MultigetGetResponse::JSONRsp(body) + }) + ) as Box> + }, + 201 => { + let body = response.body(); + Box::new( + body + .concat2() + .map_err(|e| ApiError(format!("Failed to read response: {}", e))) + .and_then(|body| + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + // 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::(body) + .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e))) + ) + ) + .map(move |body| { + MultigetGetResponse::XMLRsp(body) + }) + ) as Box> + }, + 202 => { + let body = response.body(); + Box::new( + body + .concat2() + .map_err(|e| ApiError(format!("Failed to read response: {}", e))) + .and_then(|body| + Ok(swagger::ByteArray(body.to_vec())) + ) + .map(move |body| { + MultigetGetResponse::OctetRsp(body) + }) + ) as Box> + }, + 203 => { + let body = response.body(); + Box::new( + body + .concat2() + .map_err(|e| ApiError(format!("Failed to read response: {}", e))) + .and_then(|body| + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + Ok(body.to_string()) + ) + ) + .map(move |body| { + MultigetGetResponse::StringRsp(body) + }) + ) as Box> + }, + 204 => { + let body = response.body(); + Box::new( + body + .concat2() + .map_err(|e| ApiError(format!("Failed to read response: {}", e))) + .and_then(|body| + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + serde_json::from_str::(body) + .map_err(|e| e.into()) + ) + ) + .map(move |body| { + MultigetGetResponse::DuplicateResponseLongText(body) + }) + ) as Box> + }, + 205 => { + let body = response.body(); + Box::new( + body + .concat2() + .map_err(|e| ApiError(format!("Failed to read response: {}", e))) + .and_then(|body| + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + serde_json::from_str::(body) + .map_err(|e| e.into()) + ) + ) + .map(move |body| { + MultigetGetResponse::DuplicateResponseLongText_2(body) + }) + ) as Box> + }, + 206 => { + let body = response.body(); + Box::new( + body + .concat2() + .map_err(|e| ApiError(format!("Failed to read response: {}", e))) + .and_then(|body| + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + serde_json::from_str::(body) + .map_err(|e| e.into()) + ) + ) + .map(move |body| { + MultigetGetResponse::DuplicateResponseLongText_3(body) + }) + ) as Box> + }, + code => { + let headers = response.headers().clone(); + Box::new(response.body() + .take(100) + .concat2() + .then(move |body| + future::err(ApiError(format!("Unexpected response code {}:\n{:?}\n\n{}", + code, + headers, + match body { + Ok(ref body) => match str::from_utf8(body) { + Ok(body) => Cow::from(body), + Err(e) => Cow::from(format!("", e)), + }, + Err(e) => Cow::from(format!("", e)), + }))) + ) + ) as Box> + } + } + })) + + } + + fn multiple_auth_scheme_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/multiple_auth_scheme", self.base_path @@ -275,9 +457,9 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); - (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 { &AuthData::Bearer(ref bearer_header) => { @@ -299,7 +481,7 @@ impl Api for Client where future::ok( MultipleAuthSchemeGetResponse::CheckThatLimitingToMultipleRequiredAuthSchemesWorks ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -318,14 +500,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn readonly_auth_scheme_get(&self, context: &C) -> Box> { + fn readonly_auth_scheme_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/readonly_auth_scheme", self.base_path @@ -348,9 +530,9 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); - (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 { &AuthData::Bearer(ref bearer_header) => { @@ -372,7 +554,7 @@ impl Api for Client where future::ok( ReadonlyAuthSchemeGetResponse::CheckThatLimitingToASingleRequiredAuthSchemeWorks ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -391,14 +573,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn required_octet_stream_put(&self, param_body: swagger::ByteArray, context: &C) -> Box> { + fn required_octet_stream_put(&self, param_body: swagger::ByteArray, context: &C) -> Box> { let mut uri = format!( "{}/required_octet_stream", self.base_path @@ -425,7 +607,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::REQUIRED_OCTET_STREAM_PUT.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -437,7 +619,7 @@ impl Api for Client where future::ok( RequiredOctetStreamPutResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -456,14 +638,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn responses_with_headers_get(&self, context: &C) -> Box> { + fn responses_with_headers_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/responses_with_headers", self.base_path @@ -486,7 +668,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -495,7 +677,7 @@ impl Api for Client where header! { (ResponseSuccessInfo, "Success-Info") => [String] } let response_success_info = match response.headers().get::() { Some(response_success_info) => response_success_info.0.clone(), - None => return Box::new(future::err(ApiError(String::from("Required response header Success-Info for response 200 was not found.")))) as Box>, + None => return Box::new(future::err(ApiError(String::from("Required response header Success-Info for response 200 was not found.")))) as Box>, }; let body = response.body(); Box::new( @@ -503,31 +685,28 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - - serde_json::from_str::(body) - .map_err(|e| e.into()) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + serde_json::from_str::(body) + .map_err(|e| e.into()) + ) + ) .map(move |body| { ResponsesWithHeadersGetResponse::Success{ body: body, success_info: response_success_info } }) - ) as Box> + ) as Box> }, 412 => { header! { (ResponseFurtherInfo, "Further-Info") => [String] } let response_further_info = match response.headers().get::() { Some(response_further_info) => response_further_info.0.clone(), - None => return Box::new(future::err(ApiError(String::from("Required response header Further-Info for response 412 was not found.")))) as Box>, + None => return Box::new(future::err(ApiError(String::from("Required response header Further-Info for response 412 was not found.")))) as Box>, }; header! { (ResponseFailureInfo, "Failure-Info") => [String] } let response_failure_info = match response.headers().get::() { Some(response_failure_info) => response_failure_info.0.clone(), - None => return Box::new(future::err(ApiError(String::from("Required response header Failure-Info for response 412 was not found.")))) as Box>, + None => return Box::new(future::err(ApiError(String::from("Required response header Failure-Info for response 412 was not found.")))) as Box>, }; let body = response.body(); Box::new( @@ -539,7 +718,7 @@ impl Api for Client where failure_info: response_failure_info, } ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -558,14 +737,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn uuid_get(&self, context: &C) -> Box> { + fn uuid_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/uuid", self.base_path @@ -588,7 +767,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -600,20 +779,17 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - - serde_json::from_str::(body) - .map_err(|e| e.into()) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + serde_json::from_str::(body) + .map_err(|e| e.into()) + ) + ) .map(move |body| { UuidGetResponse::DuplicateResponseLongText(body) }) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -632,14 +808,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn xml_extra_post(&self, param_duplicate_xml_object: Option, context: &C) -> Box> { + fn xml_extra_post(&self, param_duplicate_xml_object: Option, context: &C) -> Box> { let mut uri = format!( "{}/xml_extra", self.base_path @@ -671,7 +847,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::XML_EXTRA_POST.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -683,7 +859,7 @@ impl Api for Client where future::ok( XmlExtraPostResponse::OK ) - ) as Box> + ) as Box> }, 400 => { let body = response.body(); @@ -692,7 +868,7 @@ impl Api for Client where future::ok( XmlExtraPostResponse::BadRequest ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -711,14 +887,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn xml_other_post(&self, param_another_xml_object: Option, context: &C) -> Box> { + fn xml_other_post(&self, param_another_xml_object: Option, context: &C) -> Box> { let mut uri = format!( "{}/xml_other", self.base_path @@ -750,7 +926,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::XML_OTHER_POST.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -762,7 +938,7 @@ impl Api for Client where future::ok( XmlOtherPostResponse::OK ) - ) as Box> + ) as Box> }, 400 => { let body = response.body(); @@ -771,7 +947,7 @@ impl Api for Client where future::ok( XmlOtherPostResponse::BadRequest ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -790,14 +966,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn xml_other_put(&self, param_string: Option, context: &C) -> Box> { + fn xml_other_put(&self, param_string: Option, context: &C) -> Box> { let mut uri = format!( "{}/xml_other", self.base_path @@ -829,7 +1005,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::XML_OTHER_PUT.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -841,7 +1017,7 @@ impl Api for Client where future::ok( XmlOtherPutResponse::OK ) - ) as Box> + ) as Box> }, 400 => { let body = response.body(); @@ -850,7 +1026,7 @@ impl Api for Client where future::ok( XmlOtherPutResponse::BadRequest ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -869,14 +1045,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn xml_post(&self, param_string: Option, context: &C) -> Box> { + fn xml_post(&self, param_string: Option, context: &C) -> Box> { let mut uri = format!( "{}/xml", self.base_path @@ -908,7 +1084,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::XML_POST.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -920,7 +1096,7 @@ impl Api for Client where future::ok( XmlPostResponse::OK ) - ) as Box> + ) as Box> }, 400 => { let body = response.body(); @@ -929,7 +1105,7 @@ impl Api for Client where future::ok( XmlPostResponse::BadRequest ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -948,14 +1124,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn xml_put(&self, param_xml_object: Option, context: &C) -> Box> { + fn xml_put(&self, param_xml_object: Option, context: &C) -> Box> { let mut uri = format!( "{}/xml", self.base_path @@ -987,7 +1163,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::XML_PUT.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -999,7 +1175,7 @@ impl Api for Client where future::ok( XmlPutResponse::OK ) - ) as Box> + ) as Box> }, 400 => { let body = response.body(); @@ -1008,7 +1184,7 @@ impl Api for Client where future::ok( XmlPutResponse::BadRequest ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1027,7 +1203,7 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) @@ -1058,7 +1234,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/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs index 255d779db32..17fe5ad4694 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/lib.rs @@ -51,6 +51,37 @@ pub const BASE_PATH: &'static str = ""; pub const API_VERSION: &'static str = "1.0.7"; +#[derive(Debug, PartialEq)] +pub enum MultigetGetResponse { + /// JSON rsp + JSONRsp + (models::AnotherXmlObject) + , + /// XML rsp + XMLRsp + (models::InlineResponse201) + , + /// octet rsp + OctetRsp + (swagger::ByteArray) + , + /// string rsp + StringRsp + (String) + , + /// Duplicate Response long text. One. + DuplicateResponseLongText + (models::AnotherXmlObject) + , + /// Duplicate Response long text. Two. + DuplicateResponseLongText_2 + (models::AnotherXmlObject) + , + /// Duplicate Response long text. Three. + DuplicateResponseLongText_3 + (models::AnotherXmlObject) +} + #[derive(Debug, PartialEq)] pub enum MultipleAuthSchemeGetResponse { /// Check that limiting to multiple required auth schemes works @@ -142,70 +173,76 @@ pub enum XmlPutResponse { /// API pub trait Api { - - fn multiple_auth_scheme_get(&self, context: &C) -> Box>; + /// Get some stuff. + fn multiget_get(&self, context: &C) -> Box>; - fn readonly_auth_scheme_get(&self, context: &C) -> Box>; + fn multiple_auth_scheme_get(&self, context: &C) -> Box>; - fn required_octet_stream_put(&self, body: swagger::ByteArray, context: &C) -> Box>; + fn readonly_auth_scheme_get(&self, context: &C) -> Box>; - fn responses_with_headers_get(&self, context: &C) -> Box>; + fn required_octet_stream_put(&self, body: swagger::ByteArray, context: &C) -> Box>; - fn uuid_get(&self, context: &C) -> Box>; + fn responses_with_headers_get(&self, context: &C) -> Box>; - fn xml_extra_post(&self, duplicate_xml_object: Option, context: &C) -> Box>; + fn uuid_get(&self, context: &C) -> Box>; - fn xml_other_post(&self, another_xml_object: Option, context: &C) -> Box>; + fn xml_extra_post(&self, duplicate_xml_object: Option, context: &C) -> Box>; - fn xml_other_put(&self, string: Option, context: &C) -> Box>; + fn xml_other_post(&self, another_xml_object: Option, context: &C) -> Box>; + + + fn xml_other_put(&self, string: Option, context: &C) -> Box>; /// Post an array - fn xml_post(&self, string: Option, context: &C) -> Box>; + fn xml_post(&self, string: Option, context: &C) -> Box>; - fn xml_put(&self, xml_object: Option, context: &C) -> Box>; + fn xml_put(&self, xml_object: Option, context: &C) -> Box>; } /// API without a `Context` pub trait ApiNoContext { - - fn multiple_auth_scheme_get(&self) -> Box>; + /// Get some stuff. + fn multiget_get(&self) -> Box>; - fn readonly_auth_scheme_get(&self) -> Box>; + fn multiple_auth_scheme_get(&self) -> Box>; - fn required_octet_stream_put(&self, body: swagger::ByteArray) -> Box>; + fn readonly_auth_scheme_get(&self) -> Box>; - fn responses_with_headers_get(&self) -> Box>; + fn required_octet_stream_put(&self, body: swagger::ByteArray) -> Box>; - fn uuid_get(&self) -> Box>; + fn responses_with_headers_get(&self) -> Box>; - fn xml_extra_post(&self, duplicate_xml_object: Option) -> Box>; + fn uuid_get(&self) -> Box>; - fn xml_other_post(&self, another_xml_object: Option) -> Box>; + fn xml_extra_post(&self, duplicate_xml_object: Option) -> Box>; - fn xml_other_put(&self, string: Option) -> Box>; + fn xml_other_post(&self, another_xml_object: Option) -> Box>; + + + fn xml_other_put(&self, string: Option) -> Box>; /// Post an array - fn xml_post(&self, string: Option) -> Box>; + fn xml_post(&self, string: Option) -> Box>; - fn xml_put(&self, xml_object: Option) -> Box>; + fn xml_put(&self, xml_object: Option) -> Box>; } @@ -223,53 +260,58 @@ impl<'a, T: Api + Sized, C> ContextWrapperExt<'a, C> for T { impl<'a, T: Api, C> ApiNoContext for ContextWrapper<'a, T, C> { + /// Get some stuff. + fn multiget_get(&self) -> Box> { + self.api().multiget_get(&self.context()) + } - fn multiple_auth_scheme_get(&self) -> Box> { + + fn multiple_auth_scheme_get(&self) -> Box> { self.api().multiple_auth_scheme_get(&self.context()) } - fn readonly_auth_scheme_get(&self) -> Box> { + fn readonly_auth_scheme_get(&self) -> Box> { self.api().readonly_auth_scheme_get(&self.context()) } - fn required_octet_stream_put(&self, body: swagger::ByteArray) -> Box> { + fn required_octet_stream_put(&self, body: swagger::ByteArray) -> Box> { self.api().required_octet_stream_put(body, &self.context()) } - fn responses_with_headers_get(&self) -> Box> { + fn responses_with_headers_get(&self) -> Box> { self.api().responses_with_headers_get(&self.context()) } - fn uuid_get(&self) -> Box> { + fn uuid_get(&self) -> Box> { self.api().uuid_get(&self.context()) } - fn xml_extra_post(&self, duplicate_xml_object: Option) -> Box> { + fn xml_extra_post(&self, duplicate_xml_object: Option) -> Box> { self.api().xml_extra_post(duplicate_xml_object, &self.context()) } - fn xml_other_post(&self, another_xml_object: Option) -> Box> { + fn xml_other_post(&self, another_xml_object: Option) -> Box> { self.api().xml_other_post(another_xml_object, &self.context()) } - fn xml_other_put(&self, string: Option) -> Box> { + fn xml_other_put(&self, string: Option) -> Box> { self.api().xml_other_put(string, &self.context()) } /// Post an array - fn xml_post(&self, string: Option) -> Box> { + fn xml_post(&self, string: Option) -> Box> { self.api().xml_post(string, &self.context()) } - fn xml_put(&self, xml_object: Option) -> Box> { + fn xml_put(&self, xml_object: Option) -> Box> { self.api().xml_put(xml_object, &self.context()) } diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/mimetypes.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/mimetypes.rs index 3f70e612d01..28f79f4ed2b 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/mimetypes.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/mimetypes.rs @@ -5,6 +5,41 @@ pub mod responses { // The macro is called per-operation to beat the recursion limit + lazy_static! { + /// Create Mime objects for the response content types for MultigetGet + pub static ref MULTIGET_GET_JSON_RSP: Mime = "application/json".parse().unwrap(); + } + + lazy_static! { + /// Create Mime objects for the response content types for MultigetGet + pub static ref MULTIGET_GET_XML_RSP: Mime = "application/xml".parse().unwrap(); + } + + lazy_static! { + /// Create Mime objects for the response content types for MultigetGet + pub static ref MULTIGET_GET_OCTET_RSP: Mime = "application/octet-stream".parse().unwrap(); + } + + lazy_static! { + /// Create Mime objects for the response content types for MultigetGet + pub static ref MULTIGET_GET_STRING_RSP: Mime = "text/plain".parse().unwrap(); + } + + lazy_static! { + /// Create Mime objects for the response content types for MultigetGet + pub static ref MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT: Mime = "application/json".parse().unwrap(); + } + + lazy_static! { + /// Create Mime objects for the response content types for MultigetGet + pub static ref MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT_2: Mime = "application/json".parse().unwrap(); + } + + lazy_static! { + /// Create Mime objects for the response content types for MultigetGet + pub static ref MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT_3: Mime = "application/json".parse().unwrap(); + } + lazy_static! { /// Create Mime objects for the response content types for ResponsesWithHeadersGet pub static ref RESPONSES_WITH_HEADERS_GET_SUCCESS: Mime = "application/json".parse().unwrap(); diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/models.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/models.rs index 081175d56fb..b3adc1f3ad1 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/models.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/models.rs @@ -218,6 +218,32 @@ impl DuplicateXmlObject { } } +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[cfg_attr(feature = "conversion", derive(LabelledGeneric))] +pub struct InlineResponse201 { + #[serde(rename = "foo")] + #[serde(skip_serializing_if="Option::is_none")] + pub foo: Option, + +} + +impl InlineResponse201 { + pub fn new() -> InlineResponse201 { + InlineResponse201 { + foo: None, + } + } +} + +impl InlineResponse201 { + /// Helper function to allow us to convert this model to an XML string. + /// Will panic if serialisation fails. + #[allow(dead_code)] + pub(crate) fn to_xml(&self) -> String { + serde_xml_rs::to_string(&self).expect("impossible to fail to serialize") + } +} + /// Test a model containing a UUID #[derive(Debug, Clone, PartialEq, PartialOrd, Serialize, Deserialize)] #[cfg_attr(feature = "conversion", derive(LabelledGeneric))] diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs index 2298f08c707..4800083b061 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/server/mod.rs @@ -35,6 +35,7 @@ use swagger::{ApiError, XSpanId, XSpanIdString, Has, RequestParser}; use swagger::auth::Scopes; use {Api, + MultigetGetResponse, MultipleAuthSchemeGetResponse, ReadonlyAuthSchemeGetResponse, RequiredOctetStreamPutResponse, @@ -58,6 +59,7 @@ mod paths { lazy_static! { pub static ref GLOBAL_REGEX_SET: regex::RegexSet = regex::RegexSet::new(vec![ + r"^/multiget$", r"^/multiple_auth_scheme$", r"^/readonly_auth_scheme$", r"^/required_octet_stream$", @@ -68,14 +70,15 @@ mod paths { r"^/xml_other$" ]).unwrap(); } - pub static ID_MULTIPLE_AUTH_SCHEME: usize = 0; - pub static ID_READONLY_AUTH_SCHEME: usize = 1; - pub static ID_REQUIRED_OCTET_STREAM: usize = 2; - pub static ID_RESPONSES_WITH_HEADERS: usize = 3; - pub static ID_UUID: usize = 4; - pub static ID_XML: usize = 5; - pub static ID_XML_EXTRA: usize = 6; - pub static ID_XML_OTHER: usize = 7; + pub static ID_MULTIGET: usize = 0; + pub static ID_MULTIPLE_AUTH_SCHEME: usize = 1; + pub static ID_READONLY_AUTH_SCHEME: usize = 2; + pub static ID_REQUIRED_OCTET_STREAM: usize = 3; + pub static ID_RESPONSES_WITH_HEADERS: usize = 4; + pub static ID_UUID: usize = 5; + pub static ID_XML: usize = 6; + pub static ID_XML_EXTRA: usize = 7; + pub static ID_XML_OTHER: usize = 8; } pub struct NewService { @@ -130,7 +133,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(); @@ -141,10 +144,128 @@ where // Please update both places if changing how this code is autogenerated. match &method { + // MultigetGet - GET /multiget + &hyper::Method::Get if path.matched(paths::ID_MULTIGET) => { + Box::new({ + {{ + Box::new(api_impl.multiget_get(&context) + .then(move |result| { + let mut response = Response::new(); + response.headers_mut().set(XSpanId((&context as &dyn Has).get().0.to_string())); + + match result { + Ok(rsp) => match rsp { + MultigetGetResponse::JSONRsp + + (body) + + + => { + response.set_status(StatusCode::try_from(200).unwrap()); + + response.headers_mut().set(ContentType(mimetypes::responses::MULTIGET_GET_JSON_RSP.clone())); + + let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); + response.set_body(body); + }, + MultigetGetResponse::XMLRsp + + (body) + + + => { + response.set_status(StatusCode::try_from(201).unwrap()); + + response.headers_mut().set(ContentType(mimetypes::responses::MULTIGET_GET_XML_RSP.clone())); + + let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); + response.set_body(body); + }, + MultigetGetResponse::OctetRsp + + (body) + + + => { + response.set_status(StatusCode::try_from(202).unwrap()); + + response.headers_mut().set(ContentType(mimetypes::responses::MULTIGET_GET_OCTET_RSP.clone())); + + let body = body.0; + response.set_body(body); + }, + MultigetGetResponse::StringRsp + + (body) + + + => { + response.set_status(StatusCode::try_from(203).unwrap()); + + response.headers_mut().set(ContentType(mimetypes::responses::MULTIGET_GET_STRING_RSP.clone())); + + let body = body; + response.set_body(body); + }, + MultigetGetResponse::DuplicateResponseLongText + + (body) + + + => { + response.set_status(StatusCode::try_from(204).unwrap()); + + response.headers_mut().set(ContentType(mimetypes::responses::MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT.clone())); + + let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); + response.set_body(body); + }, + MultigetGetResponse::DuplicateResponseLongText_2 + + (body) + + + => { + response.set_status(StatusCode::try_from(205).unwrap()); + + response.headers_mut().set(ContentType(mimetypes::responses::MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT_2.clone())); + + let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); + response.set_body(body); + }, + MultigetGetResponse::DuplicateResponseLongText_3 + + (body) + + + => { + response.set_status(StatusCode::try_from(206).unwrap()); + + response.headers_mut().set(ContentType(mimetypes::responses::MULTIGET_GET_DUPLICATE_RESPONSE_LONG_TEXT_3.clone())); + + let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); + response.set_body(body); + }, + }, + Err(_) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + response.set_status(StatusCode::InternalServerError); + response.set_body("An internal error occurred"); + }, + } + + future::ok(response) + } + )) + }} + }) as Box> + }, + // MultipleAuthSchemeGet - GET /multiple_auth_scheme &hyper::Method::Get if path.matched(paths::ID_MULTIPLE_AUTH_SCHEME) => { { - 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) @@ -175,7 +296,7 @@ where Box::new(api_impl.multiple_auth_scheme_get(&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())); match result { Ok(rsp) => match rsp { @@ -199,13 +320,13 @@ where } )) }} - }) as Box> + }) as Box> }, // ReadonlyAuthSchemeGet - GET /readonly_auth_scheme &hyper::Method::Get if path.matched(paths::ID_READONLY_AUTH_SCHEME) => { { - 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) @@ -235,7 +356,7 @@ where Box::new(api_impl.readonly_auth_scheme_get(&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())); match result { Ok(rsp) => match rsp { @@ -259,7 +380,7 @@ where } )) }} - }) as Box> + }) as Box> }, // RequiredOctetStreamPut - PUT /required_octet_stream @@ -268,7 +389,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) => { let param_body: Option = if !body.is_empty() { @@ -283,7 +404,7 @@ where Box::new(api_impl.required_octet_stream_put(param_body, &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())); match result { Ok(rsp) => match rsp { @@ -310,7 +431,7 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter body: {}", e)))), } }) - ) as Box> + ) as Box> }, // ResponsesWithHeadersGet - GET /responses_with_headers @@ -320,7 +441,7 @@ where Box::new(api_impl.responses_with_headers_get(&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())); match result { Ok(rsp) => match rsp { @@ -339,9 +460,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::RESPONSES_WITH_HEADERS_GET_SUCCESS.clone())); - let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, ResponsesWithHeadersGetResponse::PreconditionFailed @@ -373,7 +492,7 @@ where } )) }} - }) as Box> + }) as Box> }, // UuidGet - GET /uuid @@ -383,7 +502,7 @@ where Box::new(api_impl.uuid_get(&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())); match result { Ok(rsp) => match rsp { @@ -397,9 +516,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::UUID_GET_DUPLICATE_RESPONSE_LONG_TEXT.clone())); - let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, }, @@ -415,7 +532,7 @@ where } )) }} - }) as Box> + }) as Box> }, // XmlExtraPost - POST /xml_extra @@ -424,7 +541,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) => { let mut unused_elements = Vec::new(); @@ -443,7 +560,7 @@ where Box::new(api_impl.xml_extra_post(param_duplicate_xml_object, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -481,7 +598,7 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter DuplicateXmlObject: {}", e)))), } }) - ) as Box> + ) as Box> }, // XmlOtherPost - POST /xml_other @@ -490,7 +607,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) => { let mut unused_elements = Vec::new(); @@ -509,7 +626,7 @@ where Box::new(api_impl.xml_other_post(param_another_xml_object, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -547,7 +664,7 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter AnotherXmlObject: {}", e)))), } }) - ) as Box> + ) as Box> }, // XmlOtherPut - PUT /xml_other @@ -556,7 +673,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) => { let mut unused_elements = Vec::new(); @@ -575,7 +692,7 @@ where Box::new(api_impl.xml_other_put(param_string, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -613,7 +730,7 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter string: {}", e)))), } }) - ) as Box> + ) as Box> }, // XmlPost - POST /xml @@ -622,7 +739,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) => { let mut unused_elements = Vec::new(); @@ -641,7 +758,7 @@ where Box::new(api_impl.xml_post(param_string, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -679,7 +796,7 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter string: {}", e)))), } }) - ) as Box> + ) as Box> }, // XmlPut - PUT /xml @@ -688,7 +805,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) => { let mut unused_elements = Vec::new(); @@ -707,7 +824,7 @@ where Box::new(api_impl.xml_put(param_xml_object, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -745,10 +862,10 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter XmlObject: {}", e)))), } }) - ) as Box> + ) as Box> }, - _ => Box::new(future::ok(Response::new().with_status(StatusCode::NotFound))) as Box>, + _ => Box::new(future::ok(Response::new().with_status(StatusCode::NotFound))) as Box>, } } } @@ -771,6 +888,9 @@ impl RequestParser for ApiRequestParser { let path = paths::GLOBAL_REGEX_SET.matches(request.uri().path()); match request.method() { + // MultigetGet - GET /multiget + &hyper::Method::Get if path.matched(paths::ID_MULTIGET) => Ok("MultigetGet"), + // MultipleAuthSchemeGet - GET /multiple_auth_scheme &hyper::Method::Get if path.matched(paths::ID_MULTIPLE_AUTH_SCHEME) => Ok("MultipleAuthSchemeGet"), diff --git a/samples/server/petstore/rust-server/output/ops-v3/Cargo.toml b/samples/server/petstore/rust-server/output/ops-v3/Cargo.toml index aa2e7ac6abe..088555ff7ea 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/Cargo.toml +++ b/samples/server/petstore/rust-server/output/ops-v3/Cargo.toml @@ -16,7 +16,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/samples/server/petstore/rust-server/output/ops-v3/examples/client.rs b/samples/server/petstore/rust-server/output/ops-v3/examples/client.rs index 2cfb02dad28..30d05713a7f 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/examples/client.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/examples/client.rs @@ -143,187 +143,187 @@ fn main() { Some("Op10Get") => { let result = core.run(client.op10_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op11Get") => { let result = core.run(client.op11_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op12Get") => { let result = core.run(client.op12_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op13Get") => { let result = core.run(client.op13_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op14Get") => { let result = core.run(client.op14_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op15Get") => { let result = core.run(client.op15_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op16Get") => { let result = core.run(client.op16_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op17Get") => { let result = core.run(client.op17_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op18Get") => { let result = core.run(client.op18_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op19Get") => { let result = core.run(client.op19_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op1Get") => { let result = core.run(client.op1_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op20Get") => { let result = core.run(client.op20_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op21Get") => { let result = core.run(client.op21_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op22Get") => { let result = core.run(client.op22_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op23Get") => { let result = core.run(client.op23_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op24Get") => { let result = core.run(client.op24_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op25Get") => { let result = core.run(client.op25_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op26Get") => { let result = core.run(client.op26_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op27Get") => { let result = core.run(client.op27_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op28Get") => { let result = core.run(client.op28_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op29Get") => { let result = core.run(client.op29_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op2Get") => { let result = core.run(client.op2_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op30Get") => { let result = core.run(client.op30_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op31Get") => { let result = core.run(client.op31_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op32Get") => { let result = core.run(client.op32_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op33Get") => { let result = core.run(client.op33_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op34Get") => { let result = core.run(client.op34_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op35Get") => { let result = core.run(client.op35_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op36Get") => { let result = core.run(client.op36_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op37Get") => { let result = core.run(client.op37_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op3Get") => { let result = core.run(client.op3_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op4Get") => { let result = core.run(client.op4_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op5Get") => { let result = core.run(client.op5_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op6Get") => { let result = core.run(client.op6_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op7Get") => { let result = core.run(client.op7_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op8Get") => { let result = core.run(client.op8_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("Op9Get") => { let result = core.run(client.op9_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, _ => { diff --git a/samples/server/petstore/rust-server/output/ops-v3/examples/server_lib/server.rs b/samples/server/petstore/rust-server/output/ops-v3/examples/server_lib/server.rs index 1d493838629..19e55248dec 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/examples/server_lib/server.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/examples/server_lib/server.rs @@ -64,259 +64,259 @@ impl Server { impl Api for Server where C: Has{ - fn op10_get(&self, context: &C) -> Box> { + fn op10_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op10_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op11_get(&self, context: &C) -> Box> { + fn op11_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op11_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op12_get(&self, context: &C) -> Box> { + fn op12_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op12_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op13_get(&self, context: &C) -> Box> { + fn op13_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op13_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op14_get(&self, context: &C) -> Box> { + fn op14_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op14_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op15_get(&self, context: &C) -> Box> { + fn op15_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op15_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op16_get(&self, context: &C) -> Box> { + fn op16_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op16_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op17_get(&self, context: &C) -> Box> { + fn op17_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op17_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op18_get(&self, context: &C) -> Box> { + fn op18_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op18_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op19_get(&self, context: &C) -> Box> { + fn op19_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op19_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op1_get(&self, context: &C) -> Box> { + fn op1_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op1_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op20_get(&self, context: &C) -> Box> { + fn op20_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op20_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op21_get(&self, context: &C) -> Box> { + fn op21_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op21_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op22_get(&self, context: &C) -> Box> { + fn op22_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op22_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op23_get(&self, context: &C) -> Box> { + fn op23_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op23_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op24_get(&self, context: &C) -> Box> { + fn op24_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op24_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op25_get(&self, context: &C) -> Box> { + fn op25_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op25_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op26_get(&self, context: &C) -> Box> { + fn op26_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op26_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op27_get(&self, context: &C) -> Box> { + fn op27_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op27_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op28_get(&self, context: &C) -> Box> { + fn op28_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op28_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op29_get(&self, context: &C) -> Box> { + fn op29_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op29_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op2_get(&self, context: &C) -> Box> { + fn op2_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op2_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op30_get(&self, context: &C) -> Box> { + fn op30_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op30_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op31_get(&self, context: &C) -> Box> { + fn op31_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op31_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op32_get(&self, context: &C) -> Box> { + fn op32_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op32_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op33_get(&self, context: &C) -> Box> { + fn op33_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op33_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op34_get(&self, context: &C) -> Box> { + fn op34_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op34_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op35_get(&self, context: &C) -> Box> { + fn op35_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op35_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op36_get(&self, context: &C) -> Box> { + fn op36_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op36_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op37_get(&self, context: &C) -> Box> { + fn op37_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op37_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op3_get(&self, context: &C) -> Box> { + fn op3_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op3_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op4_get(&self, context: &C) -> Box> { + fn op4_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op4_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op5_get(&self, context: &C) -> Box> { + fn op5_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op5_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op6_get(&self, context: &C) -> Box> { + fn op6_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op6_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op7_get(&self, context: &C) -> Box> { + fn op7_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op7_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op8_get(&self, context: &C) -> Box> { + fn op8_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op8_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn op9_get(&self, context: &C) -> Box> { + fn op9_get(&self, context: &C) -> Box> { let context = context.clone(); println!("op9_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) diff --git a/samples/server/petstore/rust-server/output/ops-v3/src/client/mod.rs b/samples/server/petstore/rust-server/output/ops-v3/src/client/mod.rs index 983e15ea2b4..ecb62ede32f 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/client/mod.rs @@ -105,7 +105,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, } @@ -216,7 +216,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, @@ -243,7 +243,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> @@ -261,7 +261,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> @@ -277,7 +277,7 @@ impl Api for Client where F: Future + 'static, C: Has { - fn op10_get(&self, context: &C) -> Box> { + fn op10_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op10", self.base_path @@ -300,7 +300,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -312,7 +312,7 @@ impl Api for Client where future::ok( Op10GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -331,14 +331,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op11_get(&self, context: &C) -> Box> { + fn op11_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op11", self.base_path @@ -361,7 +361,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -373,7 +373,7 @@ impl Api for Client where future::ok( Op11GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -392,14 +392,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op12_get(&self, context: &C) -> Box> { + fn op12_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op12", self.base_path @@ -422,7 +422,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -434,7 +434,7 @@ impl Api for Client where future::ok( Op12GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -453,14 +453,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op13_get(&self, context: &C) -> Box> { + fn op13_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op13", self.base_path @@ -483,7 +483,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -495,7 +495,7 @@ impl Api for Client where future::ok( Op13GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -514,14 +514,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op14_get(&self, context: &C) -> Box> { + fn op14_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op14", self.base_path @@ -544,7 +544,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -556,7 +556,7 @@ impl Api for Client where future::ok( Op14GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -575,14 +575,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op15_get(&self, context: &C) -> Box> { + fn op15_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op15", self.base_path @@ -605,7 +605,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -617,7 +617,7 @@ impl Api for Client where future::ok( Op15GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -636,14 +636,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op16_get(&self, context: &C) -> Box> { + fn op16_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op16", self.base_path @@ -666,7 +666,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -678,7 +678,7 @@ impl Api for Client where future::ok( Op16GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -697,14 +697,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op17_get(&self, context: &C) -> Box> { + fn op17_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op17", self.base_path @@ -727,7 +727,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -739,7 +739,7 @@ impl Api for Client where future::ok( Op17GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -758,14 +758,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op18_get(&self, context: &C) -> Box> { + fn op18_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op18", self.base_path @@ -788,7 +788,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -800,7 +800,7 @@ impl Api for Client where future::ok( Op18GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -819,14 +819,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op19_get(&self, context: &C) -> Box> { + fn op19_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op19", self.base_path @@ -849,7 +849,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -861,7 +861,7 @@ impl Api for Client where future::ok( Op19GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -880,14 +880,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op1_get(&self, context: &C) -> Box> { + fn op1_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op1", self.base_path @@ -910,7 +910,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -922,7 +922,7 @@ impl Api for Client where future::ok( Op1GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -941,14 +941,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op20_get(&self, context: &C) -> Box> { + fn op20_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op20", self.base_path @@ -971,7 +971,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -983,7 +983,7 @@ impl Api for Client where future::ok( Op20GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1002,14 +1002,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op21_get(&self, context: &C) -> Box> { + fn op21_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op21", self.base_path @@ -1032,7 +1032,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1044,7 +1044,7 @@ impl Api for Client where future::ok( Op21GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1063,14 +1063,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op22_get(&self, context: &C) -> Box> { + fn op22_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op22", self.base_path @@ -1093,7 +1093,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1105,7 +1105,7 @@ impl Api for Client where future::ok( Op22GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1124,14 +1124,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op23_get(&self, context: &C) -> Box> { + fn op23_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op23", self.base_path @@ -1154,7 +1154,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1166,7 +1166,7 @@ impl Api for Client where future::ok( Op23GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1185,14 +1185,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op24_get(&self, context: &C) -> Box> { + fn op24_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op24", self.base_path @@ -1215,7 +1215,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1227,7 +1227,7 @@ impl Api for Client where future::ok( Op24GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1246,14 +1246,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op25_get(&self, context: &C) -> Box> { + fn op25_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op25", self.base_path @@ -1276,7 +1276,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1288,7 +1288,7 @@ impl Api for Client where future::ok( Op25GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1307,14 +1307,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op26_get(&self, context: &C) -> Box> { + fn op26_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op26", self.base_path @@ -1337,7 +1337,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1349,7 +1349,7 @@ impl Api for Client where future::ok( Op26GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1368,14 +1368,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op27_get(&self, context: &C) -> Box> { + fn op27_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op27", self.base_path @@ -1398,7 +1398,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1410,7 +1410,7 @@ impl Api for Client where future::ok( Op27GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1429,14 +1429,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op28_get(&self, context: &C) -> Box> { + fn op28_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op28", self.base_path @@ -1459,7 +1459,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1471,7 +1471,7 @@ impl Api for Client where future::ok( Op28GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1490,14 +1490,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op29_get(&self, context: &C) -> Box> { + fn op29_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op29", self.base_path @@ -1520,7 +1520,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1532,7 +1532,7 @@ impl Api for Client where future::ok( Op29GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1551,14 +1551,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op2_get(&self, context: &C) -> Box> { + fn op2_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op2", self.base_path @@ -1581,7 +1581,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1593,7 +1593,7 @@ impl Api for Client where future::ok( Op2GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1612,14 +1612,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op30_get(&self, context: &C) -> Box> { + fn op30_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op30", self.base_path @@ -1642,7 +1642,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1654,7 +1654,7 @@ impl Api for Client where future::ok( Op30GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1673,14 +1673,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op31_get(&self, context: &C) -> Box> { + fn op31_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op31", self.base_path @@ -1703,7 +1703,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1715,7 +1715,7 @@ impl Api for Client where future::ok( Op31GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1734,14 +1734,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op32_get(&self, context: &C) -> Box> { + fn op32_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op32", self.base_path @@ -1764,7 +1764,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1776,7 +1776,7 @@ impl Api for Client where future::ok( Op32GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1795,14 +1795,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op33_get(&self, context: &C) -> Box> { + fn op33_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op33", self.base_path @@ -1825,7 +1825,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1837,7 +1837,7 @@ impl Api for Client where future::ok( Op33GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1856,14 +1856,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op34_get(&self, context: &C) -> Box> { + fn op34_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op34", self.base_path @@ -1886,7 +1886,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1898,7 +1898,7 @@ impl Api for Client where future::ok( Op34GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1917,14 +1917,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op35_get(&self, context: &C) -> Box> { + fn op35_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op35", self.base_path @@ -1947,7 +1947,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1959,7 +1959,7 @@ impl Api for Client where future::ok( Op35GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1978,14 +1978,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op36_get(&self, context: &C) -> Box> { + fn op36_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op36", self.base_path @@ -2008,7 +2008,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2020,7 +2020,7 @@ impl Api for Client where future::ok( Op36GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2039,14 +2039,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op37_get(&self, context: &C) -> Box> { + fn op37_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op37", self.base_path @@ -2069,7 +2069,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2081,7 +2081,7 @@ impl Api for Client where future::ok( Op37GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2100,14 +2100,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op3_get(&self, context: &C) -> Box> { + fn op3_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op3", self.base_path @@ -2130,7 +2130,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2142,7 +2142,7 @@ impl Api for Client where future::ok( Op3GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2161,14 +2161,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op4_get(&self, context: &C) -> Box> { + fn op4_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op4", self.base_path @@ -2191,7 +2191,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2203,7 +2203,7 @@ impl Api for Client where future::ok( Op4GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2222,14 +2222,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op5_get(&self, context: &C) -> Box> { + fn op5_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op5", self.base_path @@ -2252,7 +2252,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2264,7 +2264,7 @@ impl Api for Client where future::ok( Op5GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2283,14 +2283,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op6_get(&self, context: &C) -> Box> { + fn op6_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op6", self.base_path @@ -2313,7 +2313,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2325,7 +2325,7 @@ impl Api for Client where future::ok( Op6GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2344,14 +2344,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op7_get(&self, context: &C) -> Box> { + fn op7_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op7", self.base_path @@ -2374,7 +2374,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2386,7 +2386,7 @@ impl Api for Client where future::ok( Op7GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2405,14 +2405,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op8_get(&self, context: &C) -> Box> { + fn op8_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op8", self.base_path @@ -2435,7 +2435,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2447,7 +2447,7 @@ impl Api for Client where future::ok( Op8GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2466,14 +2466,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn op9_get(&self, context: &C) -> Box> { + fn op9_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/op9", self.base_path @@ -2496,7 +2496,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2508,7 +2508,7 @@ impl Api for Client where future::ok( Op9GetResponse::OK ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2527,7 +2527,7 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) @@ -2558,7 +2558,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/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs b/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs index 8ec590c42ab..7f73c804746 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/lib.rs @@ -277,115 +277,115 @@ pub enum Op9GetResponse { pub trait Api { - fn op10_get(&self, context: &C) -> Box>; + fn op10_get(&self, context: &C) -> Box>; - fn op11_get(&self, context: &C) -> Box>; + fn op11_get(&self, context: &C) -> Box>; - fn op12_get(&self, context: &C) -> Box>; + fn op12_get(&self, context: &C) -> Box>; - fn op13_get(&self, context: &C) -> Box>; + fn op13_get(&self, context: &C) -> Box>; - fn op14_get(&self, context: &C) -> Box>; + fn op14_get(&self, context: &C) -> Box>; - fn op15_get(&self, context: &C) -> Box>; + fn op15_get(&self, context: &C) -> Box>; - fn op16_get(&self, context: &C) -> Box>; + fn op16_get(&self, context: &C) -> Box>; - fn op17_get(&self, context: &C) -> Box>; + fn op17_get(&self, context: &C) -> Box>; - fn op18_get(&self, context: &C) -> Box>; + fn op18_get(&self, context: &C) -> Box>; - fn op19_get(&self, context: &C) -> Box>; + fn op19_get(&self, context: &C) -> Box>; - fn op1_get(&self, context: &C) -> Box>; + fn op1_get(&self, context: &C) -> Box>; - fn op20_get(&self, context: &C) -> Box>; + fn op20_get(&self, context: &C) -> Box>; - fn op21_get(&self, context: &C) -> Box>; + fn op21_get(&self, context: &C) -> Box>; - fn op22_get(&self, context: &C) -> Box>; + fn op22_get(&self, context: &C) -> Box>; - fn op23_get(&self, context: &C) -> Box>; + fn op23_get(&self, context: &C) -> Box>; - fn op24_get(&self, context: &C) -> Box>; + fn op24_get(&self, context: &C) -> Box>; - fn op25_get(&self, context: &C) -> Box>; + fn op25_get(&self, context: &C) -> Box>; - fn op26_get(&self, context: &C) -> Box>; + fn op26_get(&self, context: &C) -> Box>; - fn op27_get(&self, context: &C) -> Box>; + fn op27_get(&self, context: &C) -> Box>; - fn op28_get(&self, context: &C) -> Box>; + fn op28_get(&self, context: &C) -> Box>; - fn op29_get(&self, context: &C) -> Box>; + fn op29_get(&self, context: &C) -> Box>; - fn op2_get(&self, context: &C) -> Box>; + fn op2_get(&self, context: &C) -> Box>; - fn op30_get(&self, context: &C) -> Box>; + fn op30_get(&self, context: &C) -> Box>; - fn op31_get(&self, context: &C) -> Box>; + fn op31_get(&self, context: &C) -> Box>; - fn op32_get(&self, context: &C) -> Box>; + fn op32_get(&self, context: &C) -> Box>; - fn op33_get(&self, context: &C) -> Box>; + fn op33_get(&self, context: &C) -> Box>; - fn op34_get(&self, context: &C) -> Box>; + fn op34_get(&self, context: &C) -> Box>; - fn op35_get(&self, context: &C) -> Box>; + fn op35_get(&self, context: &C) -> Box>; - fn op36_get(&self, context: &C) -> Box>; + fn op36_get(&self, context: &C) -> Box>; - fn op37_get(&self, context: &C) -> Box>; + fn op37_get(&self, context: &C) -> Box>; - fn op3_get(&self, context: &C) -> Box>; + fn op3_get(&self, context: &C) -> Box>; - fn op4_get(&self, context: &C) -> Box>; + fn op4_get(&self, context: &C) -> Box>; - fn op5_get(&self, context: &C) -> Box>; + fn op5_get(&self, context: &C) -> Box>; - fn op6_get(&self, context: &C) -> Box>; + fn op6_get(&self, context: &C) -> Box>; - fn op7_get(&self, context: &C) -> Box>; + fn op7_get(&self, context: &C) -> Box>; - fn op8_get(&self, context: &C) -> Box>; + fn op8_get(&self, context: &C) -> Box>; - fn op9_get(&self, context: &C) -> Box>; + fn op9_get(&self, context: &C) -> Box>; } @@ -393,115 +393,115 @@ pub trait Api { pub trait ApiNoContext { - fn op10_get(&self) -> Box>; + fn op10_get(&self) -> Box>; - fn op11_get(&self) -> Box>; + fn op11_get(&self) -> Box>; - fn op12_get(&self) -> Box>; + fn op12_get(&self) -> Box>; - fn op13_get(&self) -> Box>; + fn op13_get(&self) -> Box>; - fn op14_get(&self) -> Box>; + fn op14_get(&self) -> Box>; - fn op15_get(&self) -> Box>; + fn op15_get(&self) -> Box>; - fn op16_get(&self) -> Box>; + fn op16_get(&self) -> Box>; - fn op17_get(&self) -> Box>; + fn op17_get(&self) -> Box>; - fn op18_get(&self) -> Box>; + fn op18_get(&self) -> Box>; - fn op19_get(&self) -> Box>; + fn op19_get(&self) -> Box>; - fn op1_get(&self) -> Box>; + fn op1_get(&self) -> Box>; - fn op20_get(&self) -> Box>; + fn op20_get(&self) -> Box>; - fn op21_get(&self) -> Box>; + fn op21_get(&self) -> Box>; - fn op22_get(&self) -> Box>; + fn op22_get(&self) -> Box>; - fn op23_get(&self) -> Box>; + fn op23_get(&self) -> Box>; - fn op24_get(&self) -> Box>; + fn op24_get(&self) -> Box>; - fn op25_get(&self) -> Box>; + fn op25_get(&self) -> Box>; - fn op26_get(&self) -> Box>; + fn op26_get(&self) -> Box>; - fn op27_get(&self) -> Box>; + fn op27_get(&self) -> Box>; - fn op28_get(&self) -> Box>; + fn op28_get(&self) -> Box>; - fn op29_get(&self) -> Box>; + fn op29_get(&self) -> Box>; - fn op2_get(&self) -> Box>; + fn op2_get(&self) -> Box>; - fn op30_get(&self) -> Box>; + fn op30_get(&self) -> Box>; - fn op31_get(&self) -> Box>; + fn op31_get(&self) -> Box>; - fn op32_get(&self) -> Box>; + fn op32_get(&self) -> Box>; - fn op33_get(&self) -> Box>; + fn op33_get(&self) -> Box>; - fn op34_get(&self) -> Box>; + fn op34_get(&self) -> Box>; - fn op35_get(&self) -> Box>; + fn op35_get(&self) -> Box>; - fn op36_get(&self) -> Box>; + fn op36_get(&self) -> Box>; - fn op37_get(&self) -> Box>; + fn op37_get(&self) -> Box>; - fn op3_get(&self) -> Box>; + fn op3_get(&self) -> Box>; - fn op4_get(&self) -> Box>; + fn op4_get(&self) -> Box>; - fn op5_get(&self) -> Box>; + fn op5_get(&self) -> Box>; - fn op6_get(&self) -> Box>; + fn op6_get(&self) -> Box>; - fn op7_get(&self) -> Box>; + fn op7_get(&self) -> Box>; - fn op8_get(&self) -> Box>; + fn op8_get(&self) -> Box>; - fn op9_get(&self) -> Box>; + fn op9_get(&self) -> Box>; } @@ -520,187 +520,187 @@ impl<'a, T: Api + Sized, C> ContextWrapperExt<'a, C> for T { impl<'a, T: Api, C> ApiNoContext for ContextWrapper<'a, T, C> { - fn op10_get(&self) -> Box> { + fn op10_get(&self) -> Box> { self.api().op10_get(&self.context()) } - fn op11_get(&self) -> Box> { + fn op11_get(&self) -> Box> { self.api().op11_get(&self.context()) } - fn op12_get(&self) -> Box> { + fn op12_get(&self) -> Box> { self.api().op12_get(&self.context()) } - fn op13_get(&self) -> Box> { + fn op13_get(&self) -> Box> { self.api().op13_get(&self.context()) } - fn op14_get(&self) -> Box> { + fn op14_get(&self) -> Box> { self.api().op14_get(&self.context()) } - fn op15_get(&self) -> Box> { + fn op15_get(&self) -> Box> { self.api().op15_get(&self.context()) } - fn op16_get(&self) -> Box> { + fn op16_get(&self) -> Box> { self.api().op16_get(&self.context()) } - fn op17_get(&self) -> Box> { + fn op17_get(&self) -> Box> { self.api().op17_get(&self.context()) } - fn op18_get(&self) -> Box> { + fn op18_get(&self) -> Box> { self.api().op18_get(&self.context()) } - fn op19_get(&self) -> Box> { + fn op19_get(&self) -> Box> { self.api().op19_get(&self.context()) } - fn op1_get(&self) -> Box> { + fn op1_get(&self) -> Box> { self.api().op1_get(&self.context()) } - fn op20_get(&self) -> Box> { + fn op20_get(&self) -> Box> { self.api().op20_get(&self.context()) } - fn op21_get(&self) -> Box> { + fn op21_get(&self) -> Box> { self.api().op21_get(&self.context()) } - fn op22_get(&self) -> Box> { + fn op22_get(&self) -> Box> { self.api().op22_get(&self.context()) } - fn op23_get(&self) -> Box> { + fn op23_get(&self) -> Box> { self.api().op23_get(&self.context()) } - fn op24_get(&self) -> Box> { + fn op24_get(&self) -> Box> { self.api().op24_get(&self.context()) } - fn op25_get(&self) -> Box> { + fn op25_get(&self) -> Box> { self.api().op25_get(&self.context()) } - fn op26_get(&self) -> Box> { + fn op26_get(&self) -> Box> { self.api().op26_get(&self.context()) } - fn op27_get(&self) -> Box> { + fn op27_get(&self) -> Box> { self.api().op27_get(&self.context()) } - fn op28_get(&self) -> Box> { + fn op28_get(&self) -> Box> { self.api().op28_get(&self.context()) } - fn op29_get(&self) -> Box> { + fn op29_get(&self) -> Box> { self.api().op29_get(&self.context()) } - fn op2_get(&self) -> Box> { + fn op2_get(&self) -> Box> { self.api().op2_get(&self.context()) } - fn op30_get(&self) -> Box> { + fn op30_get(&self) -> Box> { self.api().op30_get(&self.context()) } - fn op31_get(&self) -> Box> { + fn op31_get(&self) -> Box> { self.api().op31_get(&self.context()) } - fn op32_get(&self) -> Box> { + fn op32_get(&self) -> Box> { self.api().op32_get(&self.context()) } - fn op33_get(&self) -> Box> { + fn op33_get(&self) -> Box> { self.api().op33_get(&self.context()) } - fn op34_get(&self) -> Box> { + fn op34_get(&self) -> Box> { self.api().op34_get(&self.context()) } - fn op35_get(&self) -> Box> { + fn op35_get(&self) -> Box> { self.api().op35_get(&self.context()) } - fn op36_get(&self) -> Box> { + fn op36_get(&self) -> Box> { self.api().op36_get(&self.context()) } - fn op37_get(&self) -> Box> { + fn op37_get(&self) -> Box> { self.api().op37_get(&self.context()) } - fn op3_get(&self) -> Box> { + fn op3_get(&self) -> Box> { self.api().op3_get(&self.context()) } - fn op4_get(&self) -> Box> { + fn op4_get(&self) -> Box> { self.api().op4_get(&self.context()) } - fn op5_get(&self) -> Box> { + fn op5_get(&self) -> Box> { self.api().op5_get(&self.context()) } - fn op6_get(&self) -> Box> { + fn op6_get(&self) -> Box> { self.api().op6_get(&self.context()) } - fn op7_get(&self) -> Box> { + fn op7_get(&self) -> Box> { self.api().op7_get(&self.context()) } - fn op8_get(&self) -> Box> { + fn op8_get(&self) -> Box> { self.api().op8_get(&self.context()) } - fn op9_get(&self) -> Box> { + fn op9_get(&self) -> Box> { self.api().op9_get(&self.context()) } diff --git a/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs index 267efa7a217..7714591e7ca 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/server/mod.rs @@ -213,7 +213,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(); @@ -231,7 +231,7 @@ where Box::new(api_impl.op10_get(&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())); match result { Ok(rsp) => match rsp { @@ -255,7 +255,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op11Get - GET /op11 @@ -265,7 +265,7 @@ where Box::new(api_impl.op11_get(&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())); match result { Ok(rsp) => match rsp { @@ -289,7 +289,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op12Get - GET /op12 @@ -299,7 +299,7 @@ where Box::new(api_impl.op12_get(&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())); match result { Ok(rsp) => match rsp { @@ -323,7 +323,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op13Get - GET /op13 @@ -333,7 +333,7 @@ where Box::new(api_impl.op13_get(&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())); match result { Ok(rsp) => match rsp { @@ -357,7 +357,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op14Get - GET /op14 @@ -367,7 +367,7 @@ where Box::new(api_impl.op14_get(&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())); match result { Ok(rsp) => match rsp { @@ -391,7 +391,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op15Get - GET /op15 @@ -401,7 +401,7 @@ where Box::new(api_impl.op15_get(&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())); match result { Ok(rsp) => match rsp { @@ -425,7 +425,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op16Get - GET /op16 @@ -435,7 +435,7 @@ where Box::new(api_impl.op16_get(&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())); match result { Ok(rsp) => match rsp { @@ -459,7 +459,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op17Get - GET /op17 @@ -469,7 +469,7 @@ where Box::new(api_impl.op17_get(&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())); match result { Ok(rsp) => match rsp { @@ -493,7 +493,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op18Get - GET /op18 @@ -503,7 +503,7 @@ where Box::new(api_impl.op18_get(&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())); match result { Ok(rsp) => match rsp { @@ -527,7 +527,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op19Get - GET /op19 @@ -537,7 +537,7 @@ where Box::new(api_impl.op19_get(&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())); match result { Ok(rsp) => match rsp { @@ -561,7 +561,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op1Get - GET /op1 @@ -571,7 +571,7 @@ where Box::new(api_impl.op1_get(&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())); match result { Ok(rsp) => match rsp { @@ -595,7 +595,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op20Get - GET /op20 @@ -605,7 +605,7 @@ where Box::new(api_impl.op20_get(&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())); match result { Ok(rsp) => match rsp { @@ -629,7 +629,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op21Get - GET /op21 @@ -639,7 +639,7 @@ where Box::new(api_impl.op21_get(&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())); match result { Ok(rsp) => match rsp { @@ -663,7 +663,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op22Get - GET /op22 @@ -673,7 +673,7 @@ where Box::new(api_impl.op22_get(&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())); match result { Ok(rsp) => match rsp { @@ -697,7 +697,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op23Get - GET /op23 @@ -707,7 +707,7 @@ where Box::new(api_impl.op23_get(&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())); match result { Ok(rsp) => match rsp { @@ -731,7 +731,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op24Get - GET /op24 @@ -741,7 +741,7 @@ where Box::new(api_impl.op24_get(&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())); match result { Ok(rsp) => match rsp { @@ -765,7 +765,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op25Get - GET /op25 @@ -775,7 +775,7 @@ where Box::new(api_impl.op25_get(&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())); match result { Ok(rsp) => match rsp { @@ -799,7 +799,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op26Get - GET /op26 @@ -809,7 +809,7 @@ where Box::new(api_impl.op26_get(&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())); match result { Ok(rsp) => match rsp { @@ -833,7 +833,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op27Get - GET /op27 @@ -843,7 +843,7 @@ where Box::new(api_impl.op27_get(&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())); match result { Ok(rsp) => match rsp { @@ -867,7 +867,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op28Get - GET /op28 @@ -877,7 +877,7 @@ where Box::new(api_impl.op28_get(&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())); match result { Ok(rsp) => match rsp { @@ -901,7 +901,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op29Get - GET /op29 @@ -911,7 +911,7 @@ where Box::new(api_impl.op29_get(&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())); match result { Ok(rsp) => match rsp { @@ -935,7 +935,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op2Get - GET /op2 @@ -945,7 +945,7 @@ where Box::new(api_impl.op2_get(&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())); match result { Ok(rsp) => match rsp { @@ -969,7 +969,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op30Get - GET /op30 @@ -979,7 +979,7 @@ where Box::new(api_impl.op30_get(&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())); match result { Ok(rsp) => match rsp { @@ -1003,7 +1003,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op31Get - GET /op31 @@ -1013,7 +1013,7 @@ where Box::new(api_impl.op31_get(&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())); match result { Ok(rsp) => match rsp { @@ -1037,7 +1037,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op32Get - GET /op32 @@ -1047,7 +1047,7 @@ where Box::new(api_impl.op32_get(&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())); match result { Ok(rsp) => match rsp { @@ -1071,7 +1071,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op33Get - GET /op33 @@ -1081,7 +1081,7 @@ where Box::new(api_impl.op33_get(&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())); match result { Ok(rsp) => match rsp { @@ -1105,7 +1105,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op34Get - GET /op34 @@ -1115,7 +1115,7 @@ where Box::new(api_impl.op34_get(&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())); match result { Ok(rsp) => match rsp { @@ -1139,7 +1139,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op35Get - GET /op35 @@ -1149,7 +1149,7 @@ where Box::new(api_impl.op35_get(&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())); match result { Ok(rsp) => match rsp { @@ -1173,7 +1173,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op36Get - GET /op36 @@ -1183,7 +1183,7 @@ where Box::new(api_impl.op36_get(&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())); match result { Ok(rsp) => match rsp { @@ -1207,7 +1207,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op37Get - GET /op37 @@ -1217,7 +1217,7 @@ where Box::new(api_impl.op37_get(&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())); match result { Ok(rsp) => match rsp { @@ -1241,7 +1241,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op3Get - GET /op3 @@ -1251,7 +1251,7 @@ where Box::new(api_impl.op3_get(&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())); match result { Ok(rsp) => match rsp { @@ -1275,7 +1275,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op4Get - GET /op4 @@ -1285,7 +1285,7 @@ where Box::new(api_impl.op4_get(&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())); match result { Ok(rsp) => match rsp { @@ -1309,7 +1309,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op5Get - GET /op5 @@ -1319,7 +1319,7 @@ where Box::new(api_impl.op5_get(&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())); match result { Ok(rsp) => match rsp { @@ -1343,7 +1343,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op6Get - GET /op6 @@ -1353,7 +1353,7 @@ where Box::new(api_impl.op6_get(&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())); match result { Ok(rsp) => match rsp { @@ -1377,7 +1377,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op7Get - GET /op7 @@ -1387,7 +1387,7 @@ where Box::new(api_impl.op7_get(&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())); match result { Ok(rsp) => match rsp { @@ -1411,7 +1411,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op8Get - GET /op8 @@ -1421,7 +1421,7 @@ where Box::new(api_impl.op8_get(&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())); match result { Ok(rsp) => match rsp { @@ -1445,7 +1445,7 @@ where } )) }} - }) as Box> + }) as Box> }, // Op9Get - GET /op9 @@ -1455,7 +1455,7 @@ where Box::new(api_impl.op9_get(&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())); match result { Ok(rsp) => match rsp { @@ -1479,10 +1479,10 @@ where } )) }} - }) as Box> + }) as Box> }, - _ => 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/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml index eacf8e96ff4..45332e7a07f 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml @@ -16,7 +16,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/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/client.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/client.rs index bcf3e0d67d3..a55c070e0c3 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/client.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/client.rs @@ -124,171 +124,171 @@ fn main() { // Disabled because there's no example. // Some("TestSpecialTags") => { // let result = core.run(client.test_special_tags(???)); - // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); // }, Some("FakeOuterBooleanSerialize") => { let result = core.run(client.fake_outer_boolean_serialize(None)); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("FakeOuterCompositeSerialize") => { let result = core.run(client.fake_outer_composite_serialize(None)); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("FakeOuterNumberSerialize") => { let result = core.run(client.fake_outer_number_serialize(None)); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("FakeOuterStringSerialize") => { let result = core.run(client.fake_outer_string_serialize(None)); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, // Disabled because there's no example. // Some("TestBodyWithQueryParams") => { // let result = core.run(client.test_body_with_query_params("query_example".to_string(), ???)); - // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); // }, // Disabled because there's no example. // Some("TestClientModel") => { // let result = core.run(client.test_client_model(???)); - // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); // }, Some("TestEndpointParameters") => { let result = core.run(client.test_endpoint_parameters(8.14, 1.2, "pattern_without_delimiter_example".to_string(), swagger::ByteArray(Vec::from("BYTE_ARRAY_DATA_HERE")), Some(56), Some(56), Some(789), Some(3.4), Some("string_example".to_string()), Some(swagger::ByteArray(Vec::from("BINARY_DATA_HERE"))), None, None, Some("password_example".to_string()), Some("callback_example".to_string()))); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("TestEnumParameters") => { let result = core.run(client.test_enum_parameters(Some(&Vec::new()), Some("enum_header_string_example".to_string()), Some(&Vec::new()), Some("enum_query_string_example".to_string()), Some(56), Some(1.2), Some("enum_form_string_example".to_string()))); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, // Disabled because there's no example. // Some("TestInlineAdditionalProperties") => { // let result = core.run(client.test_inline_additional_properties(???)); - // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); // }, Some("TestJsonFormData") => { let result = core.run(client.test_json_form_data("param_example".to_string(), "param2_example".to_string())); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, // Disabled because there's no example. // Some("TestClassname") => { // let result = core.run(client.test_classname(???)); - // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); // }, // Disabled because there's no example. // Some("AddPet") => { // let result = core.run(client.add_pet(???)); - // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); // }, Some("DeletePet") => { let result = core.run(client.delete_pet(789, Some("api_key_example".to_string()))); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("FindPetsByStatus") => { let result = core.run(client.find_pets_by_status(&Vec::new())); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("FindPetsByTags") => { let result = core.run(client.find_pets_by_tags(&Vec::new())); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("GetPetById") => { let result = core.run(client.get_pet_by_id(789)); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, // Disabled because there's no example. // Some("UpdatePet") => { // let result = core.run(client.update_pet(???)); - // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); // }, Some("UpdatePetWithForm") => { let result = core.run(client.update_pet_with_form(789, Some("name_example".to_string()), Some("status_example".to_string()))); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("UploadFile") => { let result = core.run(client.upload_file(789, Some("additional_metadata_example".to_string()), Some(swagger::ByteArray(Vec::from("BINARY_DATA_HERE"))))); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("DeleteOrder") => { let result = core.run(client.delete_order("order_id_example".to_string())); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("GetInventory") => { let result = core.run(client.get_inventory()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("GetOrderById") => { let result = core.run(client.get_order_by_id(789)); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, // Disabled because there's no example. // Some("PlaceOrder") => { // let result = core.run(client.place_order(???)); - // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); // }, // Disabled because there's no example. // Some("CreateUser") => { // let result = core.run(client.create_user(???)); - // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); // }, Some("CreateUsersWithArrayInput") => { let result = core.run(client.create_users_with_array_input(&Vec::new())); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("CreateUsersWithListInput") => { let result = core.run(client.create_users_with_list_input(&Vec::new())); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("DeleteUser") => { let result = core.run(client.delete_user("username_example".to_string())); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("GetUserByName") => { let result = core.run(client.get_user_by_name("username_example".to_string())); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("LoginUser") => { let result = core.run(client.login_user("username_example".to_string(), "password_example".to_string())); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("LogoutUser") => { let result = core.run(client.logout_user()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, // Disabled because there's no example. // Some("UpdateUser") => { // let result = core.run(client.update_user("username_example".to_string(), ???)); - // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); // }, _ => { diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/server_lib/server.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/server_lib/server.rs index f76a7dfa875..2602397dc42 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/server_lib/server.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/examples/server_lib/server.rs @@ -60,224 +60,224 @@ impl Server { impl Api for Server where C: Has{ /// To test special tags - fn test_special_tags(&self, body: models::Client, context: &C) -> Box> { + fn test_special_tags(&self, body: models::Client, context: &C) -> Box> { let context = context.clone(); println!("test_special_tags({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn fake_outer_boolean_serialize(&self, body: Option, context: &C) -> Box> { + fn fake_outer_boolean_serialize(&self, body: Option, context: &C) -> Box> { let context = context.clone(); println!("fake_outer_boolean_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn fake_outer_composite_serialize(&self, body: Option, context: &C) -> Box> { + fn fake_outer_composite_serialize(&self, body: Option, context: &C) -> Box> { let context = context.clone(); println!("fake_outer_composite_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn fake_outer_number_serialize(&self, body: Option, context: &C) -> Box> { + fn fake_outer_number_serialize(&self, body: Option, context: &C) -> Box> { let context = context.clone(); println!("fake_outer_number_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn fake_outer_string_serialize(&self, body: Option, context: &C) -> Box> { + fn fake_outer_string_serialize(&self, body: Option, context: &C) -> Box> { let context = context.clone(); println!("fake_outer_string_serialize({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn test_body_with_query_params(&self, query: String, body: models::User, context: &C) -> Box> { + fn test_body_with_query_params(&self, query: String, body: models::User, context: &C) -> Box> { let context = context.clone(); println!("test_body_with_query_params(\"{}\", {:?}) - X-Span-ID: {:?}", query, body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// To test \"client\" model - fn test_client_model(&self, body: models::Client, context: &C) -> Box> { + fn test_client_model(&self, body: models::Client, context: &C) -> Box> { let context = context.clone(); println!("test_client_model({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - fn test_endpoint_parameters(&self, number: f64, double: f64, pattern_without_delimiter: String, byte: swagger::ByteArray, integer: Option, int32: Option, int64: Option, float: Option, string: Option, binary: Option, date: Option>, date_time: Option>, password: Option, callback: Option, context: &C) -> Box> { + fn test_endpoint_parameters(&self, number: f64, double: f64, pattern_without_delimiter: String, byte: swagger::ByteArray, integer: Option, int32: Option, int64: Option, float: Option, string: Option, binary: Option, date: Option>, date_time: Option>, password: Option, callback: Option, context: &C) -> Box> { let context = context.clone(); println!("test_endpoint_parameters({}, {}, \"{}\", {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, date, date_time, password, callback, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// To test enum parameters - fn test_enum_parameters(&self, enum_header_string_array: Option<&Vec>, enum_header_string: Option, enum_query_string_array: Option<&Vec>, enum_query_string: Option, enum_query_integer: Option, enum_query_double: Option, enum_form_string: Option, context: &C) -> Box> { + fn test_enum_parameters(&self, enum_header_string_array: Option<&Vec>, enum_header_string: Option, enum_query_string_array: Option<&Vec>, enum_query_string: Option, enum_query_integer: Option, enum_query_double: Option, enum_form_string: Option, context: &C) -> Box> { let context = context.clone(); println!("test_enum_parameters({:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", enum_header_string_array, enum_header_string, enum_query_string_array, enum_query_string, enum_query_integer, enum_query_double, enum_form_string, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// test inline additionalProperties - fn test_inline_additional_properties(&self, param: HashMap, context: &C) -> Box> { + fn test_inline_additional_properties(&self, param: HashMap, context: &C) -> Box> { let context = context.clone(); println!("test_inline_additional_properties({:?}) - X-Span-ID: {:?}", param, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// test json serialization of form data - fn test_json_form_data(&self, param: String, param2: String, context: &C) -> Box> { + fn test_json_form_data(&self, param: String, param2: String, context: &C) -> Box> { let context = context.clone(); println!("test_json_form_data(\"{}\", \"{}\") - X-Span-ID: {:?}", param, param2, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// To test class name in snake case - fn test_classname(&self, body: models::Client, context: &C) -> Box> { + fn test_classname(&self, body: models::Client, context: &C) -> Box> { let context = context.clone(); println!("test_classname({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Add a new pet to the store - fn add_pet(&self, body: models::Pet, context: &C) -> Box> { + fn add_pet(&self, body: models::Pet, context: &C) -> Box> { let context = context.clone(); println!("add_pet({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Deletes a pet - fn delete_pet(&self, pet_id: i64, api_key: Option, context: &C) -> Box> { + fn delete_pet(&self, pet_id: i64, api_key: Option, context: &C) -> Box> { let context = context.clone(); println!("delete_pet({}, {:?}) - X-Span-ID: {:?}", pet_id, api_key, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Finds Pets by status - fn find_pets_by_status(&self, status: &Vec, context: &C) -> Box> { + fn find_pets_by_status(&self, status: &Vec, context: &C) -> Box> { let context = context.clone(); println!("find_pets_by_status({:?}) - X-Span-ID: {:?}", status, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Finds Pets by tags - fn find_pets_by_tags(&self, tags: &Vec, context: &C) -> Box> { + fn find_pets_by_tags(&self, tags: &Vec, context: &C) -> Box> { let context = context.clone(); println!("find_pets_by_tags({:?}) - X-Span-ID: {:?}", tags, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Find pet by ID - fn get_pet_by_id(&self, pet_id: i64, context: &C) -> Box> { + fn get_pet_by_id(&self, pet_id: i64, context: &C) -> Box> { let context = context.clone(); println!("get_pet_by_id({}) - X-Span-ID: {:?}", pet_id, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Update an existing pet - fn update_pet(&self, body: models::Pet, context: &C) -> Box> { + fn update_pet(&self, body: models::Pet, context: &C) -> Box> { let context = context.clone(); println!("update_pet({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Updates a pet in the store with form data - fn update_pet_with_form(&self, pet_id: i64, name: Option, status: Option, context: &C) -> Box> { + fn update_pet_with_form(&self, pet_id: i64, name: Option, status: Option, context: &C) -> Box> { let context = context.clone(); println!("update_pet_with_form({}, {:?}, {:?}) - X-Span-ID: {:?}", pet_id, name, status, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// uploads an image - fn upload_file(&self, pet_id: i64, additional_metadata: Option, file: Option, context: &C) -> Box> { + fn upload_file(&self, pet_id: i64, additional_metadata: Option, file: Option, context: &C) -> Box> { let context = context.clone(); println!("upload_file({}, {:?}, {:?}) - X-Span-ID: {:?}", pet_id, additional_metadata, file, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Delete purchase order by ID - fn delete_order(&self, order_id: String, context: &C) -> Box> { + fn delete_order(&self, order_id: String, context: &C) -> Box> { let context = context.clone(); println!("delete_order(\"{}\") - X-Span-ID: {:?}", order_id, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Returns pet inventories by status - fn get_inventory(&self, context: &C) -> Box> { + fn get_inventory(&self, context: &C) -> Box> { let context = context.clone(); println!("get_inventory() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Find purchase order by ID - fn get_order_by_id(&self, order_id: i64, context: &C) -> Box> { + fn get_order_by_id(&self, order_id: i64, context: &C) -> Box> { let context = context.clone(); println!("get_order_by_id({}) - X-Span-ID: {:?}", order_id, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Place an order for a pet - fn place_order(&self, body: models::Order, context: &C) -> Box> { + fn place_order(&self, body: models::Order, context: &C) -> Box> { let context = context.clone(); println!("place_order({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Create user - fn create_user(&self, body: models::User, context: &C) -> Box> { + fn create_user(&self, body: models::User, context: &C) -> Box> { let context = context.clone(); println!("create_user({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Creates list of users with given input array - fn create_users_with_array_input(&self, body: &Vec, context: &C) -> Box> { + fn create_users_with_array_input(&self, body: &Vec, context: &C) -> Box> { let context = context.clone(); println!("create_users_with_array_input({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Creates list of users with given input array - fn create_users_with_list_input(&self, body: &Vec, context: &C) -> Box> { + fn create_users_with_list_input(&self, body: &Vec, context: &C) -> Box> { let context = context.clone(); println!("create_users_with_list_input({:?}) - X-Span-ID: {:?}", body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Delete user - fn delete_user(&self, username: String, context: &C) -> Box> { + fn delete_user(&self, username: String, context: &C) -> Box> { let context = context.clone(); println!("delete_user(\"{}\") - X-Span-ID: {:?}", username, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Get user by user name - fn get_user_by_name(&self, username: String, context: &C) -> Box> { + fn get_user_by_name(&self, username: String, context: &C) -> Box> { let context = context.clone(); println!("get_user_by_name(\"{}\") - X-Span-ID: {:?}", username, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Logs user into the system - fn login_user(&self, username: String, password: String, context: &C) -> Box> { + fn login_user(&self, username: String, password: String, context: &C) -> Box> { let context = context.clone(); println!("login_user(\"{}\", \"{}\") - X-Span-ID: {:?}", username, password, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Logs out current logged in user session - fn logout_user(&self, context: &C) -> Box> { + fn logout_user(&self, context: &C) -> Box> { let context = context.clone(); println!("logout_user() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Updated user - fn update_user(&self, username: String, body: models::User, context: &C) -> Box> { + fn update_user(&self, username: String, body: models::User, context: &C) -> Box> { let context = context.clone(); println!("update_user(\"{}\", {:?}) - X-Span-ID: {:?}", username, body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs index d7a48cd205a..0684eae45e4 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/client/mod.rs @@ -107,7 +107,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, } @@ -218,7 +218,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, @@ -245,7 +245,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> @@ -263,7 +263,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> @@ -279,7 +279,7 @@ impl Api for Client where F: Future + 'static, C: Has + Has>{ - fn test_special_tags(&self, param_body: models::Client, context: &C) -> Box> { + fn test_special_tags(&self, param_body: models::Client, context: &C) -> Box> { let mut uri = format!( "{}/v2/another-fake/dummy", self.base_path @@ -307,7 +307,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::TEST_SPECIAL_TAGS.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -319,20 +319,17 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - - serde_json::from_str::(body) - .map_err(|e| e.into()) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + serde_json::from_str::(body) + .map_err(|e| e.into()) + ) + ) .map(move |body| { TestSpecialTagsResponse::SuccessfulOperation(body) }) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -351,14 +348,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn fake_outer_boolean_serialize(&self, param_body: Option, context: &C) -> Box> { + fn fake_outer_boolean_serialize(&self, param_body: Option, context: &C) -> Box> { let mut uri = format!( "{}/v2/fake/outer/boolean", self.base_path @@ -391,7 +388,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::FAKE_OUTER_BOOLEAN_SERIALIZE.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -403,20 +400,17 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - - serde_json::from_str::(body) - .map_err(|e| e.into()) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + serde_json::from_str::(body) + .map_err(|e| e.into()) + ) + ) .map(move |body| { FakeOuterBooleanSerializeResponse::OutputBoolean(body) }) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -435,14 +429,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn fake_outer_composite_serialize(&self, param_body: Option, context: &C) -> Box> { + fn fake_outer_composite_serialize(&self, param_body: Option, context: &C) -> Box> { let mut uri = format!( "{}/v2/fake/outer/composite", self.base_path @@ -474,7 +468,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::FAKE_OUTER_COMPOSITE_SERIALIZE.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -486,20 +480,17 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - - serde_json::from_str::(body) - .map_err(|e| e.into()) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + serde_json::from_str::(body) + .map_err(|e| e.into()) + ) + ) .map(move |body| { FakeOuterCompositeSerializeResponse::OutputComposite(body) }) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -518,14 +509,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn fake_outer_number_serialize(&self, param_body: Option, context: &C) -> Box> { + fn fake_outer_number_serialize(&self, param_body: Option, context: &C) -> Box> { let mut uri = format!( "{}/v2/fake/outer/number", self.base_path @@ -557,7 +548,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::FAKE_OUTER_NUMBER_SERIALIZE.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -569,20 +560,17 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - - serde_json::from_str::(body) - .map_err(|e| e.into()) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + serde_json::from_str::(body) + .map_err(|e| e.into()) + ) + ) .map(move |body| { FakeOuterNumberSerializeResponse::OutputNumber(body) }) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -601,14 +589,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn fake_outer_string_serialize(&self, param_body: Option, context: &C) -> Box> { + fn fake_outer_string_serialize(&self, param_body: Option, context: &C) -> Box> { let mut uri = format!( "{}/v2/fake/outer/string", self.base_path @@ -640,7 +628,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::FAKE_OUTER_STRING_SERIALIZE.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -652,20 +640,17 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - - serde_json::from_str::(body) - .map_err(|e| e.into()) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + serde_json::from_str::(body) + .map_err(|e| e.into()) + ) + ) .map(move |body| { FakeOuterStringSerializeResponse::OutputString(body) }) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -684,14 +669,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn test_body_with_query_params(&self, param_query: String, param_body: models::User, context: &C) -> Box> { + fn test_body_with_query_params(&self, param_query: String, param_body: models::User, context: &C) -> Box> { let mut uri = format!( "{}/v2/fake/body-with-query-params", self.base_path @@ -719,7 +704,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::TEST_BODY_WITH_QUERY_PARAMS.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -731,7 +716,7 @@ impl Api for Client where future::ok( TestBodyWithQueryParamsResponse::Success ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -750,14 +735,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn test_client_model(&self, param_body: models::Client, context: &C) -> Box> { + fn test_client_model(&self, param_body: models::Client, context: &C) -> Box> { let mut uri = format!( "{}/v2/fake", self.base_path @@ -784,7 +769,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::TEST_CLIENT_MODEL.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -796,20 +781,17 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - - serde_json::from_str::(body) - .map_err(|e| e.into()) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + serde_json::from_str::(body) + .map_err(|e| e.into()) + ) + ) .map(move |body| { TestClientModelResponse::SuccessfulOperation(body) }) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -828,14 +810,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn test_endpoint_parameters(&self, param_number: f64, param_double: f64, param_pattern_without_delimiter: String, param_byte: swagger::ByteArray, param_integer: Option, param_int32: Option, param_int64: Option, param_float: Option, param_string: Option, param_binary: Option, param_date: Option>, param_date_time: Option>, param_password: Option, param_callback: Option, context: &C) -> Box> { + fn test_endpoint_parameters(&self, param_number: f64, param_double: f64, param_pattern_without_delimiter: String, param_byte: swagger::ByteArray, param_integer: Option, param_int32: Option, param_int64: Option, param_float: Option, param_string: Option, param_binary: Option, param_date: Option>, param_date_time: Option>, param_password: Option, param_callback: Option, context: &C) -> Box> { let mut uri = format!( "{}/v2/fake", self.base_path @@ -878,9 +860,9 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::TEST_ENDPOINT_PARAMETERS.clone())); request.set_body(body.into_bytes()); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); - (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 { &AuthData::Basic(ref basic_header) => { @@ -902,7 +884,7 @@ impl Api for Client where future::ok( TestEndpointParametersResponse::InvalidUsernameSupplied ) - ) as Box> + ) as Box> }, 404 => { let body = response.body(); @@ -911,7 +893,7 @@ impl Api for Client where future::ok( TestEndpointParametersResponse::UserNotFound ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -930,14 +912,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn test_enum_parameters(&self, param_enum_header_string_array: Option<&Vec>, param_enum_header_string: Option, param_enum_query_string_array: Option<&Vec>, param_enum_query_string: Option, param_enum_query_integer: Option, param_enum_query_double: Option, param_enum_form_string: Option, context: &C) -> Box> { + fn test_enum_parameters(&self, param_enum_header_string_array: Option<&Vec>, param_enum_header_string: Option, param_enum_query_string_array: Option<&Vec>, param_enum_query_string: Option, param_enum_query_integer: Option, param_enum_query_double: Option, param_enum_form_string: Option, context: &C) -> Box> { let mut uri = format!( "{}/v2/fake", self.base_path @@ -979,7 +961,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::TEST_ENUM_PARAMETERS.clone())); request.set_body(body.into_bytes()); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); // Header parameters header! { (RequestEnumHeaderStringArray, "enum_header_string_array") => (String)* } @@ -997,7 +979,7 @@ impl Api for Client where future::ok( TestEnumParametersResponse::InvalidRequest ) - ) as Box> + ) as Box> }, 404 => { let body = response.body(); @@ -1006,7 +988,7 @@ impl Api for Client where future::ok( TestEnumParametersResponse::NotFound ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1025,14 +1007,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn test_inline_additional_properties(&self, param_param: HashMap, context: &C) -> Box> { + fn test_inline_additional_properties(&self, param_param: HashMap, context: &C) -> Box> { let mut uri = format!( "{}/v2/fake/inline-additionalProperties", self.base_path @@ -1059,7 +1041,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::TEST_INLINE_ADDITIONAL_PROPERTIES.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1071,7 +1053,7 @@ impl Api for Client where future::ok( TestInlineAdditionalPropertiesResponse::SuccessfulOperation ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1090,14 +1072,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn test_json_form_data(&self, param_param: String, param_param2: String, context: &C) -> Box> { + fn test_json_form_data(&self, param_param: String, param_param2: String, context: &C) -> Box> { let mut uri = format!( "{}/v2/fake/jsonFormData", self.base_path @@ -1128,7 +1110,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::TEST_JSON_FORM_DATA.clone())); request.set_body(body.into_bytes()); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1140,7 +1122,7 @@ impl Api for Client where future::ok( TestJsonFormDataResponse::SuccessfulOperation ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1159,14 +1141,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn test_classname(&self, param_body: models::Client, context: &C) -> Box> { + fn test_classname(&self, param_body: models::Client, context: &C) -> Box> { let mut uri = format!( "{}/v2/fake_classname_test", self.base_path @@ -1174,7 +1156,7 @@ impl Api for Client where let mut query_string = self::url::form_urlencoded::Serializer::new("".to_owned()); - if let Some(auth_data) = (context as &Has>).get().as_ref() { + 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("api_key_query", api_key); } @@ -1198,7 +1180,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::TEST_CLASSNAME.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -1210,20 +1192,17 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - - serde_json::from_str::(body) - .map_err(|e| e.into()) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + serde_json::from_str::(body) + .map_err(|e| e.into()) + ) + ) .map(move |body| { TestClassnameResponse::SuccessfulOperation(body) }) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1242,14 +1221,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn add_pet(&self, param_body: models::Pet, context: &C) -> Box> { + fn add_pet(&self, param_body: models::Pet, context: &C) -> Box> { let mut uri = format!( "{}/v2/pet", self.base_path @@ -1277,9 +1256,9 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::ADD_PET.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); - (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 { &AuthData::Bearer(ref bearer_header) => { @@ -1301,7 +1280,7 @@ impl Api for Client where future::ok( AddPetResponse::InvalidInput ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1320,14 +1299,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn delete_pet(&self, param_pet_id: i64, param_api_key: Option, context: &C) -> Box> { + fn delete_pet(&self, param_pet_id: i64, param_api_key: Option, context: &C) -> Box> { let mut uri = format!( "{}/v2/pet/{petId}", self.base_path, petId=utf8_percent_encode(¶m_pet_id.to_string(), ID_ENCODE_SET) @@ -1350,9 +1329,9 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Delete, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); - (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 { &AuthData::Bearer(ref bearer_header) => { @@ -1378,7 +1357,7 @@ impl Api for Client where future::ok( DeletePetResponse::InvalidPetValue ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1397,14 +1376,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn find_pets_by_status(&self, param_status: &Vec, context: &C) -> Box> { + fn find_pets_by_status(&self, param_status: &Vec, context: &C) -> Box> { let mut uri = format!( "{}/v2/pet/findByStatus", self.base_path @@ -1428,9 +1407,9 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); - (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 { &AuthData::Bearer(ref bearer_header) => { @@ -1452,21 +1431,19 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - // 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::>(body) - .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e))) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + // 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::>(body) + .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e))) + ) + ) .map(move |body| { FindPetsByStatusResponse::SuccessfulOperation(body) }) - ) as Box> + ) as Box> }, 400 => { let body = response.body(); @@ -1475,7 +1452,7 @@ impl Api for Client where future::ok( FindPetsByStatusResponse::InvalidStatusValue ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1494,14 +1471,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn find_pets_by_tags(&self, param_tags: &Vec, context: &C) -> Box> { + fn find_pets_by_tags(&self, param_tags: &Vec, context: &C) -> Box> { let mut uri = format!( "{}/v2/pet/findByTags", self.base_path @@ -1525,9 +1502,9 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); - (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 { &AuthData::Bearer(ref bearer_header) => { @@ -1549,21 +1526,19 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - // 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::>(body) - .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e))) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + // 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::>(body) + .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e))) + ) + ) .map(move |body| { FindPetsByTagsResponse::SuccessfulOperation(body) }) - ) as Box> + ) as Box> }, 400 => { let body = response.body(); @@ -1572,7 +1547,7 @@ impl Api for Client where future::ok( FindPetsByTagsResponse::InvalidTagValue ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1591,14 +1566,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn get_pet_by_id(&self, param_pet_id: i64, context: &C) -> Box> { + fn get_pet_by_id(&self, param_pet_id: i64, context: &C) -> Box> { let mut uri = format!( "{}/v2/pet/{petId}", self.base_path, petId=utf8_percent_encode(¶m_pet_id.to_string(), ID_ENCODE_SET) @@ -1621,9 +1596,9 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); - (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 { &AuthData::ApiKey(ref api_key) => { @@ -1646,21 +1621,19 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - // 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::(body) - .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e))) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + // 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::(body) + .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e))) + ) + ) .map(move |body| { GetPetByIdResponse::SuccessfulOperation(body) }) - ) as Box> + ) as Box> }, 400 => { let body = response.body(); @@ -1669,7 +1642,7 @@ impl Api for Client where future::ok( GetPetByIdResponse::InvalidIDSupplied ) - ) as Box> + ) as Box> }, 404 => { let body = response.body(); @@ -1678,7 +1651,7 @@ impl Api for Client where future::ok( GetPetByIdResponse::PetNotFound ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1697,14 +1670,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn update_pet(&self, param_body: models::Pet, context: &C) -> Box> { + fn update_pet(&self, param_body: models::Pet, context: &C) -> Box> { let mut uri = format!( "{}/v2/pet", self.base_path @@ -1731,9 +1704,9 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::UPDATE_PET.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); - (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 { &AuthData::Bearer(ref bearer_header) => { @@ -1755,7 +1728,7 @@ impl Api for Client where future::ok( UpdatePetResponse::InvalidIDSupplied ) - ) as Box> + ) as Box> }, 404 => { let body = response.body(); @@ -1764,7 +1737,7 @@ impl Api for Client where future::ok( UpdatePetResponse::PetNotFound ) - ) as Box> + ) as Box> }, 405 => { let body = response.body(); @@ -1773,7 +1746,7 @@ impl Api for Client where future::ok( UpdatePetResponse::ValidationException ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1792,14 +1765,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn update_pet_with_form(&self, param_pet_id: i64, param_name: Option, param_status: Option, context: &C) -> Box> { + fn update_pet_with_form(&self, param_pet_id: i64, param_name: Option, param_status: Option, context: &C) -> Box> { let mut uri = format!( "{}/v2/pet/{petId}", self.base_path, petId=utf8_percent_encode(¶m_pet_id.to_string(), ID_ENCODE_SET) @@ -1830,9 +1803,9 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::UPDATE_PET_WITH_FORM.clone())); request.set_body(body.into_bytes()); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); - (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 { &AuthData::Bearer(ref bearer_header) => { @@ -1854,7 +1827,7 @@ impl Api for Client where future::ok( UpdatePetWithFormResponse::InvalidInput ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -1873,14 +1846,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn upload_file(&self, param_pet_id: i64, param_additional_metadata: Option, param_file: Option, context: &C) -> Box> { + fn upload_file(&self, param_pet_id: i64, param_additional_metadata: Option, param_file: Option, context: &C) -> Box> { let mut uri = format!( "{}/v2/pet/{petId}/uploadImage", self.base_path, petId=utf8_percent_encode(¶m_pet_id.to_string(), ID_ENCODE_SET) @@ -1952,9 +1925,9 @@ impl Api for Client where request.headers_mut().set(ContentType(multipart_header)); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); - (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 { &AuthData::Bearer(ref bearer_header) => { @@ -1976,20 +1949,17 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - - serde_json::from_str::(body) - .map_err(|e| e.into()) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + serde_json::from_str::(body) + .map_err(|e| e.into()) + ) + ) .map(move |body| { UploadFileResponse::SuccessfulOperation(body) }) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2008,14 +1978,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn delete_order(&self, param_order_id: String, context: &C) -> Box> { + fn delete_order(&self, param_order_id: String, context: &C) -> Box> { let mut uri = format!( "{}/v2/store/order/{order_id}", self.base_path, order_id=utf8_percent_encode(¶m_order_id.to_string(), ID_ENCODE_SET) @@ -2038,7 +2008,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Delete, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2050,7 +2020,7 @@ impl Api for Client where future::ok( DeleteOrderResponse::InvalidIDSupplied ) - ) as Box> + ) as Box> }, 404 => { let body = response.body(); @@ -2059,7 +2029,7 @@ impl Api for Client where future::ok( DeleteOrderResponse::OrderNotFound ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2078,14 +2048,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn get_inventory(&self, context: &C) -> Box> { + fn get_inventory(&self, context: &C) -> Box> { let mut uri = format!( "{}/v2/store/inventory", self.base_path @@ -2108,9 +2078,9 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); - (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 { &AuthData::ApiKey(ref api_key) => { @@ -2133,20 +2103,17 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - - serde_json::from_str::>(body) - .map_err(|e| e.into()) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + serde_json::from_str::>(body) + .map_err(|e| e.into()) + ) + ) .map(move |body| { GetInventoryResponse::SuccessfulOperation(body) }) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2165,14 +2132,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn get_order_by_id(&self, param_order_id: i64, context: &C) -> Box> { + fn get_order_by_id(&self, param_order_id: i64, context: &C) -> Box> { let mut uri = format!( "{}/v2/store/order/{order_id}", self.base_path, order_id=utf8_percent_encode(¶m_order_id.to_string(), ID_ENCODE_SET) @@ -2195,7 +2162,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2207,21 +2174,19 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - // 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::(body) - .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e))) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + // 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::(body) + .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e))) + ) + ) .map(move |body| { GetOrderByIdResponse::SuccessfulOperation(body) }) - ) as Box> + ) as Box> }, 400 => { let body = response.body(); @@ -2230,7 +2195,7 @@ impl Api for Client where future::ok( GetOrderByIdResponse::InvalidIDSupplied ) - ) as Box> + ) as Box> }, 404 => { let body = response.body(); @@ -2239,7 +2204,7 @@ impl Api for Client where future::ok( GetOrderByIdResponse::OrderNotFound ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2258,14 +2223,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn place_order(&self, param_body: models::Order, context: &C) -> Box> { + fn place_order(&self, param_body: models::Order, context: &C) -> Box> { let mut uri = format!( "{}/v2/store/order", self.base_path @@ -2292,7 +2257,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::PLACE_ORDER.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2304,21 +2269,19 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - // 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::(body) - .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e))) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + // 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::(body) + .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e))) + ) + ) .map(move |body| { PlaceOrderResponse::SuccessfulOperation(body) }) - ) as Box> + ) as Box> }, 400 => { let body = response.body(); @@ -2327,7 +2290,7 @@ impl Api for Client where future::ok( PlaceOrderResponse::InvalidOrder ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2346,14 +2309,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn create_user(&self, param_body: models::User, context: &C) -> Box> { + fn create_user(&self, param_body: models::User, context: &C) -> Box> { let mut uri = format!( "{}/v2/user", self.base_path @@ -2381,7 +2344,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::CREATE_USER.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2393,7 +2356,7 @@ impl Api for Client where future::ok( CreateUserResponse::SuccessfulOperation ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2412,14 +2375,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn create_users_with_array_input(&self, param_body: &Vec, context: &C) -> Box> { + fn create_users_with_array_input(&self, param_body: &Vec, context: &C) -> Box> { let mut uri = format!( "{}/v2/user/createWithArray", self.base_path @@ -2446,7 +2409,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::CREATE_USERS_WITH_ARRAY_INPUT.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2458,7 +2421,7 @@ impl Api for Client where future::ok( CreateUsersWithArrayInputResponse::SuccessfulOperation ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2477,14 +2440,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn create_users_with_list_input(&self, param_body: &Vec, context: &C) -> Box> { + fn create_users_with_list_input(&self, param_body: &Vec, context: &C) -> Box> { let mut uri = format!( "{}/v2/user/createWithList", self.base_path @@ -2511,7 +2474,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::CREATE_USERS_WITH_LIST_INPUT.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2523,7 +2486,7 @@ impl Api for Client where future::ok( CreateUsersWithListInputResponse::SuccessfulOperation ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2542,14 +2505,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn delete_user(&self, param_username: String, context: &C) -> Box> { + fn delete_user(&self, param_username: String, context: &C) -> Box> { let mut uri = format!( "{}/v2/user/{username}", self.base_path, username=utf8_percent_encode(¶m_username.to_string(), ID_ENCODE_SET) @@ -2572,7 +2535,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Delete, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2584,7 +2547,7 @@ impl Api for Client where future::ok( DeleteUserResponse::InvalidUsernameSupplied ) - ) as Box> + ) as Box> }, 404 => { let body = response.body(); @@ -2593,7 +2556,7 @@ impl Api for Client where future::ok( DeleteUserResponse::UserNotFound ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2612,14 +2575,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn get_user_by_name(&self, param_username: String, context: &C) -> Box> { + fn get_user_by_name(&self, param_username: String, context: &C) -> Box> { let mut uri = format!( "{}/v2/user/{username}", self.base_path, username=utf8_percent_encode(¶m_username.to_string(), ID_ENCODE_SET) @@ -2642,7 +2605,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2654,21 +2617,19 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - // 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::(body) - .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e))) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + // 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::(body) + .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e))) + ) + ) .map(move |body| { GetUserByNameResponse::SuccessfulOperation(body) }) - ) as Box> + ) as Box> }, 400 => { let body = response.body(); @@ -2677,7 +2638,7 @@ impl Api for Client where future::ok( GetUserByNameResponse::InvalidUsernameSupplied ) - ) as Box> + ) as Box> }, 404 => { let body = response.body(); @@ -2686,7 +2647,7 @@ impl Api for Client where future::ok( GetUserByNameResponse::UserNotFound ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2705,14 +2666,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn login_user(&self, param_username: String, param_password: String, context: &C) -> Box> { + fn login_user(&self, param_username: String, param_password: String, context: &C) -> Box> { let mut uri = format!( "{}/v2/user/login", self.base_path @@ -2737,7 +2698,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2746,12 +2707,12 @@ impl Api for Client where header! { (ResponseXRateLimit, "X-Rate-Limit") => [i32] } let response_x_rate_limit = match response.headers().get::() { Some(response_x_rate_limit) => response_x_rate_limit.0.clone(), - None => return Box::new(future::err(ApiError(String::from("Required response header X-Rate-Limit for response 200 was not found.")))) as Box>, + None => return Box::new(future::err(ApiError(String::from("Required response header X-Rate-Limit for response 200 was not found.")))) as Box>, }; header! { (ResponseXExpiresAfter, "X-Expires-After") => [chrono::DateTime] } let response_x_expires_after = match response.headers().get::() { Some(response_x_expires_after) => response_x_expires_after.0.clone(), - None => return Box::new(future::err(ApiError(String::from("Required response header X-Expires-After for response 200 was not found.")))) as Box>, + None => return Box::new(future::err(ApiError(String::from("Required response header X-Expires-After for response 200 was not found.")))) as Box>, }; let body = response.body(); Box::new( @@ -2759,21 +2720,19 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - // 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::(body) - .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e))) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + // 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::(body) + .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e))) + ) + ) .map(move |body| { LoginUserResponse::SuccessfulOperation{ body: body, x_rate_limit: response_x_rate_limit, x_expires_after: response_x_expires_after } }) - ) as Box> + ) as Box> }, 400 => { let body = response.body(); @@ -2782,7 +2741,7 @@ impl Api for Client where future::ok( LoginUserResponse::InvalidUsername ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2801,14 +2760,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn logout_user(&self, context: &C) -> Box> { + fn logout_user(&self, context: &C) -> Box> { let mut uri = format!( "{}/v2/user/logout", self.base_path @@ -2831,7 +2790,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2843,7 +2802,7 @@ impl Api for Client where future::ok( LogoutUserResponse::SuccessfulOperation ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2862,14 +2821,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn update_user(&self, param_username: String, param_body: models::User, context: &C) -> Box> { + fn update_user(&self, param_username: String, param_body: models::User, context: &C) -> Box> { let mut uri = format!( "{}/v2/user/{username}", self.base_path, username=utf8_percent_encode(¶m_username.to_string(), ID_ENCODE_SET) @@ -2896,7 +2855,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::UPDATE_USER.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -2908,7 +2867,7 @@ impl Api for Client where future::ok( UpdateUserResponse::InvalidUserSupplied ) - ) as Box> + ) as Box> }, 404 => { let body = response.body(); @@ -2917,7 +2876,7 @@ impl Api for Client where future::ok( UpdateUserResponse::UserNotFound ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -2936,7 +2895,7 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) @@ -2967,7 +2926,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/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs index 30181968358..12aee98b7fe 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/lib.rs @@ -319,100 +319,100 @@ pub enum UpdateUserResponse { pub trait Api { /// To test special tags - fn test_special_tags(&self, body: models::Client, context: &C) -> Box>; + fn test_special_tags(&self, body: models::Client, context: &C) -> Box>; - fn fake_outer_boolean_serialize(&self, body: Option, context: &C) -> Box>; + fn fake_outer_boolean_serialize(&self, body: Option, context: &C) -> Box>; - fn fake_outer_composite_serialize(&self, body: Option, context: &C) -> Box>; + fn fake_outer_composite_serialize(&self, body: Option, context: &C) -> Box>; - fn fake_outer_number_serialize(&self, body: Option, context: &C) -> Box>; + fn fake_outer_number_serialize(&self, body: Option, context: &C) -> Box>; - fn fake_outer_string_serialize(&self, body: Option, context: &C) -> Box>; + fn fake_outer_string_serialize(&self, body: Option, context: &C) -> Box>; - fn test_body_with_query_params(&self, query: String, body: models::User, context: &C) -> Box>; + fn test_body_with_query_params(&self, query: String, body: models::User, context: &C) -> Box>; /// To test \"client\" model - fn test_client_model(&self, body: models::Client, context: &C) -> Box>; + fn test_client_model(&self, body: models::Client, context: &C) -> Box>; /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - fn test_endpoint_parameters(&self, number: f64, double: f64, pattern_without_delimiter: String, byte: swagger::ByteArray, integer: Option, int32: Option, int64: Option, float: Option, string: Option, binary: Option, date: Option>, date_time: Option>, password: Option, callback: Option, context: &C) -> Box>; + fn test_endpoint_parameters(&self, number: f64, double: f64, pattern_without_delimiter: String, byte: swagger::ByteArray, integer: Option, int32: Option, int64: Option, float: Option, string: Option, binary: Option, date: Option>, date_time: Option>, password: Option, callback: Option, context: &C) -> Box>; /// To test enum parameters - fn test_enum_parameters(&self, enum_header_string_array: Option<&Vec>, enum_header_string: Option, enum_query_string_array: Option<&Vec>, enum_query_string: Option, enum_query_integer: Option, enum_query_double: Option, enum_form_string: Option, context: &C) -> Box>; + fn test_enum_parameters(&self, enum_header_string_array: Option<&Vec>, enum_header_string: Option, enum_query_string_array: Option<&Vec>, enum_query_string: Option, enum_query_integer: Option, enum_query_double: Option, enum_form_string: Option, context: &C) -> Box>; /// test inline additionalProperties - fn test_inline_additional_properties(&self, param: HashMap, context: &C) -> Box>; + fn test_inline_additional_properties(&self, param: HashMap, context: &C) -> Box>; /// test json serialization of form data - fn test_json_form_data(&self, param: String, param2: String, context: &C) -> Box>; + fn test_json_form_data(&self, param: String, param2: String, context: &C) -> Box>; /// To test class name in snake case - fn test_classname(&self, body: models::Client, context: &C) -> Box>; + fn test_classname(&self, body: models::Client, context: &C) -> Box>; /// Add a new pet to the store - fn add_pet(&self, body: models::Pet, context: &C) -> Box>; + fn add_pet(&self, body: models::Pet, context: &C) -> Box>; /// Deletes a pet - fn delete_pet(&self, pet_id: i64, api_key: Option, context: &C) -> Box>; + fn delete_pet(&self, pet_id: i64, api_key: Option, context: &C) -> Box>; /// Finds Pets by status - fn find_pets_by_status(&self, status: &Vec, context: &C) -> Box>; + fn find_pets_by_status(&self, status: &Vec, context: &C) -> Box>; /// Finds Pets by tags - fn find_pets_by_tags(&self, tags: &Vec, context: &C) -> Box>; + fn find_pets_by_tags(&self, tags: &Vec, context: &C) -> Box>; /// Find pet by ID - fn get_pet_by_id(&self, pet_id: i64, context: &C) -> Box>; + fn get_pet_by_id(&self, pet_id: i64, context: &C) -> Box>; /// Update an existing pet - fn update_pet(&self, body: models::Pet, context: &C) -> Box>; + fn update_pet(&self, body: models::Pet, context: &C) -> Box>; /// Updates a pet in the store with form data - fn update_pet_with_form(&self, pet_id: i64, name: Option, status: Option, context: &C) -> Box>; + fn update_pet_with_form(&self, pet_id: i64, name: Option, status: Option, context: &C) -> Box>; /// uploads an image - fn upload_file(&self, pet_id: i64, additional_metadata: Option, file: Option, context: &C) -> Box>; + fn upload_file(&self, pet_id: i64, additional_metadata: Option, file: Option, context: &C) -> Box>; /// Delete purchase order by ID - fn delete_order(&self, order_id: String, context: &C) -> Box>; + fn delete_order(&self, order_id: String, context: &C) -> Box>; /// Returns pet inventories by status - fn get_inventory(&self, context: &C) -> Box>; + fn get_inventory(&self, context: &C) -> Box>; /// Find purchase order by ID - fn get_order_by_id(&self, order_id: i64, context: &C) -> Box>; + fn get_order_by_id(&self, order_id: i64, context: &C) -> Box>; /// Place an order for a pet - fn place_order(&self, body: models::Order, context: &C) -> Box>; + fn place_order(&self, body: models::Order, context: &C) -> Box>; /// Create user - fn create_user(&self, body: models::User, context: &C) -> Box>; + fn create_user(&self, body: models::User, context: &C) -> Box>; /// Creates list of users with given input array - fn create_users_with_array_input(&self, body: &Vec, context: &C) -> Box>; + fn create_users_with_array_input(&self, body: &Vec, context: &C) -> Box>; /// Creates list of users with given input array - fn create_users_with_list_input(&self, body: &Vec, context: &C) -> Box>; + fn create_users_with_list_input(&self, body: &Vec, context: &C) -> Box>; /// Delete user - fn delete_user(&self, username: String, context: &C) -> Box>; + fn delete_user(&self, username: String, context: &C) -> Box>; /// Get user by user name - fn get_user_by_name(&self, username: String, context: &C) -> Box>; + fn get_user_by_name(&self, username: String, context: &C) -> Box>; /// Logs user into the system - fn login_user(&self, username: String, password: String, context: &C) -> Box>; + fn login_user(&self, username: String, password: String, context: &C) -> Box>; /// Logs out current logged in user session - fn logout_user(&self, context: &C) -> Box>; + fn logout_user(&self, context: &C) -> Box>; /// Updated user - fn update_user(&self, username: String, body: models::User, context: &C) -> Box>; + fn update_user(&self, username: String, body: models::User, context: &C) -> Box>; } @@ -420,100 +420,100 @@ pub trait Api { pub trait ApiNoContext { /// To test special tags - fn test_special_tags(&self, body: models::Client) -> Box>; + fn test_special_tags(&self, body: models::Client) -> Box>; - fn fake_outer_boolean_serialize(&self, body: Option) -> Box>; + fn fake_outer_boolean_serialize(&self, body: Option) -> Box>; - fn fake_outer_composite_serialize(&self, body: Option) -> Box>; + fn fake_outer_composite_serialize(&self, body: Option) -> Box>; - fn fake_outer_number_serialize(&self, body: Option) -> Box>; + fn fake_outer_number_serialize(&self, body: Option) -> Box>; - fn fake_outer_string_serialize(&self, body: Option) -> Box>; + fn fake_outer_string_serialize(&self, body: Option) -> Box>; - fn test_body_with_query_params(&self, query: String, body: models::User) -> Box>; + fn test_body_with_query_params(&self, query: String, body: models::User) -> Box>; /// To test \"client\" model - fn test_client_model(&self, body: models::Client) -> Box>; + fn test_client_model(&self, body: models::Client) -> Box>; /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - fn test_endpoint_parameters(&self, number: f64, double: f64, pattern_without_delimiter: String, byte: swagger::ByteArray, integer: Option, int32: Option, int64: Option, float: Option, string: Option, binary: Option, date: Option>, date_time: Option>, password: Option, callback: Option) -> Box>; + fn test_endpoint_parameters(&self, number: f64, double: f64, pattern_without_delimiter: String, byte: swagger::ByteArray, integer: Option, int32: Option, int64: Option, float: Option, string: Option, binary: Option, date: Option>, date_time: Option>, password: Option, callback: Option) -> Box>; /// To test enum parameters - fn test_enum_parameters(&self, enum_header_string_array: Option<&Vec>, enum_header_string: Option, enum_query_string_array: Option<&Vec>, enum_query_string: Option, enum_query_integer: Option, enum_query_double: Option, enum_form_string: Option) -> Box>; + fn test_enum_parameters(&self, enum_header_string_array: Option<&Vec>, enum_header_string: Option, enum_query_string_array: Option<&Vec>, enum_query_string: Option, enum_query_integer: Option, enum_query_double: Option, enum_form_string: Option) -> Box>; /// test inline additionalProperties - fn test_inline_additional_properties(&self, param: HashMap) -> Box>; + fn test_inline_additional_properties(&self, param: HashMap) -> Box>; /// test json serialization of form data - fn test_json_form_data(&self, param: String, param2: String) -> Box>; + fn test_json_form_data(&self, param: String, param2: String) -> Box>; /// To test class name in snake case - fn test_classname(&self, body: models::Client) -> Box>; + fn test_classname(&self, body: models::Client) -> Box>; /// Add a new pet to the store - fn add_pet(&self, body: models::Pet) -> Box>; + fn add_pet(&self, body: models::Pet) -> Box>; /// Deletes a pet - fn delete_pet(&self, pet_id: i64, api_key: Option) -> Box>; + fn delete_pet(&self, pet_id: i64, api_key: Option) -> Box>; /// Finds Pets by status - fn find_pets_by_status(&self, status: &Vec) -> Box>; + fn find_pets_by_status(&self, status: &Vec) -> Box>; /// Finds Pets by tags - fn find_pets_by_tags(&self, tags: &Vec) -> Box>; + fn find_pets_by_tags(&self, tags: &Vec) -> Box>; /// Find pet by ID - fn get_pet_by_id(&self, pet_id: i64) -> Box>; + fn get_pet_by_id(&self, pet_id: i64) -> Box>; /// Update an existing pet - fn update_pet(&self, body: models::Pet) -> Box>; + fn update_pet(&self, body: models::Pet) -> Box>; /// Updates a pet in the store with form data - fn update_pet_with_form(&self, pet_id: i64, name: Option, status: Option) -> Box>; + fn update_pet_with_form(&self, pet_id: i64, name: Option, status: Option) -> Box>; /// uploads an image - fn upload_file(&self, pet_id: i64, additional_metadata: Option, file: Option) -> Box>; + fn upload_file(&self, pet_id: i64, additional_metadata: Option, file: Option) -> Box>; /// Delete purchase order by ID - fn delete_order(&self, order_id: String) -> Box>; + fn delete_order(&self, order_id: String) -> Box>; /// Returns pet inventories by status - fn get_inventory(&self) -> Box>; + fn get_inventory(&self) -> Box>; /// Find purchase order by ID - fn get_order_by_id(&self, order_id: i64) -> Box>; + fn get_order_by_id(&self, order_id: i64) -> Box>; /// Place an order for a pet - fn place_order(&self, body: models::Order) -> Box>; + fn place_order(&self, body: models::Order) -> Box>; /// Create user - fn create_user(&self, body: models::User) -> Box>; + fn create_user(&self, body: models::User) -> Box>; /// Creates list of users with given input array - fn create_users_with_array_input(&self, body: &Vec) -> Box>; + fn create_users_with_array_input(&self, body: &Vec) -> Box>; /// Creates list of users with given input array - fn create_users_with_list_input(&self, body: &Vec) -> Box>; + fn create_users_with_list_input(&self, body: &Vec) -> Box>; /// Delete user - fn delete_user(&self, username: String) -> Box>; + fn delete_user(&self, username: String) -> Box>; /// Get user by user name - fn get_user_by_name(&self, username: String) -> Box>; + fn get_user_by_name(&self, username: String) -> Box>; /// Logs user into the system - fn login_user(&self, username: String, password: String) -> Box>; + fn login_user(&self, username: String, password: String) -> Box>; /// Logs out current logged in user session - fn logout_user(&self) -> Box>; + fn logout_user(&self) -> Box>; /// Updated user - fn update_user(&self, username: String, body: models::User) -> Box>; + fn update_user(&self, username: String, body: models::User) -> Box>; } @@ -532,162 +532,162 @@ impl<'a, T: Api + Sized, C> ContextWrapperExt<'a, C> for T { impl<'a, T: Api, C> ApiNoContext for ContextWrapper<'a, T, C> { /// To test special tags - fn test_special_tags(&self, body: models::Client) -> Box> { + fn test_special_tags(&self, body: models::Client) -> Box> { self.api().test_special_tags(body, &self.context()) } - fn fake_outer_boolean_serialize(&self, body: Option) -> Box> { + fn fake_outer_boolean_serialize(&self, body: Option) -> Box> { self.api().fake_outer_boolean_serialize(body, &self.context()) } - fn fake_outer_composite_serialize(&self, body: Option) -> Box> { + fn fake_outer_composite_serialize(&self, body: Option) -> Box> { self.api().fake_outer_composite_serialize(body, &self.context()) } - fn fake_outer_number_serialize(&self, body: Option) -> Box> { + fn fake_outer_number_serialize(&self, body: Option) -> Box> { self.api().fake_outer_number_serialize(body, &self.context()) } - fn fake_outer_string_serialize(&self, body: Option) -> Box> { + fn fake_outer_string_serialize(&self, body: Option) -> Box> { self.api().fake_outer_string_serialize(body, &self.context()) } - fn test_body_with_query_params(&self, query: String, body: models::User) -> Box> { + fn test_body_with_query_params(&self, query: String, body: models::User) -> Box> { self.api().test_body_with_query_params(query, body, &self.context()) } /// To test \"client\" model - fn test_client_model(&self, body: models::Client) -> Box> { + fn test_client_model(&self, body: models::Client) -> Box> { self.api().test_client_model(body, &self.context()) } /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - fn test_endpoint_parameters(&self, number: f64, double: f64, pattern_without_delimiter: String, byte: swagger::ByteArray, integer: Option, int32: Option, int64: Option, float: Option, string: Option, binary: Option, date: Option>, date_time: Option>, password: Option, callback: Option) -> Box> { + fn test_endpoint_parameters(&self, number: f64, double: f64, pattern_without_delimiter: String, byte: swagger::ByteArray, integer: Option, int32: Option, int64: Option, float: Option, string: Option, binary: Option, date: Option>, date_time: Option>, password: Option, callback: Option) -> Box> { self.api().test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, date, date_time, password, callback, &self.context()) } /// To test enum parameters - fn test_enum_parameters(&self, enum_header_string_array: Option<&Vec>, enum_header_string: Option, enum_query_string_array: Option<&Vec>, enum_query_string: Option, enum_query_integer: Option, enum_query_double: Option, enum_form_string: Option) -> Box> { + fn test_enum_parameters(&self, enum_header_string_array: Option<&Vec>, enum_header_string: Option, enum_query_string_array: Option<&Vec>, enum_query_string: Option, enum_query_integer: Option, enum_query_double: Option, enum_form_string: Option) -> Box> { self.api().test_enum_parameters(enum_header_string_array, enum_header_string, enum_query_string_array, enum_query_string, enum_query_integer, enum_query_double, enum_form_string, &self.context()) } /// test inline additionalProperties - fn test_inline_additional_properties(&self, param: HashMap) -> Box> { + fn test_inline_additional_properties(&self, param: HashMap) -> Box> { self.api().test_inline_additional_properties(param, &self.context()) } /// test json serialization of form data - fn test_json_form_data(&self, param: String, param2: String) -> Box> { + fn test_json_form_data(&self, param: String, param2: String) -> Box> { self.api().test_json_form_data(param, param2, &self.context()) } /// To test class name in snake case - fn test_classname(&self, body: models::Client) -> Box> { + fn test_classname(&self, body: models::Client) -> Box> { self.api().test_classname(body, &self.context()) } /// Add a new pet to the store - fn add_pet(&self, body: models::Pet) -> Box> { + fn add_pet(&self, body: models::Pet) -> Box> { self.api().add_pet(body, &self.context()) } /// Deletes a pet - fn delete_pet(&self, pet_id: i64, api_key: Option) -> Box> { + fn delete_pet(&self, pet_id: i64, api_key: Option) -> Box> { self.api().delete_pet(pet_id, api_key, &self.context()) } /// Finds Pets by status - fn find_pets_by_status(&self, status: &Vec) -> Box> { + fn find_pets_by_status(&self, status: &Vec) -> Box> { self.api().find_pets_by_status(status, &self.context()) } /// Finds Pets by tags - fn find_pets_by_tags(&self, tags: &Vec) -> Box> { + fn find_pets_by_tags(&self, tags: &Vec) -> Box> { self.api().find_pets_by_tags(tags, &self.context()) } /// Find pet by ID - fn get_pet_by_id(&self, pet_id: i64) -> Box> { + fn get_pet_by_id(&self, pet_id: i64) -> Box> { self.api().get_pet_by_id(pet_id, &self.context()) } /// Update an existing pet - fn update_pet(&self, body: models::Pet) -> Box> { + fn update_pet(&self, body: models::Pet) -> Box> { self.api().update_pet(body, &self.context()) } /// Updates a pet in the store with form data - fn update_pet_with_form(&self, pet_id: i64, name: Option, status: Option) -> Box> { + fn update_pet_with_form(&self, pet_id: i64, name: Option, status: Option) -> Box> { self.api().update_pet_with_form(pet_id, name, status, &self.context()) } /// uploads an image - fn upload_file(&self, pet_id: i64, additional_metadata: Option, file: Option) -> Box> { + fn upload_file(&self, pet_id: i64, additional_metadata: Option, file: Option) -> Box> { self.api().upload_file(pet_id, additional_metadata, file, &self.context()) } /// Delete purchase order by ID - fn delete_order(&self, order_id: String) -> Box> { + fn delete_order(&self, order_id: String) -> Box> { self.api().delete_order(order_id, &self.context()) } /// Returns pet inventories by status - fn get_inventory(&self) -> Box> { + fn get_inventory(&self) -> Box> { self.api().get_inventory(&self.context()) } /// Find purchase order by ID - fn get_order_by_id(&self, order_id: i64) -> Box> { + fn get_order_by_id(&self, order_id: i64) -> Box> { self.api().get_order_by_id(order_id, &self.context()) } /// Place an order for a pet - fn place_order(&self, body: models::Order) -> Box> { + fn place_order(&self, body: models::Order) -> Box> { self.api().place_order(body, &self.context()) } /// Create user - fn create_user(&self, body: models::User) -> Box> { + fn create_user(&self, body: models::User) -> Box> { self.api().create_user(body, &self.context()) } /// Creates list of users with given input array - fn create_users_with_array_input(&self, body: &Vec) -> Box> { + fn create_users_with_array_input(&self, body: &Vec) -> Box> { self.api().create_users_with_array_input(body, &self.context()) } /// Creates list of users with given input array - fn create_users_with_list_input(&self, body: &Vec) -> Box> { + fn create_users_with_list_input(&self, body: &Vec) -> Box> { self.api().create_users_with_list_input(body, &self.context()) } /// Delete user - fn delete_user(&self, username: String) -> Box> { + fn delete_user(&self, username: String) -> Box> { self.api().delete_user(username, &self.context()) } /// Get user by user name - fn get_user_by_name(&self, username: String) -> Box> { + fn get_user_by_name(&self, username: String) -> Box> { self.api().get_user_by_name(username, &self.context()) } /// Logs user into the system - fn login_user(&self, username: String, password: String) -> Box> { + fn login_user(&self, username: String, password: String) -> Box> { self.api().login_user(username, password, &self.context()) } /// Logs out current logged in user session - fn logout_user(&self) -> Box> { + fn logout_user(&self) -> Box> { self.api().logout_user(&self.context()) } /// Updated user - fn update_user(&self, username: String, body: models::User) -> Box> { + fn update_user(&self, username: String, body: models::User) -> Box> { self.api().update_user(username, body, &self.context()) } diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/mimetypes.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/mimetypes.rs index e947e94b363..b32609c12a7 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/mimetypes.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/mimetypes.rs @@ -42,17 +42,17 @@ pub mod responses { lazy_static! { /// Create Mime objects for the response content types for FindPetsByStatus - pub static ref FIND_PETS_BY_STATUS_SUCCESSFUL_OPERATION: Mime = "application/json".parse().unwrap(); + pub static ref FIND_PETS_BY_STATUS_SUCCESSFUL_OPERATION: Mime = "application/xml".parse().unwrap(); } lazy_static! { /// Create Mime objects for the response content types for FindPetsByTags - pub static ref FIND_PETS_BY_TAGS_SUCCESSFUL_OPERATION: Mime = "application/json".parse().unwrap(); + pub static ref FIND_PETS_BY_TAGS_SUCCESSFUL_OPERATION: Mime = "application/xml".parse().unwrap(); } lazy_static! { /// Create Mime objects for the response content types for GetPetById - pub static ref GET_PET_BY_ID_SUCCESSFUL_OPERATION: Mime = "application/json".parse().unwrap(); + pub static ref GET_PET_BY_ID_SUCCESSFUL_OPERATION: Mime = "application/xml".parse().unwrap(); } lazy_static! { @@ -67,22 +67,22 @@ pub mod responses { lazy_static! { /// Create Mime objects for the response content types for GetOrderById - pub static ref GET_ORDER_BY_ID_SUCCESSFUL_OPERATION: Mime = "application/json".parse().unwrap(); + pub static ref GET_ORDER_BY_ID_SUCCESSFUL_OPERATION: Mime = "application/xml".parse().unwrap(); } lazy_static! { /// Create Mime objects for the response content types for PlaceOrder - pub static ref PLACE_ORDER_SUCCESSFUL_OPERATION: Mime = "application/json".parse().unwrap(); + pub static ref PLACE_ORDER_SUCCESSFUL_OPERATION: Mime = "application/xml".parse().unwrap(); } lazy_static! { /// Create Mime objects for the response content types for GetUserByName - pub static ref GET_USER_BY_NAME_SUCCESSFUL_OPERATION: Mime = "application/json".parse().unwrap(); + pub static ref GET_USER_BY_NAME_SUCCESSFUL_OPERATION: Mime = "application/xml".parse().unwrap(); } lazy_static! { /// Create Mime objects for the response content types for LoginUser - pub static ref LOGIN_USER_SUCCESSFUL_OPERATION: Mime = "application/json".parse().unwrap(); + pub static ref LOGIN_USER_SUCCESSFUL_OPERATION: Mime = "application/xml".parse().unwrap(); } } diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs index d37730a9a0e..3f3c511493e 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs @@ -200,7 +200,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(); @@ -217,7 +217,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) => { let mut unused_elements = Vec::new(); @@ -240,7 +240,7 @@ where Box::new(api_impl.test_special_tags(param_body, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -258,9 +258,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::TEST_SPECIAL_TAGS_SUCCESSFUL_OPERATION.clone())); - let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, }, @@ -279,7 +277,7 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter body: {}", e)))), } }) - ) as Box> + ) as Box> }, // FakeOuterBooleanSerialize - POST /fake/outer/boolean @@ -288,7 +286,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) => { let mut unused_elements = Vec::new(); @@ -307,7 +305,7 @@ where Box::new(api_impl.fake_outer_boolean_serialize(param_body, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -325,9 +323,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::FAKE_OUTER_BOOLEAN_SERIALIZE_OUTPUT_BOOLEAN.clone())); - let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, }, @@ -346,7 +342,7 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter body: {}", e)))), } }) - ) as Box> + ) as Box> }, // FakeOuterCompositeSerialize - POST /fake/outer/composite @@ -355,7 +351,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) => { let mut unused_elements = Vec::new(); @@ -374,7 +370,7 @@ where Box::new(api_impl.fake_outer_composite_serialize(param_body, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -392,9 +388,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::FAKE_OUTER_COMPOSITE_SERIALIZE_OUTPUT_COMPOSITE.clone())); - let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, }, @@ -413,7 +407,7 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter body: {}", e)))), } }) - ) as Box> + ) as Box> }, // FakeOuterNumberSerialize - POST /fake/outer/number @@ -422,7 +416,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) => { let mut unused_elements = Vec::new(); @@ -441,7 +435,7 @@ where Box::new(api_impl.fake_outer_number_serialize(param_body, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -459,9 +453,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::FAKE_OUTER_NUMBER_SERIALIZE_OUTPUT_NUMBER.clone())); - let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, }, @@ -480,7 +472,7 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter body: {}", e)))), } }) - ) as Box> + ) as Box> }, // FakeOuterStringSerialize - POST /fake/outer/string @@ -489,7 +481,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) => { let mut unused_elements = Vec::new(); @@ -508,7 +500,7 @@ where Box::new(api_impl.fake_outer_string_serialize(param_body, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -526,9 +518,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::FAKE_OUTER_STRING_SERIALIZE_OUTPUT_STRING.clone())); - let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, }, @@ -547,7 +537,7 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter body: {}", e)))), } }) - ) as Box> + ) as Box> }, // TestBodyWithQueryParams - PUT /fake/body-with-query-params @@ -567,7 +557,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) => { let mut unused_elements = Vec::new(); @@ -590,7 +580,7 @@ where Box::new(api_impl.test_body_with_query_params(param_query, param_body, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -621,7 +611,7 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter body: {}", e)))), } }) - ) as Box> + ) as Box> }, // TestClientModel - PATCH /fake @@ -630,7 +620,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) => { let mut unused_elements = Vec::new(); @@ -653,7 +643,7 @@ where Box::new(api_impl.test_client_model(param_body, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -671,9 +661,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::TEST_CLIENT_MODEL_SUCCESSFUL_OPERATION.clone())); - let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, }, @@ -692,13 +680,13 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter body: {}", e)))), } }) - ) as Box> + ) as Box> }, // TestEndpointParameters - POST /fake &hyper::Method::Post if path.matched(paths::ID_FAKE) => { { - 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) @@ -726,7 +714,7 @@ where Box::new(api_impl.test_endpoint_parameters(param_number, param_double, param_pattern_without_delimiter, param_byte, param_integer, param_int32, param_int64, param_float, param_string, param_binary, param_date, param_date_time, param_password, param_callback, &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())); match result { Ok(rsp) => match rsp { @@ -757,7 +745,7 @@ where } )) }} - }) as Box> + }) as Box> }, // TestEnumParameters - GET /fake @@ -796,7 +784,7 @@ where Box::new(api_impl.test_enum_parameters(param_enum_header_string_array.as_ref(), param_enum_header_string, param_enum_query_string_array.as_ref(), param_enum_query_string, param_enum_query_integer, param_enum_query_double, param_enum_form_string, &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())); match result { Ok(rsp) => match rsp { @@ -827,7 +815,7 @@ where } )) }} - }) as Box> + }) as Box> }, // TestInlineAdditionalProperties - POST /fake/inline-additionalProperties @@ -836,7 +824,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) => { let mut unused_elements = Vec::new(); @@ -859,7 +847,7 @@ where Box::new(api_impl.test_inline_additional_properties(param_param, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -890,7 +878,7 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter param: {}", e)))), } }) - ) as Box> + ) as Box> }, // TestJsonFormData - GET /fake/jsonFormData @@ -903,7 +891,7 @@ where Box::new(api_impl.test_json_form_data(param_param, param_param2, &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())); match result { Ok(rsp) => match rsp { @@ -927,13 +915,13 @@ where } )) }} - }) as Box> + }) as Box> }, // TestClassname - PATCH /fake_classname_test &hyper::Method::Patch if path.matched(paths::ID_FAKE_CLASSNAME_TEST) => { { - 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) @@ -945,7 +933,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) => { let mut unused_elements = Vec::new(); @@ -968,7 +956,7 @@ where Box::new(api_impl.test_classname(param_body, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -986,9 +974,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::TEST_CLASSNAME_SUCCESSFUL_OPERATION.clone())); - let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, }, @@ -1007,13 +993,13 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter body: {}", e)))), } }) - ) as Box> + ) as Box> }, // AddPet - POST /pet &hyper::Method::Post if path.matched(paths::ID_PET) => { { - 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) @@ -1043,7 +1029,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) => { let mut unused_elements = Vec::new(); @@ -1066,7 +1052,7 @@ where Box::new(api_impl.add_pet(param_body, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -1097,13 +1083,13 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter body: {}", e)))), } }) - ) as Box> + ) as Box> }, // DeletePet - DELETE /pet/{petId} &hyper::Method::Delete if path.matched(paths::ID_PET_PETID) => { { - 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) @@ -1152,7 +1138,7 @@ where Box::new(api_impl.delete_pet(param_pet_id, param_api_key, &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())); match result { Ok(rsp) => match rsp { @@ -1176,13 +1162,13 @@ where } )) }} - }) as Box> + }) as Box> }, // FindPetsByStatus - GET /pet/findByStatus &hyper::Method::Get if path.matched(paths::ID_PET_FINDBYSTATUS) => { { - 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) @@ -1218,7 +1204,7 @@ where Box::new(api_impl.find_pets_by_status(param_status.as_ref(), &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())); match result { Ok(rsp) => match rsp { @@ -1232,9 +1218,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::FIND_PETS_BY_STATUS_SUCCESSFUL_OPERATION.clone())); - let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, FindPetsByStatusResponse::InvalidStatusValue @@ -1257,13 +1241,13 @@ where } )) }} - }) as Box> + }) as Box> }, // FindPetsByTags - GET /pet/findByTags &hyper::Method::Get if path.matched(paths::ID_PET_FINDBYTAGS) => { { - 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) @@ -1299,7 +1283,7 @@ where Box::new(api_impl.find_pets_by_tags(param_tags.as_ref(), &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())); match result { Ok(rsp) => match rsp { @@ -1313,9 +1297,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::FIND_PETS_BY_TAGS_SUCCESSFUL_OPERATION.clone())); - let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, FindPetsByTagsResponse::InvalidTagValue @@ -1338,13 +1320,13 @@ where } )) }} - }) as Box> + }) as Box> }, // GetPetById - GET /pet/{petId} &hyper::Method::Get if path.matched(paths::ID_PET_PETID) => { { - 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) @@ -1372,7 +1354,7 @@ where Box::new(api_impl.get_pet_by_id(param_pet_id, &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())); match result { Ok(rsp) => match rsp { @@ -1386,9 +1368,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::GET_PET_BY_ID_SUCCESSFUL_OPERATION.clone())); - let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, GetPetByIdResponse::InvalidIDSupplied @@ -1418,13 +1398,13 @@ where } )) }} - }) as Box> + }) as Box> }, // UpdatePet - PUT /pet &hyper::Method::Put if path.matched(paths::ID_PET) => { { - 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) @@ -1454,7 +1434,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) => { let mut unused_elements = Vec::new(); @@ -1477,7 +1457,7 @@ where Box::new(api_impl.update_pet(param_body, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -1522,13 +1502,13 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter body: {}", e)))), } }) - ) as Box> + ) as Box> }, // UpdatePetWithForm - POST /pet/{petId} &hyper::Method::Post if path.matched(paths::ID_PET_PETID) => { { - 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) @@ -1577,7 +1557,7 @@ where Box::new(api_impl.update_pet_with_form(param_pet_id, param_name, param_status, &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())); match result { Ok(rsp) => match rsp { @@ -1601,13 +1581,13 @@ where } )) }} - }) as Box> + }) as Box> }, // UploadFile - POST /pet/{petId}/uploadImage &hyper::Method::Post if path.matched(paths::ID_PET_PETID_UPLOADIMAGE) => { { - 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) @@ -1656,7 +1636,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 @@ -1697,7 +1677,7 @@ where Box::new(api_impl.upload_file(param_pet_id, param_additional_metadata, param_file, &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())); match result { Ok(rsp) => match rsp { @@ -1711,9 +1691,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::UPLOAD_FILE_SUCCESSFUL_OPERATION.clone())); - let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, }, @@ -1728,7 +1706,7 @@ where future::ok(response) } )) - as Box> + as Box> }, Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read multipart body")))), } @@ -1758,7 +1736,7 @@ where Box::new(api_impl.delete_order(param_order_id, &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())); match result { Ok(rsp) => match rsp { @@ -1789,13 +1767,13 @@ where } )) }} - }) as Box> + }) as Box> }, // GetInventory - GET /store/inventory &hyper::Method::Get if path.matched(paths::ID_STORE_INVENTORY) => { { - 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) @@ -1808,7 +1786,7 @@ where Box::new(api_impl.get_inventory(&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())); match result { Ok(rsp) => match rsp { @@ -1822,9 +1800,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::GET_INVENTORY_SUCCESSFUL_OPERATION.clone())); - let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, }, @@ -1840,7 +1816,7 @@ where } )) }} - }) as Box> + }) as Box> }, // GetOrderById - GET /store/order/{order_id} @@ -1865,7 +1841,7 @@ where Box::new(api_impl.get_order_by_id(param_order_id, &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())); match result { Ok(rsp) => match rsp { @@ -1879,9 +1855,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::GET_ORDER_BY_ID_SUCCESSFUL_OPERATION.clone())); - let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, GetOrderByIdResponse::InvalidIDSupplied @@ -1911,7 +1885,7 @@ where } )) }} - }) as Box> + }) as Box> }, // PlaceOrder - POST /store/order @@ -1920,7 +1894,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) => { let mut unused_elements = Vec::new(); @@ -1943,7 +1917,7 @@ where Box::new(api_impl.place_order(param_body, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -1961,9 +1935,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::PLACE_ORDER_SUCCESSFUL_OPERATION.clone())); - let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, PlaceOrderResponse::InvalidOrder @@ -1989,7 +1961,7 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter body: {}", e)))), } }) - ) as Box> + ) as Box> }, // CreateUser - POST /user @@ -1998,7 +1970,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) => { let mut unused_elements = Vec::new(); @@ -2021,7 +1993,7 @@ where Box::new(api_impl.create_user(param_body, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -2052,7 +2024,7 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter body: {}", e)))), } }) - ) as Box> + ) as Box> }, // CreateUsersWithArrayInput - POST /user/createWithArray @@ -2061,7 +2033,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) => { let mut unused_elements = Vec::new(); @@ -2084,7 +2056,7 @@ where Box::new(api_impl.create_users_with_array_input(param_body.as_ref(), &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -2115,7 +2087,7 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter body: {}", e)))), } }) - ) as Box> + ) as Box> }, // CreateUsersWithListInput - POST /user/createWithList @@ -2124,7 +2096,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) => { let mut unused_elements = Vec::new(); @@ -2147,7 +2119,7 @@ where Box::new(api_impl.create_users_with_list_input(param_body.as_ref(), &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -2178,7 +2150,7 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter body: {}", e)))), } }) - ) as Box> + ) as Box> }, // DeleteUser - DELETE /user/{username} @@ -2203,7 +2175,7 @@ where Box::new(api_impl.delete_user(param_username, &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())); match result { Ok(rsp) => match rsp { @@ -2234,7 +2206,7 @@ where } )) }} - }) as Box> + }) as Box> }, // GetUserByName - GET /user/{username} @@ -2259,7 +2231,7 @@ where Box::new(api_impl.get_user_by_name(param_username, &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())); match result { Ok(rsp) => match rsp { @@ -2273,9 +2245,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::GET_USER_BY_NAME_SUCCESSFUL_OPERATION.clone())); - let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, GetUserByNameResponse::InvalidUsernameSupplied @@ -2305,7 +2275,7 @@ where } )) }} - }) as Box> + }) as Box> }, // LoginUser - GET /user/login @@ -2335,7 +2305,7 @@ where Box::new(api_impl.login_user(param_username, param_password, &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())); match result { Ok(rsp) => match rsp { @@ -2358,9 +2328,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::LOGIN_USER_SUCCESSFUL_OPERATION.clone())); - let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, LoginUserResponse::InvalidUsername @@ -2383,7 +2351,7 @@ where } )) }} - }) as Box> + }) as Box> }, // LogoutUser - GET /user/logout @@ -2393,7 +2361,7 @@ where Box::new(api_impl.logout_user(&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())); match result { Ok(rsp) => match rsp { @@ -2417,7 +2385,7 @@ where } )) }} - }) as Box> + }) as Box> }, // UpdateUser - PUT /user/{username} @@ -2441,7 +2409,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) => { let mut unused_elements = Vec::new(); @@ -2464,7 +2432,7 @@ where Box::new(api_impl.update_user(param_username, param_body, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -2502,10 +2470,10 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter body: {}", e)))), } }) - ) as Box> + ) as Box> }, - _ => 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/samples/server/petstore/rust-server/output/rust-server-test/Cargo.toml b/samples/server/petstore/rust-server/output/rust-server-test/Cargo.toml index ebdcacacf1b..789fbdc0e16 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/Cargo.toml +++ b/samples/server/petstore/rust-server/output/rust-server-test/Cargo.toml @@ -16,7 +16,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/samples/server/petstore/rust-server/output/rust-server-test/examples/client.rs b/samples/server/petstore/rust-server/output/rust-server-test/examples/client.rs index 8df0e5e5ebe..afe7fce011e 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/examples/client.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/examples/client.rs @@ -78,28 +78,28 @@ fn main() { Some("DummyGet") => { let result = core.run(client.dummy_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, // Disabled because there's no example. // Some("DummyPut") => { // let result = core.run(client.dummy_put(???)); - // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + // println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); // }, Some("FileResponseGet") => { let result = core.run(client.file_response_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("HtmlPost") => { let result = core.run(client.html_post("body_example".to_string())); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, Some("RawJsonGet") => { let result = core.run(client.raw_json_get()); - println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &Has).get().clone()); + println!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, _ => { diff --git a/samples/server/petstore/rust-server/output/rust-server-test/examples/server_lib/server.rs b/samples/server/petstore/rust-server/output/rust-server-test/examples/server_lib/server.rs index 4e7c5e59254..771315a1a7f 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/examples/server_lib/server.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/examples/server_lib/server.rs @@ -32,35 +32,35 @@ impl Server { impl Api for Server where C: Has{ /// A dummy endpoint to make the spec valid. - fn dummy_get(&self, context: &C) -> Box> { + fn dummy_get(&self, context: &C) -> Box> { let context = context.clone(); println!("dummy_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } - fn dummy_put(&self, nested_response: models::InlineObject, context: &C) -> Box> { + fn dummy_put(&self, nested_response: models::InlineObject, context: &C) -> Box> { let context = context.clone(); println!("dummy_put({:?}) - X-Span-ID: {:?}", nested_response, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Get a file - fn file_response_get(&self, context: &C) -> Box> { + fn file_response_get(&self, context: &C) -> Box> { let context = context.clone(); println!("file_response_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Test HTML handling - fn html_post(&self, body: String, context: &C) -> Box> { + fn html_post(&self, body: String, context: &C) -> Box> { let context = context.clone(); println!("html_post(\"{}\") - X-Span-ID: {:?}", body, context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) } /// Get an arbitrary JSON blob. - fn raw_json_get(&self, context: &C) -> Box> { + fn raw_json_get(&self, context: &C) -> Box> { let context = context.clone(); println!("raw_json_get() - X-Span-ID: {:?}", context.get().0.clone()); Box::new(futures::failed("Generic failure".into())) diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs index 64b47aa5f24..762cd4e4911 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/client/mod.rs @@ -73,7 +73,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, } @@ -184,7 +184,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, @@ -211,7 +211,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> @@ -229,7 +229,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> @@ -245,7 +245,7 @@ impl Api for Client where F: Future + 'static, C: Has { - fn dummy_get(&self, context: &C) -> Box> { + fn dummy_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/dummy", self.base_path @@ -268,7 +268,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -280,7 +280,7 @@ impl Api for Client where future::ok( DummyGetResponse::Success ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -299,14 +299,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn dummy_put(&self, param_nested_response: models::InlineObject, context: &C) -> Box> { + fn dummy_put(&self, param_nested_response: models::InlineObject, context: &C) -> Box> { let mut uri = format!( "{}/dummy", self.base_path @@ -333,7 +333,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::DUMMY_PUT.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -345,7 +345,7 @@ impl Api for Client where future::ok( DummyPutResponse::Success ) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -364,14 +364,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn file_response_get(&self, context: &C) -> Box> { + fn file_response_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/file_response", self.base_path @@ -394,7 +394,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -406,20 +406,17 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - - serde_json::from_str::(body) - .map_err(|e| e.into()) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + serde_json::from_str::(body) + .map_err(|e| e.into()) + ) + ) .map(move |body| { FileResponseGetResponse::Success(body) }) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -438,14 +435,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn html_post(&self, param_body: String, context: &C) -> Box> { + fn html_post(&self, param_body: String, context: &C) -> Box> { let mut uri = format!( "{}/html", self.base_path @@ -472,7 +469,7 @@ impl Api for Client where request.headers_mut().set(ContentType(mimetypes::requests::HTML_POST.clone())); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -484,20 +481,16 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - - serde_json::from_str::(body) - .map_err(|e| e.into()) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + Ok(body.to_string()) + ) + ) .map(move |body| { HtmlPostResponse::Success(body) }) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -516,14 +509,14 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) } - fn raw_json_get(&self, context: &C) -> Box> { + fn raw_json_get(&self, context: &C) -> Box> { let mut uri = format!( "{}/raw_json", self.base_path @@ -546,7 +539,7 @@ impl Api for Client where let mut request = hyper::Request::new(hyper::Method::Get, uri); - request.headers_mut().set(XSpanId((context as &Has).get().0.clone())); + request.headers_mut().set(XSpanId((context as &dyn Has).get().0.clone())); Box::new(self.client_service.call(request) .map_err(|e| ApiError(format!("No response received: {}", e))) .and_then(|mut response| { @@ -558,20 +551,17 @@ impl Api for Client where .concat2() .map_err(|e| ApiError(format!("Failed to read response: {}", e))) .and_then(|body| - - str::from_utf8(&body) - .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) - .and_then(|body| - - serde_json::from_str::(body) - .map_err(|e| e.into()) - ) - - ) + str::from_utf8(&body) + .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e))) + .and_then(|body| + serde_json::from_str::(body) + .map_err(|e| e.into()) + ) + ) .map(move |body| { RawJsonGetResponse::Success(body) }) - ) as Box> + ) as Box> }, code => { let headers = response.headers().clone(); @@ -590,7 +580,7 @@ impl Api for Client where Err(e) => Cow::from(format!("", e)), }))) ) - ) as Box> + ) as Box> } } })) @@ -621,7 +611,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/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs index d6e3acc1da7..86f6b38deba 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/lib.rs @@ -88,19 +88,19 @@ pub enum RawJsonGetResponse { pub trait Api { /// A dummy endpoint to make the spec valid. - fn dummy_get(&self, context: &C) -> Box>; + fn dummy_get(&self, context: &C) -> Box>; - fn dummy_put(&self, nested_response: models::InlineObject, context: &C) -> Box>; + fn dummy_put(&self, nested_response: models::InlineObject, context: &C) -> Box>; /// Get a file - fn file_response_get(&self, context: &C) -> Box>; + fn file_response_get(&self, context: &C) -> Box>; /// Test HTML handling - fn html_post(&self, body: String, context: &C) -> Box>; + fn html_post(&self, body: String, context: &C) -> Box>; /// Get an arbitrary JSON blob. - fn raw_json_get(&self, context: &C) -> Box>; + fn raw_json_get(&self, context: &C) -> Box>; } @@ -108,19 +108,19 @@ pub trait Api { pub trait ApiNoContext { /// A dummy endpoint to make the spec valid. - fn dummy_get(&self) -> Box>; + fn dummy_get(&self) -> Box>; - fn dummy_put(&self, nested_response: models::InlineObject) -> Box>; + fn dummy_put(&self, nested_response: models::InlineObject) -> Box>; /// Get a file - fn file_response_get(&self) -> Box>; + fn file_response_get(&self) -> Box>; /// Test HTML handling - fn html_post(&self, body: String) -> Box>; + fn html_post(&self, body: String) -> Box>; /// Get an arbitrary JSON blob. - fn raw_json_get(&self) -> Box>; + fn raw_json_get(&self) -> Box>; } @@ -139,27 +139,27 @@ impl<'a, T: Api + Sized, C> ContextWrapperExt<'a, C> for T { impl<'a, T: Api, C> ApiNoContext for ContextWrapper<'a, T, C> { /// A dummy endpoint to make the spec valid. - fn dummy_get(&self) -> Box> { + fn dummy_get(&self) -> Box> { self.api().dummy_get(&self.context()) } - fn dummy_put(&self, nested_response: models::InlineObject) -> Box> { + fn dummy_put(&self, nested_response: models::InlineObject) -> Box> { self.api().dummy_put(nested_response, &self.context()) } /// Get a file - fn file_response_get(&self) -> Box> { + fn file_response_get(&self) -> Box> { self.api().file_response_get(&self.context()) } /// Test HTML handling - fn html_post(&self, body: String) -> Box> { + fn html_post(&self, body: String) -> Box> { self.api().html_post(body, &self.context()) } /// Get an arbitrary JSON blob. - fn raw_json_get(&self) -> Box> { + fn raw_json_get(&self) -> Box> { self.api().raw_json_get(&self.context()) } diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs index eae8b97db41..93d21281284 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/server/mod.rs @@ -115,7 +115,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(); @@ -133,7 +133,7 @@ where Box::new(api_impl.dummy_get(&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())); match result { Ok(rsp) => match rsp { @@ -157,7 +157,7 @@ where } )) }} - }) as Box> + }) as Box> }, // DummyPut - PUT /dummy @@ -166,7 +166,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) => { let mut unused_elements = Vec::new(); @@ -189,7 +189,7 @@ where Box::new(api_impl.dummy_put(param_nested_response, &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())); if !unused_elements.is_empty() { response.headers_mut().set(Warning(format!("Ignoring unknown fields in body: {:?}", unused_elements))); @@ -220,7 +220,7 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter nested_response: {}", e)))), } }) - ) as Box> + ) as Box> }, // FileResponseGet - GET /file_response @@ -230,7 +230,7 @@ where Box::new(api_impl.file_response_get(&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())); match result { Ok(rsp) => match rsp { @@ -244,9 +244,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::FILE_RESPONSE_GET_SUCCESS.clone())); - let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, }, @@ -262,7 +260,7 @@ where } )) }} - }) as Box> + }) as Box> }, // HtmlPost - POST /html @@ -271,7 +269,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) => { let param_body: Option = if !body.is_empty() { @@ -286,7 +284,7 @@ where Box::new(api_impl.html_post(param_body, &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())); match result { Ok(rsp) => match rsp { @@ -300,9 +298,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::HTML_POST_SUCCESS.clone())); - - let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); - + let body = body; response.set_body(body); }, }, @@ -321,7 +317,7 @@ where Err(e) => Box::new(future::ok(Response::new().with_status(StatusCode::BadRequest).with_body(format!("Couldn't read body parameter body: {}", e)))), } }) - ) as Box> + ) as Box> }, // RawJsonGet - GET /raw_json @@ -331,7 +327,7 @@ where Box::new(api_impl.raw_json_get(&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())); match result { Ok(rsp) => match rsp { @@ -345,9 +341,7 @@ where response.headers_mut().set(ContentType(mimetypes::responses::RAW_JSON_GET_SUCCESS.clone())); - let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); - response.set_body(body); }, }, @@ -363,10 +357,10 @@ where } )) }} - }) as Box> + }) as Box> }, - _ => 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/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Animal.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Animal.java index 68d2e740966..18dbc9e0427 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Animal.java @@ -19,6 +19,7 @@ import javax.validation.constraints.*; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..21a2f37430a --- /dev/null +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/BigCat.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCat + */ + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..6e595fd4762 --- /dev/null +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,115 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Animal.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Animal.java index 68d2e740966..18dbc9e0427 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Animal.java @@ -19,6 +19,7 @@ import javax.validation.constraints.*; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..21a2f37430a --- /dev/null +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/BigCat.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCat + */ + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..6e595fd4762 --- /dev/null +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,115 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Animal.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Animal.java index 68d2e740966..18dbc9e0427 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Animal.java @@ -19,6 +19,7 @@ import javax.validation.constraints.*; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..21a2f37430a --- /dev/null +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/BigCat.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCat + */ + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..6e595fd4762 --- /dev/null +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,115 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Animal.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Animal.java index 68d2e740966..18dbc9e0427 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Animal.java @@ -19,6 +19,7 @@ import javax.validation.constraints.*; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..21a2f37430a --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/BigCat.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCat + */ + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..6e595fd4762 --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,115 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Animal.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Animal.java index 68d2e740966..18dbc9e0427 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Animal.java @@ -19,6 +19,7 @@ import javax.validation.constraints.*; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..21a2f37430a --- /dev/null +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/BigCat.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCat + */ + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..6e595fd4762 --- /dev/null +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,115 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Animal.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Animal.java index 68d2e740966..18dbc9e0427 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Animal.java @@ -19,6 +19,7 @@ import javax.validation.constraints.*; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..21a2f37430a --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCat.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCat + */ + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..6e595fd4762 --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,115 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Animal.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Animal.java index 68d2e740966..18dbc9e0427 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Animal.java @@ -19,6 +19,7 @@ import javax.validation.constraints.*; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..21a2f37430a --- /dev/null +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCat.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCat + */ + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..6e595fd4762 --- /dev/null +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,115 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Animal.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Animal.java index 68d2e740966..18dbc9e0427 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Animal.java @@ -19,6 +19,7 @@ import javax.validation.constraints.*; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..21a2f37430a --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCat.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCat + */ + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..6e595fd4762 --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,115 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml index ccb16e949ad..79ba65f66ee 100644 --- a/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml @@ -1557,6 +1557,10 @@ components: allOf: - $ref: '#/components/schemas/Animal' - $ref: '#/components/schemas/Cat_allOf' + BigCat: + allOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/BigCat_allOf' Animal: discriminator: propertyName: className @@ -2221,6 +2225,15 @@ components: properties: declawed: type: boolean + BigCat_allOf: + properties: + kind: + enum: + - lions + - tigers + - leopards + - jaguars + type: string securitySchemes: petstore_auth: flows: diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Animal.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Animal.java index 68d2e740966..18dbc9e0427 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Animal.java @@ -19,6 +19,7 @@ import javax.validation.constraints.*; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..21a2f37430a --- /dev/null +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCat.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCat + */ + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..6e595fd4762 --- /dev/null +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,115 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Animal.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Animal.java index baedd9662ba..3789a15a5aa 100644 --- a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Animal.java +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Animal.java @@ -19,6 +19,7 @@ import javax.validation.constraints.*; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/BigCat.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/BigCat.java new file mode 100644 index 00000000000..dbf42161952 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/BigCat.java @@ -0,0 +1,118 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.virtualan.model.BigCatAllOf; +import org.openapitools.virtualan.model.Cat; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCat + */ + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/BigCatAllOf.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/BigCatAllOf.java new file mode 100644 index 00000000000..89cbe6c4caf --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/BigCatAllOf.java @@ -0,0 +1,115 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Animal.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Animal.java index 68d2e740966..18dbc9e0427 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Animal.java @@ -19,6 +19,7 @@ import javax.validation.constraints.*; @JsonSubTypes({ @JsonSubTypes.Type(value = Dog.class, name = "Dog"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), + @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Animal { diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/BigCat.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/BigCat.java new file mode 100644 index 00000000000..21a2f37430a --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/BigCat.java @@ -0,0 +1,118 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.model.BigCatAllOf; +import org.openapitools.model.Cat; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCat + */ + +public class BigCat extends Cat { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCat kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCat bigCat = (BigCat) o; + return Objects.equals(this.kind, bigCat.kind) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(kind, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/BigCatAllOf.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/BigCatAllOf.java new file mode 100644 index 00000000000..6e595fd4762 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/BigCatAllOf.java @@ -0,0 +1,115 @@ +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.jackson.nullable.JsonNullable; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * BigCatAllOf + */ + +public class BigCatAllOf { + /** + * Gets or Sets kind + */ + public enum KindEnum { + LIONS("lions"), + + TIGERS("tigers"), + + LEOPARDS("leopards"), + + JAGUARS("jaguars"); + + private String value; + + KindEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static KindEnum fromValue(String value) { + for (KindEnum b : KindEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + @JsonProperty("kind") + private KindEnum kind; + + public BigCatAllOf kind(KindEnum kind) { + this.kind = kind; + return this; + } + + /** + * Get kind + * @return kind + */ + @ApiModelProperty(value = "") + + + public KindEnum getKind() { + return kind; + } + + public void setKind(KindEnum kind) { + this.kind = kind; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BigCatAllOf bigCatAllOf = (BigCatAllOf) o; + return Objects.equals(this.kind, bigCatAllOf.kind); + } + + @Override + public int hashCode() { + return Objects.hash(kind); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BigCatAllOf {\n"); + + sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/website/dynamic/users.yml b/website/dynamic/users.yml index 5ab0462aabc..909dcddec37 100644 --- a/website/dynamic/users.yml +++ b/website/dynamic/users.yml @@ -313,6 +313,11 @@ image: "img/companies/veamly.png" infoLink: "https://www.veamly.com/" pinned: false +- + caption: Woleet + image: "img/companies/woleet.png" + infoLink: "https://woleet.io" + pinned: false - caption: WSO2 image: "img/companies/wso2.png" diff --git a/website/static/img/companies/woleet.png b/website/static/img/companies/woleet.png new file mode 100644 index 00000000000..dd267298255 Binary files /dev/null and b/website/static/img/companies/woleet.png differ