diff --git a/CI/samples.ci/client/petstore/java/test-manual/jersey2-java8/JSONComposedSchemaTest.java b/CI/samples.ci/client/petstore/java/test-manual/jersey2-java8/JSONComposedSchemaTest.java new file mode 100644 index 000000000000..89227f3d252c --- /dev/null +++ b/CI/samples.ci/client/petstore/java/test-manual/jersey2-java8/JSONComposedSchemaTest.java @@ -0,0 +1,68 @@ +package org.openapitools.client; + +import org.openapitools.client.model.Mammal; +import org.openapitools.client.model.AppleReq; +import org.openapitools.client.model.BananaReq; +import org.openapitools.client.model.FruitReq; +import org.openapitools.client.model.BasquePig; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; +import java.lang.Exception; + +import org.junit.*; +import static org.junit.Assert.*; + + +public class JSONComposedSchemaTest { + JSON json = null; + Mammal mammal = null; + + @Before + public void setup() { + json = new JSON(); + mammal = new Mammal(); + } + + /** + * Validate a oneOf schema can be deserialized into the expected class. + * The oneOf schema does not have a discriminator. + */ + @Test + public void testOneOfSchemaWithoutDiscriminator() throws Exception { + // BananaReq and AppleReq have explicitly defined properties that are different by name. + // There is no discriminator property. + String str = "{ \"cultivar\": \"golden delicious\", \"mealy\": false }"; + FruitReq o = json.getContext(null).readValue(str, FruitReq.class); + assertTrue(o.getActualInstance() instanceof AppleReq); + } + + /** + * Validate a oneOf schema can be deserialized into the expected class. + * The oneOf schema has a discriminator. + */ + @Test + public void testOneOfSchemaWithDiscriminator() throws Exception { + // Mammal can be one of whale, pig and zebra. + // pig has sub-classes. + String str = "{ \"className\": \"whale\", \"hasBaleen\": true, \"hasTeeth\": false }"; + /* + DISABLING unit test for now until ambiguity of discriminator is resolved. + + // Note that the 'zebra' schema does not have any explicit property defined AND + // it has additionalProperties: true. Hence without a discriminator the above + // JSON payload would match both 'whale' and 'zebra'. This is because the 'hasBaleen' + // and 'hasTeeth' would be considered additional (undeclared) properties for 'zebra'. + Mammal o = json.getContext(null).readValue(str, Mammal.class); + assertTrue(o.getActualInstance() instanceof Whale); + + str = "{ \"className\": \"zebra\" }"; + o = json.getContext(null).readValue(str, Mammal.class); + assertTrue(o.getActualInstance() instanceof Zebra); + + str = "{ \"className\": \"BasquePig\" }"; + o = json.getContext(null).readValue(str, Mammal.class); + assertTrue(o.getActualInstance() instanceof BasquePig); + */ + } +} \ No newline at end of file diff --git a/bin/configs/java-jersey2-8.yaml b/bin/configs/java-jersey2-8.yaml index b599a1aec4a0..ec636e75cb50 100644 --- a/bin/configs/java-jersey2-8.yaml +++ b/bin/configs/java-jersey2-8.yaml @@ -1,7 +1,7 @@ generatorName: java outputDir: samples/openapi3/client/petstore/java/jersey2-java8 library: jersey2 -inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +inputSpec: modules/openapi-generator/src/test/resources/3_0/python-experimental/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml additionalProperties: artifactId: petstore-openapi3-jersey2-java8 hideGenerationTimestamp: "true" diff --git a/docs/customization.md b/docs/customization.md index fbdc5a890cdb..fe40349f31e1 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -90,7 +90,8 @@ You can use this as additional dependency of the `openapi-generator-maven-plugin If you publish your artifact to a distant maven repository, do not forget to add this repository as `pluginRepository` for your project. ## Selective generation -You may not want to generate *all* models in your project. Likewise you may want just one or two apis to be written. If that's the case, you can use system properties to control the output: + +You may not want to generate *all* models in your project. Likewise, you may want just one or two apis to be written. If that's the case, you can use system properties or [global properties](./global-properties.md) to control the output. The default is generate *everything* supported by the specific library. Once you enable a feature, it will restrict the contents generated: @@ -142,7 +143,13 @@ When using selective generation, _only_ the templates needed for the specific ge To skip models defined as the form parameters in "requestBody", please use `skipFormModel` (default to false) (this option is introduced at v3.2.2) ```sh -java -DskipFormModel=true +java -DskipFormModel=true generate … +``` + +or + +```sh +java generate --global-property skipFormModel=true … ``` This option will be helpful to skip model generation due to the form parameter, which is defined differently in OAS3 as there's no form parameter in OAS3 diff --git a/docs/faq-contributing.md b/docs/faq-contributing.md index 4652194e9d76..704758bb443f 100644 --- a/docs/faq-contributing.md +++ b/docs/faq-contributing.md @@ -45,9 +45,9 @@ Please refer to http://rypress.com/tutorials/git/rebasing, or follow the steps b (To setup `upstream` pointing to the official repo, please run `git remote add upstream https://github.com/openapitools/openapi-generator.git`) -## How can I update commits that are not linked to my Github account? +## How can I update commits that are not linked to my GitHub account? -Please refer to https://stackoverflow.com/questions/3042437/how-to-change-the-commit-author-for-one-specific-commit or you can simply add the email address in the commit as your secondary email address in your Github account. +Please refer to https://stackoverflow.com/questions/3042437/how-to-change-the-commit-author-for-one-specific-commit or you can simply add the email address in the commit as your secondary email address in your GitHub account. ## Any useful git tips to share? diff --git a/docs/global-properties.md b/docs/global-properties.md new file mode 100644 index 000000000000..c2c0aab64788 --- /dev/null +++ b/docs/global-properties.md @@ -0,0 +1,43 @@ +--- +id: globals +title: Global Properties +--- + +## Available Global Properties + +| Property | Description | Acceptable value | +| -------- | ------------| ---------------- | +| debugOpenAPI | Dumps JSON formatted and fully parsed OpenAPI document during generation | none | +| debugModels | Dumps JSON formatted template-bound model information during generation | none | +| debugOperations | Dumps JSON formatted template-bound operation information during generation | none | +| debugSupportingFiles | Dumps JSON formatted Supporting File information during generation | none | +| verbose | Defines the verbosity | `true` or `false` | +| generateAliasAsModel | Defines whether primitive types defined at the model/schema level will be wrapped in a model | `true` or `false` | +| org.openapitools.codegen.utils.oncelogger.enabled | Enable/disable the "OnceLogger" which reduces noise for select repeated logs | `true` or `false` | +| supportingFiles | Allows the user to define which supporting files will be generated. Prefer using the more robust `.openapi-generator-ignore`. | no value, or a comma-separated string of file names | +| models | Allows the user to define which models will be generated. Prefer using the more robust `.openapi-generator-ignore`. | no value, or a comma-separated string of model names | +| apis | Allows the user to define which apis will be generated. Prefer using the more robust `.openapi-generator-ignore`. | no value, or a comma-separated string of api names | +| apiDocs | Allows the user to define if api docs will be generated. Prefer using the more robust `.openapi-generator-ignore`. | `true` or `false` | +| modelDocs | Allows the user to define if model docs will be generated. Prefer using the more robust `.openapi-generator-ignore`. | `true` or `false` | +| apiTests | Allows the user to define if api tests will be generated. Prefer using the more robust `.openapi-generator-ignore`. | `true` or `false` | +| modelTests | Allows the user to define if model tests will be generated. Prefer using the more robust `.openapi-generator-ignore`. | `true` or `false` | +| withXml | Allows the user to control support of XML generated constructs, where supported | none | + + +## Note on Global Property declaration + +There are _two ways_ to provide selective generation properties or "global properties". First, these can be passed as Java System Properties. Second, these can be passed via the global property tooling option (`--global-property` in CLI and `globalProperty` in Maven and Gradle configurations). This differentiation is new in version 5.0 with the removal of the `-D` CLI option and the renaming of `systemProperties`. If you're upgrading to OpenAPI Generator 5.0+ + +While the examples seen in [Customization](./customization.md) use the Java System Property syntax, keep in mind that the following are equivalent: + +```sh +java -Dmodels {jar} generate {opts} +``` + +and + +```sh +java {jar} generate {opts} --global-property=models +``` + +Why the two differing ways to provide the same properties? We previously accepted a `-D` tooling option which resembled Java System Property declaration. In older versions of OpenAPI Generator, the option modified the SystemProperties collection directly and was truly a "system property". This option changed during the 4.x release in an effort to make OpenAPI Generator thread-safe and isolate its configuration via thread locals. We no longer mutate System Properties. In the 4.x release and earlier, specifying the tooling `-D` option with system properties intended for other tools like swagger-parser rather than passing them as true Java System Properties would lead to unexpected behavior for the user; if our tool set the system property _after_ invoking certain code, it would seem to the user like Java System Properties weren't working! \ No newline at end of file diff --git a/docs/installation.md b/docs/installation.md index 274024c9478f..f3015d1e7a1e 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -8,11 +8,11 @@ Installing OpenAPI Generator's CLI tool allows users to generate all available g Some of the following are cross-platform options and some are not, these are called out where possible. -## NPM +## npm > **Platform(s)**: Linux, macOS, Windows -The [NPM package wrapper](https://github.com/openapitools/openapi-generator-cli) is cross-platform wrapper around the .jar artifact. It works by providing a CLI wrapper atop the JAR's command line options. This gives a simple interface layer which normalizes usage of the command line across operating systems, removing some differences in how options or switches are passed to the tool (depending on OS). +The [npm package wrapper](https://github.com/openapitools/openapi-generator-cli) is cross-platform wrapper around the .jar artifact. It works by providing a CLI wrapper atop the JAR's command line options. This gives a simple interface layer which normalizes usage of the command line across operating systems, removing some differences in how options or switches are passed to the tool (depending on OS). **Install** the latest version of the tool globally, exposing the CLI on the command line: ```bash diff --git a/docs/integration.md b/docs/integration.md index fdf2898646d2..8b5b2ca52195 100644 --- a/docs/integration.md +++ b/docs/integration.md @@ -2,7 +2,7 @@ id: integrations title: Workflow Integrations --- -## Workflow Integration (Maven, Github, CI/CD) +## Workflow Integration (Maven, GitHub, CI/CD) ### Gradle Integration @@ -39,7 +39,7 @@ To push the auto-generated SDK to GitHub, we provide `git_push.sh` to streamline -i modules/openapi-generator/src/test/resources/2_0/petstore.json -g perl \ --git-user-id "wing328" \ --git-repo-id "petstore-perl" \ - --release-note "Github integration demo" \ + --release-note "GitHub integration demo" \ -o /var/tmp/perl/petstore ``` 3) Push the SDK to GitHub diff --git a/docs/usage.md b/docs/usage.md index 4522d5510091..68e022e5fbf3 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -261,14 +261,14 @@ SYNOPSIS [(-a | --auth )] [--api-name-suffix ] [--api-package ] [--artifact-id ] [--artifact-version ] - [(-c | --config )] - [-D ...] [--dry-run] + [(-c | --config )] [--dry-run] [(-e | --engine )] [--enable-post-process-file] [(-g | --generator-name )] [--generate-alias-as-model] [--git-host ] [--git-repo-id ] [--git-user-id ] - [--group-id ] [--http-user-agent ] + [--global-property ...] [--group-id ] + [--http-user-agent ] (-i | --input-spec ) [--ignore-file-override ] [--import-mappings ...] @@ -324,10 +324,6 @@ OPTIONS different for each language. Run config-help -g {generator name} command for language-specific config options. - -D - sets specified system properties in the format of - name=value,name=value (or multiple options, each with name=value) - --dry-run Try things out and report on potential changes (without actually making changes). @@ -343,11 +339,11 @@ OPTIONS --generate-alias-as-model Generate model implementation for aliases to map and array schemas. - An 'alias' is an array, map, or list which is defined inline in a - OpenAPI document and becomes a model in the generated code. - A 'map' schema is an object that can have undeclared properties, - i.e. the 'additionalproperties' attribute is set on that object. - An 'array' schema is a list of sub schemas in a OAS document. + An 'alias' is an array, map, or list which is defined inline in a + OpenAPI document and becomes a model in the generated code. A 'map' + schema is an object that can have undeclared properties, i.e. the + 'additionalproperties' attribute is set on that object. An 'array' + schema is a list of sub schemas in a OAS document --git-host Git host, e.g. gitlab.com. @@ -358,6 +354,11 @@ OPTIONS --git-user-id Git user ID, e.g. openapitools. + --global-property + sets specified global properties (previously called 'system + properties') in the format of name=value,name=value (or multiple + options, each with name=value) + --group-id groupId in generated pom.xml diff --git a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java index 084026f5552e..3387a4047487 100644 --- a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java +++ b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java @@ -71,9 +71,8 @@ public class Generate extends OpenApiGeneratorCommand { + "Pass in a URL-encoded string of name:header with a comma separating multiple values") private String auth; - // TODO: Remove -D short option in 5.0 @Option( - name = {"-D", "--global-property"}, + name = {"--global-property"}, title = "global properties", description = "sets specified global properties (previously called 'system properties') in " + "the format of name=value,name=value (or multiple options, each with name=value)") @@ -231,7 +230,7 @@ public class Generate extends OpenApiGeneratorCommand { @Option(name = {"--log-to-stderr"}, title = "Log to STDERR", description = "write all log messages (not just errors) to STDOUT." - + " Useful for piping the JSON output of debug options (e.g. `-DdebugOperations`) to an external parser directly while testing a generator.") + + " Useful for piping the JSON output of debug options (e.g. `--global-property debugOperations`) to an external parser directly while testing a generator.") private Boolean logToStderr; @Option(name = {"--enable-post-process-file"}, title = "enable post-process file", description = CodegenConstants.ENABLE_POST_PROCESS_FILE_DESC) @@ -408,7 +407,6 @@ public void execute() { } if (globalProperties != null && !globalProperties.isEmpty()) { - System.err.println("[DEPRECATED] -D arguments after 'generate' are application arguments and not Java System Properties, please consider changing to --global-property, apply your system properties to JAVA_OPTS, or move the -D arguments before the jar option."); applyGlobalPropertiesKvpList(globalProperties, configurator); } applyInstantiationTypesKvpList(instantiationTypes, configurator); diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/WorkflowSettings.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/WorkflowSettings.java index 2a0c9ac572af..c7a49db52a73 100644 --- a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/WorkflowSettings.java +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/WorkflowSettings.java @@ -47,7 +47,7 @@ public class WorkflowSettings { public static final boolean DEFAULT_ENABLE_MINIMAL_UPDATE = false; public static final boolean DEFAULT_STRICT_SPEC_BEHAVIOR = true; public static final String DEFAULT_TEMPLATING_ENGINE_NAME = "mustache"; - public static final ImmutableMap DEFAULT_SYSTEM_PROPERTIES = ImmutableMap.of(); + public static final ImmutableMap DEFAULT_GLOBAL_PROPERTIES = ImmutableMap.of(); private String inputSpec; private String outputDir = DEFAULT_OUTPUT_DIR; @@ -62,7 +62,7 @@ public class WorkflowSettings { private String templateDir; private String templatingEngineName = DEFAULT_TEMPLATING_ENGINE_NAME; private String ignoreFileOverride; - private ImmutableMap systemProperties = DEFAULT_SYSTEM_PROPERTIES; + private ImmutableMap globalProperties = DEFAULT_GLOBAL_PROPERTIES; private WorkflowSettings(Builder builder) { this.inputSpec = builder.inputSpec; @@ -78,15 +78,7 @@ private WorkflowSettings(Builder builder) { this.templateDir = builder.templateDir; this.templatingEngineName = builder.templatingEngineName; this.ignoreFileOverride = builder.ignoreFileOverride; - // TODO: rename to globalProperties for 5.0 - this.systemProperties = ImmutableMap.copyOf(builder.systemProperties); - if (this.systemProperties.size() > 0) { - // write no more than every 5s. This is temporary until version 5.0 as once(Logger) is not accessible here. - // thread contention may cause this to write more than once, but this is just an attempt to reduce noise - if (System.currentTimeMillis() - lastWarning.getAndUpdate(x -> System.currentTimeMillis()) > 5000) { - LOGGER.warn("systemProperties will be renamed to globalProperties in version 5.0"); - } - } + this.globalProperties = ImmutableMap.copyOf(builder.globalProperties); } /** @@ -117,7 +109,7 @@ public static Builder newBuilder(WorkflowSettings copy) { builder.ignoreFileOverride = copy.getIgnoreFileOverride(); // this, and any other collections, must be mutable in the builder. - builder.systemProperties = new HashMap<>(copy.getSystemProperties()); + builder.globalProperties = new HashMap<>(copy.getGlobalProperties()); // force builder "with" methods to invoke side effects builder.withTemplateDir(copy.getTemplateDir()); @@ -264,8 +256,8 @@ public String getIgnoreFileOverride() { * * @return the system properties */ - public Map getSystemProperties() { - return systemProperties; + public Map getGlobalProperties() { + return globalProperties; } /** @@ -288,7 +280,7 @@ public static final class Builder { private String ignoreFileOverride; // NOTE: All collections must be mutable in the builder, and copied to a new immutable collection in .build() - private Map systemProperties = new HashMap<>();; + private Map globalProperties = new HashMap<>();; private Builder() { } @@ -469,30 +461,30 @@ public Builder withIgnoreFileOverride(String ignoreFileOverride) { } /** - * Sets the {@code systemProperties} and returns a reference to this Builder so that the methods can be chained together. + * Sets the {@code globalProperties} and returns a reference to this Builder so that the methods can be chained together. * - * @param systemProperties the {@code systemProperties} to set + * @param globalProperties the {@code globalProperties} to set * @return a reference to this Builder */ - public Builder withSystemProperties(Map systemProperties) { - if (systemProperties != null) { - this.systemProperties = systemProperties; + public Builder withGlobalProperties(Map globalProperties) { + if (globalProperties != null) { + this.globalProperties = globalProperties; } return this; } /** - * Sets the {@code systemProperties} and returns a reference to this Builder so that the methods can be chained together. + * Sets the {@code globalProperties} and returns a reference to this Builder so that the methods can be chained together. * * @param key The key of a system (global) property to set * @param value The value of a system (global) property to set * @return a reference to this Builder */ - public Builder withSystemProperty(String key, String value) { - if (this.systemProperties == null) { - this.systemProperties = new HashMap<>(); + public Builder withGlobalProperty(String key, String value) { + if (this.globalProperties == null) { + this.globalProperties = new HashMap<>(); } - this.systemProperties.put(key, value); + this.globalProperties.put(key, value); return this; } @@ -526,7 +518,7 @@ public String toString() { ", templateDir='" + templateDir + '\'' + ", templatingEngineName='" + templatingEngineName + '\'' + ", ignoreFileOverride='" + ignoreFileOverride + '\'' + - ", systemProperties=" + systemProperties + + ", globalProperties=" + globalProperties + '}'; } @@ -548,7 +540,7 @@ public boolean equals(Object o) { Objects.equals(getTemplateDir(), that.getTemplateDir()) && Objects.equals(getTemplatingEngineName(), that.getTemplatingEngineName()) && Objects.equals(getIgnoreFileOverride(), that.getIgnoreFileOverride()) && - Objects.equals(getSystemProperties(), that.getSystemProperties()); + Objects.equals(getGlobalProperties(), that.getGlobalProperties()); } @Override @@ -567,7 +559,7 @@ public int hashCode() { getTemplateDir(), getTemplatingEngineName(), getIgnoreFileOverride(), - getSystemProperties() + getGlobalProperties() ); } } diff --git a/modules/openapi-generator-core/src/test/java/org/openapitools/codegen/config/WorkflowSettingsTest.java b/modules/openapi-generator-core/src/test/java/org/openapitools/codegen/config/WorkflowSettingsTest.java index 3ab0048677c7..33638f767356 100644 --- a/modules/openapi-generator-core/src/test/java/org/openapitools/codegen/config/WorkflowSettingsTest.java +++ b/modules/openapi-generator-core/src/test/java/org/openapitools/codegen/config/WorkflowSettingsTest.java @@ -50,19 +50,19 @@ public void defaultValuesNotOverriddenByNulls(){ } @Test - public void newBuilderFromCopyShouldMutateSystemProperties(){ + public void newBuilderFromCopyShouldMutateGlobalProperties(){ WorkflowSettings original = WorkflowSettings.newBuilder() .withOutputDir("output") .withVerbose(true) .withSkipOverwrite(false) - .withSystemProperty("first", "1st") + .withGlobalProperty("first", "1st") .build(); WorkflowSettings modified = WorkflowSettings.newBuilder(original) - .withSystemProperty("second", "2nd") + .withGlobalProperty("second", "2nd") .build(); - Map properties = modified.getSystemProperties(); + Map properties = modified.getGlobalProperties(); assertEquals(properties.size(), 2, "System Properties map should allow mutation when invoked via copy constructor"); assertEquals(properties.getOrDefault("first", ""), "1st"); assertEquals(properties.getOrDefault("second", ""), "2nd"); diff --git a/modules/openapi-generator-gradle-plugin/README.adoc b/modules/openapi-generator-gradle-plugin/README.adoc index 7a8cef3596a5..2c10b0a8b342 100644 --- a/modules/openapi-generator-gradle-plugin/README.adoc +++ b/modules/openapi-generator-gradle-plugin/README.adoc @@ -135,10 +135,10 @@ apply plugin: 'org.openapi.generator' |None |Adds authorization headers when fetching the OpenAPI definitions remotely. Pass in a URL-encoded string of name:header with a comma separating multiple values. -|systemProperties +|globalProperties |Map(String,String) |None -|Sets specified system properties. +|Sets specified global properties. |configFile |String @@ -346,12 +346,12 @@ For more control over generation of individual files, configure an ignore file a [NOTE] ==== -When configuring `systemProperties` in order to perform selective generation you can disable generation of some parts by providing `"false"` value: +When configuring `globalProperties` in order to perform selective generation you can disable generation of some parts by providing `"false"` value: [source,groovy] ---- openApiGenerate { // other settings omitted - systemProperties = [ + globalProperties = [ modelDocs: "false", apis: "false" ] @@ -362,7 +362,7 @@ When enabling generation of only specific parts you either have to provide CSV l ---- openApiGenerate { // other settings omitted - systemProperties = [ + globalProperties = [ apis: "", models: "User,Pet" ] @@ -609,7 +609,7 @@ task buildKotlinClient(type: org.openapitools.generator.gradle.plugin.tasks.Gene configOptions = [ dateLibrary: "java8" ] - systemProperties = [ + globalProperties = [ modelDocs: "false" ] } diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/build.gradle b/modules/openapi-generator-gradle-plugin/samples/local-spec/build.gradle index 22a21f46c6ff..cb99b8838faa 100644 --- a/modules/openapi-generator-gradle-plugin/samples/local-spec/build.gradle +++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/build.gradle @@ -42,7 +42,7 @@ openApiGenerate { configOptions = [ dateLibrary: "java8" ] - systemProperties = [ + globalProperties = [ modelDocs: "false" ] skipValidateSpec = true @@ -74,7 +74,7 @@ task buildDotnetSdk(type: org.openapitools.generator.gradle.plugin.tasks.Generat useCompareNetObjects: "true" ] outputDir = "$buildDir/csharp-netcore".toString() - systemProperties = [ + globalProperties = [ models: "", apis : "", ] diff --git a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/OpenApiGeneratorPlugin.kt b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/OpenApiGeneratorPlugin.kt index dcc3ce08915d..84caadfad839 100644 --- a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/OpenApiGeneratorPlugin.kt +++ b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/OpenApiGeneratorPlugin.kt @@ -98,7 +98,7 @@ class OpenApiGeneratorPlugin : Plugin { inputSpec.set(generate.inputSpec) templateDir.set(generate.templateDir) auth.set(generate.auth) - systemProperties.set(generate.systemProperties) + globalProperties.set(generate.globalProperties) configFile.set(generate.configFile) skipOverwrite.set(generate.skipOverwrite) packageName.set(generate.packageName) diff --git a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/extensions/OpenApiGeneratorGenerateExtension.kt b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/extensions/OpenApiGeneratorGenerateExtension.kt index daed01ae256e..4f099db7f6ff 100644 --- a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/extensions/OpenApiGeneratorGenerateExtension.kt +++ b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/extensions/OpenApiGeneratorGenerateExtension.kt @@ -65,9 +65,9 @@ open class OpenApiGeneratorGenerateExtension(project: Project) { val auth = project.objects.property() /** - * Sets specified system properties. + * Sets specified global properties. */ - val systemProperties = project.objects.mapProperty() + val globalProperties = project.objects.mapProperty() /** * Path to json configuration file. diff --git a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt index 81a7e918c141..500597599b36 100644 --- a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt +++ b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt @@ -97,10 +97,10 @@ open class GenerateTask : DefaultTask() { val auth = project.objects.property() /** - * Sets specified system properties. + * Sets specified global properties. */ @get:Internal - val systemProperties = project.objects.mapProperty() + val globalProperties = project.objects.mapProperty() /** * Path to json configuration file. @@ -415,9 +415,9 @@ open class GenerateTask : DefaultTask() { } else CodegenConfigurator() try { - if (systemProperties.isPresent) { - systemProperties.get().forEach { (key, value) -> - configurator.addSystemProperty(key, value) + if (globalProperties.isPresent) { + globalProperties.get().forEach { (key, value) -> + configurator.addGlobalProperty(key, value) } } @@ -582,10 +582,9 @@ open class GenerateTask : DefaultTask() { } } - if (systemProperties.isPresent) { - // TODO: rename to globalProperties in 5.0 - systemProperties.get().forEach { entry -> - configurator.addSystemProperty(entry.key, entry.value) + if (globalProperties.isPresent) { + globalProperties.get().forEach { entry -> + configurator.addGlobalProperty(entry.key, entry.value) } } diff --git a/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java b/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java index 90703b7f6031..628c15390c94 100644 --- a/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java +++ b/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java @@ -85,14 +85,6 @@ public class CodeGenMojo extends AbstractMojo { @Parameter(name = "verbose", defaultValue = "false") private boolean verbose; - // TODO: 5.0 Remove `language` option. - /** - * Client language to generate. - */ - @Parameter(name = "language") - private String language; - - /** * The name of the generator to use. */ @@ -538,20 +530,8 @@ public void execute() throws MojoExecutionException { configurator.setGenerateAliasAsModel(generateAliasAsModel); } - // TODO: After 3.0.0 release (maybe for 3.1.0): Fully deprecate lang. if (isNotEmpty(generatorName)) { configurator.setGeneratorName(generatorName); - - // check if generatorName & language are set together, inform user this needs to be updated to prevent future issues. - if (isNotEmpty(language)) { - LOGGER.warn("The 'language' option is deprecated and was replaced by 'generatorName'. Both can not be set together"); - throw new MojoExecutionException( - "Illegal configuration: 'language' and 'generatorName' can not be set both, remove 'language' from your configuration"); - } - } else if (isNotEmpty(language)) { - LOGGER.warn( - "The 'language' option is deprecated and may reference language names only in the next major release (4.0). Please use 'generatorName' instead."); - configurator.setGeneratorName(language); } else { LOGGER.error("A generator name (generatorName) is required."); throw new MojoExecutionException("The generator requires 'generatorName'. Refer to documentation for a list of options."); @@ -724,7 +704,7 @@ public void execute() throws MojoExecutionException { originalEnvironmentVariables.put(key, GlobalSettings.getProperty(key)); String value = environmentVariables.get(key); if (value != null) { - configurator.addSystemProperty(key, value); + configurator.addGlobalProperty(key, value); } } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java index 5b05c3ccf422..26b91464f898 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java @@ -192,6 +192,8 @@ public interface CodegenConfig { void postProcessParameter(CodegenParameter parameter); + String modelFilename(String templateName, String modelName); + String apiFilename(String templateName, String tag); String apiTestFilename(String templateName, String tag); 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 fec45254f055..d711a4064097 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 @@ -4828,6 +4828,11 @@ public String apiFilename(String templateName, String tag) { return apiFileFolder() + File.separator + toApiFilename(tag) + suffix; } + public String modelFilename(String templateName, String modelName) { + String suffix = modelTemplateFiles().get(templateName); + return modelFileFolder() + File.separator + toModelFilename(modelName) + suffix; + } + /** * Return the full path and API documentation file * diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index ac72d822c985..f99a6c2d2e22 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -363,14 +363,9 @@ private void generateModelDocumentation(List files, Map mo } } - private String getModelFilenameByTemplate(String modelName, String templateName){ - String suffix = config.modelTemplateFiles().get(templateName); - return config.modelFileFolder() + File.separator + config.toModelFilename(modelName) + suffix; - } - private void generateModel(List files, Map models, String modelName) throws IOException { for (String templateName : config.modelTemplateFiles().keySet()) { - String filename = getModelFilenameByTemplate(modelName, templateName); + String filename = config.modelFilename(templateName, modelName); File written = processTemplateToFile(models, templateName, filename, generateModels, CodegenConstants.MODELS); if (written != null) { files.add(written); @@ -429,7 +424,7 @@ void generateModels(List files, List allModels, List unuse for (String templateName : config.modelTemplateFiles().keySet()) { // HACK: Because this returns early, could lead to some invalid model reporting. - String filename = getModelFilenameByTemplate(name, templateName); + String filename = config.modelFilename(templateName, name); Path path = java.nio.file.Paths.get(filename); this.templateProcessor.skip(path,"Skipped prior to model processing due to import mapping conflict (either by user or by generator)." ); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java index 57acb0009937..946573684e2d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java @@ -62,7 +62,7 @@ public class CodegenConfigurator { private String generatorName; private String inputSpec; private String templatingEngineName; - private Map systemProperties = new HashMap<>(); + private Map globalProperties = new HashMap<>(); private Map instantiationTypes = new HashMap<>(); private Map typeMappings = new HashMap<>(); private Map additionalProperties = new HashMap<>(); @@ -92,8 +92,8 @@ public static CodegenConfigurator fromFile(String configFile, Module... modules) configurator.generatorName = generatorSettings.getGeneratorName(); configurator.inputSpec = workflowSettings.getInputSpec(); configurator.templatingEngineName = workflowSettings.getTemplatingEngineName(); - if (workflowSettings.getSystemProperties() != null) { - configurator.systemProperties.putAll(workflowSettings.getSystemProperties()); + if (workflowSettings.getGlobalProperties() != null) { + configurator.globalProperties.putAll(workflowSettings.getGlobalProperties()); } if(generatorSettings.getInstantiationTypes() != null) { configurator.instantiationTypes.putAll(generatorSettings.getInstantiationTypes()); @@ -184,10 +184,9 @@ public CodegenConfigurator addLanguageSpecificPrimitive(String value) { return this; } - // TODO: rename this and other references to "global property" rather than "system property" - public CodegenConfigurator addSystemProperty(String key, String value) { - this.systemProperties.put(key, value); - workflowSettingsBuilder.withSystemProperty(key, value); + public CodegenConfigurator addGlobalProperty(String key, String value) { + this.globalProperties.put(key, value); + workflowSettingsBuilder.withGlobalProperty(key, value); return this; } @@ -432,9 +431,9 @@ public CodegenConfigurator setStrictSpecBehavior(boolean strictSpecBehavior) { return this; } - public CodegenConfigurator setSystemProperties(Map systemProperties) { - this.systemProperties = systemProperties; - workflowSettingsBuilder.withSystemProperties(systemProperties); + public CodegenConfigurator setGlobalProperties(Map globalProperties) { + this.globalProperties = globalProperties; + workflowSettingsBuilder.withGlobalProperties(globalProperties); return this; } @@ -497,8 +496,7 @@ public Context toContext() { GlobalSettings.setProperty("verbose", "false"); } - // TODO: Need to rename system properties to global properties - for (Map.Entry entry : workflowSettings.getSystemProperties().entrySet()) { + for (Map.Entry entry : workflowSettings.getGlobalProperties().entrySet()) { GlobalSettings.setProperty(entry.getKey(), entry.getValue()); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfiguratorUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfiguratorUtils.java index b3154db6407a..e6251baa8f04 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfiguratorUtils.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfiguratorUtils.java @@ -42,39 +42,6 @@ */ public final class CodegenConfiguratorUtils { - /** - * Applies "system" properties to the configurator as global properties. - * - * @deprecated - * This method is deprecated due to confusion around the tool's use of system properties. We called these system properties - * in the past and accepted them via CLI option -D. This lead to confusion between true Java System Properties and generator-specific - * "system level properties". They've since been renamed as "Global Properties". Please use {@link CodegenConfiguratorUtils#applyGlobalPropertiesKvpList(List, CodegenConfigurator)}. - * - * @param systemProperties List of properties to be globally available throughout the generator execution. - * @param configurator The {@link CodegenConfigurator} instance to configure. - */ - @Deprecated - public static void applySystemPropertiesKvpList(List systemProperties, CodegenConfigurator configurator) { - // TODO: Remove in 5.0 - applyGlobalPropertiesKvpList(systemProperties, configurator); - } - - /** - * Applies a key-value pair of strings as "system" properties to the configurator as global properties. - * - * @deprecated - * This method is deprecated due to confusing between Java Sytsem Properties and generator-specific "system-level properties". - * They've since been renamed as "Global Properties". Please use {@link CodegenConfiguratorUtils#applyGlobalPropertiesKvp(String, CodegenConfigurator)}. - * - * @param systemProperties List of properties to be globally available throughout the generator execution. - * @param configurator The {@link CodegenConfigurator} instance to configure. - */ - @Deprecated - public static void applySystemPropertiesKvp(String systemProperties, CodegenConfigurator configurator) { - // TODO: Remove in 5.0 - applyGlobalPropertiesKvp(systemProperties, configurator); - } - public static void applyGlobalPropertiesKvpList(List globalProperties, CodegenConfigurator configurator) { for(String propString : globalProperties) { applyGlobalPropertiesKvp(propString, configurator); @@ -84,7 +51,7 @@ public static void applyGlobalPropertiesKvpList(List globalProperties, C public static void applyGlobalPropertiesKvp(String globalProperties, CodegenConfigurator configurator) { final Map map = createMapFromKeyValuePairs(globalProperties); for (Map.Entry entry : map.entrySet()) { - configurator.addSystemProperty(entry.getKey(), entry.getValue()); + configurator.addGlobalProperty(entry.getKey(), entry.getValue()); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractApexCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractApexCodegen.java index 196ac1aa1815..17b687a3cf2b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractApexCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractApexCodegen.java @@ -456,13 +456,6 @@ public CodegenModel fromModel(String name, Schema model) { } } - // TODO: 5.0: Remove this block and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - cm.vendorExtensions.put("hasPropertyMappings", !propertyMappings.isEmpty()); // TODO: 5.0 Remove - cm.vendorExtensions.put("hasDefaultValues", hasDefaultValues); // TODO: 5.0 Remove - cm.vendorExtensions.put("propertyMappings", propertyMappings); // TODO: 5.0 Remove - - cm.vendorExtensions.put("x-has-property-mappings", !propertyMappings.isEmpty()); cm.vendorExtensions.put("x-has-default-values", hasDefaultValues); cm.vendorExtensions.put("x-property-mappings", propertyMappings); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index ee16ccdd0ebf..7941bb05f4c8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -590,14 +590,11 @@ public void updateCodegenPropertyEnum(CodegenProperty var) { * @param models list of all models */ protected void updateValueTypeProperty(Map models) { - // TODO: 5.0: Remove the camelCased vendorExtension within the below loop and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); for (Map.Entry entry : models.entrySet()) { String openAPIName = entry.getKey(); CodegenModel model = ModelUtils.getModelByName(openAPIName, models); if (model != null) { for (CodegenProperty var : model.vars) { - var.vendorExtensions.put("isValueType", isValueType(var)); // TODO: 5.0 Remove var.vendorExtensions.put("x-is-value-type", isValueType(var)); } } 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 82eba4b189c5..da78a87dd78d 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 @@ -235,19 +235,14 @@ public void postProcessParameter(CodegenParameter parameter) { char firstChar = parameter.paramName.charAt(0); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - if (Character.isUpperCase(firstChar)) { // First char is already uppercase, just use paramName. - parameter.vendorExtensions.put("x-exportParamName", parameter.paramName); // TODO: 5.0 Remove parameter.vendorExtensions.put("x-export-param-name", parameter.paramName); } // It's a lowercase first char, let's convert it to uppercase StringBuilder sb = new StringBuilder(parameter.paramName); sb.setCharAt(0, Character.toUpperCase(firstChar)); - parameter.vendorExtensions.put("x-exportParamName", sb.toString()); // TODO: 5.0 Remove parameter.vendorExtensions.put("x-export-param-name", sb.toString()); } 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 5a7f9ae4e4f3..262ecaad0e29 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 @@ -457,9 +457,6 @@ public Map postProcessOperationsWithModels(Map o @SuppressWarnings("unchecked") List operations = (List) objectMap.get("operation"); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - for (CodegenOperation operation : operations) { // http method verb conversion (e.g. PUT => Put) operation.httpMethod = camelize(operation.httpMethod.toLowerCase(Locale.ROOT)); @@ -525,12 +522,10 @@ public Map postProcessOperationsWithModels(Map o // We need to specially map Time type to the optionals package if ("time.Time".equals(param.dataType)) { - param.vendorExtensions.put("x-optionalDataType", "Time"); // TODO: 5.0 Remove param.vendorExtensions.put("x-optional-data-type", "Time"); } else { // Map optional type to dataType String optionalType = param.dataType.substring(0, 1).toUpperCase(Locale.ROOT) + param.dataType.substring(1); - param.vendorExtensions.put("x-optionalDataType", optionalType); // TODO: 5.0 Remove param.vendorExtensions.put("x-optional-data-type", optionalType); } } @@ -539,13 +534,11 @@ public Map postProcessOperationsWithModels(Map o char nameFirstChar = param.paramName.charAt(0); if (Character.isUpperCase(nameFirstChar)) { // First char is already uppercase, just use paramName. - param.vendorExtensions.put("x-exportParamName", param.paramName); // TODO: 5.0 Remove param.vendorExtensions.put("x-export-param-name", param.paramName); } else { // It's a lowercase first char, let's convert it to uppercase StringBuilder sb = new StringBuilder(param.paramName); sb.setCharAt(0, Character.toUpperCase(nameFirstChar)); - param.vendorExtensions.put("x-exportParamName", sb.toString()); // TODO: 5.0 Remove param.vendorExtensions.put("x-export-param-name", sb.toString()); } } @@ -579,21 +572,15 @@ public Map postProcessOperationsWithModels(Map o } private void setExportParameterName(List codegenParameters) { - - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - for (CodegenParameter param : codegenParameters) { char nameFirstChar = param.paramName.charAt(0); if (Character.isUpperCase(nameFirstChar)) { // First char is already uppercase, just use paramName. - param.vendorExtensions.put("x-exportParamName", param.paramName); // TODO: 5.0 Remove param.vendorExtensions.put("x-export-param-name", param.paramName); } else { // It's a lowercase first char, let's convert it to uppercase StringBuilder sb = new StringBuilder(param.paramName); sb.setCharAt(0, Character.toUpperCase(nameFirstChar)); - param.vendorExtensions.put("x-exportParamName", sb.toString()); // TODO: 5.0 Remove param.vendorExtensions.put("x-export-param-name", sb.toString()); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index f4e35763adb1..badec0f64994 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -1034,12 +1034,7 @@ public CodegenModel fromModel(String name, Schema model) { public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { if (serializeBigDecimalAsString) { if (property.baseType.equals("BigDecimal")) { - - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - // we serialize BigDecimal as `string` to avoid precision loss - property.vendorExtensions.put("extraAnnotation", "@JsonSerialize(using = ToStringSerializer.class)"); // TODO: 5.0 Remove property.vendorExtensions.put("x-extra-annotation", "@JsonSerialize(using = ToStringSerializer.class)"); // this requires some more imports to be added for this model... diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java index 4592f21310a9..3a76a35649a0 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java @@ -675,14 +675,9 @@ public Map postProcessModels(Map objs) { public Map postProcessOperationsWithModels(Map objs, List allModels) { Map operations = (Map) objs.get("operations"); List operationList = (List) operations.get("operation"); - - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - for (CodegenOperation op : operationList) { // for API test method name // e.g. public function test{{vendorExtensions.x-testOperationId}}() - op.vendorExtensions.put("x-testOperationId", camelize(op.operationId)); // TODO: 5.0 Remove op.vendorExtensions.put("x-test-operation-id", camelize(op.operationId)); } return objs; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Apache2ConfigCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Apache2ConfigCodegen.java index 5cd7dfb6c679..cd0a392fb23d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Apache2ConfigCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Apache2ConfigCodegen.java @@ -96,9 +96,6 @@ public Map postProcessOperationsWithModels(Map o List operationList = (List) operations.get("operation"); List newOpList = new ArrayList(); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - for (CodegenOperation op : operationList) { String path = op.path; @@ -111,7 +108,6 @@ public Map postProcessOperationsWithModels(Map o splitPath.add(item); op.path += item + "/"; } - op.vendorExtensions.put("x-codegen-userInfoPath", userInfoPath); // TODO: 5.0 Remove op.vendorExtensions.put("x-codegen-user-info-path", userInfoPath); boolean foundInNewList = false; for (CodegenOperation op1 : newOpList) { @@ -124,7 +120,6 @@ public Map postProcessOperationsWithModels(Map o } op.operationIdCamelCase = op1.operationIdCamelCase; currentOtherMethodList.add(op); - op1.vendorExtensions.put("x-codegen-otherMethods", currentOtherMethodList); // TODO: 5.0 Remove op1.vendorExtensions.put("x-codegen-other-methods", currentOtherMethodList); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ClojureClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ClojureClientCodegen.java index cb31f4f895d4..5af22a8d3f8f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ClojureClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ClojureClientCodegen.java @@ -47,7 +47,6 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi private static final String PROJECT_LICENSE_URL = "projectLicenseUrl"; private static final String BASE_NAMESPACE = "baseNamespace"; - static final String X_BASE_SPEC = "x-baseSpec"; // TODO: 5.0 Remove static final String VENDOR_EXTENSION_X_BASE_SPEC = "x-base-spec"; static final String X_MODELS = "x-models"; @@ -202,16 +201,10 @@ public String toModelName(String name) { @Override public CodegenModel fromModel(String name, Schema mod) { CodegenModel model = super.fromModel(name, mod); - - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - // If a var is a base spec we won't need to import it for (CodegenProperty var : model.vars) { - var.vendorExtensions.put(X_BASE_SPEC, baseSpecs.contains(var.complexType)); // TODO: 5.0 Remove var.vendorExtensions.put(VENDOR_EXTENSION_X_BASE_SPEC, baseSpecs.contains(var.complexType)); if (var.items != null) { - var.items.vendorExtensions.put(X_BASE_SPEC, baseSpecs.contains(var.items.complexType)); // TODO: 5.0 Remove var.items.vendorExtensions.put(VENDOR_EXTENSION_X_BASE_SPEC, baseSpecs.contains(var.items.complexType)); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java index 6a2368cd319f..6cd08e70a424 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java @@ -253,10 +253,6 @@ public Map postProcessOperationsWithModels(Map o String classname = (String) operations.get("classname"); operations.put("classnameSnakeUpperCase", underscore(classname).toUpperCase(Locale.ROOT)); operations.put("classnameSnakeLowerCase", underscore(classname).toLowerCase(Locale.ROOT)); - - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - List operationList = (List) operations.get("operation"); for (CodegenOperation op : operationList) { boolean consumeJson = false; @@ -267,7 +263,6 @@ public Map postProcessOperationsWithModels(Map o } boolean isStringOrDate = op.bodyParam.isString || op.bodyParam.isDate; - op.bodyParam.vendorExtensions.put("x-codegen-pistache-isStringOrDate", isStringOrDate); // TODO: 5.0 Remove op.bodyParam.vendorExtensions.put("x-codegen-pistache-is-string-or-date", isStringOrDate); } if (op.consumes != null) { @@ -302,9 +297,7 @@ public Map postProcessOperationsWithModels(Map o if (op.vendorExtensions == null) { op.vendorExtensions = new HashMap<>(); } - op.vendorExtensions.put("x-codegen-pistache-consumesJson", consumeJson); // TODO: 5.0 Remove op.vendorExtensions.put("x-codegen-pistache-consumes-json", consumeJson); - op.vendorExtensions.put("x-codegen-pistache-isParsingSupported", isParsingSupported); // TODO: 5.0 Remove op.vendorExtensions.put("x-codegen-pistache-is-parsing-supported", isParsingSupported); // Check if any one of the operations needs a model, then at API file level, at least one model has to be included. diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestbedServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestbedServerCodegen.java index 09626e7a327f..c06fb7f66350 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestbedServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestbedServerCodegen.java @@ -287,9 +287,6 @@ public Map postProcessOperationsWithModels(Map o List operationList = (List) operations.get("operation"); List newOpList = new ArrayList(); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - for (CodegenOperation op : operationList) { String path = op.path; @@ -311,7 +308,6 @@ public Map postProcessOperationsWithModels(Map o } op.path += item + "/"; } - op.vendorExtensions.put("x-codegen-resourceName", resourceNameCamelCase); // TODO: 5.0 Remove op.vendorExtensions.put("x-codegen-resource-name", resourceNameCamelCase); boolean foundInNewList = false; @@ -325,7 +321,6 @@ public Map postProcessOperationsWithModels(Map o } op.operationIdCamelCase = op1.operationIdCamelCase; currentOtherMethodList.add(op); - op1.vendorExtensions.put("x-codegen-otherMethods", currentOtherMethodList); // TODO: 5.0 Remove op1.vendorExtensions.put("x-codegen-other-methods", currentOtherMethodList); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppUE4ClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppUE4ClientCodegen.java index 175a64160a1b..064b5282f62a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppUE4ClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppUE4ClientCodegen.java @@ -331,18 +331,16 @@ public String apiFileFolder() { return outputFolder + File.separator + apiPackage().replace("::", File.separator); } - /* @Override - public String modelFilename(String templateName, String tag) { + public String modelFilename(String templateName, String modelName) { String suffix = modelTemplateFiles().get(templateName); String folder = privateFolder; if (suffix == ".h") { folder = publicFolder; } - return modelFileFolder() + File.separator + folder + File.separator + toModelFilename(tag) + suffix; + return modelFileFolder() + File.separator + folder + File.separator + toModelFilename(modelName) + suffix; } - */ @Override public String toModelFilename(String name) { @@ -399,6 +397,10 @@ public String getTypeDeclaration(Schema p) { } } + @Override + public String getTypeDeclaration(String name) { + return name; + } @Override public String toDefaultValue(Schema p) { 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 2a8de81aff62..ef750c05f8f1 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 @@ -270,9 +270,6 @@ public Map postProcessModels(Map objs) { List models = (List) objs.get("models"); ProcessUtils.addIndexToProperties(models, 1); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - for (Object _mo : models) { Map mo = (Map) _mo; Set modelImports = new HashSet<>(); @@ -289,7 +286,6 @@ public Map postProcessModels(Map objs) { cm.imports = modelImports; boolean hasVars = cm.vars.size() > 0; - cm.vendorExtensions.put("hasVars", hasVars); // TODO: 5.0 Remove cm.vendorExtensions.put("x-has-vars", hasVars); } return objs; @@ -356,13 +352,6 @@ public Map postProcessOperationsWithModels(Map o } } - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - - op.vendorExtensions.put("isJson", isJson); // TODO: 5.0 Remove - op.vendorExtensions.put("isForm", isForm); // TODO: 5.0 Remove - op.vendorExtensions.put("isMultipart", isMultipart); // TODO: 5.0 Remove - op.vendorExtensions.put("x-is-json", isJson); op.vendorExtensions.put("x-is-form", isForm); op.vendorExtensions.put("x-is-multipart", isMultipart); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java index eabb64854a4c..c5042947a17b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java @@ -225,9 +225,6 @@ public Map postProcessModels(Map objs) { List models = (List) objs.get("models"); ProcessUtils.addIndexToProperties(models, 1); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - for (Object _mo : models) { Map mo = (Map) _mo; Set modelImports = new HashSet<>(); @@ -249,7 +246,6 @@ public Map postProcessModels(Map objs) { cm.imports = modelImports; boolean hasVars = cm.vars.size() > 0; - cm.vendorExtensions.put("hasVars", hasVars); // TODO: 5.0 Remove cm.vendorExtensions.put("x-has-vars", hasVars); } return objs; @@ -259,9 +255,6 @@ public Map postProcessModels(Map objs) { public Map postProcessOperationsWithModels(Map objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - Map operations = (Map) objs.get("operations"); List operationList = (List) operations.get("operation"); @@ -305,11 +298,6 @@ public Map postProcessOperationsWithModels(Map o } } - op.vendorExtensions.put("isForm", isForm); // TODO: 5.0 Remove - op.vendorExtensions.put("isJson", isJson); // TODO: 5.0 Remove - op.vendorExtensions.put("isProto", isProto); // TODO: 5.0 Remove - op.vendorExtensions.put("isMultipart", isMultipart); // TODO: 5.0 Remove - op.vendorExtensions.put("x-is-form", isForm); op.vendorExtensions.put("x-is-json", isJson); op.vendorExtensions.put("x-is-proto", isProto); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellHttpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellHttpClientCodegen.java index f0676b8e1873..00fc4e981756 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellHttpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellHttpClientCodegen.java @@ -38,7 +38,6 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; -import static org.openapitools.codegen.utils.OnceLogger.once; import static org.openapitools.codegen.utils.StringUtils.camelize; import static org.openapitools.codegen.utils.StringUtils.underscore; @@ -88,24 +87,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC static final String MIME_ANY = "MimeAny"; // vendor extensions. These must follow our convention of x- prefixed and lower-kebab cased. - static final String X_COLLECTION_FORMAT = "x-collectionFormat"; // TODO: 5.0 Remove - static final String X_HADDOCK_PATH = "x-haddockPath"; // TODO: 5.0 Remove - static final String X_HAS_BODY_OR_FORM_PARAM = "x-hasBodyOrFormParam"; // TODO: 5.0 Remove - static final String X_HAS_MIME_FORM_URL_ENCODED = "x-hasMimeFormUrlEncoded"; // TODO: 5.0 Remove - static final String X_HAS_NEW_TAG = "x-hasNewTag"; // TODO: 5.0 Remove - static final String X_HAS_OPTIONAL_PARAMS = "x-hasOptionalParams"; // TODO: 5.0 Remove - static final String X_HAS_UNKNOWN_RETURN = "x-hasUnknownReturn"; // TODO: 5.0 Remove - static final String X_INLINE_CONTENT_TYPE = "x-inlineContentType"; // TODO: 5.0 Remove - static final String X_INLINE_ACCEPT = "x-inlineAccept"; // TODO: 5.0 Remove - static final String X_IS_BODY_OR_FORM_PARAM = "x-isBodyOrFormParam"; // TODO: 5.0 Remove - static final String X_IS_MAYBE_VALUE = "x-isMaybeValue"; // TODO: 5.0 Remove - static final String X_DATA_TYPE = "x-dataType"; // TODO: 5.0 Remove - static final String X_MIME_TYPES = "x-mimeTypes"; // TODO: 5.0 Remove - static final String X_OPERATION_TYPE = "x-operationType"; // TODO: 5.0 Remove - static final String X_PARAM_NAME_TYPE = "x-paramNameType"; // TODO: 5.0 Remove - static final String X_RETURN_TYPE = "x-returnType"; // TODO: 5.0 Remove - static final String X_UNKNOWN_MIME_TYPES = "x-unknownMimeTypes"; // TODO: 5.0 Remove - + static final String VENDOR_EXTENSION_X_UNKNOWN_MIME_TYPES = "x-unknown-mime-types"; static final String VENDOR_EXTENSION_X_COLLECTION_FORMAT = "x-collection-format"; static final String VENDOR_EXTENSION_X_HADDOCK_PATH = "x-haddock-path"; static final String VENDOR_EXTENSION_X_HAS_BODY_OR_FORM_PARAM = "x-has-body-or-form-param"; @@ -687,10 +669,6 @@ public String toInstantiationType(Schema p) { @Override public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation op, Map> operations) { - - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - List opList = operations.get(tag); if (opList == null || opList.isEmpty()) { opList = new ArrayList(); @@ -727,33 +705,25 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera op.vendorExtensions = new LinkedHashMap(); String operationType = toTypeName("Op", op.operationId); - op.vendorExtensions.put(X_OPERATION_TYPE, operationType); // TODO: 5.0 Remove op.vendorExtensions.put(VENDOR_EXTENSION_X_OPERATION_TYPE, operationType); typeNames.add(operationType); String xHaddockPath = String.format(Locale.ROOT, "%s %s", op.httpMethod, op.path.replace("/", "\\/")); - op.vendorExtensions.put(X_HADDOCK_PATH, xHaddockPath); // TODO: 5.0 Remove op.vendorExtensions.put(VENDOR_EXTENSION_X_HADDOCK_PATH, xHaddockPath); - op.vendorExtensions.put(X_HAS_BODY_OR_FORM_PARAM, op.getHasBodyParam() || op.getHasFormParams()); // TODO: 5.0 Remove op.vendorExtensions.put(VENDOR_EXTENSION_X_HAS_BODY_OR_FORM_PARAM, op.getHasBodyParam() || op.getHasFormParams()); for (CodegenParameter param : op.allParams) { param.vendorExtensions = new LinkedHashMap(); // prevent aliasing/sharing - param.vendorExtensions.put(X_OPERATION_TYPE, operationType); // TODO: 5.0 Remove param.vendorExtensions.put(VENDOR_EXTENSION_X_OPERATION_TYPE, operationType); - param.vendorExtensions.put(X_IS_BODY_OR_FORM_PARAM, param.isBodyParam || param.isFormParam); // TODO: 5.0 Remove param.vendorExtensions.put(VENDOR_EXTENSION_X_IS_BODY_OR_FORM_PARAM, param.isBodyParam || param.isFormParam); if (!StringUtils.isBlank(param.collectionFormat)) { - param.vendorExtensions.put(X_COLLECTION_FORMAT, mapCollectionFormat(param.collectionFormat)); // TODO: 5.0 Remove param.vendorExtensions.put(VENDOR_EXTENSION_X_COLLECTION_FORMAT, mapCollectionFormat(param.collectionFormat)); } else if (!param.isBodyParam && (param.isListContainer || param.dataType.startsWith("["))) { // param.isListContainer is sometimes false for list types // defaulting due to https://github.com/wing328/openapi-generator/issues/72 param.collectionFormat = "csv"; - param.vendorExtensions.put(X_COLLECTION_FORMAT, mapCollectionFormat(param.collectionFormat)); // TODO: 5.0 Remove param.vendorExtensions.put(VENDOR_EXTENSION_X_COLLECTION_FORMAT, mapCollectionFormat(param.collectionFormat)); } if (!param.required) { - op.vendorExtensions.put(X_HAS_OPTIONAL_PARAMS, true); // TODO: 5.0 Remove op.vendorExtensions.put(VENDOR_EXTENSION_X_HAS_OPTIONAL_PARAMS, true); } @@ -764,7 +734,6 @@ public void addOperationToGroup(String tag, String resourcePath, Operation opera String dataType = genEnums && param.isEnum ? param.datatypeWithEnum : param.dataType; String paramNameType = toDedupedModelName(toTypeName("Param", param.paramName), dataType, !(param.isEnum || param.allowableValues != null)); - param.vendorExtensions.put(X_PARAM_NAME_TYPE, paramNameType); // TODO: 5.0 Remove param.vendorExtensions.put(VENDOR_EXTENSION_X_PARAM_NAME_TYPE, paramNameType); HashMap props = new HashMap<>(); @@ -809,16 +778,16 @@ public int compare(Map o1, Map o2) { return o1.get(MEDIA_TYPE).compareTo(o2.get(MEDIA_TYPE)); } }); - additionalProperties.put(X_UNKNOWN_MIME_TYPES, unknownMimeTypes); + additionalProperties.put(VENDOR_EXTENSION_X_UNKNOWN_MIME_TYPES, unknownMimeTypes); ArrayList> params = new ArrayList<>(uniqueParamNameTypes.values()); Collections.sort(params, new Comparator>() { @Override public int compare(Map o1, Map o2) { return - ((String) o1.get(X_PARAM_NAME_TYPE)) + ((String) o1.get(VENDOR_EXTENSION_X_PARAM_NAME_TYPE)) .compareTo( - (String) o2.get(X_PARAM_NAME_TYPE)); + (String) o2.get(VENDOR_EXTENSION_X_PARAM_NAME_TYPE)); } }); additionalProperties.put(X_ALL_UNIQUE_PARAMS, params); @@ -827,14 +796,9 @@ public int compare(Map o1, Map o2) { @Override public Map postProcessOperationsWithModels(Map objs, List allModels) { Map ret = super.postProcessOperationsWithModels(objs, allModels); - - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - HashMap pathOps = (HashMap) ret.get("operations"); ArrayList ops = (ArrayList) pathOps.get("operation"); if (ops.size() > 0) { - ops.get(0).vendorExtensions.put(X_HAS_NEW_TAG, true); // TODO: 5.0 Remove ops.get(0).vendorExtensions.put(VENDOR_EXTENSION_X_HAS_NEW_TAG, true); } @@ -846,7 +810,6 @@ public Map postProcessOperationsWithModels(Map o if (modelMimeTypes.containsKey(m.classname)) { Set mimeTypes = modelMimeTypes.get(m.classname); - m.vendorExtensions.put(X_MIME_TYPES, mimeTypes); // TODO: 5.0 Remove m.vendorExtensions.put(VENDOR_EXTENSION_X_MIME_TYPES, mimeTypes); if ((boolean) additionalProperties.get(PROP_GENERATE_FORM_URLENCODED_INSTANCES) && mimeTypes.contains("MimeFormUrlEncoded")) { @@ -857,7 +820,6 @@ public Map postProcessOperationsWithModels(Map o } } if (hasMimeFormUrlEncoded) { - m.vendorExtensions.put(X_HAS_MIME_FORM_URL_ENCODED, true); // TODO: 5.0 Remove m.vendorExtensions.put(VENDOR_EXTENSION_X_HAS_MIME_FORM_URL_ENCODED, true); } } @@ -919,14 +881,9 @@ private void processReturnType(CodegenOperation op) { if (returnType == null || returnType.equals("null")) { if (op.hasProduces) { returnType = "res"; - op.vendorExtensions.put(X_HAS_UNKNOWN_RETURN, true); // TODO: 5.0 Remove op.vendorExtensions.put(VENDOR_EXTENSION_X_HAS_UNKNOWN_RETURN, true); } else { returnType = "NoContent"; - // TODO: 5.0 Remove vendor extension usage which is not lower-kebab cased. - if (!op.vendorExtensions.containsKey(X_INLINE_ACCEPT)) { - SetNoContent(op, X_INLINE_ACCEPT); - } if (!op.vendorExtensions.containsKey(VENDOR_EXTENSION_X_INLINE_ACCEPT)) { SetNoContent(op, VENDOR_EXTENSION_X_INLINE_ACCEPT); } @@ -935,13 +892,11 @@ private void processReturnType(CodegenOperation op) { if (returnType.contains(" ")) { returnType = "(" + returnType + ")"; } - op.vendorExtensions.put(X_RETURN_TYPE, returnType); // TODO: 5.0 Remove op.vendorExtensions.put(VENDOR_EXTENSION_X_RETURN_TYPE, returnType); } private void processProducesConsumes(CodegenOperation op) { - if (!(Boolean) op.vendorExtensions.get(X_HAS_BODY_OR_FORM_PARAM)) { - SetNoContent(op, X_INLINE_CONTENT_TYPE); // TODO: 5.0 Remove + if (!(Boolean) op.vendorExtensions.get(VENDOR_EXTENSION_X_HAS_BODY_OR_FORM_PARAM)) { SetNoContent(op, VENDOR_EXTENSION_X_INLINE_CONTENT_TYPE); } if (op.hasConsumes) { @@ -979,20 +934,15 @@ private void processProducesConsumes(CodegenOperation op) { } private void processInlineConsumesContentType(CodegenOperation op, Map m) { - if (op.vendorExtensions.containsKey(X_INLINE_CONTENT_TYPE)) return; - - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); + if (op.vendorExtensions.containsKey(VENDOR_EXTENSION_X_INLINE_CONTENT_TYPE)) return; if ((boolean) additionalProperties.get(PROP_INLINE_MIME_TYPES) && op.consumes.size() == 1 && !MIME_ANY.equals(op.consumes.get(0).get(X_MEDIA_DATA_TYPE)) && !MIME_NO_CONTENT.equals(op.consumes.get(0).get(X_MEDIA_DATA_TYPE))) { - op.vendorExtensions.put(X_INLINE_CONTENT_TYPE, m); // TODO: 5.0 Remove op.vendorExtensions.put(VENDOR_EXTENSION_X_INLINE_CONTENT_TYPE, m); for (CodegenParameter param : op.allParams) { if (param.isBodyParam && param.required) { - param.vendorExtensions.put(X_INLINE_CONTENT_TYPE, m); // TODO: 5.0 Remove param.vendorExtensions.put(VENDOR_EXTENSION_X_INLINE_CONTENT_TYPE, m); } } @@ -1005,10 +955,6 @@ private void processInlineProducesContentType(CodegenOperation op, Map lastParam = this.uniqueParamNameTypes.get(paramNameType); if (lastParam != null) { - String comparisonKey = lastParam.containsKey(VENDOR_EXTENSION_X_ENUM) ? X_ENUM_VALUES : X_DATA_TYPE; + String comparisonKey = lastParam.containsKey(VENDOR_EXTENSION_X_ENUM) ? X_ENUM_VALUES : VENDOR_EXTENSION_X_DATA_TYPE; String lastParamDataType = (String) lastParam.get(comparisonKey); if (lastParamDataType != null && lastParamDataType.equals(dataType)) { return true; @@ -1053,7 +999,7 @@ public Boolean isDuplicate(String paramNameType, String dataType) { private Pair isDuplicateEnumValues(String enumValues) { for (Map vs : uniqueParamNameTypes.values()) { if (enumValues.equals(vs.get(X_ENUM_VALUES))) { - return Pair.of(true, (String) vs.get(X_PARAM_NAME_TYPE)); + return Pair.of(true, (String) vs.get(VENDOR_EXTENSION_X_PARAM_NAME_TYPE)); } } return Pair.of(false, null); @@ -1062,8 +1008,8 @@ private Pair isDuplicateEnumValues(String enumValues) { private void addToUniques(String xGroup, String paramNameType, String dataType, Map props) { HashMap m = new HashMap<>(); - m.put(X_PARAM_NAME_TYPE, paramNameType); - m.put(X_DATA_TYPE, dataType); + m.put(VENDOR_EXTENSION_X_PARAM_NAME_TYPE, paramNameType); + m.put(VENDOR_EXTENSION_X_DATA_TYPE, dataType); m.put(xGroup, true); m.putAll(props); uniqueParamNameTypes.put(paramNameType, m); @@ -1323,9 +1269,6 @@ public String toDefaultValue(Schema p) { public Map postProcessModels(Map objs) { List models = (List) objs.get("models"); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - for (Object _mo : models) { Map mo = (Map) _mo; CodegenModel cm = (CodegenModel) mo.get("model"); @@ -1335,10 +1278,8 @@ public Map postProcessModels(Map objs) { if (dataType == null && cm.isArrayModel) { // isAlias + arrayModelType missing "datatype" dataType = "[" + cm.arrayModelType + "]"; } - cm.vendorExtensions.put(X_DATA_TYPE, dataType); // TODO: 5.0 Remove cm.vendorExtensions.put(VENDOR_EXTENSION_X_DATA_TYPE, dataType); if (dataType.equals("Maybe A.Value")) { - cm.vendorExtensions.put(X_IS_MAYBE_VALUE, true); // TODO: 5.0 Remove cm.vendorExtensions.put(VENDOR_EXTENSION_X_IS_MAYBE_VALUE, true); } } @@ -1346,10 +1287,8 @@ public Map postProcessModels(Map objs) { String datatype = genEnums && !StringUtils.isBlank(var.datatypeWithEnum) ? var.datatypeWithEnum : var.dataType; - var.vendorExtensions.put(X_DATA_TYPE, datatype); // TODO: 5.0 Remove var.vendorExtensions.put(VENDOR_EXTENSION_X_DATA_TYPE, datatype); if (!var.required && datatype.equals("A.Value") || var.required && datatype.equals("Maybe A.Value")) { - var.vendorExtensions.put(X_IS_MAYBE_VALUE, true); // TODO: 5.0 Remove var.vendorExtensions.put(VENDOR_EXTENSION_X_IS_MAYBE_VALUE, true); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellServantCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellServantCodegen.java index 857bc4a55e42..fab903fa4930 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellServantCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellServantCodegen.java @@ -507,9 +507,6 @@ private List pathToClientType(String path, List pathPa public CodegenOperation fromOperation(String resourcePath, String httpMethod, Operation operation, List servers) { CodegenOperation op = super.fromOperation(resourcePath, httpMethod, operation, servers); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - List path = pathToServantRoute(op.path, op.pathParams); List type = pathToClientType(op.path, op.pathParams); @@ -562,7 +559,6 @@ public CodegenOperation fromOperation(String resourcePath, String httpMethod, Op // store form parameter name in the vendor extensions for (CodegenParameter param : op.formParams) { - param.vendorExtensions.put("x-formParamName", camelize(param.baseName)); // TODO: 5.0 Remove param.vendorExtensions.put("x-form-param-name", camelize(param.baseName)); } @@ -577,14 +573,10 @@ public CodegenOperation fromOperation(String resourcePath, String httpMethod, Op path.add("Verb '" + op.httpMethod.toUpperCase(Locale.ROOT) + " 200 '[JSON] " + returnType); type.add("m " + returnType); - op.vendorExtensions.put("x-routeType", joinStrings(" :> ", path)); // TODO: 5.0 Remove op.vendorExtensions.put("x-route-type", joinStrings(" :> ", path)); - op.vendorExtensions.put("x-clientType", joinStrings(" -> ", type)); // TODO: 5.0 Remove op.vendorExtensions.put("x-client-type", joinStrings(" -> ", type)); - op.vendorExtensions.put("x-formName", "Form" + camelize(op.operationId)); // TODO: 5.0 Remove op.vendorExtensions.put("x-form-name", "Form" + camelize(op.operationId)); for (CodegenParameter param : op.formParams) { - param.vendorExtensions.put("x-formPrefix", camelize(op.operationId, true)); // TODO: 5.0 Remove param.vendorExtensions.put("x-form-prefix", camelize(op.operationId, true)); } return op; @@ -642,9 +634,6 @@ private String fixModelChars(String string) { public CodegenModel fromModel(String name, Schema mod) { CodegenModel model = super.fromModel(name, mod); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - setGenerateToSchema(model); // Clean up the class name to remove invalid characters @@ -663,7 +652,6 @@ public CodegenModel fromModel(String name, Schema mod) { String dataOrNewtype = "data"; if (!"object".equals(model.dataType) && typeMapping.containsKey(model.dataType)) { String newtype = typeMapping.get(model.dataType); - model.vendorExtensions.put("x-customNewtype", newtype); // TODO: 5.0 Remove // note; newtype is a single lowercase word in Haskell (not separated by hyphen) model.vendorExtensions.put("x-custom-newtype", newtype); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index 0a973ab0496f..5a5b618a202b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -750,14 +750,12 @@ public Map postProcessModelsEnum(Map objs) { return objs; } + @SuppressWarnings("unchecked") @Override public Map postProcessModels(Map objs) { objs = super.postProcessModels(objs); List models = (List) objs.get("models"); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - if (additionalProperties.containsKey(SERIALIZATION_LIBRARY_JACKSON) && !JERSEY1.equals(getLibrary())) { List> imports = (List>) objs.get("imports"); for (Object _mo : models) { @@ -768,7 +766,6 @@ public Map postProcessModels(Map objs) { boolean isOptionalNullable = Boolean.FALSE.equals(var.required) && Boolean.TRUE.equals(var.isNullable); // only add JsonNullable and related imports to optional and nullable values addImports |= isOptionalNullable; - var.getVendorExtensions().put("isJacksonOptionalNullable", isOptionalNullable); // TODO: 5.0 Remove var.getVendorExtensions().put("x-is-jackson-optional-nullable", isOptionalNullable); } if (addImports) { @@ -791,9 +788,8 @@ public Map postProcessModels(Map objs) { for (Object _mo : models) { Map mo = (Map) _mo; CodegenModel cm = (CodegenModel) mo.get("model"); - cm.getVendorExtensions().putIfAbsent("implements", new ArrayList()); // TODO: 5.0 Remove - cm.getVendorExtensions().putIfAbsent("x-implements", cm.getVendorExtensions().get("implements")); - //List impl = (List) cm.getVendorExtensions().get("x-implements"); + + cm.getVendorExtensions().putIfAbsent("x-implements", new ArrayList()); if (JERSEY2.equals(getLibrary())) { cm.getVendorExtensions().put("x-implements", new ArrayList()); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPlayFrameworkCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPlayFrameworkCodegen.java index fb6b93472dc8..1cfd2e63ad93 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPlayFrameworkCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPlayFrameworkCodegen.java @@ -291,9 +291,6 @@ public void setUseSwaggerUI(boolean useSwaggerUI) { public Map postProcessOperationsWithModels(Map objs, List allModels) { Map operations = (Map) objs.get("operations"); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - if (operations != null) { List ops = (List) operations.get("operation"); for (CodegenOperation operation : ops) { @@ -320,11 +317,9 @@ public Map postProcessOperationsWithModels(Map o if (operation.returnType != null) { if (operation.returnType.equals("Boolean")) { - operation.vendorExtensions.put("missingReturnInfoIfNeeded", "true"); // TODO: 5.0 Remove operation.vendorExtensions.put("x-missing-return-info-if-needed", "true"); } if (operation.returnType.equals("BigDecimal")) { - operation.vendorExtensions.put("missingReturnInfoIfNeeded", "1.0"); // TODO: 5.0 Remove operation.vendorExtensions.put("x-missing-return-info-if-needed", "1.0"); } if (operation.returnType.startsWith("List")) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptApolloClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptApolloClientCodegen.java index a08486854ab6..b92c70e2aa10 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptApolloClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptApolloClientCodegen.java @@ -814,9 +814,6 @@ public String toOperationId(String operationId) { @Override public CodegenModel fromModel(String name, Schema model) { - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - Map allDefinitions = ModelUtils.getSchemas(this.openAPI); CodegenModel codegenModel = super.fromModel(name, model); @@ -829,22 +826,17 @@ public CodegenModel fromModel(String name, Schema model) { ArraySchema am = (ArraySchema) model; if (codegenModel != null && am.getItems() != null) { String itemType = getSchemaType(am.getItems()); - codegenModel.vendorExtensions.put("x-isArray", true); // TODO: 5.0 Remove codegenModel.vendorExtensions.put("x-is-array", true); - codegenModel.vendorExtensions.put("x-itemType", itemType); // TODO: 5.0 Remove codegenModel.vendorExtensions.put("x-item-type", itemType); } } else if (ModelUtils.isMapSchema(model)) { if (codegenModel != null && getAdditionalProperties(model) != null) { String itemType = getSchemaType(getAdditionalProperties(model)); - codegenModel.vendorExtensions.put("x-isMap", true); // TODO: 5.0 Remove codegenModel.vendorExtensions.put("x-is-map", true); - codegenModel.vendorExtensions.put("x-itemType", itemType); // TODO: 5.0 Remove codegenModel.vendorExtensions.put("x-item-type", itemType); } else { String type = model.getType(); if (codegenModel != null && isPrimitiveType(type)) { - codegenModel.vendorExtensions.put("x-isPrimitive", true); // TODO: 5.0 Remove codegenModel.vendorExtensions.put("x-is-primitive", true); } } @@ -918,9 +910,6 @@ public Map postProcessOperationsWithModels(Map o // vendor-extension: x-codegen-argList. Map operations = (Map) objs.get("operations"); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - if (operations != null) { List ops = (List) operations.get("operation"); for (CodegenOperation operation : ops) { @@ -944,9 +933,7 @@ public Map postProcessOperationsWithModels(Map o } String joinedArgList = StringUtils.join(argList, ", "); - operation.vendorExtensions.put("x-codegen-argList", joinedArgList); // TODO: 5.0 Remove operation.vendorExtensions.put("x-codegen-arg-list", joinedArgList); - operation.vendorExtensions.put("x-codegen-hasOptionalParams", hasOptionalParams); // TODO: 5.0 Remove operation.vendorExtensions.put("x-codegen-has-optional-params", hasOptionalParams); // Store JSDoc type specification into vendor-extension: x-jsdoc-type. @@ -972,9 +959,6 @@ public Map postProcessModels(Map objs) { objs = super.postProcessModelsEnum(objs); List models = (List) objs.get("models"); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - for (Object _mo : models) { Map mo = (Map) _mo; CodegenModel cm = (CodegenModel) mo.get("model"); @@ -1025,10 +1009,8 @@ public Map postProcessModels(Map objs) { for (CodegenProperty var : cm.vars) { Optional.ofNullable(lastRequired).ifPresent(_lastRequired -> { if (var == _lastRequired) { - var.vendorExtensions.put("x-codegen-hasMoreRequired", false); // TODO: 5.0 Remove var.vendorExtensions.put("x-codegen-has-more-required", false); } else if (var.required) { - var.vendorExtensions.put("x-codegen-hasMoreRequired", true); // TODO: 5.0 Remove var.vendorExtensions.put("x-codegen-has-more-required", true); } }); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClientCodegen.java index 092ecd658721..dddf793e81be 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClientCodegen.java @@ -862,9 +862,6 @@ public String toOperationId(String operationId) { @Override public CodegenModel fromModel(String name, Schema model) { - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - Map allDefinitions = ModelUtils.getSchemas(this.openAPI); CodegenModel codegenModel = super.fromModel(name, model); @@ -877,22 +874,17 @@ public CodegenModel fromModel(String name, Schema model) { ArraySchema am = (ArraySchema) model; if (codegenModel != null && am.getItems() != null) { String itemType = getSchemaType(am.getItems()); - codegenModel.vendorExtensions.put("x-isArray", true); // TODO: 5.0 Remove codegenModel.vendorExtensions.put("x-is-array", true); - codegenModel.vendorExtensions.put("x-itemType", itemType); // TODO: 5.0 Remove codegenModel.vendorExtensions.put("x-item-type", itemType); } } else if (ModelUtils.isMapSchema(model)) { if (codegenModel != null && getAdditionalProperties(model) != null) { String itemType = getSchemaType(getAdditionalProperties(model)); - codegenModel.vendorExtensions.put("x-isMap", true); // TODO: 5.0 Remove codegenModel.vendorExtensions.put("x-is-map", true); - codegenModel.vendorExtensions.put("x-itemType", itemType); // TODO: 5.0 Remove codegenModel.vendorExtensions.put("x-item-type", itemType); } else { String type = model.getType(); if (codegenModel != null && isPrimitiveType(type)) { - codegenModel.vendorExtensions.put("x-isPrimitive", true); // TODO: 5.0 Remove codegenModel.vendorExtensions.put("x-is-primitive", true); } } @@ -992,9 +984,6 @@ public Map postProcessOperationsWithModels(Map o // vendor-extension: x-codegen-argList. Map operations = (Map) objs.get("operations"); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - if (operations != null) { List ops = (List) operations.get("operation"); for (CodegenOperation operation : ops) { @@ -1021,9 +1010,7 @@ public Map postProcessOperationsWithModels(Map o argList.add("callback"); } String joinedArgList = StringUtils.join(argList, ", "); - operation.vendorExtensions.put("x-codegen-argList", joinedArgList); // TODO: 5.0 Remove operation.vendorExtensions.put("x-codegen-arg-list", joinedArgList); - operation.vendorExtensions.put("x-codegen-hasOptionalParams", hasOptionalParams); // TODO: 5.0 Remove operation.vendorExtensions.put("x-codegen-has-optional-params", hasOptionalParams); // Store JSDoc type specification into vendor-extension: x-jsdoc-type. @@ -1049,9 +1036,6 @@ public Map postProcessModels(Map objs) { objs = super.postProcessModelsEnum(objs); List models = (List) objs.get("models"); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - for (Object _mo : models) { Map mo = (Map) _mo; CodegenModel cm = (CodegenModel) mo.get("model"); @@ -1102,10 +1086,8 @@ public Map postProcessModels(Map objs) { for (CodegenProperty var : cm.vars) { Optional.ofNullable(lastRequired).ifPresent(_lastRequired -> { if (var == _lastRequired) { - var.vendorExtensions.put("x-codegen-hasMoreRequired", false); // TODO: 5.0 Remove var.vendorExtensions.put("x-codegen-has-more-required", false); } else if (var.required) { - var.vendorExtensions.put("x-codegen-hasMoreRequired", true); // TODO: 5.0 Remove var.vendorExtensions.put("x-codegen-has-more-required", true); } }); 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 790dbd92322a..7abd38b276cf 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 @@ -29,10 +29,10 @@ import static org.openapitools.codegen.utils.StringUtils.underscore; +@SuppressWarnings("unchecked") 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"; // TODO: 5.0 Remove public static final String VENDOR_EXTENSION_MYSQL_SCHEMA = "x-mysql-schema"; public static final String DEFAULT_DATABASE_NAME = "defaultDatabaseName"; public static final String JSON_DATA_TYPE_ENABLED = "jsonDataTypeEnabled"; @@ -272,12 +272,11 @@ public Map postProcessModels(Map objs) { modelDescription = (modelDescription == null || modelDescription.isEmpty()) ? commentExtra : modelDescription + ". " + commentExtra; } - if (modelVendorExtensions.containsKey(CODEGEN_VENDOR_EXTENSION_KEY)) { + if (modelVendorExtensions.containsKey(VENDOR_EXTENSION_MYSQL_SCHEMA)) { // user already specified schema values LOGGER.info("Found vendor extension in '" + modelName + "' model, autogeneration skipped"); - continue; } else { - modelVendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema); + modelVendorExtensions.put(VENDOR_EXTENSION_MYSQL_SCHEMA, mysqlSchema); mysqlSchema.put("tableDefinition", tableDefinition); tableDefinition.put("tblName", tableName); tableDefinition.put("tblComment", modelDescription); @@ -336,15 +335,15 @@ public void processIntegerTypeProperty(CodegenModel model, CodegenProperty prope String description = property.getDescription(); String minimum = property.getMinimum(); String maximum = property.getMaximum(); - Boolean exclusiveMinimum = property.getExclusiveMinimum(); - Boolean exclusiveMaximum = property.getIExclusiveMaximum(); + boolean exclusiveMinimum = property.getExclusiveMinimum(); + boolean exclusiveMaximum = property.getIExclusiveMaximum(); String defaultValue = property.getDefaultValue(); Boolean required = property.getRequired(); - Boolean unsigned = false; + boolean unsigned = false; Boolean isUuid = property.isUuid; Boolean isEnum = property.isEnum; - if (vendorExtensions.containsKey(CODEGEN_VENDOR_EXTENSION_KEY)) { + if (vendorExtensions.containsKey(VENDOR_EXTENSION_MYSQL_SCHEMA)) { // user already specified schema values LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped"); return; @@ -356,7 +355,6 @@ public void processIntegerTypeProperty(CodegenModel model, CodegenProperty prope description = (description == null || description.isEmpty()) ? commentExtra : description + ". " + commentExtra; } - vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema); // TODO: 5.0 Remove vendorExtensions.put(VENDOR_EXTENSION_MYSQL_SCHEMA, mysqlSchema); mysqlSchema.put("columnDefinition", columnDefinition); columnDefinition.put("colName", colName); @@ -364,7 +362,7 @@ public void processIntegerTypeProperty(CodegenModel model, CodegenProperty prope if (Boolean.TRUE.equals(isEnum)) { Map allowableValues = property.getAllowableValues(); List enumValues = (List) allowableValues.get("values"); - for (Integer i = 0; i < enumValues.size(); i++) { + for (int i = 0; i < enumValues.size(); i++) { if (i > ENUM_MAX_ELEMENTS - 1) { LOGGER.warn("ENUM column can have maximum of " + ENUM_MAX_ELEMENTS.toString() + " distinct elements, following value will be skipped: " + (String) enumValues.get(i)); break; @@ -380,8 +378,8 @@ public void processIntegerTypeProperty(CodegenModel model, CodegenProperty prope } else { Long min = (minimum != null) ? Long.parseLong(minimum) : null; Long max = (maximum != null) ? Long.parseLong(maximum) : null; - if (exclusiveMinimum == true && min != null) min += 1; - if (exclusiveMaximum == true && max != null) max -= 1; + if (exclusiveMinimum && min != null) min += 1; + if (exclusiveMaximum && max != null) max -= 1; if (min != null && min >= 0) { unsigned = true; } @@ -425,14 +423,14 @@ public void processDecimalTypeProperty(CodegenModel model, CodegenProperty prope String description = property.getDescription(); String minimum = property.getMinimum(); String maximum = property.getMaximum(); - Boolean exclusiveMinimum = property.getExclusiveMinimum(); - Boolean exclusiveMaximum = property.getIExclusiveMaximum(); + boolean exclusiveMinimum = property.getExclusiveMinimum(); + boolean exclusiveMaximum = property.getIExclusiveMaximum(); String defaultValue = property.getDefaultValue(); Boolean required = property.getRequired(); - Boolean unsigned = false; + boolean unsigned = false; Boolean isEnum = property.isEnum; - if (vendorExtensions.containsKey(CODEGEN_VENDOR_EXTENSION_KEY)) { + if (vendorExtensions.containsKey(VENDOR_EXTENSION_MYSQL_SCHEMA)) { // user already specified schema values LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped"); return; @@ -444,7 +442,6 @@ public void processDecimalTypeProperty(CodegenModel model, CodegenProperty prope description = (description == null || description.isEmpty()) ? commentExtra : description + ". " + commentExtra; } - vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema); // TODO: 5.0 Remove vendorExtensions.put(VENDOR_EXTENSION_MYSQL_SCHEMA, mysqlSchema); mysqlSchema.put("columnDefinition", columnDefinition); columnDefinition.put("colName", colName); @@ -452,7 +449,7 @@ public void processDecimalTypeProperty(CodegenModel model, CodegenProperty prope if (Boolean.TRUE.equals(isEnum)) { Map allowableValues = property.getAllowableValues(); List enumValues = (List) allowableValues.get("values"); - for (Integer i = 0; i < enumValues.size(); i++) { + for (int i = 0; i < enumValues.size(); i++) { if (i > ENUM_MAX_ELEMENTS - 1) { LOGGER.warn("ENUM column can have maximum of " + ENUM_MAX_ELEMENTS.toString() + " distinct elements, following value will be skipped: " + (String) enumValues.get(i)); break; @@ -465,8 +462,8 @@ public void processDecimalTypeProperty(CodegenModel model, CodegenProperty prope } else { Float min = (minimum != null) ? Float.valueOf(minimum) : null; Float max = (maximum != null) ? Float.valueOf(maximum) : null; - if (exclusiveMinimum == true && min != null) min += 1; - if (exclusiveMaximum == true && max != null) max -= 1; + if (exclusiveMinimum && min != null) min += 1; + if (exclusiveMaximum && max != null) max -= 1; if (min != null && min >= 0) { unsigned = true; } @@ -511,7 +508,7 @@ public void processBooleanTypeProperty(CodegenModel model, CodegenProperty prope String defaultValue = property.getDefaultValue(); Boolean required = property.getRequired(); - if (vendorExtensions.containsKey(CODEGEN_VENDOR_EXTENSION_KEY)) { + if (vendorExtensions.containsKey(VENDOR_EXTENSION_MYSQL_SCHEMA)) { // user already specified schema values LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped"); return; @@ -523,7 +520,6 @@ public void processBooleanTypeProperty(CodegenModel model, CodegenProperty prope description = (description == null || description.isEmpty()) ? commentExtra : description + ". " + commentExtra; } - vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema); // TODO: 5.0 Remove vendorExtensions.put(VENDOR_EXTENSION_MYSQL_SCHEMA, mysqlSchema); mysqlSchema.put("columnDefinition", columnDefinition); columnDefinition.put("colName", colName); @@ -570,7 +566,7 @@ public void processStringTypeProperty(CodegenModel model, CodegenProperty proper Boolean required = property.getRequired(); Boolean isEnum = property.isEnum; - if (vendorExtensions.containsKey(CODEGEN_VENDOR_EXTENSION_KEY)) { + if (vendorExtensions.containsKey(VENDOR_EXTENSION_MYSQL_SCHEMA)) { // user already specified schema values LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped"); return; @@ -582,7 +578,6 @@ public void processStringTypeProperty(CodegenModel model, CodegenProperty proper description = (description == null || description.isEmpty()) ? commentExtra : description + ". " + commentExtra; } - vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema); // TODO: 5.0 Remove vendorExtensions.put(VENDOR_EXTENSION_MYSQL_SCHEMA, mysqlSchema); mysqlSchema.put("columnDefinition", columnDefinition); columnDefinition.put("colName", colName); @@ -592,7 +587,7 @@ public void processStringTypeProperty(CodegenModel model, CodegenProperty proper List enumValues = (List) allowableValues.get("values"); columnDefinition.put("colDataType", "ENUM"); columnDefinition.put("colDataTypeArguments", columnDataTypeArguments); - for (Integer i = 0; i < enumValues.size(); i++) { + for (int i = 0; i < enumValues.size(); i++) { if (i > ENUM_MAX_ELEMENTS - 1) { LOGGER.warn("ENUM column can have maximum of " + ENUM_MAX_ELEMENTS.toString() + " distinct elements, following value will be skipped: " + (String) enumValues.get(i)); break; @@ -645,7 +640,7 @@ public void processDateTypeProperty(CodegenModel model, CodegenProperty property String description = property.getDescription(); String defaultValue = property.getDefaultValue(); - if (vendorExtensions.containsKey(CODEGEN_VENDOR_EXTENSION_KEY)) { + if (vendorExtensions.containsKey(VENDOR_EXTENSION_MYSQL_SCHEMA)) { // user already specified schema values LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped"); return; @@ -657,7 +652,6 @@ public void processDateTypeProperty(CodegenModel model, CodegenProperty property description = (description == null || description.isEmpty()) ? commentExtra : description + ". " + commentExtra; } - vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema); // TODO: 5.0 Remove vendorExtensions.put(VENDOR_EXTENSION_MYSQL_SCHEMA, mysqlSchema); mysqlSchema.put("columnDefinition", columnDefinition); columnDefinition.put("colName", colName); @@ -697,7 +691,7 @@ public void processJsonTypeProperty(CodegenModel model, CodegenProperty property String description = property.getDescription(); String defaultValue = property.getDefaultValue(); - if (vendorExtensions.containsKey(CODEGEN_VENDOR_EXTENSION_KEY)) { + if (vendorExtensions.containsKey(VENDOR_EXTENSION_MYSQL_SCHEMA)) { // user already specified schema values LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped"); return; @@ -709,7 +703,6 @@ public void processJsonTypeProperty(CodegenModel model, CodegenProperty property description = (description == null || description.isEmpty()) ? commentExtra : description + ". " + commentExtra; } - vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema); // TODO: 5.0 Remove vendorExtensions.put(VENDOR_EXTENSION_MYSQL_SCHEMA, mysqlSchema); mysqlSchema.put("columnDefinition", columnDefinition); columnDefinition.put("colName", colName); @@ -752,7 +745,7 @@ public void processUnknownTypeProperty(CodegenModel model, CodegenProperty prope String description = property.getDescription(); String defaultValue = property.getDefaultValue(); - if (vendorExtensions.containsKey(CODEGEN_VENDOR_EXTENSION_KEY)) { + if (vendorExtensions.containsKey(VENDOR_EXTENSION_MYSQL_SCHEMA)) { // user already specified schema values LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped"); return; @@ -764,7 +757,6 @@ public void processUnknownTypeProperty(CodegenModel model, CodegenProperty prope description = (description == null || description.isEmpty()) ? commentExtra : description + ". " + commentExtra; } - vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema); // TODO: 5.0 Remove vendorExtensions.put(VENDOR_EXTENSION_MYSQL_SCHEMA, mysqlSchema); mysqlSchema.put("columnDefinition", columnDefinition); columnDefinition.put("colName", colName); @@ -903,10 +895,10 @@ public HashMap toCodegenMysqlDataTypeDefault(String defaultValue public String getMysqlMatchedIntegerDataType(Long minimum, Long maximum, Boolean unsigned) { // we can choose fit mysql data type // ref: https://dev.mysql.com/doc/refman/8.0/en/integer-types.html - Long min = (minimum != null) ? minimum : -2147483648L; - Long max = (maximum != null) ? maximum : 2147483647L; - Long actualMin = Math.min(min, max); // sometimes min and max values can be mixed up - Long actualMax = Math.max(min, max); // sometimes only minimum specified and it can be pretty high + long min = (minimum != null) ? minimum : -2147483648L; + long max = (maximum != null) ? maximum : 2147483647L; + long actualMin = Math.min(min, max); // sometimes min and max values can be mixed up + long actualMax = Math.max(min, max); // sometimes only minimum specified and it can be pretty high if (minimum != null && maximum != null && minimum > maximum) { LOGGER.warn("Codegen property 'minimum' cannot be greater than 'maximum'"); } @@ -949,8 +941,8 @@ public String getMysqlMatchedIntegerDataType(Long minimum, Long maximum, Boolean public String getMysqlMatchedStringDataType(Integer minLength, Integer maxLength) { // we can choose fit mysql data type // ref: https://dev.mysql.com/doc/refman/8.0/en/string-type-overview.html - Integer min = (minLength != null && minLength >= 0) ? minLength : 0; - Integer max = (maxLength != null && maxLength >= 0) ? maxLength : 65535; + int min = (minLength != null && minLength >= 0) ? minLength : 0; + int max = (maxLength != null && maxLength >= 0) ? maxLength : 65535; Integer actualMin = Math.min(min, max); // sometimes minLength and maxLength values can be mixed up Integer actualMax = Math.max(min, max); // sometimes only minLength specified and it can be pretty high if (minLength != null && maxLength != null && minLength > maxLength) { @@ -1140,7 +1132,7 @@ public String escapeUnsafeCharacters(String input) { */ public void setDefaultDatabaseName(String databaseName) { String escapedName = toDatabaseName(databaseName); - if (escapedName.equals(databaseName) == false) { + if (!escapedName.equals(databaseName)) { LOGGER.error("Invalid database name. '" + databaseName + "' cannot be used as MySQL identifier. Escaped value '" + escapedName + "' will be used instead."); } this.defaultDatabaseName = escapedName; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OCamlClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OCamlClientCodegen.java index 4d6d038c73be..f75ff87698f2 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OCamlClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OCamlClientCodegen.java @@ -45,7 +45,7 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig public static final String PACKAGE_NAME = "packageName"; public static final String PACKAGE_VERSION = "packageVersion"; - static final String X_MODEL_MODULE = "x-modelModule"; + static final String X_MODEL_MODULE = "x-model-module"; public static final String CO_HTTP = "cohttp"; @@ -715,9 +715,6 @@ public Map postProcessOperationsWithModels(Map o @SuppressWarnings("unchecked") List operations = (List) objectMap.get("operation"); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - for (CodegenOperation operation : operations) { // http method verb conversion, depending on client library (e.g. Hyper: PUT => Put, Reqwest: PUT => put) //if (CO_HTTP.equals(getLibrary())) { @@ -728,7 +725,6 @@ public Map postProcessOperationsWithModels(Map o } if ("Yojson.Safe.t".equals(operation.returnBaseType)) { - operation.vendorExtensions.put("x-returnFreeFormObject", true); // TODO: 5.0 Remove operation.vendorExtensions.put("x-return-free-form-object", true); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ObjcClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ObjcClientCodegen.java index abeeeffa2697..b8dd22f8d577 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ObjcClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ObjcClientCodegen.java @@ -654,15 +654,11 @@ public void setLicense(String license) { public Map postProcessOperationsWithModels(Map objs, List allModels) { Map operations = (Map) objs.get("operations"); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - if (operations != null) { List ops = (List) operations.get("operation"); for (CodegenOperation operation : ops) { if (!operation.allParams.isEmpty()) { String firstParamName = operation.allParams.get(0).paramName; - operation.vendorExtensions.put("firstParamAltName", camelize(firstParamName)); // TODO: 5.0 Remove operation.vendorExtensions.put("x-first-param-alt-name", camelize(firstParamName)); } } @@ -673,11 +669,6 @@ public Map postProcessOperationsWithModels(Map o @Override public void postProcessModelProperty(CodegenModel model, CodegenProperty schema) { super.postProcessModelProperty(model, schema); - - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - - schema.vendorExtensions.put("x-uppercaseName", camelize(schema.name)); // TODO: 5.0 Remove schema.vendorExtensions.put("x-uppercase-name", camelize(schema.name)); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java index 14de1216d4c0..30c41f7f2910 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java @@ -390,9 +390,6 @@ public void processOpts() { public Map postProcessOperationsWithModels(Map objs, List allModels) { objs = super.postProcessOperationsWithModels(objs, allModels); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - Map operations = (Map) objs.get("operations"); operations.put("controllerName", toControllerName((String) operations.get("pathPrefix"))); operations.put("symfonyService", toSymfonyService((String) operations.get("pathPrefix"))); @@ -408,20 +405,16 @@ public Map postProcessOperationsWithModels(Map o // to the templating engine String typeHint = getTypeHint(param.dataType); if (!typeHint.isEmpty()) { - param.vendorExtensions.put("x-parameterType", typeHint); // TODO: 5.0 Remove param.vendorExtensions.put("x-parameter-type", typeHint); } if (param.isContainer) { - param.vendorExtensions.put("x-parameterType", getTypeHint(param.dataType + "[]")); // TODO: 5.0 Remove param.vendorExtensions.put("x-parameter-type", getTypeHint(param.dataType + "[]")); } // Create a variable to display the correct data type in comments for interfaces - param.vendorExtensions.put("x-commentType", param.dataType); // TODO: 5.0 Remove param.vendorExtensions.put("x-comment-type", param.dataType); if (param.isContainer) { - param.vendorExtensions.put("x-commentType", param.dataType + "[]"); // TODO: 5.0 Remove param.vendorExtensions.put("x-comment-type", param.dataType + "[]"); } @@ -436,14 +429,11 @@ public Map postProcessOperationsWithModels(Map o // Create a variable to display the correct return type in comments for interfaces if (op.returnType != null) { - op.vendorExtensions.put("x-commentType", op.returnType); // TODO: 5.0 Remove op.vendorExtensions.put("x-comment-type", op.returnType); if (op.returnContainer != null && op.returnContainer.equals("array")) { - op.vendorExtensions.put("x-commentType", op.returnType + "[]"); // TODO: 5.0 Remove op.vendorExtensions.put("x-comment-type", op.returnType + "[]"); } } else { - op.vendorExtensions.put("x-commentType", "void"); // TODO: 5.0 Remove op.vendorExtensions.put("x-comment-type", "void"); } @@ -466,9 +456,6 @@ public Map postProcessOperationsWithModels(Map o public Map postProcessModels(Map objs) { objs = super.postProcessModels(objs); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - ArrayList modelsArray = (ArrayList) objs.get("models"); Map models = (Map) modelsArray.get(0); CodegenModel model = (CodegenModel) models.get("model"); @@ -480,20 +467,16 @@ public Map postProcessModels(Map objs) { // to the templating engine String typeHint = getTypeHint(var.dataType); if (!typeHint.isEmpty()) { - var.vendorExtensions.put("x-parameterType", typeHint); // TODO: 5.0 Remove var.vendorExtensions.put("x-parameter-type", typeHint); } if (var.isContainer) { - var.vendorExtensions.put("x-parameterType", getTypeHint(var.dataType + "[]")); // TODO: 5.0 Remove var.vendorExtensions.put("x-parameter-type", getTypeHint(var.dataType + "[]")); } // Create a variable to display the correct data type in comments for models - var.vendorExtensions.put("x-commentType", var.dataType); // TODO: 5.0 Remove var.vendorExtensions.put("x-comment-type", var.dataType); if (var.isContainer) { - var.vendorExtensions.put("x-commentType", var.dataType + "[]"); // TODO: 5.0 Remove var.vendorExtensions.put("x-comment-type", var.dataType + "[]"); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpZendExpressivePathHandlerServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpZendExpressivePathHandlerServerCodegen.java index 39732835cf91..ee2099b6af89 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpZendExpressivePathHandlerServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpZendExpressivePathHandlerServerCodegen.java @@ -36,6 +36,7 @@ public class PhpZendExpressivePathHandlerServerCodegen extends AbstractPhpCodegen { private static final Logger LOGGER = LoggerFactory.getLogger(PhpZendExpressivePathHandlerServerCodegen.class); + // TODO: Rename to x- prefixed vendor extensions, per specification. public static final String VEN_FROM_QUERY = "internal.ze-ph.fromQuery"; public static final String VEN_COLLECTION_FORMAT = "internal.ze-ph.collectionFormat"; public static final String VEN_QUERY_DATA_TYPE = "internal.ze-ph.queryDataType"; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java index 5b7138c0686c..384960012385 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientExperimentalCodegen.java @@ -97,6 +97,9 @@ public PythonClientExperimentalCodegen() { apiDocTemplateFiles.remove("api_doc.mustache"); apiDocTemplateFiles.put("python-experimental/api_doc.mustache", ".md"); + apiTestTemplateFiles.remove("api_test.mustache", ".py"); + apiTestTemplateFiles.put("python-experimental/api_test.mustache", ".py"); + modelDocTemplateFiles.remove("model_doc.mustache"); modelDocTemplateFiles.put("python-experimental/model_doc.mustache", ".md"); @@ -123,6 +126,7 @@ public void processOpts() { this.setLegacyDiscriminatorBehavior(false); super.processOpts(); + modelPackage = packageName + "." + "model"; supportingFiles.remove(new SupportingFile("api_client.mustache", packagePath(), "api_client.py")); supportingFiles.add(new SupportingFile("python-experimental/api_client.mustache", packagePath(), "api_client.py")); @@ -130,11 +134,14 @@ public void processOpts() { supportingFiles.add(new SupportingFile("python-experimental/model_utils.mustache", packagePath(), "model_utils.py")); supportingFiles.remove(new SupportingFile("__init__model.mustache", packagePath() + File.separatorChar + "models", "__init__.py")); - supportingFiles.add(new SupportingFile("python-experimental/__init__model.mustache", packagePath() + File.separatorChar + "models", "__init__.py")); + supportingFiles.add(new SupportingFile("python-experimental/__init__model.mustache", packagePath() + File.separatorChar + "model", "__init__.py")); supportingFiles.remove(new SupportingFile("__init__package.mustache", packagePath(), "__init__.py")); supportingFiles.add(new SupportingFile("python-experimental/__init__package.mustache", packagePath(), "__init__.py")); + // add the models and apis folders + supportingFiles.add(new SupportingFile("python-experimental/__init__models.mustache", packagePath() + File.separatorChar + "models", "__init__.py")); + supportingFiles.add(new SupportingFile("python-experimental/__init__apis.mustache", packagePath() + File.separatorChar + "apis", "__init__.py")); // Generate the 'signing.py' module, but only if the 'HTTP signature' security scheme is specified in the OAS. Map securitySchemeMap = openAPI != null ? @@ -518,9 +525,9 @@ public CodegenParameter fromRequestBody(RequestBody body, Set imports, S // set the example value if (modelProp.isEnum) { String value = modelProp._enum.get(0).toString(); - result.example = this.packageName + "." + result.baseType + "(" + toEnumValue(value, simpleDataType) + ")"; + result.example = result.dataType + "(" + toEnumValue(value, simpleDataType) + ")"; } else { - result.example = this.packageName + "." + result.baseType + "(" + result.example + ")"; + result.example = result.dataType + "(" + result.example + ")"; } } else if (!result.isPrimitiveType) { // fix the baseType for the api docs so the .md link to the class's documentation file is correct @@ -1064,7 +1071,7 @@ public void setParameterExampleValue(CodegenParameter p) { example = "'" + escapeText(example) + "'"; } else if (!languageSpecificPrimitives.contains(type)) { // type is a model class, e.g. user.User - example = this.packageName + "." + getPythonClassName(type) + "()"; + example = type + "()"; } else { LOGGER.warn("Type " + type + " not handled properly in setParameterExampleValue"); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java index 31d4610f86ca..bd6e45bd223f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java @@ -198,9 +198,6 @@ public Map postProcessAllModels(Map objs) { // Index all CodegenModels by model name. Map allModels = new HashMap<>(); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - for (Map.Entry entry : objs.entrySet()) { String modelName = toModelName(entry.getKey()); Map inner = (Map) entry.getValue(); @@ -229,9 +226,7 @@ public Map postProcessAllModels(Map objs) { } // TODO: figure out how to properly have the original property type that didn't go through toVarName String vendorExtensionTagName = cm.discriminator.getPropertyName().replace("_", ""); - cm.vendorExtensions.put("tagName", vendorExtensionTagName); // TODO: 5.0 Remove cm.vendorExtensions.put("x-tag-name", vendorExtensionTagName); - cm.vendorExtensions.put("mappedModels", discriminatorVars); // TODO: 5.0 Remove cm.vendorExtensions.put("x-mapped-models", discriminatorVars); } } 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 80fd3dd58e24..e7de4e326498 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 @@ -609,9 +609,6 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation Map definitions = ModelUtils.getSchemas(this.openAPI); CodegenOperation op = super.fromOperation(path, httpMethod, operation, servers); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - String pathFormatString = op.path; for (CodegenParameter param : op.pathParams) { // Replace {baseName} with {paramName} for format string @@ -705,7 +702,7 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation hasPathParams = true; } - op.vendorExtensions.put("callbackParams", params); + op.vendorExtensions.put("x-callback-params", params); } // Save off the regular expression and path details in the relevant @@ -735,28 +732,20 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation } String underscoredOperationId = underscore(op.operationId); - op.vendorExtensions.put("operation_id", underscoredOperationId); // TODO: 5.0 Remove op.vendorExtensions.put("x-operation-id", underscoredOperationId); - op.vendorExtensions.put("uppercase_operation_id", underscoredOperationId.toUpperCase(Locale.ROOT)); // TODO: 5.0 Remove op.vendorExtensions.put("x-uppercase-operation-id", underscoredOperationId.toUpperCase(Locale.ROOT)); String vendorExtensionPath = op.path.replace("{", ":").replace("}", ""); - op.vendorExtensions.put("path", vendorExtensionPath); // TODO: 5.0 Remove op.vendorExtensions.put("x-path",vendorExtensionPath); - op.vendorExtensions.put("PATH_ID", pathId); // TODO: 5.0 Remove op.vendorExtensions.put("x-path-id", pathId); - op.vendorExtensions.put("hasPathParams", !op.pathParams.isEmpty()); // TODO: 5.0 Remove - op.vendorExtensions.put("x-has-path-params", !op.pathParams.isEmpty()); - op.vendorExtensions.put("hasPathParams", hasPathParams); // TODO: 5.0 Remove + op.vendorExtensions.put("x-has-path-params", hasPathParams); op.vendorExtensions.put("x-path-format-string", formatPath); String vendorExtensionHttpMethod = op.httpMethod.toUpperCase(Locale.ROOT); - op.vendorExtensions.put("HttpMethod", vendorExtensionHttpMethod); // TODO: 5.0 Remove op.vendorExtensions.put("x-http-method", vendorExtensionHttpMethod); - // TODO: 5.0 Fix formatting - if (!op.vendorExtensions.containsKey("x-mustUseResponse")) { + if (!op.vendorExtensions.containsKey("x-must-use-response")) { // If there's more than one response, than by default the user must explicitly handle them - op.vendorExtensions.put("x-mustUseResponse", op.responses.size() > 1); + op.vendorExtensions.put("x-must-use-response", op.responses.size() > 1); } for (CodegenParameter param : op.allParams) { @@ -800,7 +789,6 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation processParam(param, op); // Give header params a name in camel case. CodegenParameters don't have a nameInCamelCase property. - param.vendorExtensions.put("typeName", toModelName(param.baseName)); // TODO: 5.0 Remove param.vendorExtensions.put("x-type-name", toModelName(param.baseName)); } @@ -822,9 +810,9 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation // Create a unique responseID for this response. String responseId; - if (rsp.vendorExtensions.containsKey("x-responseId")) { + if (rsp.vendorExtensions.containsKey("x-response-id")) { // If it's been specified directly, use that. - responseId = (String) rsp.vendorExtensions.get("x-responseId"); + responseId = (String) rsp.vendorExtensions.get("x-response-id"); } else if ((words.length != 0) && (words[0].trim().length() != 0)) { // If there's a description, build it from the description. responseId = camelize(words[0].replace(" ", "_")); @@ -850,15 +838,11 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation responseIds.add(responseId); String underscoredResponseId = underscore(responseId).toUpperCase(Locale.ROOT); - rsp.vendorExtensions.put("x-responseId", responseId); // TODO: 5.0 Remove rsp.vendorExtensions.put("x-response-id", responseId); - rsp.vendorExtensions.put("x-uppercaseResponseId", underscoredResponseId.toUpperCase(Locale.ROOT)); // TODO: 5.0 Remove rsp.vendorExtensions.put("x-uppercase-response-id", underscoredResponseId.toUpperCase(Locale.ROOT)); - rsp.vendorExtensions.put("uppercase_operation_id", underscoredOperationId.toUpperCase(Locale.ROOT)); // TODO: 5.0 Remove rsp.vendorExtensions.put("x-uppercase-operation-id", underscoredOperationId.toUpperCase(Locale.ROOT)); if (rsp.dataType != null) { String uppercaseDataType = (rsp.dataType.replace("models::", "")).toUpperCase(Locale.ROOT); - rsp.vendorExtensions.put("uppercase_data_type", uppercaseDataType); // TODO: 5.0 Remove rsp.vendorExtensions.put("x-uppercase-data-type", uppercaseDataType); // Get the mimetype which is produced by this response. Note @@ -908,13 +892,11 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation outputMime = firstProduces; } - rsp.vendorExtensions.put("mimeType", outputMime); // TODO: 5.0 Remove rsp.vendorExtensions.put("x-mime-type", outputMime); // Write out the type of data we actually expect this response // to make. if (producesXml) { - rsp.vendorExtensions.put("producesXml", true); // TODO: 5.0 Remove rsp.vendorExtensions.put("x-produces-xml", true); } else if (producesPlainText) { // Plain text means that there is not structured data in @@ -926,14 +908,11 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation // base64 encoding should be done. They both look like // 'producesBytes'. if (rsp.dataType.equals(bytesType)) { - rsp.vendorExtensions.put("producesBytes", true); // TODO: 5.0 Remove rsp.vendorExtensions.put("x-produces-bytes", true); } else { - rsp.vendorExtensions.put("producesPlainText", true); // TODO: 5.0 Remove rsp.vendorExtensions.put("x-produces-plain-text", true); } } else { - rsp.vendorExtensions.put("producesJson", true); // TODO: 5.0 Remove rsp.vendorExtensions.put("x-produces-json", true); // If the data type is just "object", then ensure that the // Rust data type is "serde_json::Value". This allows us @@ -950,7 +929,6 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation if ((model != null)) { XML xml = model.getXml(); if ((xml != null) && (xml.getNamespace() != null)) { - rsp.vendorExtensions.put("has_namespace", "true"); // TODO: 5.0 Remove rsp.vendorExtensions.put("x-has-namespace", "true"); } } @@ -996,9 +974,6 @@ private void postProcessOperationWithModels(CodegenOperation op, List al boolean consumesPlainText = false; boolean consumesXml = false; - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - if (op.consumes != null) { for (Map consume : op.consumes) { if (consume.get("mediaType") != null) { @@ -1012,12 +987,11 @@ private void postProcessOperationWithModels(CodegenOperation op, List al } else if (isMimetypeWwwFormUrlEncoded(mediaType)) { additionalProperties.put("usesUrlEncodedForm", true); } else if (isMimetypeMultipartFormData(mediaType)) { - op.vendorExtensions.put("consumesMultipart", true); // TODO Remove: 5.0 Remove op.vendorExtensions.put("x-consumes-multipart", true); additionalProperties.put("apiUsesMultipartFormData", true); additionalProperties.put("apiUsesMultipart", true); } else if (isMimetypeMultipartRelated(mediaType)) { - op.vendorExtensions.put("consumesMultipartRelated", true); + op.vendorExtensions.put("x-consumes-multipart-related", true); additionalProperties.put("apiUsesMultipartRelated", true); additionalProperties.put("apiUsesMultipart", true); } @@ -1028,16 +1002,12 @@ private void postProcessOperationWithModels(CodegenOperation op, List al String underscoredOperationId = underscore(op.operationId).toUpperCase(Locale.ROOT); if (op.bodyParam != null) { // Default to consuming json - op.bodyParam.vendorExtensions.put("uppercase_operation_id", underscoredOperationId); // TODO: 5.0 Remove op.bodyParam.vendorExtensions.put("x-uppercase-operation-id", underscoredOperationId); if (consumesXml) { - op.bodyParam.vendorExtensions.put("consumesXml", true); // TODO: 5.0 Remove op.bodyParam.vendorExtensions.put("x-consumes-xml", true); } else if (consumesPlainText) { - op.bodyParam.vendorExtensions.put("consumesPlainText", true); // TODO: 5.0 Remove op.bodyParam.vendorExtensions.put("x-consumes-plain-text", true); } else { - op.bodyParam.vendorExtensions.put("consumesJson", true); // TODO: 5.0 Remove op.bodyParam.vendorExtensions.put("x-consumes-json", true); } } @@ -1045,18 +1015,14 @@ private void postProcessOperationWithModels(CodegenOperation op, List al for (CodegenParameter param : op.bodyParams) { processParam(param, op); - param.vendorExtensions.put("uppercase_operation_id", underscoredOperationId); // TODO: 5.0 Remove param.vendorExtensions.put("x-uppercase-operation-id", underscoredOperationId); // Default to producing json if nothing else is specified if (consumesXml) { - param.vendorExtensions.put("consumesXml", true); // TODO: 5.0 Remove param.vendorExtensions.put("x-consumes-xml", true); } else if (consumesPlainText) { - param.vendorExtensions.put("consumesPlainText", true); // TODO: 5.0 Remove param.vendorExtensions.put("x-consumes-plain-text", true); } else { - param.vendorExtensions.put("consumesJson", true); // TODO: 5.0 Remove param.vendorExtensions.put("x-consumes-json", true); } } @@ -1082,7 +1048,6 @@ private void postProcessOperationWithModels(CodegenOperation op, List al for (CodegenSecurity s : op.authMethods) { if (s.isApiKey && s.isKeyInHeader) { - s.vendorExtensions.put("x-apiKeyName", toModelName(s.keyParamName)); // TODO: 5.0 Remove s.vendorExtensions.put("x-api-key-name", toModelName(s.keyParamName)); headerAuthMethods = true; } @@ -1093,7 +1058,6 @@ private void postProcessOperationWithModels(CodegenOperation op, List al } if (headerAuthMethods) { - op.vendorExtensions.put("hasHeaderAuthMethods", "true"); // TODO: 5.0 Remove op.vendorExtensions.put("x-has-header-auth-methods", "true"); } } @@ -1220,13 +1184,8 @@ public String toInstantiationType(Schema p) { @Override public CodegenModel fromModel(String name, Schema model) { - - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - Map allDefinitions = ModelUtils.getSchemas(this.openAPI); CodegenModel mdl = super.fromModel(name, model); - mdl.vendorExtensions.put("upperCaseName", name.toUpperCase(Locale.ROOT)); // TODO: 5.0 Remove mdl.vendorExtensions.put("x-upper-case-name", name.toUpperCase(Locale.ROOT)); if (!StringUtils.isEmpty(model.get$ref())) { Schema schema = allDefinitions.get(ModelUtils.getSimpleRef(model.get$ref())); @@ -1258,7 +1217,6 @@ public CodegenModel fromModel(String name, Schema model) { // If this model's items require wrapping in xml, squirrel away the // xml name so we can insert it into the relevant model fields. if (xmlName != null) { - mdl.vendorExtensions.put("itemXmlName", xmlName); // TODO: 5.0 Remove mdl.vendorExtensions.put("x-item-xml-name", xmlName); modelXmlNames.put("models::" + mdl.classname, xmlName); } @@ -1287,9 +1245,6 @@ public CodegenModel fromModel(String name, Schema model) { public Map postProcessAllModels(Map objs) { Map newObjs = super.postProcessAllModels(objs); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - //Index all CodegenModels by model name. HashMap allModels = new HashMap(); for (Entry entry : objs.entrySet()) { @@ -1317,7 +1272,6 @@ public Map postProcessAllModels(Map objs) { String xmlName = modelXmlNames.get(prop.dataType); if (xmlName != null) { - prop.vendorExtensions.put("itemXmlName", xmlName); // TODO: 5.0 Remove prop.vendorExtensions.put("x-item-xml-name", xmlName); } @@ -1564,9 +1518,6 @@ private String matchingIntType(boolean unsigned, Long inclusiveMin, Long inclusi public Map postProcessModels(Map objs) { List models = (List) objs.get("models"); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - for (Object _mo : models) { Map mo = (Map) _mo; CodegenModel cm = (CodegenModel) mo.get("model"); @@ -1608,7 +1559,6 @@ public Map postProcessModels(Map objs) { } } - cm.vendorExtensions.put("isString", "String".equals(cm.dataType)); // TODO: 5.0 Remove cm.vendorExtensions.put("x-is-string", "String".equals(cm.dataType)); } return super.postProcessModelsEnum(objs); @@ -1618,38 +1568,30 @@ private void processParam(CodegenParameter param, CodegenOperation op) { String example = null; - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - // If a parameter uses UUIDs, we need to import the UUID package. if (uuidType.equals(param.dataType)) { additionalProperties.put("apiUsesUuid", true); } if (Boolean.TRUE.equals(param.isFreeFormObject)) { - param.vendorExtensions.put("formatString", "{:?}"); + param.vendorExtensions.put("x-format-string", "{:?}"); example = null; } else if (param.isString) { - param.vendorExtensions.put("formatString", "\\\"{}\\\""); // TODO: 5.0 Remove - param.vendorExtensions.put("x-format-string", "\\\"{}\\\""); // TODO: 5.0 Remove + param.vendorExtensions.put("x-format-string", "\\\"{}\\\""); example = "\"" + ((param.example != null) ? param.example : "") + "\".to_string()"; } else if (param.isPrimitiveType) { if ((param.isByteArray) || (param.isBinary)) { // Binary primitive types don't implement `Display`. - param.vendorExtensions.put("formatString", "{:?}"); // TODO: 5.0 Remove param.vendorExtensions.put("x-format-string", "{:?}"); example = "swagger::ByteArray(Vec::from(\"" + ((param.example != null) ? param.example : "") + "\"))"; } else { - param.vendorExtensions.put("formatString", "{}"); // TODO: 5.0 Remove param.vendorExtensions.put("x-format-string", "{}"); example = (param.example != null) ? param.example : ""; } } else if (param.isListContainer) { - param.vendorExtensions.put("formatString", "{:?}"); // TODO: 5.0 Remove param.vendorExtensions.put("x-format-string", "{:?}"); example = (param.example != null) ? param.example : "&Vec::new()"; } else { - param.vendorExtensions.put("formatString", "{:?}"); // TODO: 5.0 Remove param.vendorExtensions.put("x-format-string", "{:?}"); if (param.example != null) { example = "serde_json::from_str::<" + param.dataType + ">(r#\"" + param.example + "\"#).expect(\"Failed to parse JSON example\")"; @@ -1658,30 +1600,22 @@ private void processParam(CodegenParameter param, CodegenOperation op) { if (param.required) { if (example != null) { - param.vendorExtensions.put("example", example); // TODO: 5.0 Remove param.vendorExtensions.put("x-example", example); } else if (param.isListContainer) { // Use the empty list if we don't have an example - param.vendorExtensions.put("example", "&Vec::new()"); // TODO: 5.0 Remove param.vendorExtensions.put("x-example", "&Vec::new()"); } else { // If we don't have an example that we can provide, we need to disable the client example, as it won't build. - param.vendorExtensions.put("example", "???"); // TODO: 5.0 Remove param.vendorExtensions.put("x-example", "???"); - op.vendorExtensions.put("noClientExample", Boolean.TRUE); // TODO: 5.0 Remove op.vendorExtensions.put("x-no-client-example", Boolean.TRUE); } } else if ((param.dataFormat != null) && ((param.dataFormat.equals("date-time")) || (param.dataFormat.equals("date")))) { - param.vendorExtensions.put("formatString", "{:?}"); // TODO: 5.0 Remove param.vendorExtensions.put("x-format-string", "{:?}"); - param.vendorExtensions.put("example", "None"); // TODO: 5.0 Remove param.vendorExtensions.put("x-example", "None"); } else { // Not required, so override the format string and example - param.vendorExtensions.put("formatString", "{:?}"); // TODO: 5.0 Remove param.vendorExtensions.put("x-format-string", "{:?}"); String exampleString = (example != null) ? "Some(" + example + ")" : "None"; - param.vendorExtensions.put("example", exampleString); // TODO: 5.0 Remove param.vendorExtensions.put("x-example", exampleString); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaFinchServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaFinchServerCodegen.java index 50e4ffc684e7..70a3258b4ccd 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaFinchServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaFinchServerCodegen.java @@ -240,9 +240,9 @@ public Map postProcessOperationsWithModels(Map o // Converts GET /foo/bar => get("foo" :: "bar") generateScalaPath(op); - // Generates e.g. uuid :: header("boo") :: params("baa") under key "x-codegen-pathParams" - // Generates e.g. (id: UUID, headerBoo: String, paramBaa: String) under key "x-codegen-typedInputParams" - // Generates e.g. (id, headerBoo, paramBaa) under key "x-codegen-inputParams" + // Generates e.g. uuid :: header("boo") :: params("baa") under key "x-codegen-path-params" + // Generates e.g. (id: UUID, headerBoo: String, paramBaa: String) under key "x-codegen-typed-input-params" + // Generates e.g. (id, headerBoo, paramBaa) under key "x-codegen-input-params" generateInputParameters(op); //Generate Auth parameters using security: definition @@ -346,9 +346,6 @@ private void authParameters(CodegenOperation op) { String authInputParams = ""; String typedAuthInputParams = ""; - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - //Append apikey security to path params and create input parameters for functions if (op.authMethods != null) { @@ -365,10 +362,6 @@ private void authParameters(CodegenOperation op) { } } - op.vendorExtensions.put("x-codegen-authParams", authParams); // TODO: 5.0 Remove - op.vendorExtensions.put("x-codegen-authInputParams", authInputParams); // TODO: 5.0 Remove - op.vendorExtensions.put("x-codegen-typedAuthInputParams", typedAuthInputParams); // TODO: 5.0 Remove - op.vendorExtensions.put("x-codegen-auth-params", authParams); op.vendorExtensions.put("x-codegen-auth-input-params", authInputParams); op.vendorExtensions.put("x-codegen-typed-auth-input-params", typedAuthInputParams); @@ -414,18 +407,13 @@ private void generateScalaPath(CodegenOperation op) { private void concatParameters(CodegenOperation op) { - - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - - String path = colConcat(colConcat(op.vendorExtensions.get("x-codegen-path").toString(), op.vendorExtensions.get("x-codegen-pathParams").toString()), op.vendorExtensions.get("x-codegen-authParams").toString()); - String parameters = csvConcat(op.vendorExtensions.get("x-codegen-inputParams").toString(), op.vendorExtensions.get("x-codegen-authInputParams").toString()); - String typedParameters = csvConcat(op.vendorExtensions.get("x-codegen-typedInputParams").toString(), op.vendorExtensions.get("x-codegen-typedAuthInputParams").toString()); + String path = colConcat(colConcat(op.vendorExtensions.get("x-codegen-path").toString(), op.vendorExtensions.get("x-codegen-path-params").toString()), op.vendorExtensions.get("x-codegen-auth-params").toString()); + String parameters = csvConcat(op.vendorExtensions.get("x-codegen-input-params").toString(), op.vendorExtensions.get("x-codegen-auth-input-params").toString()); + String typedParameters = csvConcat(op.vendorExtensions.get("x-codegen-typed-input-params").toString(), op.vendorExtensions.get("x-codegen-typed-auth-input-params").toString()); // The input parameters for functions op.vendorExtensions.put("x-codegen-paths", path); op.vendorExtensions.put("x-codegen-params", parameters); - op.vendorExtensions.put("x-codegen-typedParams", typedParameters); // TODO: 5.0 Remove op.vendorExtensions.put("x-codegen-typed-params", typedParameters); } @@ -433,9 +421,6 @@ private void concatParameters(CodegenOperation op) { private void generateInputParameters(CodegenOperation op) { - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - String inputParams = ""; String typedInputParams = ""; String pathParams = ""; @@ -482,13 +467,10 @@ private void generateInputParameters(CodegenOperation op) { } // All body, path, query and header parameters - op.vendorExtensions.put("x-codegen-pathParams", pathParams); // TODO: 5.0 Remove op.vendorExtensions.put("x-codegen-path-params", pathParams); // The input parameters for functions - op.vendorExtensions.put("x-codegen-inputParams", inputParams); // TODO: 5.0 Remove op.vendorExtensions.put("x-codegen-input-params", inputParams); - op.vendorExtensions.put("x-codegen-typedInputParams", typedInputParams); // TODO: 5.0 Remove op.vendorExtensions.put("x-codegen-typed-input-params", typedInputParams); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaPlayFrameworkServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaPlayFrameworkServerCodegen.java index 18ad995d1f59..59037d183dfb 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaPlayFrameworkServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaPlayFrameworkServerCodegen.java @@ -258,9 +258,6 @@ public Map postProcessAllModels(Map objs) { objs = super.postProcessAllModels(objs); Map modelsByClassName = new HashMap<>(); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - for (Object _outer : objs.values()) { Map outer = (Map) _outer; List> models = (List>) outer.get("models"); @@ -271,7 +268,6 @@ public Map postProcessAllModels(Map objs) { cm.classVarName = camelize(cm.classVarName, true); modelsByClassName.put(cm.classname, cm); boolean hasFiles = cm.vars.stream().anyMatch(var -> var.isFile); - cm.vendorExtensions.put("hasFiles", hasFiles); // TODO: 5.0 Remove cm.vendorExtensions.put("x-has-files", hasFiles); } } @@ -289,9 +285,6 @@ public Map postProcessSupportingFileData(Map obj objs = super.postProcessSupportingFileData(objs); generateJSONSpecFile(objs); - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - // Prettify routes file Map apiInfo = (Map) objs.get("apiInfo"); List> apis = (List>) apiInfo.get("apis"); @@ -304,11 +297,9 @@ public Map postProcessSupportingFileData(Map obj .reduce(0, Integer::max); ops.forEach(op -> { String paddedPath = rightPad(op.path, maxPathLength - op.httpMethod.length()); - op.vendorExtensions.put("paddedPath", paddedPath); // TODO: 5.0 Remove op.vendorExtensions.put("x-padded-path", paddedPath); }); ops.forEach(op -> { - op.vendorExtensions.put("hasPathParams", op.getHasPathParams()); // TODO: 5.0 Remove op.vendorExtensions.put("x-has-path-params", op.getHasPathParams()); }); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtml2Generator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtml2Generator.java index a0aaec724861..055b29417dac 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtml2Generator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtml2Generator.java @@ -202,10 +202,6 @@ public void preprocessOpenAPI(OpenAPI openAPI) { @Override public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, List servers) { CodegenOperation op = super.fromOperation(path, httpMethod, operation, servers); - - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - if (op.returnType != null) { op.returnType = normalizeType(op.returnType); } @@ -214,7 +210,6 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation op.path = sanitizePath(op.path); String methodUpperCase = httpMethod.toUpperCase(Locale.ROOT); - op.vendorExtensions.put("x-codegen-httpMethodUpperCase", methodUpperCase); // TODO: 5.0 Remove op.vendorExtensions.put("x-codegen-http-method-upper-case", methodUpperCase); return op; @@ -248,9 +243,6 @@ private void preparHtmlForGlobalDescription(OpenAPI openAPI) { public List postProcessParameterEnum(List parameterList) { String enumFormatted = ""; - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - for (CodegenParameter parameter : parameterList) { if (parameter.isEnum) { for (int i = 0; i < parameter._enum.size(); i++) { @@ -262,7 +254,6 @@ public List postProcessParameterEnum(List pa Markdown markInstance = new Markdown(); if (!enumFormatted.isEmpty()) { String formattedExtension = markInstance.toHtml(enumFormatted); - parameter.vendorExtensions.put("x-eumFormatted", formattedExtension); // TODO: 5.0 Remove parameter.vendorExtensions.put("x-eum-formatted", formattedExtension); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptRxjsClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptRxjsClientCodegen.java index ec5ddb557fde..7a740ab76e00 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptRxjsClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptRxjsClientCodegen.java @@ -249,11 +249,7 @@ private void updateOperationParameterEnumInformation(Map operati private void setParamNameAlternative(CodegenParameter param, String paramName, String paramNameAlternative) { - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - if (param.paramName.equals(paramName)) { - param.vendorExtensions.put("paramNameAlternative", paramNameAlternative); // TODO: 5.0 Remove param.vendorExtensions.put("x-param-name-alternative", paramNameAlternative); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalData.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalData.java index 3ba31200598c..c0dc9e685063 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalData.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalData.java @@ -103,18 +103,13 @@ public void addFromInterfaceModel(CodegenModel cm, List> mod * @param implImports imports of the implementing model * @param addInterfaceImports whether or not to add the interface model as import (will vary by language) */ + @SuppressWarnings("unchecked") public void addToImplementor(CodegenConfig cc, CodegenModel implcm, List> implImports, boolean addInterfaceImports) { - - // TODO: 5.0: Remove the camelCased vendorExtension below and ensure templates use the newer property naming. - once(LOGGER).warn("4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix."); - - - implcm.getVendorExtensions().putIfAbsent("implements", new ArrayList()); // TODO: 5.0 Remove - implcm.getVendorExtensions().putIfAbsent("x-implements", implcm.getVendorExtensions().get("implements")); + implcm.getVendorExtensions().putIfAbsent("x-implements", new ArrayList()); // Add implemented interfaces for (String intf : additionalInterfaces) { - List impl = (List) implcm.getVendorExtensions().get("implements"); + List impl = (List) implcm.getVendorExtensions().get("x-implements"); impl.add(intf); if (addInterfaceImports) { // Add imports for interfaces 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 8d12c42630d1..d6ff3f94e0bd 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 @@ -36,6 +36,8 @@ import org.glassfish.jersey.logging.LoggingFeature; import org.apache.commons.io.FileUtils; import org.glassfish.jersey.filter.LoggingFilter; {{/supportJava6}} +import java.util.logging.Level; +import java.util.logging.Logger; import java.util.Collection; import java.util.Collections; import java.util.Map; @@ -73,6 +75,8 @@ public class ApiClient { protected Map defaultHeaderMap = new HashMap(); protected Map defaultCookieMap = new HashMap(); protected String basePath = "{{{basePath}}}"; + private static final Logger log = Logger.getLogger(ApiClient.class.getName()); + protected List servers = new ArrayList({{#servers}}{{#-first}}Arrays.asList( {{/-first}} new ServerConfiguration( "{{{url}}}", @@ -928,6 +932,9 @@ public class ApiClient { } } catch (Exception ex) { // failed to deserialize, do nothing and try next one (schema) + // Logging the error may be useful to troubleshoot why a payload fails to match + // the schema. + log.log(Level.FINE, "Input data does not match schema '" + schemaName + "'", ex); } } else {// unknown type throw new ApiException(schemaType.getClass() + " is not a GenericType and cannot be handled properly in deserialization."); @@ -938,7 +945,7 @@ public class ApiClient { if (matchCounter > 1 && "oneOf".equals(schema.getSchemaType())) {// more than 1 match for oneOf throw new ApiException("Response body is invalid as it matches more than one schema (" + StringUtil.join(matchSchemas, ", ") + ") defined in the oneOf model: " + schema.getClass().getName()); } else if (matchCounter == 0) { // fail to match any in oneOf/anyOf schemas - throw new ApiException("Response body is invalid as it doens't match any schemas (" + StringUtil.join(schema.getSchemas().keySet(), ", ") + ") defined in the oneOf/anyOf model: " + schema.getClass().getName()); + throw new ApiException("Response body is invalid as it does not match any schemas (" + StringUtil.join(schema.getSchemas().keySet(), ", ") + ") defined in the oneOf/anyOf model: " + schema.getClass().getName()); } else { // only one matched schema.setActualInstance(result); return schema; diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/anyof_model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/anyof_model.mustache index f5d76fed53b7..5c3219b5de37 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/anyof_model.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/anyof_model.mustache @@ -1,6 +1,8 @@ import javax.ws.rs.core.GenericType; import javax.ws.rs.core.Response; import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @@ -15,6 +17,8 @@ import com.fasterxml.jackson.databind.deser.std.StdDeserializer; {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} @JsonDeserialize(using={{classname}}.{{classname}}Deserializer.class) public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} { + private static final Logger log = Logger.getLogger({{classname}}.class.getName()); + public static class {{classname}}Deserializer extends StdDeserializer<{{classname}}> { public {{classname}}Deserializer() { this({{classname}}.class); @@ -37,7 +41,8 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im ret.setActualInstance(deserialized); return ret; } catch (Exception e) { - // deserialization failed, continue + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match '{{classname}}'", e); } {{/anyOf}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/auth/HttpSignatureAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/auth/HttpSignatureAuth.mustache index 3e1c0f0e7f71..c978de46a0f6 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/auth/HttpSignatureAuth.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/auth/HttpSignatureAuth.mustache @@ -17,6 +17,7 @@ import java.util.Locale; import java.util.Map; import java.util.List; import java.security.spec.AlgorithmParameterSpec; +import java.security.InvalidKeyException; import org.tomitribe.auth.signatures.Algorithm; import org.tomitribe.auth.signatures.Signer; @@ -204,7 +205,7 @@ public class HttpSignatureAuth implements Authentication { * @throws InvalidKeyException Unable to parse the key, or the security provider for this key * is not installed. */ - public void setPrivateKey(Key key) throws InvalidKeyException { + public void setPrivateKey(Key key) throws InvalidKeyException, ApiException { if (key == null) { throw new ApiException("Private key (java.security.Key) cannot be null"); } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/oneof_model.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/oneof_model.mustache index b7523272c00f..fec28f2e2dce 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/oneof_model.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/oneof_model.mustache @@ -1,6 +1,8 @@ import javax.ws.rs.core.GenericType; import javax.ws.rs.core.Response; import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @@ -15,6 +17,8 @@ import com.fasterxml.jackson.databind.deser.std.StdDeserializer; {{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} @JsonDeserialize(using={{classname}}.{{classname}}Deserializer.class) public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-implements}}, {{{.}}}{{/vendorExtensions.x-implements}} { + private static final Logger log = Logger.getLogger({{classname}}.class.getName()); + public static class {{classname}}Deserializer extends StdDeserializer<{{classname}}> { public {{classname}}Deserializer() { this({{classname}}.class); @@ -35,8 +39,10 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im try { deserialized = tree.traverse(jp.getCodec()).readValueAs({{{.}}}.class); match++; + log.log(Level.FINER, "Input data matches schema '{{{.}}}'"); } catch (Exception e) { // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema '{{{.}}}'", e); } {{/oneOf}} diff --git a/modules/openapi-generator/src/main/resources/apex/model_test.mustache b/modules/openapi-generator/src/main/resources/apex/model_test.mustache index 3aef0d655725..b3a49b28b505 100644 --- a/modules/openapi-generator/src/main/resources/apex/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/apex/model_test.mustache @@ -86,18 +86,18 @@ private class {{classname}}Test { System.assertEquals({{classVarName}}3.hashCode(), {{classVarName}}4.hashCode()); } {{#vendorExtensions}} - {{#hasPropertyMappings}} + {{#x-has-property-mappings}} @isTest private static void maintainRenamedProperties() { {{classname}} {{classVarName}} = new {{classname}}(); - Map propertyMappings = {{classVarName}}.getPropertyMappings(); - {{#propertyMappings}} - System.assertEquals('{{internalName}}', propertyMappings.get('{{externalName}}')); - {{/propertyMappings}} + Map x-property-mappings = {{classVarName}}.getx-property-mappings(); + {{#x-property-mappings}} + System.assertEquals('{{internalName}}', x-property-mappings.get('{{externalName}}')); + {{/x-property-mappings}} } - {{/hasPropertyMappings}} - {{#hasDefaultValues}} + {{/x-has-property-mappings}} + {{#x-has-default-values}} @isTest private static void defaultValuesPopulated() { @@ -113,7 +113,7 @@ private class {{classname}}Test { {{/defaultValue}} {{/vars}} } - {{/hasDefaultValues}} + {{/x-has-default-values}} {{/vendorExtensions}} {{/isEnum}} } diff --git a/modules/openapi-generator/src/main/resources/apex/pojo.mustache b/modules/openapi-generator/src/main/resources/apex/pojo.mustache index 9f192178eeac..74f64634440b 100644 --- a/modules/openapi-generator/src/main/resources/apex/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/apex/pojo.mustache @@ -34,19 +34,19 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{#interfac {{/vars}} {{#vendorExtensions}} - {{#hasPropertyMappings}} + {{#x-property-mappings}} private static final Map propertyMappings = new Map{ - {{#propertyMappings}} + {{#x-property-mappings}} '{{externalName}}' => '{{internalName}}'{{^-last}},{{/-last}} - {{/propertyMappings}} + {{/x-property-mappings}} }; public Map getPropertyMappings() { return propertyMappings; } - {{/hasPropertyMappings}} - {{#hasDefaultValues}} + {{/x-property-mappings}} + {{#x-has-default-values}} public {{classname}}() { {{#vars}} {{#defaultValue}} @@ -55,7 +55,7 @@ public class {{classname}}{{#parent}} extends {{{parent}}}{{/parent}}{{#interfac {{/vars}} } - {{/hasDefaultValues}} + {{/x-has-default-values}} {{/vendorExtensions}} public static {{classname}} getExample() { {{classname}} {{classVarName}} = new {{classname}}(); diff --git a/modules/openapi-generator/src/main/resources/cpp-ue4/api-operations-source.mustache b/modules/openapi-generator/src/main/resources/cpp-ue4/api-operations-source.mustache index 894e76bc7b7b..8ab14a704cf1 100644 --- a/modules/openapi-generator/src/main/resources/cpp-ue4/api-operations-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-ue4/api-operations-source.mustache @@ -139,19 +139,17 @@ void {{classname}}::{{operationIdCamelCase}}Request::SetupHttpRequest(const TSha FString JsonBody; JsonWriter Writer = TJsonWriterFactory<>::Create(&JsonBody); - Writer->WriteObjectStart(); {{#bodyParams}} {{#required}} - Writer->WriteIdentifierPrefix(TEXT("{{baseName}}")); WriteJsonValue(Writer, {{paramName}}); + WriteJsonValue(Writer, {{paramName}}); {{/required}} {{^required}} if ({{paramName}}.IsSet()) { - Writer->WriteIdentifierPrefix(TEXT("{{baseName}}")); WriteJsonValue(Writer, {{paramName}}.GetValue()); + WriteJsonValue(Writer, {{paramName}}.GetValue()); } {{/required}} {{/bodyParams}} - Writer->WriteObjectEnd(); Writer->Close(); HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json; charset=utf-8")); @@ -176,14 +174,14 @@ void {{classname}}::{{operationIdCamelCase}}Request::SetupHttpRequest(const TSha {{#isFile}} FormData.AddFilePart(TEXT("{{baseName}}"), {{paramName}}); {{/isFile}} + {{^isFile}} {{#isBinary}} FormData.AddBinaryPart(TEXT("{{baseName}}"), {{paramName}}); {{/isBinary}} - {{#isBinary}} - {{^isFile}} + {{^isBinary}} FormData.AddStringPart(TEXT("{{baseName}}"), *ToUrlString({{paramName}})); - {{/isFile}} {{/isBinary}} + {{/isFile}} {{/required}} {{^required}} if({{paramName}}.IsSet()) @@ -191,14 +189,14 @@ void {{classname}}::{{operationIdCamelCase}}Request::SetupHttpRequest(const TSha {{#isFile}} FormData.AddFilePart(TEXT("{{baseName}}"), {{paramName}}.GetValue()); {{/isFile}} + {{^isFile}} {{#isBinary}} FormData.AddBinaryPart(TEXT("{{baseName}}"), {{paramName}}.GetValue()); {{/isBinary}} {{^isBinary}} - {{^isFile}} FormData.AddStringPart(TEXT("{{baseName}}"), *ToUrlString({{paramName}}.GetValue())); - {{/isFile}} {{/isBinary}} + {{/isFile}} } {{/required}} {{/isContainer}} diff --git a/modules/openapi-generator/src/main/resources/cpp-ue4/model-source.mustache b/modules/openapi-generator/src/main/resources/cpp-ue4/model-source.mustache index 4850fb9859ce..3e9b14788a67 100644 --- a/modules/openapi-generator/src/main/resources/cpp-ue4/model-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-ue4/model-source.mustache @@ -42,6 +42,7 @@ inline void WriteJsonValue(JsonWriter& Writer, const {{classname}}::{{{enumName} inline bool TryGetJsonValue(const TSharedPtr& JsonValue, {{classname}}::{{{enumName}}}& Value) { + {{#allowableValues}} FString TmpValue; if (JsonValue->TryGetString(TmpValue)) { @@ -55,6 +56,7 @@ inline bool TryGetJsonValue(const TSharedPtr& JsonValue, {{classname return true; } } + {{/allowableValues}} return false; } diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/api.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/api.mustache index 4d1a4c5931cd..339e22af3c9d 100644 --- a/modules/openapi-generator/src/main/resources/dart-jaguar/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/api.mustache @@ -40,11 +40,11 @@ class {{classname}} extends ApiClient with _${{classname}}Client { {{#vendorExtensions}} {{#formParams}} {{#-first}}{{#hasQueryParams}},{{/hasQueryParams}}{{^hasQueryParams}}{{#hasHeaderParams}},{{/hasHeaderParams}}{{/hasQueryParams}}{{^hasQueryParams}}{{^hasHeaderParams}}{{#hasPathParams}},{{/hasPathParams}}{{/hasHeaderParams}}{{/hasQueryParams}}{{/-first}} - {{#isJson}}@AsJson() {{/isJson}}{{#isForm}}@AsFormField() {{/isForm}}{{#isMultipart}}@AsMultipartField() {{/isMultipart}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}} + {{#x-is-json}}@AsJson() {{/x-is-json}}{{#x-is-form}}@AsFormField() {{/x-is-form}}{{#x-is-multipart}}@AsMultipartField() {{/x-is-multipart}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}} {{/formParams}} {{#bodyParam}} {{#hasFormParams}},{{/hasFormParams}}{{^hasFormParams}}{{#hasQueryParams}},{{/hasQueryParams}}{{/hasFormParams}}{{^hasFormParams}}{{^hasQueryParams}}{{#hasHeaderParams}},{{/hasHeaderParams}}{{/hasQueryParams}}{{/hasFormParams}}{{^hasFormParams}}{{^hasQueryParams}}{{^hasHeaderParams}}{{#hasPathParams}},{{/hasPathParams}}{{/hasHeaderParams}}{{/hasQueryParams}}{{/hasFormParams}} - {{^isProto}}{{^isJson}}{{^isForm}}{{^isMultipart}}@AsBody(){{/isMultipart}}{{/isForm}}{{/isJson}}{{/isProto}} {{#isProto}}@Serialized(MimeTypes.binary) {{/isProto}}{{#isJson}}@AsJson() {{/isJson}}{{#isForm}}@AsForm() {{/isForm}}{{#isMultipart}}@AsMultipart() {{/isMultipart}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}} + {{^x-is-proto}}{{^x-is-json}}{{^x-is-form}}{{^x-is-multipart}}@AsBody(){{/x-is-multipart}}{{/x-is-form}}{{/x-is-json}}{{/x-is-proto}} {{#x-is-proto}}@Serialized(MimeTypes.binary) {{/x-is-proto}}{{#x-is-json}}@AsJson() {{/x-is-json}}{{#x-is-form}}@AsForm() {{/x-is-form}}{{#x-is-multipart}}@AsMultipart() {{/x-is-multipart}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}} {{/bodyParam}} {{/vendorExtensions}} ) { diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/class.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/class.mustache index 0ee26193bba5..5a5edb919999 100644 --- a/modules/openapi-generator/src/main/resources/dart-jaguar/class.mustache +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/class.mustache @@ -22,10 +22,10 @@ class {{classname}} { {{classname}}( {{#vars}}{{^defaultValue}}{{#required}} this.{{name}}, {{/required}}{{/defaultValue}}{{/vars}} -{{#vendorExtensions}}{{#hasVars}}{ +{{#vendorExtensions}}{{#x-has-vars}}{ {{#vars}}{{^required}} this.{{name}}{{#defaultValue}} = {{{defaultValue}}}{{#hasMore}}, {{/hasMore}} {{/defaultValue}}{{/required}} {{#required}} {{#defaultValue}}this.{{name}} = {{{defaultValue}}}{{#hasMore}}, {{/hasMore}} {{/defaultValue}}{{/required}}{{/vars}} - }{{/hasVars}}{{/vendorExtensions}} + }{{/x-has-vars}}{{/vendorExtensions}} ); @override diff --git a/modules/openapi-generator/src/main/resources/haskell-http-client/MimeTypes.mustache b/modules/openapi-generator/src/main/resources/haskell-http-client/MimeTypes.mustache index c1c83ec7120d..b9bdd3e27335 100644 --- a/modules/openapi-generator/src/main/resources/haskell-http-client/MimeTypes.mustache +++ b/modules/openapi-generator/src/main/resources/haskell-http-client/MimeTypes.mustache @@ -195,7 +195,7 @@ instance MimeUnrender MimeNoContent NoContent where mimeUnrender _ = P.Right . P {{#x-hasUnknownMimeTypes}} -- * Custom Mime Types -{{#x-unknownMimeTypes}}-- ** {{{x-mediaDataType}}} +{{#x-unknown-mime-types}}-- ** {{{x-mediaDataType}}} data {{{x-mediaDataType}}} = {{{x-mediaDataType}}} deriving (P.Typeable) @@ -207,4 +207,4 @@ instance A.FromJSON a => MimeUnrender {{{x-mediaDataType}}} a where mimeUnrender -- instance MimeRender {{{x-mediaDataType}}} T.Text where mimeRender _ = undefined -- instance MimeUnrender {{{x-mediaDataType}}} T.Text where mimeUnrender _ = undefined -{{/x-unknownMimeTypes}}{{/x-hasUnknownMimeTypes}} \ No newline at end of file +{{/x-unknown-mime-types}}{{/x-hasUnknownMimeTypes}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/haskell-http-client/Model.mustache b/modules/openapi-generator/src/main/resources/haskell-http-client/Model.mustache index d8dd9f0f2489..c42a4ee01ff9 100644 --- a/modules/openapi-generator/src/main/resources/haskell-http-client/Model.mustache +++ b/modules/openapi-generator/src/main/resources/haskell-http-client/Model.mustache @@ -58,8 +58,8 @@ import qualified Prelude as P -- * Parameter newtypes {{#x-allUniqueParams}}{{#x-newtype}} --- ** {{{x-paramNameType}}} -newtype {{{x-paramNameType}}} = {{{x-paramNameType}}} { un{{{x-paramNameType}}} :: {{{x-dataType}}} } deriving (P.Eq, P.Show{{#x-isBodyParam}}, A.ToJSON{{/x-isBodyParam}}){{/x-newtype}}{{/x-allUniqueParams}} +-- ** {{{x-param-name-type}}} +newtype {{{x-param-name-type}}} = {{{x-param-name-type}}} { un{{{x-param-name-type}}} :: {{{x-data-type}}} } deriving (P.Eq, P.Show{{#x-isBodyParam}}, A.ToJSON{{/x-isBodyParam}}){{/x-newtype}}{{/x-allUniqueParams}} -- * Models @@ -125,30 +125,30 @@ mk{{classname}} {{#vars}}{{#required}}{{name}} {{/required}}{{/vars}}= {{#x-hasEnumSection}}-- * Enums {{#x-allUniqueParams}}{{#x-enum}} --- ** {{{x-paramNameType}}} +-- ** {{{x-param-name-type}}} --- | Enum of '{{{x-dataType}}}'{{#description}} . +-- | Enum of '{{{x-data-type}}}'{{#description}} . -- {{{.}}}{{/description}} -data {{{x-paramNameType}}} +data {{{x-param-name-type}}} = {{#allowableValues}}{{#enumVars}}{{{name}}} -- ^ @{{{value}}}@ {{^-last}}| {{/-last}}{{#-last}}deriving (P.Show, P.Eq, P.Typeable, P.Ord, P.Bounded, P.Enum){{/-last}}{{/enumVars}}{{/allowableValues}} -instance A.ToJSON {{{x-paramNameType}}} where toJSON = A.toJSON . from{{{x-paramNameType}}} -instance A.FromJSON {{{x-paramNameType}}} where parseJSON o = P.either P.fail (pure . P.id) . to{{{x-paramNameType}}} =<< A.parseJSON o -instance WH.ToHttpApiData {{{x-paramNameType}}} where toQueryParam = WH.toQueryParam . from{{{x-paramNameType}}} -instance WH.FromHttpApiData {{{x-paramNameType}}} where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . to{{{x-paramNameType}}} -instance MimeRender MimeMultipartFormData {{{x-paramNameType}}} where mimeRender _ = mimeRenderDefaultMultipartFormData +instance A.ToJSON {{{x-param-name-type}}} where toJSON = A.toJSON . from{{{x-param-name-type}}} +instance A.FromJSON {{{x-param-name-type}}} where parseJSON o = P.either P.fail (pure . P.id) . to{{{x-param-name-type}}} =<< A.parseJSON o +instance WH.ToHttpApiData {{{x-param-name-type}}} where toQueryParam = WH.toQueryParam . from{{{x-param-name-type}}} +instance WH.FromHttpApiData {{{x-param-name-type}}} where parseQueryParam o = WH.parseQueryParam o >>= P.left T.pack . to{{{x-param-name-type}}} +instance MimeRender MimeMultipartFormData {{{x-param-name-type}}} where mimeRender _ = mimeRenderDefaultMultipartFormData --- | unwrap '{{{x-paramNameType}}}' enum -from{{{x-paramNameType}}} :: {{{x-paramNameType}}} -> {{{x-dataType}}} -from{{{x-paramNameType}}} = \case{{#allowableValues}}{{#enumVars}} +-- | unwrap '{{{x-param-name-type}}}' enum +from{{{x-param-name-type}}} :: {{{x-param-name-type}}} -> {{{x-data-type}}} +from{{{x-param-name-type}}} = \case{{#allowableValues}}{{#enumVars}} {{{name}}} -> {{{value}}}{{/enumVars}}{{/allowableValues}} --- | parse '{{{x-paramNameType}}}' enum -to{{{x-paramNameType}}} :: {{{x-dataType}}} -> P.Either String {{{x-paramNameType}}} -to{{{x-paramNameType}}} = \case{{#allowableValues}}{{#enumVars}} +-- | parse '{{{x-param-name-type}}}' enum +to{{{x-param-name-type}}} :: {{{x-data-type}}} -> P.Either String {{{x-param-name-type}}} +to{{{x-param-name-type}}} = \case{{#allowableValues}}{{#enumVars}} {{{value}}} -> P.Right {{{name}}}{{/enumVars}}{{/allowableValues}} - s -> P.Left $ "to{{{x-paramNameType}}}: enum parse failure: " P.++ P.show s + s -> P.Left $ "to{{{x-param-name-type}}}: enum parse failure: " P.++ P.show s {{/x-enum}}{{/x-allUniqueParams}}{{/x-hasEnumSection}} {{#authMethods}}{{#-first}}-- * Auth Methods diff --git a/modules/openapi-generator/src/main/resources/haskell-http-client/tests/Instances.mustache b/modules/openapi-generator/src/main/resources/haskell-http-client/tests/Instances.mustache index a684c08db710..a3232a07daa8 100644 --- a/modules/openapi-generator/src/main/resources/haskell-http-client/tests/Instances.mustache +++ b/modules/openapi-generator/src/main/resources/haskell-http-client/tests/Instances.mustache @@ -123,6 +123,6 @@ gen{{classname}} n = {{#x-allUniqueParams}}{{#x-enum}} -instance Arbitrary {{{x-paramNameType}}} where +instance Arbitrary {{{x-param-name-type}}} where arbitrary = arbitraryBoundedEnum {{/x-enum}}{{/x-allUniqueParams}} diff --git a/modules/openapi-generator/src/main/resources/mysql-schema/mysql_schema.mustache b/modules/openapi-generator/src/main/resources/mysql-schema/mysql_schema.mustache index 9ccdef756432..e54dc6daf336 100644 --- a/modules/openapi-generator/src/main/resources/mysql-schema/mysql_schema.mustache +++ b/modules/openapi-generator/src/main/resources/mysql-schema/mysql_schema.mustache @@ -12,34 +12,34 @@ CREATE DATABASE IF NOT EXISTS `{{{defaultDatabaseName}}}` DEFAULT CHARACTER SET -- -------------------------------------------------------- {{#models}}{{#model}}{{#hasVars}}{{^isArrayModel}}-- --- Table structure{{#vendorExtensions}}{{#x-mysqlSchema}}{{#tableDefinition}} for table `{{tblName}}`{{/tableDefinition}}{{/x-mysqlSchema}}{{/vendorExtensions}} generated from model '{{classVarName}}' +-- Table structure{{#vendorExtensions}}{{#x-mysql-schema}}{{#tableDefinition}} for table `{{tblName}}`{{/tableDefinition}}{{/x-mysql-schema}}{{/vendorExtensions}} generated from model '{{classVarName}}' {{#description}} -- {{description}} {{/description}} -- {{#vendorExtensions}} -{{#x-mysqlSchema}} +{{#x-mysql-schema}} {{#tableDefinition}} CREATE TABLE IF NOT EXISTS {{#defaultDatabaseName}}`{{{defaultDatabaseName}}}`.{{/defaultDatabaseName}}`{{tblName}}` ( {{/tableDefinition}} -{{/x-mysqlSchema}} +{{/x-mysql-schema}} {{/vendorExtensions}} {{#vars}} {{#vendorExtensions}} - {{#x-mysqlSchema}} + {{#x-mysql-schema}} {{#columnDefinition}} `{{colName}}` {{colDataType}}{{#colDataTypeArguments}}{{#-first}}({{/-first}}{{#isString}}'{{/isString}}{{argumentValue}}{{#isString}}'{{/isString}}{{^-last}}, {{/-last}}{{#-last}}){{/-last}}{{/colDataTypeArguments}}{{#colUnsigned}} UNSIGNED{{/colUnsigned}}{{#colNotNull}} NOT NULL{{/colNotNull}}{{#colDefault}} DEFAULT {{#isString}}'{{defaultValue}}'{{/isString}}{{^isString}}{{defaultValue}}{{/isString}}{{/colDefault}}{{#colComment}} COMMENT '{{colComment}}'{{/colComment}}{{^-last}},{{/-last}} {{/columnDefinition}} - {{/x-mysqlSchema}} + {{/x-mysql-schema}} {{/vendorExtensions}} {{/vars}} {{#vendorExtensions}} -{{#x-mysqlSchema}} +{{#x-mysql-schema}} {{#tableDefinition}} ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci{{#tblComment}} COMMENT='{{tblComment}}'{{/tblComment}}; {{/tableDefinition}} -{{/x-mysqlSchema}} +{{/x-mysql-schema}} {{/vendorExtensions}} {{/isArrayModel}}{{/hasVars}}{{/model}}{{/models}} diff --git a/modules/openapi-generator/src/main/resources/mysql-schema/sql_query.mustache b/modules/openapi-generator/src/main/resources/mysql-schema/sql_query.mustache index 888ecb3e8a7d..7775e7c70d30 100644 --- a/modules/openapi-generator/src/main/resources/mysql-schema/sql_query.mustache +++ b/modules/openapi-generator/src/main/resources/mysql-schema/sql_query.mustache @@ -6,22 +6,22 @@ {{#models}}{{#model}} -- --- SELECT template for table {{#vendorExtensions}}{{#x-mysqlSchema}}{{#tableDefinition}}`{{tblName}}`{{/tableDefinition}}{{/x-mysqlSchema}}{{/vendorExtensions}} +-- SELECT template for table {{#vendorExtensions}}{{#x-mysql-schema}}{{#tableDefinition}}`{{tblName}}`{{/tableDefinition}}{{/x-mysql-schema}}{{/vendorExtensions}} -- -SELECT {{#vars}}{{#vendorExtensions}}{{#x-mysqlSchema}}{{#columnDefinition}}`{{colName}}`{{#hasMore}}, {{/hasMore}}{{/columnDefinition}}{{/x-mysqlSchema}}{{/vendorExtensions}}{{/vars}} FROM {{#vendorExtensions}}{{#x-mysqlSchema}}{{#tableDefinition}}{{#defaultDatabaseName}}`{{{defaultDatabaseName}}}`.{{/defaultDatabaseName}}`{{tblName}}`{{/tableDefinition}}{{/x-mysqlSchema}}{{/vendorExtensions}} WHERE 1; +SELECT {{#vars}}{{#vendorExtensions}}{{#x-mysql-schema}}{{#columnDefinition}}`{{colName}}`{{#hasMore}}, {{/hasMore}}{{/columnDefinition}}{{/x-mysql-schema}}{{/vendorExtensions}}{{/vars}} FROM {{#vendorExtensions}}{{#x-mysql-schema}}{{#tableDefinition}}{{#defaultDatabaseName}}`{{{defaultDatabaseName}}}`.{{/defaultDatabaseName}}`{{tblName}}`{{/tableDefinition}}{{/x-mysql-schema}}{{/vendorExtensions}} WHERE 1; -- --- INSERT template for table {{#vendorExtensions}}{{#x-mysqlSchema}}{{#tableDefinition}}`{{tblName}}`{{/tableDefinition}}{{/x-mysqlSchema}}{{/vendorExtensions}} +-- INSERT template for table {{#vendorExtensions}}{{#x-mysql-schema}}{{#tableDefinition}}`{{tblName}}`{{/tableDefinition}}{{/x-mysql-schema}}{{/vendorExtensions}} -- -INSERT INTO {{#vendorExtensions}}{{#x-mysqlSchema}}{{#tableDefinition}}{{#defaultDatabaseName}}`{{{defaultDatabaseName}}}`.{{/defaultDatabaseName}}`{{tblName}}`{{/tableDefinition}}{{/x-mysqlSchema}}{{/vendorExtensions}}({{#vars}}{{#vendorExtensions}}{{#x-mysqlSchema}}{{#columnDefinition}}`{{colName}}`{{#hasMore}}, {{/hasMore}}{{/columnDefinition}}{{/x-mysqlSchema}}{{/vendorExtensions}}{{/vars}}) VALUES ({{#vars}}{{#vendorExtensions}}{{#x-mysqlSchema}}{{#columnDefinition}}{{#namedParametersEnabled}}:{{colName}}{{/namedParametersEnabled}}{{^namedParametersEnabled}}?{{/namedParametersEnabled}}{{#hasMore}}, {{/hasMore}}{{/columnDefinition}}{{/x-mysqlSchema}}{{/vendorExtensions}}{{/vars}}); +INSERT INTO {{#vendorExtensions}}{{#x-mysql-schema}}{{#tableDefinition}}{{#defaultDatabaseName}}`{{{defaultDatabaseName}}}`.{{/defaultDatabaseName}}`{{tblName}}`{{/tableDefinition}}{{/x-mysql-schema}}{{/vendorExtensions}}({{#vars}}{{#vendorExtensions}}{{#x-mysql-schema}}{{#columnDefinition}}`{{colName}}`{{#hasMore}}, {{/hasMore}}{{/columnDefinition}}{{/x-mysql-schema}}{{/vendorExtensions}}{{/vars}}) VALUES ({{#vars}}{{#vendorExtensions}}{{#x-mysql-schema}}{{#columnDefinition}}{{#namedParametersEnabled}}:{{colName}}{{/namedParametersEnabled}}{{^namedParametersEnabled}}?{{/namedParametersEnabled}}{{#hasMore}}, {{/hasMore}}{{/columnDefinition}}{{/x-mysql-schema}}{{/vendorExtensions}}{{/vars}}); -- --- UPDATE template for table {{#vendorExtensions}}{{#x-mysqlSchema}}{{#tableDefinition}}`{{tblName}}`{{/tableDefinition}}{{/x-mysqlSchema}}{{/vendorExtensions}} +-- UPDATE template for table {{#vendorExtensions}}{{#x-mysql-schema}}{{#tableDefinition}}`{{tblName}}`{{/tableDefinition}}{{/x-mysql-schema}}{{/vendorExtensions}} -- -UPDATE {{#vendorExtensions}}{{#x-mysqlSchema}}{{#tableDefinition}}{{#defaultDatabaseName}}`{{{defaultDatabaseName}}}`.{{/defaultDatabaseName}}`{{tblName}}`{{/tableDefinition}}{{/x-mysqlSchema}}{{/vendorExtensions}} SET {{#vars}}{{#vendorExtensions}}{{#x-mysqlSchema}}{{#columnDefinition}}`{{colName}}` = {{#namedParametersEnabled}}:{{colName}}{{/namedParametersEnabled}}{{^namedParametersEnabled}}?{{/namedParametersEnabled}}{{#hasMore}}, {{/hasMore}}{{/columnDefinition}}{{/x-mysqlSchema}}{{/vendorExtensions}}{{/vars}} WHERE 1; +UPDATE {{#vendorExtensions}}{{#x-mysql-schema}}{{#tableDefinition}}{{#defaultDatabaseName}}`{{{defaultDatabaseName}}}`.{{/defaultDatabaseName}}`{{tblName}}`{{/tableDefinition}}{{/x-mysql-schema}}{{/vendorExtensions}} SET {{#vars}}{{#vendorExtensions}}{{#x-mysql-schema}}{{#columnDefinition}}`{{colName}}` = {{#namedParametersEnabled}}:{{colName}}{{/namedParametersEnabled}}{{^namedParametersEnabled}}?{{/namedParametersEnabled}}{{#hasMore}}, {{/hasMore}}{{/columnDefinition}}{{/x-mysql-schema}}{{/vendorExtensions}}{{/vars}} WHERE 1; -- --- DELETE template for table {{#vendorExtensions}}{{#x-mysqlSchema}}{{#tableDefinition}}`{{tblName}}`{{/tableDefinition}}{{/x-mysqlSchema}}{{/vendorExtensions}} +-- DELETE template for table {{#vendorExtensions}}{{#x-mysql-schema}}{{#tableDefinition}}`{{tblName}}`{{/tableDefinition}}{{/x-mysql-schema}}{{/vendorExtensions}} -- -DELETE FROM {{#vendorExtensions}}{{#x-mysqlSchema}}{{#tableDefinition}}{{#defaultDatabaseName}}`{{{defaultDatabaseName}}}`.{{/defaultDatabaseName}}`{{tblName}}`{{/tableDefinition}}{{/x-mysqlSchema}}{{/vendorExtensions}} WHERE 0; +DELETE FROM {{#vendorExtensions}}{{#x-mysql-schema}}{{#tableDefinition}}{{#defaultDatabaseName}}`{{{defaultDatabaseName}}}`.{{/defaultDatabaseName}}`{{tblName}}`{{/tableDefinition}}{{/x-mysql-schema}}{{/vendorExtensions}} WHERE 0; {{/model}}{{/models}} diff --git a/modules/openapi-generator/src/main/resources/ocaml/of_json.mustache b/modules/openapi-generator/src/main/resources/ocaml/of_json.mustache index a7be3d4d7ca5..be01eeafa4c4 100644 --- a/modules/openapi-generator/src/main/resources/ocaml/of_json.mustache +++ b/modules/openapi-generator/src/main/resources/ocaml/of_json.mustache @@ -1 +1 @@ -{{#isEnum}}JsonSupport.unwrap Enums.{{{datatypeWithEnum}}}_of_yojson{{/isEnum}}{{^isEnum}}{{#returnType}}{{#returnTypeIsPrimitive}}JsonSupport.to_{{{returnBaseType}}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}{{#vendorExtensions.x-modelModule}}JsonSupport.unwrap {{{vendorExtensions.x-modelModule}}}.of_yojson{{/vendorExtensions.x-modelModule}}{{^vendorExtensions.x-modelModule}}JsonSupport.unwrap {{{returnBaseType}}}.of_yojson{{/vendorExtensions.x-modelModule}}{{/returnTypeIsPrimitive}}{{/returnType}}{{/isEnum}} \ No newline at end of file +{{#isEnum}}JsonSupport.unwrap Enums.{{{datatypeWithEnum}}}_of_yojson{{/isEnum}}{{^isEnum}}{{#returnType}}{{#returnTypeIsPrimitive}}JsonSupport.to_{{{returnBaseType}}}{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}{{#vendorExtensions.x-model-module}}JsonSupport.unwrap {{{vendorExtensions.x-model-module}}}.of_yojson{{/vendorExtensions.x-model-module}}{{^vendorExtensions.x-model-module}}JsonSupport.unwrap {{{returnBaseType}}}.of_yojson{{/vendorExtensions.x-model-module}}{{/returnTypeIsPrimitive}}{{/returnType}}{{/isEnum}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/ocaml/to_json.mustache b/modules/openapi-generator/src/main/resources/ocaml/to_json.mustache index 6b8fea90fdcd..a0fa3504a7aa 100644 --- a/modules/openapi-generator/src/main/resources/ocaml/to_json.mustache +++ b/modules/openapi-generator/src/main/resources/ocaml/to_json.mustache @@ -1 +1 @@ -{{#isListContainer}}{{#items}}(JsonSupport.of_list_of {{> to_json}}){{/items}}{{/isListContainer}}{{#isMapContainer}}{{#items}}(JsonSupport.of_map_of {{> to_json}}){{/items}}{{/isMapContainer}}{{#isString}}JsonSupport.of_string{{/isString}}{{#isLong}}JsonSupport.of_int64{{/isLong}}{{#isInteger}}JsonSupport.of_int32{{/isInteger}}{{#isFloat}}JsonSupport.of_float{{/isFloat}}{{#isNumber}}JsonSupport.of_float{{/isNumber}}{{#isDouble}}JsonSupport.of_float{{/isDouble}}{{#isBoolean}}JsonSupport.of_bool{{/isBoolean}}{{^isEnum}}{{#isModel}}{{#vendorExtensions.x-modelModule}}{{{vendorExtensions.x-modelModule}}}.to_yojson{{/vendorExtensions.x-modelModule}}{{^vendorExtensions.x-modelModule}}{{{baseType}}}.to_yojson{{/vendorExtensions.x-modelModule}}{{/isModel}}{{/isEnum}}{{^isModel}}{{^isContainer}}{{#isEnum}}Enums.{{{datatypeWithEnum}}}_to_yojson{{/isEnum}}{{/isContainer}}{{/isModel}} \ No newline at end of file +{{#isListContainer}}{{#items}}(JsonSupport.of_list_of {{> to_json}}){{/items}}{{/isListContainer}}{{#isMapContainer}}{{#items}}(JsonSupport.of_map_of {{> to_json}}){{/items}}{{/isMapContainer}}{{#isString}}JsonSupport.of_string{{/isString}}{{#isLong}}JsonSupport.of_int64{{/isLong}}{{#isInteger}}JsonSupport.of_int32{{/isInteger}}{{#isFloat}}JsonSupport.of_float{{/isFloat}}{{#isNumber}}JsonSupport.of_float{{/isNumber}}{{#isDouble}}JsonSupport.of_float{{/isDouble}}{{#isBoolean}}JsonSupport.of_bool{{/isBoolean}}{{^isEnum}}{{#isModel}}{{#vendorExtensions.x-model-module}}{{{vendorExtensions.x-model-module}}}.to_yojson{{/vendorExtensions.x-model-module}}{{^vendorExtensions.x-model-module}}{{{baseType}}}.to_yojson{{/vendorExtensions.x-model-module}}{{/isModel}}{{/isEnum}}{{^isModel}}{{^isContainer}}{{#isEnum}}Enums.{{{datatypeWithEnum}}}_to_yojson{{/isEnum}}{{/isContainer}}{{/isModel}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/ocaml/to_string.mustache b/modules/openapi-generator/src/main/resources/ocaml/to_string.mustache index 0588ac5ab4f8..3b41569d43d9 100644 --- a/modules/openapi-generator/src/main/resources/ocaml/to_string.mustache +++ b/modules/openapi-generator/src/main/resources/ocaml/to_string.mustache @@ -1 +1 @@ -{{#isContainer}}{{#items}}(List.map {{> to_string}}){{/items}}{{/isContainer}}{{^isEnum}}{{#isLong}}Int64.to_string{{/isLong}}{{#isInteger}}Int32.to_string{{/isInteger}}{{#isFloat}}string_of_float{{/isFloat}}{{#isNumber}}string_of_float{{/isNumber}}{{#isDouble}}string_of_float{{/isDouble}}{{#isBoolean}}string_of_bool{{/isBoolean}}{{#isFile}}(fun x -> x){{/isFile}}{{#isDate}}(fun x -> x){{/isDate}}{{#isDateTime}}(fun x -> x){{/isDateTime}}{{#isString}}(fun x -> x){{/isString}}{{#isByteArray}}(fun x -> x){{/isByteArray}}{{#isModel}}{{{vendorExtensions.x-modelModule}}}.show{{/isModel}}{{/isEnum}}{{^isModel}}{{^isContainer}}{{#isEnum}}Enums.show_{{{datatypeWithEnum}}}{{/isEnum}}{{/isContainer}}{{/isModel}} \ No newline at end of file +{{#isContainer}}{{#items}}(List.map {{> to_string}}){{/items}}{{/isContainer}}{{^isEnum}}{{#isLong}}Int64.to_string{{/isLong}}{{#isInteger}}Int32.to_string{{/isInteger}}{{#isFloat}}string_of_float{{/isFloat}}{{#isNumber}}string_of_float{{/isNumber}}{{#isDouble}}string_of_float{{/isDouble}}{{#isBoolean}}string_of_bool{{/isBoolean}}{{#isFile}}(fun x -> x){{/isFile}}{{#isDate}}(fun x -> x){{/isDate}}{{#isDateTime}}(fun x -> x){{/isDateTime}}{{#isString}}(fun x -> x){{/isString}}{{#isByteArray}}(fun x -> x){{/isByteArray}}{{#isModel}}{{{vendorExtensions.x-model-module}}}.show{{/isModel}}{{/isEnum}}{{^isModel}}{{^isContainer}}{{#isEnum}}Enums.show_{{{datatypeWithEnum}}}{{/isEnum}}{{/isContainer}}{{/isModel}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/php-laravel/README.md b/modules/openapi-generator/src/main/resources/php-laravel/README.md index 76ceb65d21f6..607a00a0ad2a 100644 --- a/modules/openapi-generator/src/main/resources/php-laravel/README.md +++ b/modules/openapi-generator/src/main/resources/php-laravel/README.md @@ -1,5 +1,8 @@ # OpenAPI generated server +## Requirements +* PHP 7.1.3 or newer + ## Overview This server was generated by the [openapi-generator](https://github.com/openapitools/openapi-generator) project. By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This diff --git a/modules/openapi-generator/src/main/resources/php-laravel/licenseInfo.mustache b/modules/openapi-generator/src/main/resources/php-laravel/licenseInfo.mustache index 63721e9a8946..acdb498a673f 100644 --- a/modules/openapi-generator/src/main/resources/php-laravel/licenseInfo.mustache +++ b/modules/openapi-generator/src/main/resources/php-laravel/licenseInfo.mustache @@ -1,6 +1,7 @@ /** * {{{appName}}} * {{{appDescription}}} + * PHP version 7.1.3 * * {{#version}}The version of the OpenAPI document: {{{version}}}{{/version}} * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} diff --git a/modules/openapi-generator/src/main/resources/php-lumen/licenseInfo.mustache b/modules/openapi-generator/src/main/resources/php-lumen/licenseInfo.mustache index 9866f297a4d7..ef8396ce24d4 100644 --- a/modules/openapi-generator/src/main/resources/php-lumen/licenseInfo.mustache +++ b/modules/openapi-generator/src/main/resources/php-lumen/licenseInfo.mustache @@ -1,6 +1,7 @@ /** * {{{appName}}} * {{{appDescription}}} + * PHP version 7.1.3 * * {{#version}}The version of the OpenAPI document: {{{version}}}{{/version}} * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} diff --git a/modules/openapi-generator/src/main/resources/php-lumen/readme.md b/modules/openapi-generator/src/main/resources/php-lumen/readme.md index e0dba8a2f5ca..77316595b804 100644 --- a/modules/openapi-generator/src/main/resources/php-lumen/readme.md +++ b/modules/openapi-generator/src/main/resources/php-lumen/readme.md @@ -1,5 +1,8 @@ # OpenAPITools generated server +## Requirements +* PHP 7.1.3 or newer + ## Overview This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification/) from a remote server, you can easily generate a server stub. This diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/README_common.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/README_common.mustache index 7d9811fdfb85..0f6dcb41d6f6 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/README_common.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/README_common.mustache @@ -4,13 +4,22 @@ from __future__ import print_function import time import {{{packageName}}} from pprint import pprint -{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} +{{#apiInfo}} +{{#apis}} +{{#-first}} +from {{apiPackage}} import {{classVarName}} +{{#imports}} +{{{import}}} +{{/imports}} +{{#operations}} +{{#operation}} +{{#-first}} {{> python_doc_auth_partial}} # Enter a context with an instance of the API client with {{{packageName}}}.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = {{{packageName}}}.{{{classname}}}(api_client) + api_instance = {{classVarName}}.{{{classname}}}(api_client) {{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} {{/allParams}} @@ -20,7 +29,12 @@ with {{{packageName}}}.ApiClient(configuration) as api_client: pprint(api_response){{/returnType}} except {{{packageName}}}.ApiException as e: print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e) - {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +{{/-first}} +{{/operation}} +{{/operations}} +{{/-first}} +{{/apis}} +{{/apiInfo}} ``` ## Documentation for API Endpoints @@ -77,3 +91,22 @@ Class | Method | HTTP request | Description {{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} {{/hasMore}}{{/apis}}{{/apiInfo}} + +## Notes for Large OpenAPI documents +If the OpenAPI document is large, imports in {{{packageName}}}.apis and {{{packageName}}}.models may fail with a +RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions: + +Solution 1: +Use specific imports for apis and models like: +- `from {{{packageName}}}.api.default_api import DefaultApi` +- `from {{{packageName}}}.model.pet import Pet` + +Solution 1: +Before importing the package, adjust the maximum recursion limit as shown below: +``` +import sys +sys.setrecursionlimit(1500) +import {{{packageName}}} +from {{{packageName}}}.apis import * +from {{{packageName}}}.models import * +``` diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/__init__api.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__api.mustache new file mode 100644 index 000000000000..d37ee6c78b29 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__api.mustache @@ -0,0 +1,3 @@ +# do not import all apis into this module because that uses a lot of memory and stack frames +# if you need the ability to import all models from one package, import them with +# from {{packageName}.apis import DefaultApi, PetApi \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/__init__apis.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__apis.mustache new file mode 100644 index 000000000000..b5b7065e1ed2 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__apis.mustache @@ -0,0 +1,19 @@ +# coding: utf-8 + +# flake8: noqa + +# import all apis into this package +# if you have many ampis here with many many models used in each api this may +# raise a RecursionError +# to avoid this, import only the api that you directly need like: +# from {{packagename}}.api.pet_api import PetApi +# or import this package, but before doing it, use: +# import sys +# sys.setrecursionlimit(n) + +# import apis into api package +{{#apiInfo}} +{{#apis}} +from {{apiPackage}}.{{classVarName}} import {{classname}} +{{/apis}} +{{/apiInfo}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/__init__model.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__model.mustache index ca86cb8a6249..cfe32b784926 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/__init__model.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__model.mustache @@ -1,7 +1,5 @@ -# coding: utf-8 - -# flake8: noqa -{{>partial_header}} - # we can not import model classes here because that would create a circular # reference which would not work in python2 +# do not import all models into this module because that uses a lot of memory and stack frames +# if you need the ability to import all models from one package, import them with +# from {{packageName}.models import ModelA, ModelB diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/__init__models.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__models.mustache new file mode 100644 index 000000000000..abe69dc03504 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__models.mustache @@ -0,0 +1,18 @@ +# coding: utf-8 + +# flake8: noqa + +# import all models into this package +# if you have many models here with many references from one model to another this may +# raise a RecursionError +# to avoid this, import only the models that you directly need like: +# from from {{modelPackage}}.pet import Pet +# or import this package, but before doing it, use: +# import sys +# sys.setrecursionlimit(n) + +{{#models}} +{{#model}} +from {{modelPackage}}.{{classFilename}} import {{unescapedDescription}} +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/__init__package.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__package.mustache index 1d74d016ab47..a949d5085067 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/__init__package.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/__init__package.mustache @@ -8,13 +8,6 @@ from __future__ import absolute_import __version__ = "{{packageVersion}}" -# import apis into sdk package -{{#apiInfo}} -{{#apis}} -from {{apiPackage}}.{{classVarName}} import {{classname}} -{{/apis}} -{{/apiInfo}} - # import ApiClient from {{packageName}}.api_client import ApiClient @@ -26,14 +19,8 @@ from {{packageName}}.signing import HttpSigningConfiguration # import exceptions from {{packageName}}.exceptions import OpenApiException +from {{packageName}}.exceptions import ApiAttributeError from {{packageName}}.exceptions import ApiTypeError from {{packageName}}.exceptions import ApiValueError from {{packageName}}.exceptions import ApiKeyError -from {{packageName}}.exceptions import ApiException - -# import models into sdk package -{{#models}} -{{#model}} -from {{modelPackage}}.{{classFilename}} import {{unescapedDescription}} -{{/model}} -{{/models}} +from {{packageName}}.exceptions import ApiException \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/api_doc_example.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/api_doc_example.mustache index ae7b8a697970..23cf85e9dffa 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/api_doc_example.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/api_doc_example.mustache @@ -2,6 +2,10 @@ from __future__ import print_function import time import {{{packageName}}} +from {{apiPackage}} import {{classVarName}} +{{#imports}} +{{{.}}} +{{/imports}} from pprint import pprint {{> python_doc_auth_partial}} # Enter a context with an instance of the API client @@ -12,7 +16,7 @@ with {{{packageName}}}.ApiClient(configuration) as api_client: with {{{packageName}}}.ApiClient() as api_client: {{/hasAuthMethods}} # Create an instance of the API class - api_instance = {{{packageName}}}.{{{classname}}}(api_client) + api_instance = {{classVarName}}.{{{classname}}}(api_client) {{#requiredParams}}{{^defaultValue}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}} {{/defaultValue}}{{/requiredParams}}{{#optionalParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/defaultValue}} {{/optionalParams}} diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/api_test.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/api_test.mustache new file mode 100644 index 000000000000..e04b32f96edb --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/api_test.mustache @@ -0,0 +1,36 @@ +# coding: utf-8 + +{{>partial_header}} + +from __future__ import absolute_import + +import unittest + +import {{packageName}} +from {{apiPackage}}.{{classVarName}} import {{classname}} # noqa: E501 + + +class {{#operations}}Test{{classname}}(unittest.TestCase): + """{{classname}} unit test stubs""" + + def setUp(self): + self.api = {{classname}}() # noqa: E501 + + def tearDown(self): + pass + + {{#operation}} + def test_{{operationId}}(self): + """Test case for {{{operationId}}} + +{{#summary}} + {{{summary}}} # noqa: E501 +{{/summary}} + """ + pass + + {{/operation}} +{{/operations}} + +if __name__ == '__main__': + unittest.main() diff --git a/modules/openapi-generator/src/main/resources/python/python-experimental/model_test.mustache b/modules/openapi-generator/src/main/resources/python/python-experimental/model_test.mustache index 4fd1263b5f28..5b9a91d2d073 100644 --- a/modules/openapi-generator/src/main/resources/python/python-experimental/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/python/python-experimental/model_test.mustache @@ -3,12 +3,16 @@ {{>partial_header}} from __future__ import absolute_import - +import sys import unittest +import {{packageName}} {{#models}} {{#model}} -import {{packageName}} +{{#imports}} +{{{.}}} +{{/imports}} +from {{modelPackage}}.{{classFilename}} import {{unescapedDescription}} class Test{{unescapedDescription}}(unittest.TestCase): @@ -23,7 +27,7 @@ class Test{{unescapedDescription}}(unittest.TestCase): def test{{unescapedDescription}}(self): """Test {{unescapedDescription}}""" # FIXME: construct object with mandatory attributes with example values - # model = {{packageName}}.{{unescapedDescription}}() # noqa: E501 + # model = {{unescapedDescription}}() # noqa: E501 pass {{/model}} diff --git a/modules/openapi-generator/src/main/resources/rust-server/README.mustache b/modules/openapi-generator/src/main/resources/rust-server/README.mustache index f75899a2e493..bb8fe72a7491 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/README.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/README.mustache @@ -68,9 +68,9 @@ To run a client, follow one of the following simple steps: {{#operations}} {{#operation}} {{#vendorExtensions}} - {{^noClientExample}} + {{^x-no-client-example}} cargo run --example client {{{operationId}}} - {{/noClientExample}} + {{/x-no-client-example}} {{/vendorExtensions}} {{/operation}} {{/operations}} diff --git a/modules/openapi-generator/src/main/resources/rust-server/client-callbacks.mustache b/modules/openapi-generator/src/main/resources/rust-server/client-callbacks.mustache index 33d3bd68c14a..dbc63930c2d0 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/client-callbacks.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/client-callbacks.mustache @@ -58,7 +58,7 @@ impl RequestParser for ApiRequestParser { {{#urls}} {{#requests}} // {{{operationId}}} - {{{httpMethod}}} {{{path}}} - &hyper::Method::{{{vendorExtensions.HttpMethod}}} if path.matched(paths::ID_{{{vendorExtensions.PATH_ID}}}) => Ok("{{{operationId}}}"), + &hyper::Method::{{{vendorExtensions.x-http-method}}} if path.matched(paths::ID_{{{vendorExtensions.x-path-id}}}) => Ok("{{{operationId}}}"), {{/requests}} {{/urls}} {{/callbacks}} diff --git a/modules/openapi-generator/src/main/resources/rust-server/client-operation.mustache b/modules/openapi-generator/src/main/resources/rust-server/client-operation.mustache index 9db3e8c2c5c6..a027811c122a 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/client-operation.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/client-operation.mustache @@ -1,9 +1,9 @@ - async fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}( + async fn {{#vendorExtensions}}{{{x-operation-id}}}{{/vendorExtensions}}( &self, {{#vendorExtensions}} - {{#callbackParams}} + {{#x-callback-params}} callback_{{.}}: String, - {{/callbackParams}} + {{/x-callback-params}} {{/vendorExtensions}} {{#allParams}} param_{{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}, @@ -23,9 +23,9 @@ ,{{{paramName}}}=utf8_percent_encode(¶m_{{{paramName}}}.to_string(), ID_ENCODE_SET) {{/pathParams}} {{#vendorExtensions}} - {{#callbackParams}} + {{#x-callback-params}} ,{{.}}=callback_{{.}} - {{/callbackParams}} + {{/x-callback-params}} {{/vendorExtensions}} ); @@ -65,7 +65,7 @@ }; let mut request = match Request::builder() - .method("{{{vendorExtensions.HttpMethod}}}") + .method("{{{vendorExtensions.x-http-method}}}") .uri(uri) .body(Body::empty()) { Ok(req) => req, @@ -73,7 +73,7 @@ }; {{#vendorExtensions}} - {{#consumesMultipart}} + {{#x-consumes-multipart}} let (body_string, multipart_header) = { let mut multipart = Multipart::new(); @@ -139,10 +139,10 @@ Err(e) => return Err(ApiError(format!("Unable to create header: {} - {}", multipart_header, e))) }); - {{/consumesMultipart}} - {{^consumesMultipart}} + {{/x-consumes-multipart}} + {{^x-consumes-multipart}} {{#vendorExtensions}} - {{^consumesMultipartRelated}} + {{^x-consumes-multipart-related}} {{#formParams}} {{#-first}} let params = &[ @@ -160,8 +160,8 @@ *request.body_mut() = Body::from(body.into_bytes()); {{/-last}} {{/formParams}} - {{/consumesMultipartRelated}} - {{#consumesMultipartRelated}} + {{/x-consumes-multipart-related}} + {{#x-consumes-multipart-related}} {{#formParams}} {{#-first}} // Construct the Body for a multipart/related request. The mime 0.2.6 library @@ -223,37 +223,37 @@ {{/-last}} {{/formParams}} - {{/consumesMultipartRelated}} + {{/x-consumes-multipart-related}} {{/vendorExtensions}} {{#bodyParam}} {{#-first}} // Body parameter {{/-first}} {{#vendorExtensions}} - {{#consumesPlainText}} + {{#x-consumes-plain-text}} {{#isByteArray}} let body = param_{{{paramName}}}.0; {{/isByteArray}} {{^isByteArray}} let body = param_{{{paramName}}}; {{/isByteArray}} - {{/consumesPlainText}} + {{/x-consumes-plain-text}} {{#required}} - {{#consumesXml}} + {{#x-consumes-xml}} let body = param_{{{paramName}}}.to_xml(); - {{/consumesXml}} - {{#consumesJson}} + {{/x-consumes-xml}} + {{#x-consumes-json}} let body = serde_json::to_string(¶m_{{{paramName}}}).expect("impossible to fail to serialize"); - {{/consumesJson}} + {{/x-consumes-json}} {{/required}} {{^required}} let body = param_{{{paramName}}}.map(|ref body| { - {{#consumesXml}} + {{#x-consumes-xml}} body.to_xml() - {{/consumesXml}} - {{#consumesJson}} + {{/x-consumes-xml}} + {{#x-consumes-json}} serde_json::to_string(body).expect("impossible to fail to serialize") - {{/consumesJson}} + {{/x-consumes-json}} }); {{/required}} {{/vendorExtensions}} @@ -279,7 +279,7 @@ {{/-last}} {{/bodyParam}} -{{/consumesMultipart}} +{{/x-consumes-multipart}} {{/vendorExtensions}} let header = HeaderValue::from_str(Has::::get(context).0.clone().to_string().as_str()); request.headers_mut().insert(HeaderName::from_static("x-span-id"), match header { @@ -393,27 +393,27 @@ .to_raw() .map_err(|e| ApiError(format!("Failed to read response: {}", e))).await?; {{#vendorExtensions}} -{{#producesBytes}} +{{#x-produces-bytes}} let body = swagger::ByteArray(body.to_vec()); -{{/producesBytes}} -{{^producesBytes}} +{{/x-produces-bytes}} +{{^x-produces-bytes}} let body = str::from_utf8(&body) .map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))?; - {{#producesXml}} + {{#x-produces-xml}} // 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 let body = serde_xml_rs::from_str::<{{{dataType}}}>(body) .map_err(|e| ApiError(format!("Response body did not match the schema: {}", e)))?; - {{/producesXml}} - {{#producesJson}} + {{/x-produces-xml}} + {{#x-produces-json}} let body = serde_json::from_str::<{{{dataType}}}>(body)?; - {{/producesJson}} - {{#producesPlainText}} + {{/x-produces-json}} + {{#x-produces-plain-text}} let body = body.to_string(); - {{/producesPlainText}} -{{/producesBytes}} + {{/x-produces-plain-text}} +{{/x-produces-bytes}} {{/vendorExtensions}} - Ok({{{operationId}}}Response::{{#vendorExtensions}}{{x-responseId}}{{/vendorExtensions}} + Ok({{{operationId}}}Response::{{#vendorExtensions}}{{x-response-id}}{{/vendorExtensions}} {{^headers}} (body) {{/headers}} @@ -431,7 +431,7 @@ {{/dataType}} {{^dataType}} Ok( - {{{operationId}}}Response::{{#vendorExtensions}}{{x-responseId}}{{/vendorExtensions}} + {{{operationId}}}Response::{{#vendorExtensions}}{{x-response-id}}{{/vendorExtensions}} {{#headers}} {{#-first}} { diff --git a/modules/openapi-generator/src/main/resources/rust-server/example-client-main.mustache b/modules/openapi-generator/src/main/resources/rust-server/example-client-main.mustache index 2463d942f998..b29b387b1e4c 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/example-client-main.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/example-client-main.mustache @@ -43,9 +43,9 @@ fn main() { {{#operations}} {{#operation}} {{#vendorExtensions}} - {{^noClientExample}} + {{^x-no-client-example}} "{{{operationId}}}", - {{/noClientExample}} + {{/x-no-client-example}} {{/vendorExtensions}} {{/operation}} {{/operations}} @@ -104,22 +104,22 @@ fn main() { {{#operations}} {{#operation}} {{#vendorExtensions}} - {{#noClientExample}} + {{#x-no-client-example}} /* Disabled because there's no example. - {{/noClientExample}} + {{/x-no-client-example}} {{/vendorExtensions}} Some("{{{operationId}}}") => { - let result = rt.block_on(client.{{{vendorExtensions.operation_id}}}( + let result = rt.block_on(client.{{{vendorExtensions.x-operation-id}}}( {{#allParams}} - {{{vendorExtensions.example}}}{{^-last}},{{/-last}} + {{{vendorExtensions.x-example}}}{{^-last}},{{/-last}} {{/allParams}} )); info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has).get().clone()); }, {{#vendorExtensions}} - {{#noClientExample}} + {{#x-no-client-example}} */ - {{/noClientExample}} + {{/x-no-client-example}} {{/vendorExtensions}} {{/operation}} {{/operations}} diff --git a/modules/openapi-generator/src/main/resources/rust-server/example-server-operation.mustache b/modules/openapi-generator/src/main/resources/rust-server/example-server-operation.mustache index 5caf982d9121..ea9a9ea16e84 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/example-server-operation.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/example-server-operation.mustache @@ -1,12 +1,12 @@ {{#summary}} /// {{{summary}}} {{/summary}} - async fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}( + async fn {{#vendorExtensions}}{{{x-operation-id}}}{{/vendorExtensions}}( &self, {{#vendorExtensions}} - {{#callbackParams}} + {{#x-callback-params}} callback_{{.}}: String, - {{/callbackParams}} + {{/x-callback-params}} {{/vendorExtensions}} {{#allParams}} {{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}, @@ -14,6 +14,6 @@ context: &C) -> Result<{{{operationId}}}Response, ApiError> { let context = context.clone(); - info!("{{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}({{#allParams}}{{#vendorExtensions}}{{{formatString}}}{{/vendorExtensions}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) - X-Span-ID: {:?}"{{#allParams}}, {{{paramName}}}{{/allParams}}, context.get().0.clone()); + info!("{{#vendorExtensions}}{{{x-operation-id}}}{{/vendorExtensions}}({{#allParams}}{{#vendorExtensions}}{{{x-format-string}}}{{/vendorExtensions}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) - X-Span-ID: {:?}"{{#allParams}}, {{{paramName}}}{{/allParams}}, context.get().0.clone()); Err("Generic failuare".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 2b5af42776a4..51c94217a6f8 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/lib.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/lib.mustache @@ -36,7 +36,7 @@ pub trait Api { {{#summary}} /// {{{summary}}} {{/summary}} - async fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}( + async fn {{#vendorExtensions}}{{{x-operation-id}}}{{/vendorExtensions}}( &self, {{#allParams}} {{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}, @@ -64,7 +64,7 @@ pub trait ApiNoContext { {{#summary}} /// {{{summary}}} {{/summary}} - async fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}( + async fn {{#vendorExtensions}}{{{x-operation-id}}}{{/vendorExtensions}}( &self, {{#allParams}} {{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}, @@ -107,7 +107,7 @@ impl + Send + Sync, C: Clone + Send + Sync> ApiNoContext for Contex {{#summary}} /// {{{summary}}} {{/summary}} - async fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}( + async fn {{#vendorExtensions}}{{{x-operation-id}}}{{/vendorExtensions}}( &self, {{#allParams}} {{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}, @@ -115,7 +115,7 @@ impl + Send + Sync, C: Clone + Send + Sync> ApiNoContext for Contex ) -> Result<{{{operationId}}}Response, ApiError> { let context = self.context().clone(); - self.api().{{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}({{#allParams}}{{{paramName}}}, {{/allParams}}&context).await + self.api().{{#vendorExtensions}}{{{x-operation-id}}}{{/vendorExtensions}}({{#allParams}}{{{paramName}}}, {{/allParams}}&context).await } {{/operation}} @@ -159,12 +159,12 @@ pub trait CallbackApi { {{#summary}} /// {{{summary}}} {{/summary}} - async fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}( + async fn {{#vendorExtensions}}{{{x-operation-id}}}{{/vendorExtensions}}( &self, {{#vendorExtensions}} - {{#callbackParams}} + {{#x-callback-params}} callback_{{.}}: String, - {{/callbackParams}} + {{/x-callback-params}} {{/vendorExtensions}} {{#allParams}} {{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}, @@ -197,12 +197,12 @@ pub trait CallbackApiNoContext { {{#summary}} /// {{{summary}}} {{/summary}} - async fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}( + async fn {{#vendorExtensions}}{{{x-operation-id}}}{{/vendorExtensions}}( &self, {{#vendorExtensions}} - {{#callbackParams}} + {{#x-callback-params}} callback_{{.}}: String, - {{/callbackParams}} + {{/x-callback-params}} {{/vendorExtensions}} {{#allParams}} {{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}, @@ -250,12 +250,12 @@ impl + Send + Sync, C: Clone + Send + Sync> CallbackApiNoConte {{#summary}} /// {{{summary}}} {{/summary}} - async fn {{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}( + async fn {{#vendorExtensions}}{{{x-operation-id}}}{{/vendorExtensions}}( &self, {{#vendorExtensions}} - {{#callbackParams}} + {{#x-callback-params}} callback_{{.}}: String, - {{/callbackParams}} + {{/x-callback-params}} {{/vendorExtensions}} {{#allParams}} {{{paramName}}}: {{^required}}Option<{{/required}}{{#isListContainer}}&{{/isListContainer}}{{{dataType}}}{{^required}}>{{/required}}, @@ -263,11 +263,11 @@ impl + Send + Sync, C: Clone + Send + Sync> CallbackApiNoConte ) -> Result<{{{operationId}}}Response, ApiError> { let context = self.context().clone(); - self.api().{{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}( + self.api().{{#vendorExtensions}}{{{x-operation-id}}}{{/vendorExtensions}}( {{#vendorExtensions}} - {{#callbackParams}} + {{#x-callback-params}} callback_{{.}}, - {{/callbackParams}} + {{/x-callback-params}} {{/vendorExtensions}} {{#allParams}} {{{paramName}}}, diff --git a/modules/openapi-generator/src/main/resources/rust-server/models.mustache b/modules/openapi-generator/src/main/resources/rust-server/models.mustache index 58618bef5ff8..63bc8e469c87 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/models.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/models.mustache @@ -159,25 +159,25 @@ impl std::convert::TryFrom for header::IntoHeaderVal } } -{{#arrayModelType}}{{#vendorExtensions}}{{#itemXmlName}}// Utility function for wrapping list elements when serializing xml +{{#arrayModelType}}{{#vendorExtensions}}{{#x-item-xml-name}}// Utility function for wrapping list elements when serializing xml #[allow(non_snake_case)] -fn wrap_in_{{{itemXmlName}}}(item: &Vec<{{{arrayModelType}}}>, serializer: S) -> std::result::Result +fn wrap_in_{{{x-item-xml-name}}}(item: &Vec<{{{arrayModelType}}}>, serializer: S) -> std::result::Result where S: serde::ser::Serializer, { - serde_xml_rs::wrap_primitives(item, serializer, "{{{itemXmlName}}}") + serde_xml_rs::wrap_primitives(item, serializer, "{{{x-item-xml-name}}}") } -{{/itemXmlName}} +{{/x-item-xml-name}} {{/vendorExtensions}} {{! vec}} #[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct {{{classname}}}( {{#vendorExtensions}} -{{#itemXmlName}} - #[serde(serialize_with = "wrap_in_{{{itemXmlName}}}")] -{{/itemXmlName}} +{{#x-item-xml-name}} + #[serde(serialize_with = "wrap_in_{{{x-item-xml-name}}}")] +{{/x-item-xml-name}} {{/vendorExtensions}} Vec<{{{arrayModelType}}}> ); @@ -277,9 +277,9 @@ pub struct {{{classname}}} { {{/isEnum}} #[serde(rename = "{{{baseName}}}")] {{#vendorExtensions}} -{{#itemXmlName}} - #[serde(serialize_with = "wrap_in_{{{itemXmlName}}}")] -{{/itemXmlName}} +{{#x-item-xml-name}} + #[serde(serialize_with = "wrap_in_{{{x-item-xml-name}}}")] +{{/x-item-xml-name}} {{/vendorExtensions}} {{#required}} pub {{{name}}}: {{#isNullable}}swagger::Nullable<{{/isNullable}}{{{dataType}}}{{#isNullable}}>{{/isNullable}}, @@ -478,4 +478,4 @@ impl {{{classname}}} { } {{/usesXml}} {{/model}} -{{/models}} +{{/models}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/rust-server/response.mustache b/modules/openapi-generator/src/main/resources/rust-server/response.mustache index 3e4bc94494a3..ca2dbe7a6a6c 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/response.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/response.mustache @@ -1,13 +1,13 @@ #[derive(Debug, PartialEq)] -{{#vendorExtensions.x-mustUseResponse}} +{{#vendorExtensions.x-must-use-response}} #[must_use] -{{/vendorExtensions.x-mustUseResponse}} +{{/vendorExtensions.x-must-use-response}} pub enum {{{operationId}}}Response { {{#responses}} {{#message}} /// {{{message}}}{{/message}} {{#vendorExtensions}} - {{{x-responseId}}} + {{{x-response-id}}} {{/vendorExtensions}} {{^dataType}} {{#hasHeaders}} @@ -17,23 +17,23 @@ pub enum {{{operationId}}}Response { {{#dataType}} {{^hasHeaders}} {{#vendorExtensions}} - {{#producesPlainText}} + {{#x-produces-plain-text}} (String) - {{/producesPlainText}} - {{^producesPlainText}} + {{/x-produces-plain-text}} + {{^x-produces-plain-text}} ({{{dataType}}}) - {{/producesPlainText}} + {{/x-produces-plain-text}} {{/vendorExtensions}} {{/hasHeaders}} {{#hasHeaders}} { {{#vendorExtensions}} - {{#producesPlainText}} + {{#x-produces-plain-text}} body: String, - {{/producesPlainText}} - {{^producesPlainText}} + {{/x-produces-plain-text}} + {{^x-produces-plain-text}} body: {{{dataType}}}, - {{/producesPlainText}} + {{/x-produces-plain-text}} {{/vendorExtensions}} {{/hasHeaders}} {{/dataType}} diff --git a/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache b/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache index f3306f76a874..8243908defd7 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/server-operation.mustache @@ -38,7 +38,7 @@ {{/hasAuthMethods}} {{#vendorExtensions}} - {{#consumesMultipart}} + {{#x-consumes-multipart}} let boundary = match swagger::multipart::boundary(&headers) { Some(boundary) => boundary.to_string(), None => return Ok(Response::builder() @@ -47,8 +47,8 @@ .expect("Unable to create Bad Request response for incorrect boundary")), }; - {{/consumesMultipart}} - {{#hasPathParams}} + {{/x-consumes-multipart}} + {{#x-has-path-params}} // Path parameters let path: &str = &uri.path().to_string(); let path_params = @@ -58,7 +58,7 @@ panic!("Path {} matched RE {{{x-path-id}}} in set but failed match against \"{}\"", path, paths::REGEX_{{{x-path-id}}}.as_str()) ); - {{/hasPathParams}} + {{/x-has-path-params}} {{/vendorExtensions}} {{#pathParams}} let param_{{{paramName}}} = match percent_encoding::percent_decode(path_params["{{{baseName}}}"].as_bytes()).decode_utf8() { @@ -77,9 +77,9 @@ {{/pathParams}} {{#vendorExtensions}} - {{#callbackParams}} + {{#x-callback-params}} let callback_{{.}} = path_params["{{{.}}}"].to_string(); - {{/callbackParams}} + {{/x-callback-params}} {{/vendorExtensions}} {{#headerParams}} {{#-first}} @@ -163,7 +163,7 @@ {{/-last}} {{/queryParams}} {{#vendorExtensions}} -{{^consumesMultipart}} +{{^x-consumes-multipart}} {{#bodyParams}} {{#-first}} // Body parameters (note that non-required body parameters will ignore garbage @@ -173,17 +173,17 @@ match result { Ok(body) => { {{#vendorExtensions}} -{{^consumesPlainText}} +{{^x-consumes-plain-text}} let mut unused_elements = Vec::new(); -{{/consumesPlainText}} +{{/x-consumes-plain-text}} let param_{{{paramName}}}: Option<{{{dataType}}}> = if !body.is_empty() { -{{#consumesXml}} +{{#x-consumes-xml}} let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body); -{{/consumesXml}} -{{#consumesJson}} +{{/x-consumes-xml}} +{{#x-consumes-json}} let deserializer = &mut serde_json::Deserializer::from_slice(&*body); -{{/consumesJson}} -{{^consumesPlainText}} +{{/x-consumes-json}} +{{^x-consumes-plain-text}} match serde_ignored::deserialize(deserializer, |path| { warn!("Ignoring unknown field in body: {}", path); unused_elements.push(path.to_string()); @@ -199,8 +199,8 @@ Err(_) => None, {{/required}} } -{{/consumesPlainText}} -{{#consumesPlainText}} +{{/x-consumes-plain-text}} +{{#x-consumes-plain-text}} {{#isByteArray}} Some(swagger::ByteArray(body.to_vec())) {{/isByteArray}} @@ -213,7 +213,7 @@ .expect("Unable to create Bad Request response for invalid body parameter {{{baseName}}} due to UTF-8")), } {{/isString}} -{{/consumesPlainText}} +{{/x-consumes-plain-text}} {{/vendorExtensions}} } else { None @@ -232,8 +232,8 @@ {{/-last}} {{/bodyParams}} -{{/consumesMultipart}} -{{#consumesMultipart}} +{{/x-consumes-multipart}} +{{#x-consumes-multipart}} {{^bodyParams}} {{#vendorExtensions}} // Form Body parameters (note that non-required body parameters will ignore garbage @@ -306,25 +306,25 @@ {{/formParams}} {{/vendorExtensions}} {{/bodyParams}} -{{/consumesMultipart}} -{{^consumesMultipartRelated}} -{{^consumesMultipart}} +{{/x-consumes-multipart}} +{{^x-consumes-multipart-related}} +{{^x-consumes-multipart}} {{^bodyParams}} {{#vendorExtensions}} {{#formParams}} {{#-first}} // Form parameters {{/-first}} - let param_{{{paramName}}} = {{^isContainer}}{{#vendorExtensions}}{{{example}}};{{/vendorExtensions}}{{/isContainer}}{{#isListContainer}}{{#required}}Vec::new();{{/required}}{{^required}}None;{{/required}}{{/isListContainer}}{{#isMapContainer}}None;{{/isMapContainer}} + let param_{{{paramName}}} = {{^isContainer}}{{#vendorExtensions}}{{{x-example}}};{{/vendorExtensions}}{{/isContainer}}{{#isListContainer}}{{#required}}Vec::new();{{/required}}{{^required}}None;{{/required}}{{/isListContainer}}{{#isMapContainer}}None;{{/isMapContainer}} {{#-last}} {{/-last}} {{/formParams}} {{/vendorExtensions}} {{/bodyParams}} -{{/consumesMultipart}} -{{/consumesMultipartRelated}} -{{#consumesMultipartRelated}} +{{/x-consumes-multipart}} +{{/x-consumes-multipart-related}} +{{#x-consumes-multipart-related}} // Body parameters (note that non-required body parameters will ignore garbage // values, rather than causing a 400 response). Produce warning header and logs for // any unused fields. @@ -432,13 +432,13 @@ {{/-last}} {{/formParams}} -{{/consumesMultipartRelated}} +{{/x-consumes-multipart-related}} {{/vendorExtensions}} - let result = api_impl.{{#vendorExtensions}}{{{operation_id}}}{{/vendorExtensions}}( + let result = api_impl.{{#vendorExtensions}}{{{x-operation-id}}}{{/vendorExtensions}}( {{#vendorExtensions}} - {{#callbackParams}} + {{#x-callback-params}} callback_{{.}}, - {{/callbackParams}} + {{/x-callback-params}} {{/vendorExtensions}} {{#allParams}} param_{{{paramName}}}{{#isListContainer}}.as_ref(){{/isListContainer}}, @@ -453,7 +453,7 @@ {{#bodyParams}} {{#vendorExtensions}} -{{^consumesPlainText}} +{{^x-consumes-plain-text}} if !unused_elements.is_empty() { response.headers_mut().insert( HeaderName::from_static("warning"), @@ -461,13 +461,13 @@ .expect("Unable to create Warning header value")); } -{{/consumesPlainText}} +{{/x-consumes-plain-text}} {{/vendorExtensions}} {{/bodyParams}} match result { Ok(rsp) => match rsp { {{#responses}} - {{{operationId}}}Response::{{#vendorExtensions}}{{x-responseId}}{{/vendorExtensions}} + {{{operationId}}}Response::{{#vendorExtensions}}{{x-response-id}}{{/vendorExtensions}} {{#dataType}} {{^headers}} (body) @@ -520,35 +520,35 @@ {{#vendorExtensions}} response.headers_mut().insert( CONTENT_TYPE, - HeaderValue::from_str("{{{mimeType}}}") - .expect("Unable to create Content-Type header for {{{uppercase_operation_id}}}_{{x-uppercaseResponseId}}")); + HeaderValue::from_str("{{{x-mime-type}}}") + .expect("Unable to create Content-Type header for {{{x-uppercase-operation-id}}}_{{x-uppercase-response-id}}")); {{/vendorExtensions}} {{/dataType}} {{/-first}} {{/produces}} {{#dataType}} {{#vendorExtensions}} -{{#producesXml}} -{{^has_namespace}} +{{#x-produces-xml}} +{{^x-has-namespace}} let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize"); -{{/has_namespace}} -{{#has_namespace}} +{{/x-has-namespace}} +{{#x-has-namespace}} let mut namespaces = std::collections::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}} +{{/x-has-namespace}} +{{/x-produces-xml}} +{{#x-produces-json}} let body = serde_json::to_string(&body).expect("impossible to fail to serialize"); -{{/producesJson}} -{{#producesBytes}} +{{/x-produces-json}} +{{#x-produces-bytes}} let body = body.0; -{{/producesBytes}} -{{#producesPlainText}} +{{/x-produces-bytes}} +{{#x-produces-plain-text}} let body = body; -{{/producesPlainText}} +{{/x-produces-plain-text}} {{/vendorExtensions}} *response.body_mut() = Body::from(body); {{/dataType}} @@ -565,20 +565,20 @@ Ok(response) {{#vendorExtensions}} -{{^consumesMultipart}} +{{^x-consumes-multipart}} {{^bodyParams}} {{#vendorExtensions}} -{{#consumesMultipartRelated}} +{{#x-consumes-multipart-related}} }, Err(e) => Ok(Response::builder() .status(StatusCode::BAD_REQUEST) .body(Body::from(format!("Couldn't read body parameter {{{baseName}}}: {}", e))) .expect("Unable to create Bad Request response due to unable to read body parameter {{{baseName}}}")), } -{{/consumesMultipartRelated}} +{{/x-consumes-multipart-related}} {{/vendorExtensions}} {{/bodyParams}} -{{/consumesMultipart}} +{{/x-consumes-multipart}} {{/vendorExtensions}} {{#bodyParams}} {{#-first}} @@ -591,7 +591,7 @@ {{/-first}} {{/bodyParams}} {{#vendorExtensions}} -{{#consumesMultipart}} +{{#x-consumes-multipart}} {{^bodyParams}} {{#vendorExtensions}} }, @@ -602,6 +602,6 @@ } {{/vendorExtensions}} {{/bodyParams}} -{{/consumesMultipart}} +{{/x-consumes-multipart}} {{/vendorExtensions}} }, diff --git a/modules/openapi-generator/src/main/resources/rust/model.mustache b/modules/openapi-generator/src/main/resources/rust/model.mustache index dab429fdeb37..c845b7d2cf8a 100644 --- a/modules/openapi-generator/src/main/resources/rust/model.mustache +++ b/modules/openapi-generator/src/main/resources/rust/model.mustache @@ -24,7 +24,7 @@ pub enum {{classname}} { #[serde(tag = "{{{vendorExtensions.x-tag-name}}}")] pub enum {{classname}} { {{#vendorExtensions}} - {{#mappedModels}} + {{#x-mapped-models}} #[serde(rename="{{mappingName}}")] {{modelName}} { {{#vars}} @@ -35,7 +35,7 @@ pub enum {{classname}} { {{{name}}}: {{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{^required}}Option<{{/required}}{{#isEnum}}{{{enumName}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^required}}>{{/required}}, {{/vars}} }, - {{/mappedModels}} + {{/x-mapped-models}} {{/vendorExtensions}} } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractIntegrationTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractIntegrationTest.java index fce15f7b2e73..81c4978e7873 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractIntegrationTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractIntegrationTest.java @@ -38,14 +38,14 @@ public abstract class AbstractIntegrationTest { protected Boolean generateMetadata = true; - protected Map systemPropertyOverrides = new HashMap<>(); + protected Map globalPropertyOverrides = new HashMap<>(); // @wing328: ignore for the time being until we fix the error with the integration test @Test(enabled = false) public void generatesCorrectDirectoryStructure() throws IOException { DefaultGenerator codeGen = new DefaultGenerator(); codeGen.setGenerateMetadata(generateMetadata); - for (Map.Entry propertyOverride : systemPropertyOverrides.entrySet()) { + for (Map.Entry propertyOverride : globalPropertyOverrides.entrySet()) { codeGen.setGeneratorPropertyDefault(propertyOverride.getKey(), propertyOverride.getValue()); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/CodegenConfiguratorTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/CodegenConfiguratorTest.java index 7cd8aa957989..7055bff46595 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/CodegenConfiguratorTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/CodegenConfiguratorTest.java @@ -19,7 +19,6 @@ import org.openapitools.codegen.ClientOptInput; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenConstants; -import org.openapitools.codegen.DefaultGenerator; import org.testng.annotations.Test; import java.io.File; @@ -66,7 +65,7 @@ public void shouldSetConfiglProperties() throws IOException { .addImportMapping("one", "two") .addInstantiationType("three", "four") .addLanguageSpecificPrimitive("five") - .addSystemProperty("six", "seven") + .addGlobalProperty("six", "seven") .addTypeMapping("eight", "nine") .setApiPackage("test-api") .setArtifactId("test-artifactId") diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalDataTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalDataTest.java index 9f8f969b49a2..5a10f3d219d0 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalDataTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/OneOfImplementorAdditionalDataTest.java @@ -53,7 +53,7 @@ public void testGeneralUsage() { o.addToImplementor(cc, implModel, implModelImports, false); // make sure all the additions were done correctly - Assert.assertEquals(implModel.getVendorExtensions().get("implements"), new ArrayList(){{add(oneOfModel.classname);}}); + Assert.assertEquals(implModel.getVendorExtensions().get("x-implements"), new ArrayList(){{add(oneOfModel.classname);}}); Assert.assertEquals(implModelImports, interfaceModelImports); Assert.assertEquals(implModel.vars, new ArrayList(){{add(cp3); add(cp1);}}); Assert.assertTrue(implModel.vars.get(0).hasMore); diff --git a/modules/openapi-generator/src/test/resources/sampleConfig.json b/modules/openapi-generator/src/test/resources/sampleConfig.json index 17dd8ab86696..1c59ab4e5461 100644 --- a/modules/openapi-generator/src/test/resources/sampleConfig.json +++ b/modules/openapi-generator/src/test/resources/sampleConfig.json @@ -14,7 +14,7 @@ "artifactVersion" : "1.2.3", "library" : "jersey2", "ignoreFileOverride": "/path/to/override/.openapi-generator-ignore", - "systemProperties" : { + "globalProperties" : { "systemProp1" : "value1" }, "instantiationTypes" : { diff --git a/pom.xml b/pom.xml index 20562772d132..9a6a76e3cd77 100644 --- a/pom.xml +++ b/pom.xml @@ -703,6 +703,18 @@ samples/client/petstore/java/jersey2-java8 + + java-client-openapi3-jersey2-java8 + + + env + java + + + + samples/openapi3/client/petstore/java/jersey2-java8 + + java-client-okhttp-gson @@ -1252,6 +1264,7 @@ samples/client/petstore/java/feign10x samples/client/petstore/java/jersey1 samples/client/petstore/java/jersey2-java8 + samples/openapi3/client/petstore/java/jersey2-java8 samples/client/petstore/java/okhttp-gson samples/client/petstore/java/retrofit2 samples/client/petstore/java/retrofit2rx diff --git a/samples/client/petstore/apex/.openapi-generator/FILES b/samples/client/petstore/apex/.openapi-generator/FILES index 11fd3bc07bbd..96cebdaa72fa 100644 --- a/samples/client/petstore/apex/.openapi-generator/FILES +++ b/samples/client/petstore/apex/.openapi-generator/FILES @@ -8,6 +8,14 @@ force-app/main/default/classes/OASCategory.cls force-app/main/default/classes/OASCategory.cls-meta.xml force-app/main/default/classes/OASClient.cls force-app/main/default/classes/OASClient.cls-meta.xml +force-app/main/default/classes/OASInlineObject.cls +force-app/main/default/classes/OASInlineObject.cls-meta.xml +force-app/main/default/classes/OASInlineObject1.cls +force-app/main/default/classes/OASInlineObject1.cls-meta.xml +force-app/main/default/classes/OASInlineObject1Test.cls +force-app/main/default/classes/OASInlineObject1Test.cls-meta.xml +force-app/main/default/classes/OASInlineObjectTest.cls +force-app/main/default/classes/OASInlineObjectTest.cls-meta.xml force-app/main/default/classes/OASOrder.cls force-app/main/default/classes/OASOrder.cls-meta.xml force-app/main/default/classes/OASPet.cls diff --git a/samples/client/petstore/apex/README.md b/samples/client/petstore/apex/README.md index 60da087e3fbe..3a22819780c8 100644 --- a/samples/client/petstore/apex/README.md +++ b/samples/client/petstore/apex/README.md @@ -91,6 +91,8 @@ Class | Method | HTTP request | Description - [OASApiResponse](OASApiResponse.md) - [OASCategory](OASCategory.md) + - [OASInlineObject](OASInlineObject.md) + - [OASInlineObject1](OASInlineObject1.md) - [OASOrder](OASOrder.md) - [OASPet](OASPet.md) - [OASTag](OASTag.md) diff --git a/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObject.cls b/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObject.cls new file mode 100644 index 000000000000..904594a5573c --- /dev/null +++ b/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObject.cls @@ -0,0 +1,52 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by the OAS code generator program. + * https://github.com/OpenAPITools/openapi-generator + * Do not edit the class manually. + */ + +/** + * OASInlineObject + */ +public class OASInlineObject { + /** + * Updated name of the pet + * @return name + */ + public String name { get; set; } + + /** + * Updated status of the pet + * @return status + */ + public String status { get; set; } + + public static OASInlineObject getExample() { + OASInlineObject inlineObject = new OASInlineObject(); + inlineObject.name = ''; + inlineObject.status = ''; + return inlineObject; + } + + public Boolean equals(Object obj) { + if (obj instanceof OASInlineObject) { + OASInlineObject inlineObject = (OASInlineObject) obj; + return this.name == inlineObject.name + && this.status == inlineObject.status; + } + return false; + } + + public Integer hashCode() { + Integer hashCode = 43; + hashCode = (17 * hashCode) + (name == null ? 0 : System.hashCode(name)); + hashCode = (17 * hashCode) + (status == null ? 0 : System.hashCode(status)); + return hashCode; + } +} + diff --git a/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObject.cls-meta.xml b/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObject.cls-meta.xml new file mode 100644 index 000000000000..fec71a26693f --- /dev/null +++ b/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObject.cls-meta.xml @@ -0,0 +1,5 @@ + + + 42.0 + Active + diff --git a/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObject1.cls b/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObject1.cls new file mode 100644 index 000000000000..f55bd1c5712e --- /dev/null +++ b/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObject1.cls @@ -0,0 +1,52 @@ +/* + * 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. + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by the OAS code generator program. + * https://github.com/OpenAPITools/openapi-generator + * Do not edit the class manually. + */ + +/** + * OASInlineObject1 + */ +public class OASInlineObject1 { + /** + * Additional data to pass to server + * @return additionalMetadata + */ + public String additionalMetadata { get; set; } + + /** + * file to upload + * @return file + */ + public Blob file { get; set; } + + public static OASInlineObject1 getExample() { + OASInlineObject1 inlineObject1 = new OASInlineObject1(); + inlineObject1.additionalMetadata = ''; + inlineObject1.file = EncodingUtil.base64Decode(VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2cu); + return inlineObject1; + } + + public Boolean equals(Object obj) { + if (obj instanceof OASInlineObject1) { + OASInlineObject1 inlineObject1 = (OASInlineObject1) obj; + return this.additionalMetadata == inlineObject1.additionalMetadata + && this.file == inlineObject1.file; + } + return false; + } + + public Integer hashCode() { + Integer hashCode = 43; + hashCode = (17 * hashCode) + (additionalMetadata == null ? 0 : System.hashCode(additionalMetadata)); + hashCode = (17 * hashCode) + (file == null ? 0 : System.hashCode(file)); + return hashCode; + } +} + diff --git a/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObject1.cls-meta.xml b/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObject1.cls-meta.xml new file mode 100644 index 000000000000..fec71a26693f --- /dev/null +++ b/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObject1.cls-meta.xml @@ -0,0 +1,5 @@ + + + 42.0 + Active + diff --git a/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObject1Test.cls b/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObject1Test.cls new file mode 100644 index 000000000000..31c06fadba9d --- /dev/null +++ b/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObject1Test.cls @@ -0,0 +1,71 @@ +@isTest +private class OASInlineObject1Test { + @isTest + private static void equalsSameInstance() { + OASInlineObject1 inlineObject11 = OASInlineObject1.getExample(); + OASInlineObject1 inlineObject12 = inlineObject11; + OASInlineObject1 inlineObject13 = new OASInlineObject1(); + OASInlineObject1 inlineObject14 = inlineObject13; + + System.assert(inlineObject11.equals(inlineObject12)); + System.assert(inlineObject12.equals(inlineObject11)); + System.assert(inlineObject11.equals(inlineObject11)); + System.assert(inlineObject13.equals(inlineObject14)); + System.assert(inlineObject14.equals(inlineObject13)); + System.assert(inlineObject13.equals(inlineObject13)); + } + + @isTest + private static void equalsIdenticalInstance() { + OASInlineObject1 inlineObject11 = OASInlineObject1.getExample(); + OASInlineObject1 inlineObject12 = OASInlineObject1.getExample(); + OASInlineObject1 inlineObject13 = new OASInlineObject1(); + OASInlineObject1 inlineObject14 = new OASInlineObject1(); + + System.assert(inlineObject11.equals(inlineObject12)); + System.assert(inlineObject12.equals(inlineObject11)); + System.assert(inlineObject13.equals(inlineObject14)); + System.assert(inlineObject14.equals(inlineObject13)); + } + + @isTest + private static void notEqualsDifferentType() { + OASInlineObject1 inlineObject11 = OASInlineObject1.getExample(); + OASInlineObject1 inlineObject12 = new OASInlineObject1(); + + System.assertEquals(false, inlineObject11.equals('foo')); + System.assertEquals(false, inlineObject12.equals('foo')); + } + + @isTest + private static void notEqualsNull() { + OASInlineObject1 inlineObject11 = OASInlineObject1.getExample(); + OASInlineObject1 inlineObject12 = new OASInlineObject1(); + OASInlineObject1 inlineObject13; + + System.assertEquals(false, inlineObject11.equals(inlineObject13)); + System.assertEquals(false, inlineObject12.equals(inlineObject13)); + } + + @isTest + private static void consistentHashCodeValue() { + OASInlineObject1 inlineObject11 = OASInlineObject1.getExample(); + OASInlineObject1 inlineObject12 = new OASInlineObject1(); + + System.assertEquals(inlineObject11.hashCode(), inlineObject11.hashCode()); + System.assertEquals(inlineObject12.hashCode(), inlineObject12.hashCode()); + } + + @isTest + private static void equalInstancesHaveSameHashCode() { + OASInlineObject1 inlineObject11 = OASInlineObject1.getExample(); + OASInlineObject1 inlineObject12 = OASInlineObject1.getExample(); + OASInlineObject1 inlineObject13 = new OASInlineObject1(); + OASInlineObject1 inlineObject14 = new OASInlineObject1(); + + System.assert(inlineObject11.equals(inlineObject12)); + System.assert(inlineObject13.equals(inlineObject14)); + System.assertEquals(inlineObject11.hashCode(), inlineObject12.hashCode()); + System.assertEquals(inlineObject13.hashCode(), inlineObject14.hashCode()); + } +} diff --git a/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObject1Test.cls-meta.xml b/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObject1Test.cls-meta.xml new file mode 100644 index 000000000000..fec71a26693f --- /dev/null +++ b/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObject1Test.cls-meta.xml @@ -0,0 +1,5 @@ + + + 42.0 + Active + diff --git a/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObjectTest.cls b/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObjectTest.cls new file mode 100644 index 000000000000..a93b4a228e91 --- /dev/null +++ b/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObjectTest.cls @@ -0,0 +1,71 @@ +@isTest +private class OASInlineObjectTest { + @isTest + private static void equalsSameInstance() { + OASInlineObject inlineObject1 = OASInlineObject.getExample(); + OASInlineObject inlineObject2 = inlineObject1; + OASInlineObject inlineObject3 = new OASInlineObject(); + OASInlineObject inlineObject4 = inlineObject3; + + System.assert(inlineObject1.equals(inlineObject2)); + System.assert(inlineObject2.equals(inlineObject1)); + System.assert(inlineObject1.equals(inlineObject1)); + System.assert(inlineObject3.equals(inlineObject4)); + System.assert(inlineObject4.equals(inlineObject3)); + System.assert(inlineObject3.equals(inlineObject3)); + } + + @isTest + private static void equalsIdenticalInstance() { + OASInlineObject inlineObject1 = OASInlineObject.getExample(); + OASInlineObject inlineObject2 = OASInlineObject.getExample(); + OASInlineObject inlineObject3 = new OASInlineObject(); + OASInlineObject inlineObject4 = new OASInlineObject(); + + System.assert(inlineObject1.equals(inlineObject2)); + System.assert(inlineObject2.equals(inlineObject1)); + System.assert(inlineObject3.equals(inlineObject4)); + System.assert(inlineObject4.equals(inlineObject3)); + } + + @isTest + private static void notEqualsDifferentType() { + OASInlineObject inlineObject1 = OASInlineObject.getExample(); + OASInlineObject inlineObject2 = new OASInlineObject(); + + System.assertEquals(false, inlineObject1.equals('foo')); + System.assertEquals(false, inlineObject2.equals('foo')); + } + + @isTest + private static void notEqualsNull() { + OASInlineObject inlineObject1 = OASInlineObject.getExample(); + OASInlineObject inlineObject2 = new OASInlineObject(); + OASInlineObject inlineObject3; + + System.assertEquals(false, inlineObject1.equals(inlineObject3)); + System.assertEquals(false, inlineObject2.equals(inlineObject3)); + } + + @isTest + private static void consistentHashCodeValue() { + OASInlineObject inlineObject1 = OASInlineObject.getExample(); + OASInlineObject inlineObject2 = new OASInlineObject(); + + System.assertEquals(inlineObject1.hashCode(), inlineObject1.hashCode()); + System.assertEquals(inlineObject2.hashCode(), inlineObject2.hashCode()); + } + + @isTest + private static void equalInstancesHaveSameHashCode() { + OASInlineObject inlineObject1 = OASInlineObject.getExample(); + OASInlineObject inlineObject2 = OASInlineObject.getExample(); + OASInlineObject inlineObject3 = new OASInlineObject(); + OASInlineObject inlineObject4 = new OASInlineObject(); + + System.assert(inlineObject1.equals(inlineObject2)); + System.assert(inlineObject3.equals(inlineObject4)); + System.assertEquals(inlineObject1.hashCode(), inlineObject2.hashCode()); + System.assertEquals(inlineObject3.hashCode(), inlineObject4.hashCode()); + } +} diff --git a/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObjectTest.cls-meta.xml b/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObjectTest.cls-meta.xml new file mode 100644 index 000000000000..fec71a26693f --- /dev/null +++ b/samples/client/petstore/apex/force-app/main/default/classes/OASInlineObjectTest.cls-meta.xml @@ -0,0 +1,5 @@ + + + 42.0 + Active + diff --git a/samples/client/petstore/cpp-ue4/.openapi-generator/FILES b/samples/client/petstore/cpp-ue4/.openapi-generator/FILES new file mode 100644 index 000000000000..23079276740b --- /dev/null +++ b/samples/client/petstore/cpp-ue4/.openapi-generator/FILES @@ -0,0 +1,31 @@ +OpenAPI.Build.cs +Private\OpenAPIApiResponse.cpp +Private\OpenAPIBaseModel.cpp +Private\OpenAPICategory.cpp +Private\OpenAPIHelpers.cpp +Private\OpenAPIModule.cpp +Private\OpenAPIModule.h +Private\OpenAPIOrder.cpp +Private\OpenAPIPet.cpp +Private\OpenAPIPetApi.cpp +Private\OpenAPIPetApiOperations.cpp +Private\OpenAPIStoreApi.cpp +Private\OpenAPIStoreApiOperations.cpp +Private\OpenAPITag.cpp +Private\OpenAPIUser.cpp +Private\OpenAPIUserApi.cpp +Private\OpenAPIUserApiOperations.cpp +Public\OpenAPIApiResponse.h +Public\OpenAPIBaseModel.h +Public\OpenAPICategory.h +Public\OpenAPIHelpers.h +Public\OpenAPIOrder.h +Public\OpenAPIPet.h +Public\OpenAPIPetApi.h +Public\OpenAPIPetApiOperations.h +Public\OpenAPIStoreApi.h +Public\OpenAPIStoreApiOperations.h +Public\OpenAPITag.h +Public\OpenAPIUser.h +Public\OpenAPIUserApi.h +Public\OpenAPIUserApiOperations.h diff --git a/samples/client/petstore/cpp-ue4/OpenAPIApiResponse.cpp b/samples/client/petstore/cpp-ue4/Private/OpenAPIApiResponse.cpp similarity index 100% rename from samples/client/petstore/cpp-ue4/OpenAPIApiResponse.cpp rename to samples/client/petstore/cpp-ue4/Private/OpenAPIApiResponse.cpp diff --git a/samples/client/petstore/cpp-ue4/OpenAPICategory.cpp b/samples/client/petstore/cpp-ue4/Private/OpenAPICategory.cpp similarity index 100% rename from samples/client/petstore/cpp-ue4/OpenAPICategory.cpp rename to samples/client/petstore/cpp-ue4/Private/OpenAPICategory.cpp diff --git a/samples/client/petstore/cpp-ue4/OpenAPIOrder.cpp b/samples/client/petstore/cpp-ue4/Private/OpenAPIOrder.cpp similarity index 93% rename from samples/client/petstore/cpp-ue4/OpenAPIOrder.cpp rename to samples/client/petstore/cpp-ue4/Private/OpenAPIOrder.cpp index cd8e524b0496..f125c7ae40b1 100644 --- a/samples/client/petstore/cpp-ue4/OpenAPIOrder.cpp +++ b/samples/client/petstore/cpp-ue4/Private/OpenAPIOrder.cpp @@ -51,7 +51,10 @@ inline bool TryGetJsonValue(const TSharedPtr& JsonValue, OpenAPIOrde FString TmpValue; if (JsonValue->TryGetString(TmpValue)) { - static TMap StringToEnum = { }; + static TMap StringToEnum = { + { TEXT("placed"), OpenAPIOrder::StatusEnum::Placed }, + { TEXT("approved"), OpenAPIOrder::StatusEnum::Approved }, + { TEXT("delivered"), OpenAPIOrder::StatusEnum::Delivered }, }; const auto Found = StringToEnum.Find(TmpValue); if(Found) diff --git a/samples/client/petstore/cpp-ue4/OpenAPIPet.cpp b/samples/client/petstore/cpp-ue4/Private/OpenAPIPet.cpp similarity index 94% rename from samples/client/petstore/cpp-ue4/OpenAPIPet.cpp rename to samples/client/petstore/cpp-ue4/Private/OpenAPIPet.cpp index d1d1a690d6c5..b36df84ae6b7 100644 --- a/samples/client/petstore/cpp-ue4/OpenAPIPet.cpp +++ b/samples/client/petstore/cpp-ue4/Private/OpenAPIPet.cpp @@ -51,7 +51,10 @@ inline bool TryGetJsonValue(const TSharedPtr& JsonValue, OpenAPIPet: FString TmpValue; if (JsonValue->TryGetString(TmpValue)) { - static TMap StringToEnum = { }; + static TMap StringToEnum = { + { TEXT("available"), OpenAPIPet::StatusEnum::Available }, + { TEXT("pending"), OpenAPIPet::StatusEnum::Pending }, + { TEXT("sold"), OpenAPIPet::StatusEnum::Sold }, }; const auto Found = StringToEnum.Find(TmpValue); if(Found) diff --git a/samples/client/petstore/cpp-ue4/Private/OpenAPIPetApiOperations.cpp b/samples/client/petstore/cpp-ue4/Private/OpenAPIPetApiOperations.cpp index 8ca1ec220fd5..4df6f9160880 100644 --- a/samples/client/petstore/cpp-ue4/Private/OpenAPIPetApiOperations.cpp +++ b/samples/client/petstore/cpp-ue4/Private/OpenAPIPetApiOperations.cpp @@ -43,9 +43,7 @@ void OpenAPIPetApi::AddPetRequest::SetupHttpRequest(const TSharedRef::Create(&JsonBody); - Writer->WriteObjectStart(); - Writer->WriteIdentifierPrefix(TEXT("body")); WriteJsonValue(Writer, Body); - Writer->WriteObjectEnd(); + WriteJsonValue(Writer, Body); Writer->Close(); HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json; charset=utf-8")); @@ -366,9 +364,7 @@ void OpenAPIPetApi::UpdatePetRequest::SetupHttpRequest(const TSharedRef::Create(&JsonBody); - Writer->WriteObjectStart(); - Writer->WriteIdentifierPrefix(TEXT("body")); WriteJsonValue(Writer, Body); - Writer->WriteObjectEnd(); + WriteJsonValue(Writer, Body); Writer->Close(); HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json; charset=utf-8")); @@ -517,7 +513,6 @@ void OpenAPIPetApi::UploadFileRequest::SetupHttpRequest(const TSharedRef::Create(&JsonBody); - Writer->WriteObjectStart(); - Writer->WriteIdentifierPrefix(TEXT("body")); WriteJsonValue(Writer, Body); - Writer->WriteObjectEnd(); + WriteJsonValue(Writer, Body); Writer->Close(); HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json; charset=utf-8")); diff --git a/samples/client/petstore/cpp-ue4/OpenAPITag.cpp b/samples/client/petstore/cpp-ue4/Private/OpenAPITag.cpp similarity index 100% rename from samples/client/petstore/cpp-ue4/OpenAPITag.cpp rename to samples/client/petstore/cpp-ue4/Private/OpenAPITag.cpp diff --git a/samples/client/petstore/cpp-ue4/OpenAPIUser.cpp b/samples/client/petstore/cpp-ue4/Private/OpenAPIUser.cpp similarity index 100% rename from samples/client/petstore/cpp-ue4/OpenAPIUser.cpp rename to samples/client/petstore/cpp-ue4/Private/OpenAPIUser.cpp diff --git a/samples/client/petstore/cpp-ue4/Private/OpenAPIUserApiOperations.cpp b/samples/client/petstore/cpp-ue4/Private/OpenAPIUserApiOperations.cpp index c31afe5ba13e..97562911f703 100644 --- a/samples/client/petstore/cpp-ue4/Private/OpenAPIUserApiOperations.cpp +++ b/samples/client/petstore/cpp-ue4/Private/OpenAPIUserApiOperations.cpp @@ -43,9 +43,7 @@ void OpenAPIUserApi::CreateUserRequest::SetupHttpRequest(const TSharedRef::Create(&JsonBody); - Writer->WriteObjectStart(); - Writer->WriteIdentifierPrefix(TEXT("body")); WriteJsonValue(Writer, Body); - Writer->WriteObjectEnd(); + WriteJsonValue(Writer, Body); Writer->Close(); HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json; charset=utf-8")); @@ -102,9 +100,7 @@ void OpenAPIUserApi::CreateUsersWithArrayInputRequest::SetupHttpRequest(const TS FString JsonBody; JsonWriter Writer = TJsonWriterFactory<>::Create(&JsonBody); - Writer->WriteObjectStart(); - Writer->WriteIdentifierPrefix(TEXT("body")); WriteJsonValue(Writer, Body); - Writer->WriteObjectEnd(); + WriteJsonValue(Writer, Body); Writer->Close(); HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json; charset=utf-8")); @@ -161,9 +157,7 @@ void OpenAPIUserApi::CreateUsersWithListInputRequest::SetupHttpRequest(const TSh FString JsonBody; JsonWriter Writer = TJsonWriterFactory<>::Create(&JsonBody); - Writer->WriteObjectStart(); - Writer->WriteIdentifierPrefix(TEXT("body")); WriteJsonValue(Writer, Body); - Writer->WriteObjectEnd(); + WriteJsonValue(Writer, Body); Writer->Close(); HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json; charset=utf-8")); @@ -433,9 +427,7 @@ void OpenAPIUserApi::UpdateUserRequest::SetupHttpRequest(const TSharedRef::Create(&JsonBody); - Writer->WriteObjectStart(); - Writer->WriteIdentifierPrefix(TEXT("body")); WriteJsonValue(Writer, Body); - Writer->WriteObjectEnd(); + WriteJsonValue(Writer, Body); Writer->Close(); HttpRequest->SetHeader(TEXT("Content-Type"), TEXT("application/json; charset=utf-8")); diff --git a/samples/client/petstore/cpp-ue4/OpenAPIApiResponse.h b/samples/client/petstore/cpp-ue4/Public/OpenAPIApiResponse.h similarity index 100% rename from samples/client/petstore/cpp-ue4/OpenAPIApiResponse.h rename to samples/client/petstore/cpp-ue4/Public/OpenAPIApiResponse.h diff --git a/samples/client/petstore/cpp-ue4/OpenAPICategory.h b/samples/client/petstore/cpp-ue4/Public/OpenAPICategory.h similarity index 100% rename from samples/client/petstore/cpp-ue4/OpenAPICategory.h rename to samples/client/petstore/cpp-ue4/Public/OpenAPICategory.h diff --git a/samples/client/petstore/cpp-ue4/OpenAPIOrder.h b/samples/client/petstore/cpp-ue4/Public/OpenAPIOrder.h similarity index 100% rename from samples/client/petstore/cpp-ue4/OpenAPIOrder.h rename to samples/client/petstore/cpp-ue4/Public/OpenAPIOrder.h diff --git a/samples/client/petstore/cpp-ue4/OpenAPIPet.h b/samples/client/petstore/cpp-ue4/Public/OpenAPIPet.h similarity index 89% rename from samples/client/petstore/cpp-ue4/OpenAPIPet.h rename to samples/client/petstore/cpp-ue4/Public/OpenAPIPet.h index 3a90d2b0c6b1..0e81e5fe0f9c 100644 --- a/samples/client/petstore/cpp-ue4/OpenAPIPet.h +++ b/samples/client/petstore/cpp-ue4/Public/OpenAPIPet.h @@ -34,8 +34,8 @@ class OPENAPI_API OpenAPIPet : public Model TOptional Id; TOptional Category; FString Name; - TArray> PhotoUrls; - TOptional>> Tags; + TArray PhotoUrls; + TOptional> Tags; enum class StatusEnum { Available, diff --git a/samples/client/petstore/cpp-ue4/Public/OpenAPIPetApiOperations.h b/samples/client/petstore/cpp-ue4/Public/OpenAPIPetApiOperations.h index 2667a08066b7..a93365d9546a 100644 --- a/samples/client/petstore/cpp-ue4/Public/OpenAPIPetApiOperations.h +++ b/samples/client/petstore/cpp-ue4/Public/OpenAPIPetApiOperations.h @@ -33,7 +33,7 @@ class OPENAPI_API OpenAPIPetApi::AddPetRequest : public Request FString ComputePath() const final; /* Pet object that needs to be added to the store */ - std::shared_ptr Body; + OpenAPIPet Body; }; class OPENAPI_API OpenAPIPetApi::AddPetResponse : public Response @@ -89,7 +89,7 @@ class OPENAPI_API OpenAPIPetApi::FindPetsByStatusRequest : public Request Sold, }; /* Status values that need to be considered for filter */ - TArray> Status; + TArray Status; }; class OPENAPI_API OpenAPIPetApi::FindPetsByStatusResponse : public Response @@ -99,7 +99,7 @@ class OPENAPI_API OpenAPIPetApi::FindPetsByStatusResponse : public Response void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final; bool FromJson(const TSharedPtr& JsonObject) final; - TArray> Content; + TArray Content; }; /* Finds Pets by tags @@ -114,7 +114,7 @@ class OPENAPI_API OpenAPIPetApi::FindPetsByTagsRequest : public Request FString ComputePath() const final; /* Tags to filter by */ - TArray> Tags; + TArray Tags; }; class OPENAPI_API OpenAPIPetApi::FindPetsByTagsResponse : public Response @@ -124,7 +124,7 @@ class OPENAPI_API OpenAPIPetApi::FindPetsByTagsResponse : public Response void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final; bool FromJson(const TSharedPtr& JsonObject) final; - TArray> Content; + TArray Content; }; /* Find pet by ID @@ -163,7 +163,7 @@ class OPENAPI_API OpenAPIPetApi::UpdatePetRequest : public Request FString ComputePath() const final; /* Pet object that needs to be added to the store */ - std::shared_ptr Body; + OpenAPIPet Body; }; class OPENAPI_API OpenAPIPetApi::UpdatePetResponse : public Response diff --git a/samples/client/petstore/cpp-ue4/Public/OpenAPIStoreApiOperations.h b/samples/client/petstore/cpp-ue4/Public/OpenAPIStoreApiOperations.h index 924bb148dd46..06e6809c1850 100644 --- a/samples/client/petstore/cpp-ue4/Public/OpenAPIStoreApiOperations.h +++ b/samples/client/petstore/cpp-ue4/Public/OpenAPIStoreApiOperations.h @@ -65,7 +65,7 @@ class OPENAPI_API OpenAPIStoreApi::GetInventoryResponse : public Response void SetHttpResponseCode(EHttpResponseCodes::Type InHttpResponseCode) final; bool FromJson(const TSharedPtr& JsonObject) final; - TMap> Content; + TMap Content; }; /* Find purchase order by ID @@ -104,7 +104,7 @@ class OPENAPI_API OpenAPIStoreApi::PlaceOrderRequest : public Request FString ComputePath() const final; /* order placed for purchasing the pet */ - std::shared_ptr Body; + OpenAPIOrder Body; }; class OPENAPI_API OpenAPIStoreApi::PlaceOrderResponse : public Response diff --git a/samples/client/petstore/cpp-ue4/OpenAPITag.h b/samples/client/petstore/cpp-ue4/Public/OpenAPITag.h similarity index 100% rename from samples/client/petstore/cpp-ue4/OpenAPITag.h rename to samples/client/petstore/cpp-ue4/Public/OpenAPITag.h diff --git a/samples/client/petstore/cpp-ue4/OpenAPIUser.h b/samples/client/petstore/cpp-ue4/Public/OpenAPIUser.h similarity index 100% rename from samples/client/petstore/cpp-ue4/OpenAPIUser.h rename to samples/client/petstore/cpp-ue4/Public/OpenAPIUser.h diff --git a/samples/client/petstore/cpp-ue4/Public/OpenAPIUserApiOperations.h b/samples/client/petstore/cpp-ue4/Public/OpenAPIUserApiOperations.h index 2b0ab2e5385e..3e050a41ef08 100644 --- a/samples/client/petstore/cpp-ue4/Public/OpenAPIUserApiOperations.h +++ b/samples/client/petstore/cpp-ue4/Public/OpenAPIUserApiOperations.h @@ -32,7 +32,7 @@ class OPENAPI_API OpenAPIUserApi::CreateUserRequest : public Request FString ComputePath() const final; /* Created user object */ - std::shared_ptr Body; + OpenAPIUser Body; }; class OPENAPI_API OpenAPIUserApi::CreateUserResponse : public Response @@ -56,7 +56,7 @@ class OPENAPI_API OpenAPIUserApi::CreateUsersWithArrayInputRequest : public Requ FString ComputePath() const final; /* List of user object */ - TArray> Body; + TArray Body; }; class OPENAPI_API OpenAPIUserApi::CreateUsersWithArrayInputResponse : public Response @@ -80,7 +80,7 @@ class OPENAPI_API OpenAPIUserApi::CreateUsersWithListInputRequest : public Reque FString ComputePath() const final; /* List of user object */ - TArray> Body; + TArray Body; }; class OPENAPI_API OpenAPIUserApi::CreateUsersWithListInputResponse : public Response @@ -204,7 +204,7 @@ class OPENAPI_API OpenAPIUserApi::UpdateUserRequest : public Request /* name that need to be deleted */ FString Username; /* Updated user object */ - std::shared_ptr Body; + OpenAPIUser Body; }; class OPENAPI_API OpenAPIUserApi::UpdateUserResponse : public Response 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 1331ed4b237d..53327dc686a3 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs @@ -2039,7 +2039,7 @@ toE'ArrayEnum = \case -- ** E'EnumFormString --- | Enum of 'Text' . +-- | Enum of 'Text' . -- Form parameter enum test (string) data E'EnumFormString = E'EnumFormString'_abc -- ^ @"_abc"@ @@ -2304,7 +2304,7 @@ toE'Kind = \case -- ** E'Status --- | Enum of 'Text' . +-- | Enum of 'Text' . -- Order Status data E'Status = E'Status'Placed -- ^ @"placed"@ @@ -2336,7 +2336,7 @@ toE'Status = \case -- ** E'Status2 --- | Enum of 'Text' . +-- | Enum of 'Text' . -- pet status in the store data E'Status2 = E'Status2'Available -- ^ @"available"@ 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 a4ebc69f5678..0755459fc431 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 @@ -28,6 +28,8 @@ import java.nio.file.Files; import java.nio.file.StandardCopyOption; import org.glassfish.jersey.logging.LoggingFeature; +import java.util.logging.Level; +import java.util.logging.Logger; import java.util.Collection; import java.util.Collections; import java.util.Map; @@ -60,6 +62,8 @@ public class ApiClient { protected Map defaultHeaderMap = new HashMap(); protected Map defaultCookieMap = new HashMap(); protected String basePath = "http://petstore.swagger.io:80/v2"; + private static final Logger log = Logger.getLogger(ApiClient.class.getName()); + protected List servers = new ArrayList(Arrays.asList( new ServerConfiguration( "http://petstore.swagger.io:80/v2", @@ -845,6 +849,9 @@ public AbstractOpenApiSchema deserializeSchemas(Response response, AbstractOpenA } } catch (Exception ex) { // failed to deserialize, do nothing and try next one (schema) + // Logging the error may be useful to troubleshoot why a payload fails to match + // the schema. + log.log(Level.FINE, "Input data does not match schema '" + schemaName + "'", ex); } } else {// unknown type throw new ApiException(schemaType.getClass() + " is not a GenericType and cannot be handled properly in deserialization."); @@ -855,7 +862,7 @@ public AbstractOpenApiSchema deserializeSchemas(Response response, AbstractOpenA if (matchCounter > 1 && "oneOf".equals(schema.getSchemaType())) {// more than 1 match for oneOf throw new ApiException("Response body is invalid as it matches more than one schema (" + StringUtil.join(matchSchemas, ", ") + ") defined in the oneOf model: " + schema.getClass().getName()); } else if (matchCounter == 0) { // fail to match any in oneOf/anyOf schemas - throw new ApiException("Response body is invalid as it doens't match any schemas (" + StringUtil.join(schema.getSchemas().keySet(), ", ") + ") defined in the oneOf/anyOf model: " + schema.getClass().getName()); + throw new ApiException("Response body is invalid as it does not match any schemas (" + StringUtil.join(schema.getSchemas().keySet(), ", ") + ") defined in the oneOf/anyOf model: " + schema.getClass().getName()); } else { // only one matched schema.setActualInstance(result); return schema; diff --git a/samples/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/PetApiTest.java index 1ab8611db472..11dcafbcc11d 100644 --- a/samples/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/PetApiTest.java +++ b/samples/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -3,7 +3,7 @@ * 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 @@ -13,97 +13,142 @@ package org.openapitools.client.api; -import org.openapitools.client.*; -import org.openapitools.client.auth.*; -import java.io.File; -import org.openapitools.client.model.ModelApiResponse; -import org.openapitools.client.model.Pet; +import org.junit.Assert; import org.junit.Test; -import org.junit.Ignore; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.ApiKeyAuth; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Pet; +import org.openapitools.client.model.Tag; -import java.util.ArrayList; -import java.util.HashMap; +import java.io.File; +import java.util.Arrays; +import java.util.HashSet; import java.util.List; -import java.util.Map; import java.util.Set; /** * API tests for PetApi */ -@Ignore public class PetApiTest { private final PetApi api = new PetApi(); + private final long petId = 5638l; /** * Add a new pet to the store * - * - * - * @throws ApiException - * if the Api call fails + * @throws ApiException if the Api call fails */ @Test public void addPetTest() throws ApiException { - Pet body = null; + // add pet + Pet body = new Pet(); + body.setId(petId); + body.setName("jersey2 java8 pet"); + Category category = new Category(); + category.setId(petId); + category.setName("jersey2 java8 category"); + body.setCategory(category); + body.setStatus(Pet.StatusEnum.AVAILABLE); + body.setPhotoUrls(new HashSet<>(Arrays.asList("A", "B", "C"))); + Tag tag = new Tag(); + tag.setId(petId); + tag.setName("jersey2 java8 tag"); + body.setTags(Arrays.asList(tag)); + api.addPet(body); - // TODO: test validations + + //get pet by ID + Pet result = api.getPetById(petId); + Assert.assertEquals(result.getId(), body.getId()); + Assert.assertEquals(result.getCategory(), category); + Assert.assertEquals(result.getName(), body.getName()); + Assert.assertEquals(result.getPhotoUrls(), body.getPhotoUrls()); + Assert.assertEquals(result.getStatus(), body.getStatus()); + Assert.assertEquals(result.getTags(), body.getTags()); + + // update pet + api.updatePetWithForm(petId, "jersey2 java8 pet 2", "sold"); + + //get pet by ID + Pet result2 = api.getPetById(petId); + Assert.assertEquals(result2.getId(), body.getId()); + Assert.assertEquals(result2.getCategory(), category); + Assert.assertEquals(result2.getName(), "jersey2 java8 pet 2"); + Assert.assertEquals(result2.getPhotoUrls(), body.getPhotoUrls()); + Assert.assertEquals(result2.getStatus(), Pet.StatusEnum.SOLD); + Assert.assertEquals(result2.getTags(), body.getTags()); + + // delete pet + api.deletePet(petId, "empty api key"); + + try { + Pet result3 = api.getPetById(petId); + Assert.assertEquals(false, true); + } catch (ApiException e) { +// System.err.println("Exception when calling PetApi#getPetById"); +// System.err.println("Status code: " + e.getCode()); +// System.err.println("Reason: " + e.getResponseBody()); +// System.err.println("Response headers: " + e.getResponseHeaders()); + + Assert.assertEquals(e.getCode(), 404); + Assert.assertEquals(e.getResponseBody(), "{\"code\":1,\"type\":\"error\",\"message\":\"Pet not found\"}"); + + } + } /** * Deletes a pet * - * - * - * @throws ApiException - * if the Api call fails + * @throws ApiException if the Api call fails */ @Test public void deletePetTest() throws ApiException { Long petId = null; String apiKey = null; - api.deletePet(petId, apiKey); // TODO: test validations + //api.deletePet(petId, apiKey); } /** * Finds Pets by status - * + *

* Multiple status values can be provided with comma separated strings * - * @throws ApiException - * if the Api call fails + * @throws ApiException if the Api call fails */ @Test public void findPetsByStatusTest() throws ApiException { List status = null; - List response = api.findPetsByStatus(status); + //List response = api.findPetsByStatus(status); // TODO: test validations } /** * Finds Pets by tags - * + *

* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * - * @throws ApiException - * if the Api call fails + * @throws ApiException if the Api call fails */ @Test public void findPetsByTagsTest() throws ApiException { Set tags = null; - Set response = api.findPetsByTags(tags); + //Set response = api.findPetsByTags(tags); // TODO: test validations } /** * Find pet by ID - * + *

* Returns a single pet * - * @throws ApiException - * if the Api call fails + * @throws ApiException if the Api call fails */ @Test public void getPetByIdTest() throws ApiException { @@ -126,7 +171,6 @@ public void getPetByIdTest() throws ApiException { System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); } } @@ -134,66 +178,54 @@ public void getPetByIdTest() throws ApiException { /** * Update an existing pet * - * - * - * @throws ApiException - * if the Api call fails + * @throws ApiException if the Api call fails */ @Test public void updatePetTest() throws ApiException { Pet body = null; - api.updatePet(body); + //api.updatePet(body); // TODO: test validations } /** * Updates a pet in the store with form data * - * - * - * @throws ApiException - * if the Api call fails + * @throws ApiException if the Api call fails */ @Test public void updatePetWithFormTest() throws ApiException { Long petId = null; String name = null; String status = null; - api.updatePetWithForm(petId, name, status); + //api.updatePetWithForm(petId, name, status); // TODO: test validations } /** * uploads an image * - * - * - * @throws ApiException - * if the Api call fails + * @throws ApiException if the Api call fails */ @Test public void uploadFileTest() throws ApiException { Long petId = null; String additionalMetadata = null; File file = null; - ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + //ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); // TODO: test validations } /** * uploads an image (required) * - * - * - * @throws ApiException - * if the Api call fails + * @throws ApiException if the Api call fails */ @Test public void uploadFileWithRequiredFileTest() throws ApiException { Long petId = null; File requiredFile = null; String additionalMetadata = null; - ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + //ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); // TODO: test validations } diff --git a/samples/client/petstore/python-experimental/.openapi-generator/FILES b/samples/client/petstore/python-experimental/.openapi-generator/FILES index e855d6b1ef4e..d282130ffbc0 100644 --- a/samples/client/petstore/python-experimental/.openapi-generator/FILES +++ b/samples/client/petstore/python-experimental/.openapi-generator/FILES @@ -80,72 +80,74 @@ petstore_api/api/pet_api.py petstore_api/api/store_api.py petstore_api/api/user_api.py petstore_api/api_client.py +petstore_api/apis/__init__.py petstore_api/configuration.py petstore_api/exceptions.py +petstore_api/model/__init__.py +petstore_api/model/additional_properties_any_type.py +petstore_api/model/additional_properties_array.py +petstore_api/model/additional_properties_boolean.py +petstore_api/model/additional_properties_class.py +petstore_api/model/additional_properties_integer.py +petstore_api/model/additional_properties_number.py +petstore_api/model/additional_properties_object.py +petstore_api/model/additional_properties_string.py +petstore_api/model/animal.py +petstore_api/model/api_response.py +petstore_api/model/array_of_array_of_number_only.py +petstore_api/model/array_of_number_only.py +petstore_api/model/array_test.py +petstore_api/model/capitalization.py +petstore_api/model/cat.py +petstore_api/model/cat_all_of.py +petstore_api/model/category.py +petstore_api/model/child.py +petstore_api/model/child_all_of.py +petstore_api/model/child_cat.py +petstore_api/model/child_cat_all_of.py +petstore_api/model/child_dog.py +petstore_api/model/child_dog_all_of.py +petstore_api/model/child_lizard.py +petstore_api/model/child_lizard_all_of.py +petstore_api/model/class_model.py +petstore_api/model/client.py +petstore_api/model/dog.py +petstore_api/model/dog_all_of.py +petstore_api/model/enum_arrays.py +petstore_api/model/enum_class.py +petstore_api/model/enum_test.py +petstore_api/model/file.py +petstore_api/model/file_schema_test_class.py +petstore_api/model/format_test.py +petstore_api/model/grandparent.py +petstore_api/model/grandparent_animal.py +petstore_api/model/has_only_read_only.py +petstore_api/model/list.py +petstore_api/model/map_test.py +petstore_api/model/mixed_properties_and_additional_properties_class.py +petstore_api/model/model200_response.py +petstore_api/model/model_return.py +petstore_api/model/name.py +petstore_api/model/number_only.py +petstore_api/model/order.py +petstore_api/model/outer_composite.py +petstore_api/model/outer_enum.py +petstore_api/model/outer_number.py +petstore_api/model/parent.py +petstore_api/model/parent_all_of.py +petstore_api/model/parent_pet.py +petstore_api/model/pet.py +petstore_api/model/player.py +petstore_api/model/read_only_first.py +petstore_api/model/special_model_name.py +petstore_api/model/string_boolean_map.py +petstore_api/model/tag.py +petstore_api/model/type_holder_default.py +petstore_api/model/type_holder_example.py +petstore_api/model/user.py +petstore_api/model/xml_item.py petstore_api/model_utils.py petstore_api/models/__init__.py -petstore_api/models/additional_properties_any_type.py -petstore_api/models/additional_properties_array.py -petstore_api/models/additional_properties_boolean.py -petstore_api/models/additional_properties_class.py -petstore_api/models/additional_properties_integer.py -petstore_api/models/additional_properties_number.py -petstore_api/models/additional_properties_object.py -petstore_api/models/additional_properties_string.py -petstore_api/models/animal.py -petstore_api/models/api_response.py -petstore_api/models/array_of_array_of_number_only.py -petstore_api/models/array_of_number_only.py -petstore_api/models/array_test.py -petstore_api/models/capitalization.py -petstore_api/models/cat.py -petstore_api/models/cat_all_of.py -petstore_api/models/category.py -petstore_api/models/child.py -petstore_api/models/child_all_of.py -petstore_api/models/child_cat.py -petstore_api/models/child_cat_all_of.py -petstore_api/models/child_dog.py -petstore_api/models/child_dog_all_of.py -petstore_api/models/child_lizard.py -petstore_api/models/child_lizard_all_of.py -petstore_api/models/class_model.py -petstore_api/models/client.py -petstore_api/models/dog.py -petstore_api/models/dog_all_of.py -petstore_api/models/enum_arrays.py -petstore_api/models/enum_class.py -petstore_api/models/enum_test.py -petstore_api/models/file.py -petstore_api/models/file_schema_test_class.py -petstore_api/models/format_test.py -petstore_api/models/grandparent.py -petstore_api/models/grandparent_animal.py -petstore_api/models/has_only_read_only.py -petstore_api/models/list.py -petstore_api/models/map_test.py -petstore_api/models/mixed_properties_and_additional_properties_class.py -petstore_api/models/model200_response.py -petstore_api/models/model_return.py -petstore_api/models/name.py -petstore_api/models/number_only.py -petstore_api/models/order.py -petstore_api/models/outer_composite.py -petstore_api/models/outer_enum.py -petstore_api/models/outer_number.py -petstore_api/models/parent.py -petstore_api/models/parent_all_of.py -petstore_api/models/parent_pet.py -petstore_api/models/pet.py -petstore_api/models/player.py -petstore_api/models/read_only_first.py -petstore_api/models/special_model_name.py -petstore_api/models/string_boolean_map.py -petstore_api/models/tag.py -petstore_api/models/type_holder_default.py -petstore_api/models/type_holder_example.py -petstore_api/models/user.py -petstore_api/models/xml_item.py petstore_api/rest.py requirements.txt setup.cfg diff --git a/samples/client/petstore/python-experimental/README.md b/samples/client/petstore/python-experimental/README.md index 81b680fa57b3..d6b85d02a55a 100644 --- a/samples/client/petstore/python-experimental/README.md +++ b/samples/client/petstore/python-experimental/README.md @@ -50,7 +50,8 @@ from __future__ import print_function import time import petstore_api from pprint import pprint - +from petstore_api.api import another_fake_api +from petstore_api.model import client # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -62,8 +63,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.AnotherFakeApi(api_client) - body = petstore_api.Client() # client.Client | client model + api_instance = another_fake_api.AnotherFakeApi(api_client) + body = client.Client() # client.Client | client model try: # To test special tags @@ -71,7 +72,6 @@ with petstore_api.ApiClient(configuration) as api_client: pprint(api_response) except petstore_api.ApiException as e: print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e) - ``` ## Documentation for API Endpoints @@ -223,3 +223,22 @@ Class | Method | HTTP request | Description +## Notes for Large OpenAPI documents +If the OpenAPI document is large, imports in petstore_api.apis and petstore_api.models may fail with a +RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions: + +Solution 1: +Use specific imports for apis and models like: +- `from petstore_api.api.default_api import DefaultApi` +- `from petstore_api.model.pet import Pet` + +Solution 1: +Before importing the package, adjust the maximum recursion limit as shown below: +``` +import sys +sys.setrecursionlimit(1500) +import petstore_api +from petstore_api.apis import * +from petstore_api.models import * +``` + diff --git a/samples/client/petstore/python-experimental/docs/AnotherFakeApi.md b/samples/client/petstore/python-experimental/docs/AnotherFakeApi.md index 83a89addfaee..8b7a61109454 100644 --- a/samples/client/petstore/python-experimental/docs/AnotherFakeApi.md +++ b/samples/client/petstore/python-experimental/docs/AnotherFakeApi.md @@ -20,6 +20,8 @@ To test special tags and operation ID starting with number from __future__ import print_function import time import petstore_api +from petstore_api.api import another_fake_api +from petstore_api.model import client from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -31,8 +33,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.AnotherFakeApi(api_client) - body = petstore_api.Client() # client.Client | client model + api_instance = another_fake_api.AnotherFakeApi(api_client) + body = client.Client() # client.Client | client model # example passing only required values which don't have defaults set try: diff --git a/samples/client/petstore/python-experimental/docs/FakeApi.md b/samples/client/petstore/python-experimental/docs/FakeApi.md index de9a3fd1a4fb..7f813d160f77 100644 --- a/samples/client/petstore/python-experimental/docs/FakeApi.md +++ b/samples/client/petstore/python-experimental/docs/FakeApi.md @@ -34,6 +34,8 @@ this route creates an XmlItem from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import xml_item from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -45,8 +47,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - xml_item = petstore_api.XmlItem() # xml_item.XmlItem | XmlItem Body + api_instance = fake_api.FakeApi(api_client) + xml_item = xml_item.XmlItem() # xml_item.XmlItem | XmlItem Body # example passing only required values which don't have defaults set try: @@ -95,6 +97,7 @@ Test serialization of outer boolean types from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -106,7 +109,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) body = True # bool | Input boolean as post body (optional) # example passing only required values which don't have defaults set @@ -157,6 +160,8 @@ Test serialization of object with outer number type from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import outer_composite from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -168,8 +173,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - body = petstore_api.OuterComposite() # outer_composite.OuterComposite | Input composite as post body (optional) + api_instance = fake_api.FakeApi(api_client) + body = outer_composite.OuterComposite() # outer_composite.OuterComposite | Input composite as post body (optional) # example passing only required values which don't have defaults set # and optional values @@ -219,6 +224,8 @@ Test serialization of outer enum from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import outer_enum from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -230,8 +237,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - body = petstore_api.OuterEnum("placed") # outer_enum.OuterEnum | Input enum as post body (optional) + api_instance = fake_api.FakeApi(api_client) + body = outer_enum.OuterEnum("placed") # outer_enum.OuterEnum | Input enum as post body (optional) # example passing only required values which don't have defaults set # and optional values @@ -281,6 +288,8 @@ Test serialization of outer number types from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import outer_number from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -292,8 +301,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - body = petstore_api.OuterNumber(3.4) # outer_number.OuterNumber | Input number as post body (optional) + api_instance = fake_api.FakeApi(api_client) + body = outer_number.OuterNumber(3.4) # outer_number.OuterNumber | Input number as post body (optional) # example passing only required values which don't have defaults set # and optional values @@ -343,6 +352,7 @@ Test serialization of outer string types from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -354,7 +364,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) body = 'body_example' # str | Input string as post body (optional) # example passing only required values which don't have defaults set @@ -405,6 +415,8 @@ For this test, the body for this request much reference a schema named `File`. from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import file_schema_test_class from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -416,8 +428,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - body = petstore_api.FileSchemaTestClass() # file_schema_test_class.FileSchemaTestClass | + api_instance = fake_api.FakeApi(api_client) + body = file_schema_test_class.FileSchemaTestClass() # file_schema_test_class.FileSchemaTestClass | # example passing only required values which don't have defaults set try: @@ -463,6 +475,8 @@ No authorization required from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -474,9 +488,9 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) query = 'query_example' # str | - body = petstore_api.User() # user.User | + body = user.User() # user.User | # example passing only required values which don't have defaults set try: @@ -525,6 +539,8 @@ To test \"client\" model from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import client from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -536,8 +552,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - body = petstore_api.Client() # client.Client | client model + api_instance = fake_api.FakeApi(api_client) + body = client.Client() # client.Client | client model # example passing only required values which don't have defaults set try: @@ -587,6 +603,7 @@ This route has required values with enums of 1 from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -598,7 +615,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) # example passing only required values which don't have defaults set try: @@ -651,6 +668,7 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイ from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -672,7 +690,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) number = 3.4 # float | None double = 3.4 # float | None pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None @@ -757,6 +775,7 @@ To test enum parameters from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -768,7 +787,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) enum_header_string_array = ['enum_header_string_array_example'] # [str] | Header parameter enum test (string array) (optional) enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) if omitted the server will use the default value of '-efg' enum_query_string_array = ['enum_query_string_array_example'] # [str] | Query parameter enum test (string array) (optional) @@ -834,6 +853,7 @@ Fake endpoint to test group parameters (optional) from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -845,7 +865,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) required_string_group = 56 # int | Required String in group parameters required_boolean_group = True # bool | Required Boolean in group parameters required_int64_group = 56 # int | Required Integer in group parameters @@ -911,6 +931,7 @@ test inline additionalProperties from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -922,7 +943,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) param = {'key': 'param_example'} # {str: (str,)} | request body # example passing only required values which don't have defaults set @@ -970,6 +991,7 @@ test json serialization of form data from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -981,7 +1003,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) param = 'param_example' # str | field1 param2 = 'param2_example' # str | field2 diff --git a/samples/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md b/samples/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md index c10f9f37e164..6cc246194992 100644 --- a/samples/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md @@ -21,6 +21,8 @@ To test class name in snake case from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_classname_tags_123_api +from petstore_api.model import client from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -46,8 +48,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeClassnameTags123Api(api_client) - body = petstore_api.Client() # client.Client | client model + api_instance = fake_classname_tags_123_api.FakeClassnameTags123Api(api_client) + body = client.Client() # client.Client | client model # example passing only required values which don't have defaults set try: diff --git a/samples/client/petstore/python-experimental/docs/PetApi.md b/samples/client/petstore/python-experimental/docs/PetApi.md index d7192a2dd5f3..20b56372d833 100644 --- a/samples/client/petstore/python-experimental/docs/PetApi.md +++ b/samples/client/petstore/python-experimental/docs/PetApi.md @@ -27,6 +27,8 @@ Add a new pet to the store from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -48,8 +50,8 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - body = petstore_api.Pet() # pet.Pet | Pet object that needs to be added to the store + api_instance = pet_api.PetApi(api_client) + body = pet.Pet() # pet.Pet | Pet object that needs to be added to the store # example passing only required values which don't have defaults set try: @@ -98,6 +100,7 @@ Deletes a pet from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -119,7 +122,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | Pet id to delete api_key = 'api_key_example' # str | (optional) @@ -181,6 +184,8 @@ Multiple status values can be provided with comma separated strings from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -202,7 +207,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) status = ['status_example'] # [str] | Status values that need to be considered for filter # example passing only required values which don't have defaults set @@ -255,6 +260,8 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -276,7 +283,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) tags = ['tags_example'] # [str] | Tags to filter by # example passing only required values which don't have defaults set @@ -329,6 +336,8 @@ Returns a single pet from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -354,7 +363,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | ID of pet to return # example passing only required values which don't have defaults set @@ -406,6 +415,8 @@ Update an existing pet from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -427,8 +438,8 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - body = petstore_api.Pet() # pet.Pet | Pet object that needs to be added to the store + api_instance = pet_api.PetApi(api_client) + body = pet.Pet() # pet.Pet | Pet object that needs to be added to the store # example passing only required values which don't have defaults set try: @@ -479,6 +490,7 @@ Updates a pet in the store with form data from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -500,7 +512,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | ID of pet that needs to be updated name = 'name_example' # str | Updated name of the pet (optional) status = 'status_example' # str | Updated status of the pet (optional) @@ -561,6 +573,8 @@ uploads an image from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import api_response from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -582,7 +596,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | ID of pet to update additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) file = open('/path/to/file', 'rb') # file_type | file to upload (optional) @@ -647,6 +661,8 @@ uploads an image (required) from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import api_response from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -668,7 +684,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | ID of pet to update required_file = open('/path/to/file', 'rb') # file_type | file to upload additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) diff --git a/samples/client/petstore/python-experimental/docs/StoreApi.md b/samples/client/petstore/python-experimental/docs/StoreApi.md index b4492962d69c..36e72b2ac4f1 100644 --- a/samples/client/petstore/python-experimental/docs/StoreApi.md +++ b/samples/client/petstore/python-experimental/docs/StoreApi.md @@ -23,6 +23,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non from __future__ import print_function import time import petstore_api +from petstore_api.api import store_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -34,7 +35,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) + api_instance = store_api.StoreApi(api_client) order_id = 'order_id_example' # str | ID of the order that needs to be deleted # example passing only required values which don't have defaults set @@ -86,6 +87,7 @@ Returns a map of status codes to quantities from __future__ import print_function import time import petstore_api +from petstore_api.api import store_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -111,7 +113,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) + api_instance = store_api.StoreApi(api_client) # example, this endpoint has no required or optional parameters try: @@ -158,6 +160,8 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge from __future__ import print_function import time import petstore_api +from petstore_api.api import store_api +from petstore_api.model import order from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -169,7 +173,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) + api_instance = store_api.StoreApi(api_client) order_id = 56 # int | ID of pet that needs to be fetched # example passing only required values which don't have defaults set @@ -220,6 +224,8 @@ Place an order for a pet from __future__ import print_function import time import petstore_api +from petstore_api.api import store_api +from petstore_api.model import order from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -231,8 +237,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) - body = petstore_api.Order() # order.Order | order placed for purchasing the pet + api_instance = store_api.StoreApi(api_client) + body = order.Order() # order.Order | order placed for purchasing the pet # example passing only required values which don't have defaults set try: diff --git a/samples/client/petstore/python-experimental/docs/UserApi.md b/samples/client/petstore/python-experimental/docs/UserApi.md index b02b92afbf74..4727961273c1 100644 --- a/samples/client/petstore/python-experimental/docs/UserApi.md +++ b/samples/client/petstore/python-experimental/docs/UserApi.md @@ -27,6 +27,8 @@ This can only be done by the logged in user. from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -38,8 +40,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - body = petstore_api.User() # user.User | Created user object + api_instance = user_api.UserApi(api_client) + body = user.User() # user.User | Created user object # example passing only required values which don't have defaults set try: @@ -86,6 +88,8 @@ Creates list of users with given input array from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -97,8 +101,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - body = [petstore_api.User()] # [user.User] | List of user object + api_instance = user_api.UserApi(api_client) + body = [user.User()] # [user.User] | List of user object # example passing only required values which don't have defaults set try: @@ -145,6 +149,8 @@ Creates list of users with given input array from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -156,8 +162,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - body = [petstore_api.User()] # [user.User] | List of user object + api_instance = user_api.UserApi(api_client) + body = [user.User()] # [user.User] | List of user object # example passing only required values which don't have defaults set try: @@ -206,6 +212,7 @@ This can only be done by the logged in user. from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -217,7 +224,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) username = 'username_example' # str | The name that needs to be deleted # example passing only required values which don't have defaults set @@ -266,6 +273,8 @@ Get user by user name from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -277,7 +286,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing. # example passing only required values which don't have defaults set @@ -328,6 +337,7 @@ Logs user into the system from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -339,7 +349,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) username = 'username_example' # str | The user name for login password = 'password_example' # str | The password for login in clear text @@ -391,6 +401,7 @@ Logs out current logged in user session from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -402,7 +413,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) # example, this endpoint has no required or optional parameters try: @@ -448,6 +459,8 @@ This can only be done by the logged in user. from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -459,9 +472,9 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) username = 'username_example' # str | name that need to be deleted - body = petstore_api.User() # user.User | Updated user object + body = user.User() # user.User | Updated user object # example passing only required values which don't have defaults set try: diff --git a/samples/client/petstore/python-experimental/petstore_api/__init__.py b/samples/client/petstore/python-experimental/petstore_api/__init__.py index 445bf2409aee..4af4353187f6 100644 --- a/samples/client/petstore/python-experimental/petstore_api/__init__.py +++ b/samples/client/petstore/python-experimental/petstore_api/__init__.py @@ -16,14 +16,6 @@ __version__ = "1.0.0" -# import apis into sdk package -from petstore_api.api.another_fake_api import AnotherFakeApi -from petstore_api.api.fake_api import FakeApi -from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api -from petstore_api.api.pet_api import PetApi -from petstore_api.api.store_api import StoreApi -from petstore_api.api.user_api import UserApi - # import ApiClient from petstore_api.api_client import ApiClient @@ -32,71 +24,8 @@ # import exceptions from petstore_api.exceptions import OpenApiException +from petstore_api.exceptions import ApiAttributeError from petstore_api.exceptions import ApiTypeError from petstore_api.exceptions import ApiValueError from petstore_api.exceptions import ApiKeyError -from petstore_api.exceptions import ApiException - -# import models into sdk package -from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType -from petstore_api.models.additional_properties_array import AdditionalPropertiesArray -from petstore_api.models.additional_properties_boolean import AdditionalPropertiesBoolean -from petstore_api.models.additional_properties_class import AdditionalPropertiesClass -from petstore_api.models.additional_properties_integer import AdditionalPropertiesInteger -from petstore_api.models.additional_properties_number import AdditionalPropertiesNumber -from petstore_api.models.additional_properties_object import AdditionalPropertiesObject -from petstore_api.models.additional_properties_string import AdditionalPropertiesString -from petstore_api.models.animal import Animal -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.capitalization import Capitalization -from petstore_api.models.cat import Cat -from petstore_api.models.cat_all_of import CatAllOf -from petstore_api.models.category import Category -from petstore_api.models.child import Child -from petstore_api.models.child_all_of import ChildAllOf -from petstore_api.models.child_cat import ChildCat -from petstore_api.models.child_cat_all_of import ChildCatAllOf -from petstore_api.models.child_dog import ChildDog -from petstore_api.models.child_dog_all_of import ChildDogAllOf -from petstore_api.models.child_lizard import ChildLizard -from petstore_api.models.child_lizard_all_of import ChildLizardAllOf -from petstore_api.models.class_model import ClassModel -from petstore_api.models.client import Client -from petstore_api.models.dog import Dog -from petstore_api.models.dog_all_of import DogAllOf -from petstore_api.models.enum_arrays import EnumArrays -from petstore_api.models.enum_class import EnumClass -from petstore_api.models.enum_test import EnumTest -from petstore_api.models.file import File -from petstore_api.models.file_schema_test_class import FileSchemaTestClass -from petstore_api.models.format_test import FormatTest -from petstore_api.models.grandparent import Grandparent -from petstore_api.models.grandparent_animal import GrandparentAnimal -from petstore_api.models.has_only_read_only import HasOnlyReadOnly -from petstore_api.models.list import List -from petstore_api.models.map_test import MapTest -from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model200_response import Model200Response -from petstore_api.models.model_return import ModelReturn -from petstore_api.models.name import Name -from petstore_api.models.number_only import NumberOnly -from petstore_api.models.order import Order -from petstore_api.models.outer_composite import OuterComposite -from petstore_api.models.outer_enum import OuterEnum -from petstore_api.models.outer_number import OuterNumber -from petstore_api.models.parent import Parent -from petstore_api.models.parent_all_of import ParentAllOf -from petstore_api.models.parent_pet import ParentPet -from petstore_api.models.pet import Pet -from petstore_api.models.player import Player -from petstore_api.models.read_only_first import ReadOnlyFirst -from petstore_api.models.special_model_name import SpecialModelName -from petstore_api.models.string_boolean_map import StringBooleanMap -from petstore_api.models.tag import Tag -from petstore_api.models.type_holder_default import TypeHolderDefault -from petstore_api.models.type_holder_example import TypeHolderExample -from petstore_api.models.user import User -from petstore_api.models.xml_item import XmlItem +from petstore_api.exceptions import ApiException \ No newline at end of file diff --git a/samples/client/petstore/python-experimental/petstore_api/api/another_fake_api.py b/samples/client/petstore/python-experimental/petstore_api/api/another_fake_api.py index b7ea5e549329..3f277311b8fb 100644 --- a/samples/client/petstore/python-experimental/petstore_api/api/another_fake_api.py +++ b/samples/client/petstore/python-experimental/petstore_api/api/another_fake_api.py @@ -34,7 +34,7 @@ str, validate_and_convert_types ) -from petstore_api.models import client +from petstore_api.model import client class AnotherFakeApi(object): diff --git a/samples/client/petstore/python-experimental/petstore_api/api/fake_api.py b/samples/client/petstore/python-experimental/petstore_api/api/fake_api.py index e97902bb9a2b..a05c8e947b31 100644 --- a/samples/client/petstore/python-experimental/petstore_api/api/fake_api.py +++ b/samples/client/petstore/python-experimental/petstore_api/api/fake_api.py @@ -34,13 +34,13 @@ str, validate_and_convert_types ) -from petstore_api.models import xml_item -from petstore_api.models import outer_composite -from petstore_api.models import outer_enum -from petstore_api.models import outer_number -from petstore_api.models import file_schema_test_class -from petstore_api.models import user -from petstore_api.models import client +from petstore_api.model import xml_item +from petstore_api.model import outer_composite +from petstore_api.model import outer_enum +from petstore_api.model import outer_number +from petstore_api.model import file_schema_test_class +from petstore_api.model import user +from petstore_api.model import client class FakeApi(object): diff --git a/samples/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api.py b/samples/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api.py index 863e64beb0b5..be57432ae68d 100644 --- a/samples/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api.py @@ -34,7 +34,7 @@ str, validate_and_convert_types ) -from petstore_api.models import client +from petstore_api.model import client class FakeClassnameTags123Api(object): diff --git a/samples/client/petstore/python-experimental/petstore_api/api/pet_api.py b/samples/client/petstore/python-experimental/petstore_api/api/pet_api.py index 3d289a669882..6ec1e6d5c5cd 100644 --- a/samples/client/petstore/python-experimental/petstore_api/api/pet_api.py +++ b/samples/client/petstore/python-experimental/petstore_api/api/pet_api.py @@ -34,8 +34,8 @@ str, validate_and_convert_types ) -from petstore_api.models import pet -from petstore_api.models import api_response +from petstore_api.model import pet +from petstore_api.model import api_response class PetApi(object): diff --git a/samples/client/petstore/python-experimental/petstore_api/api/store_api.py b/samples/client/petstore/python-experimental/petstore_api/api/store_api.py index bcae5aab2a60..e612a43704f2 100644 --- a/samples/client/petstore/python-experimental/petstore_api/api/store_api.py +++ b/samples/client/petstore/python-experimental/petstore_api/api/store_api.py @@ -34,7 +34,7 @@ str, validate_and_convert_types ) -from petstore_api.models import order +from petstore_api.model import order class StoreApi(object): diff --git a/samples/client/petstore/python-experimental/petstore_api/api/user_api.py b/samples/client/petstore/python-experimental/petstore_api/api/user_api.py index 1362c5e31105..930ae821f2cb 100644 --- a/samples/client/petstore/python-experimental/petstore_api/api/user_api.py +++ b/samples/client/petstore/python-experimental/petstore_api/api/user_api.py @@ -34,7 +34,7 @@ str, validate_and_convert_types ) -from petstore_api.models import user +from petstore_api.model import user class UserApi(object): diff --git a/samples/client/petstore/python-experimental/petstore_api/apis/__init__.py b/samples/client/petstore/python-experimental/petstore_api/apis/__init__.py new file mode 100644 index 000000000000..f309caa3e651 --- /dev/null +++ b/samples/client/petstore/python-experimental/petstore_api/apis/__init__.py @@ -0,0 +1,20 @@ +# coding: utf-8 + +# flake8: noqa + +# import all apis into this package +# if you have many ampis here with many many models used in each api this may +# raise a RecursionError +# to avoid this, import only the api that you directly need like: +# from .api.pet_api import PetApi +# or import this package, but before doing it, use: +# import sys +# sys.setrecursionlimit(n) + +# import apis into api package +from petstore_api.api.another_fake_api import AnotherFakeApi +from petstore_api.api.fake_api import FakeApi +from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api +from petstore_api.api.pet_api import PetApi +from petstore_api.api.store_api import StoreApi +from petstore_api.api.user_api import UserApi diff --git a/samples/client/petstore/python-experimental/petstore_api/model/__init__.py b/samples/client/petstore/python-experimental/petstore_api/model/__init__.py new file mode 100644 index 000000000000..cfe32b784926 --- /dev/null +++ b/samples/client/petstore/python-experimental/petstore_api/model/__init__.py @@ -0,0 +1,5 @@ +# we can not import model classes here because that would create a circular +# reference which would not work in python2 +# do not import all models into this module because that uses a lot of memory and stack frames +# if you need the ability to import all models from one package, import them with +# from {{packageName}.models import ModelA, ModelB diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_any_type.py b/samples/client/petstore/python-experimental/petstore_api/model/additional_properties_any_type.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/additional_properties_any_type.py rename to samples/client/petstore/python-experimental/petstore_api/model/additional_properties_any_type.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_array.py b/samples/client/petstore/python-experimental/petstore_api/model/additional_properties_array.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/additional_properties_array.py rename to samples/client/petstore/python-experimental/petstore_api/model/additional_properties_array.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_boolean.py b/samples/client/petstore/python-experimental/petstore_api/model/additional_properties_boolean.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/additional_properties_boolean.py rename to samples/client/petstore/python-experimental/petstore_api/model/additional_properties_boolean.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py b/samples/client/petstore/python-experimental/petstore_api/model/additional_properties_class.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py rename to samples/client/petstore/python-experimental/petstore_api/model/additional_properties_class.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_integer.py b/samples/client/petstore/python-experimental/petstore_api/model/additional_properties_integer.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/additional_properties_integer.py rename to samples/client/petstore/python-experimental/petstore_api/model/additional_properties_integer.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_number.py b/samples/client/petstore/python-experimental/petstore_api/model/additional_properties_number.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/additional_properties_number.py rename to samples/client/petstore/python-experimental/petstore_api/model/additional_properties_number.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_object.py b/samples/client/petstore/python-experimental/petstore_api/model/additional_properties_object.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/additional_properties_object.py rename to samples/client/petstore/python-experimental/petstore_api/model/additional_properties_object.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/additional_properties_string.py b/samples/client/petstore/python-experimental/petstore_api/model/additional_properties_string.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/additional_properties_string.py rename to samples/client/petstore/python-experimental/petstore_api/model/additional_properties_string.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/animal.py b/samples/client/petstore/python-experimental/petstore_api/model/animal.py similarity index 97% rename from samples/client/petstore/python-experimental/petstore_api/models/animal.py rename to samples/client/petstore/python-experimental/petstore_api/model/animal.py index 641c9c16e279..7ba62dad1622 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/animal.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/animal.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import cat + from petstore_api.model import cat except ImportError: cat = sys.modules[ - 'petstore_api.models.cat'] + 'petstore_api.model.cat'] try: - from petstore_api.models import dog + from petstore_api.model import dog except ImportError: dog = sys.modules[ - 'petstore_api.models.dog'] + 'petstore_api.model.dog'] class Animal(ModelNormal): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/api_response.py b/samples/client/petstore/python-experimental/petstore_api/model/api_response.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/api_response.py rename to samples/client/petstore/python-experimental/petstore_api/model/api_response.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py b/samples/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py rename to samples/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py b/samples/client/petstore/python-experimental/petstore_api/model/array_of_number_only.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py rename to samples/client/petstore/python-experimental/petstore_api/model/array_of_number_only.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_test.py b/samples/client/petstore/python-experimental/petstore_api/model/array_test.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_test.py rename to samples/client/petstore/python-experimental/petstore_api/model/array_test.py index 0eed8d054611..e2bc76832b27 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_test.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/array_test.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import read_only_first + from petstore_api.model import read_only_first except ImportError: read_only_first = sys.modules[ - 'petstore_api.models.read_only_first'] + 'petstore_api.model.read_only_first'] class ArrayTest(ModelNormal): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/capitalization.py b/samples/client/petstore/python-experimental/petstore_api/model/capitalization.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/capitalization.py rename to samples/client/petstore/python-experimental/petstore_api/model/capitalization.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/cat.py b/samples/client/petstore/python-experimental/petstore_api/model/cat.py similarity index 98% rename from samples/client/petstore/python-experimental/petstore_api/models/cat.py rename to samples/client/petstore/python-experimental/petstore_api/model/cat.py index 9620612169bf..b40a97dbab9a 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/cat.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/cat.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import animal + from petstore_api.model import animal except ImportError: animal = sys.modules[ - 'petstore_api.models.animal'] + 'petstore_api.model.animal'] try: - from petstore_api.models import cat_all_of + from petstore_api.model import cat_all_of except ImportError: cat_all_of = sys.modules[ - 'petstore_api.models.cat_all_of'] + 'petstore_api.model.cat_all_of'] class Cat(ModelComposed): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/cat_all_of.py b/samples/client/petstore/python-experimental/petstore_api/model/cat_all_of.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/cat_all_of.py rename to samples/client/petstore/python-experimental/petstore_api/model/cat_all_of.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/category.py b/samples/client/petstore/python-experimental/petstore_api/model/category.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/category.py rename to samples/client/petstore/python-experimental/petstore_api/model/category.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child.py b/samples/client/petstore/python-experimental/petstore_api/model/child.py similarity index 98% rename from samples/client/petstore/python-experimental/petstore_api/models/child.py rename to samples/client/petstore/python-experimental/petstore_api/model/child.py index 7be69a7d5280..37c138d6a488 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/child.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import child_all_of + from petstore_api.model import child_all_of except ImportError: child_all_of = sys.modules[ - 'petstore_api.models.child_all_of'] + 'petstore_api.model.child_all_of'] try: - from petstore_api.models import parent + from petstore_api.model import parent except ImportError: parent = sys.modules[ - 'petstore_api.models.parent'] + 'petstore_api.model.parent'] class Child(ModelComposed): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_all_of.py b/samples/client/petstore/python-experimental/petstore_api/model/child_all_of.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/child_all_of.py rename to samples/client/petstore/python-experimental/petstore_api/model/child_all_of.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_cat.py b/samples/client/petstore/python-experimental/petstore_api/model/child_cat.py similarity index 97% rename from samples/client/petstore/python-experimental/petstore_api/models/child_cat.py rename to samples/client/petstore/python-experimental/petstore_api/model/child_cat.py index 873c3bc76cf7..6d42f11a18ff 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_cat.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/child_cat.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import child_cat_all_of + from petstore_api.model import child_cat_all_of except ImportError: child_cat_all_of = sys.modules[ - 'petstore_api.models.child_cat_all_of'] + 'petstore_api.model.child_cat_all_of'] try: - from petstore_api.models import parent_pet + from petstore_api.model import parent_pet except ImportError: parent_pet = sys.modules[ - 'petstore_api.models.parent_pet'] + 'petstore_api.model.parent_pet'] class ChildCat(ModelComposed): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_cat_all_of.py b/samples/client/petstore/python-experimental/petstore_api/model/child_cat_all_of.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/child_cat_all_of.py rename to samples/client/petstore/python-experimental/petstore_api/model/child_cat_all_of.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_dog.py b/samples/client/petstore/python-experimental/petstore_api/model/child_dog.py similarity index 97% rename from samples/client/petstore/python-experimental/petstore_api/models/child_dog.py rename to samples/client/petstore/python-experimental/petstore_api/model/child_dog.py index a49f042cf74d..b7a93571a6a0 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_dog.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/child_dog.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import child_dog_all_of + from petstore_api.model import child_dog_all_of except ImportError: child_dog_all_of = sys.modules[ - 'petstore_api.models.child_dog_all_of'] + 'petstore_api.model.child_dog_all_of'] try: - from petstore_api.models import parent_pet + from petstore_api.model import parent_pet except ImportError: parent_pet = sys.modules[ - 'petstore_api.models.parent_pet'] + 'petstore_api.model.parent_pet'] class ChildDog(ModelComposed): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_dog_all_of.py b/samples/client/petstore/python-experimental/petstore_api/model/child_dog_all_of.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/child_dog_all_of.py rename to samples/client/petstore/python-experimental/petstore_api/model/child_dog_all_of.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_lizard.py b/samples/client/petstore/python-experimental/petstore_api/model/child_lizard.py similarity index 97% rename from samples/client/petstore/python-experimental/petstore_api/models/child_lizard.py rename to samples/client/petstore/python-experimental/petstore_api/model/child_lizard.py index 0f11243a2493..978fea14a183 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/child_lizard.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/child_lizard.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import child_lizard_all_of + from petstore_api.model import child_lizard_all_of except ImportError: child_lizard_all_of = sys.modules[ - 'petstore_api.models.child_lizard_all_of'] + 'petstore_api.model.child_lizard_all_of'] try: - from petstore_api.models import parent_pet + from petstore_api.model import parent_pet except ImportError: parent_pet = sys.modules[ - 'petstore_api.models.parent_pet'] + 'petstore_api.model.parent_pet'] class ChildLizard(ModelComposed): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/child_lizard_all_of.py b/samples/client/petstore/python-experimental/petstore_api/model/child_lizard_all_of.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/child_lizard_all_of.py rename to samples/client/petstore/python-experimental/petstore_api/model/child_lizard_all_of.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/class_model.py b/samples/client/petstore/python-experimental/petstore_api/model/class_model.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/class_model.py rename to samples/client/petstore/python-experimental/petstore_api/model/class_model.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/client.py b/samples/client/petstore/python-experimental/petstore_api/model/client.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/client.py rename to samples/client/petstore/python-experimental/petstore_api/model/client.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/dog.py b/samples/client/petstore/python-experimental/petstore_api/model/dog.py similarity index 98% rename from samples/client/petstore/python-experimental/petstore_api/models/dog.py rename to samples/client/petstore/python-experimental/petstore_api/model/dog.py index f9b93eebc78f..547eba90c2b1 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/dog.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/dog.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import animal + from petstore_api.model import animal except ImportError: animal = sys.modules[ - 'petstore_api.models.animal'] + 'petstore_api.model.animal'] try: - from petstore_api.models import dog_all_of + from petstore_api.model import dog_all_of except ImportError: dog_all_of = sys.modules[ - 'petstore_api.models.dog_all_of'] + 'petstore_api.model.dog_all_of'] class Dog(ModelComposed): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/dog_all_of.py b/samples/client/petstore/python-experimental/petstore_api/model/dog_all_of.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/dog_all_of.py rename to samples/client/petstore/python-experimental/petstore_api/model/dog_all_of.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/enum_arrays.py b/samples/client/petstore/python-experimental/petstore_api/model/enum_arrays.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/enum_arrays.py rename to samples/client/petstore/python-experimental/petstore_api/model/enum_arrays.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/enum_class.py b/samples/client/petstore/python-experimental/petstore_api/model/enum_class.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/enum_class.py rename to samples/client/petstore/python-experimental/petstore_api/model/enum_class.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/enum_test.py b/samples/client/petstore/python-experimental/petstore_api/model/enum_test.py similarity index 98% rename from samples/client/petstore/python-experimental/petstore_api/models/enum_test.py rename to samples/client/petstore/python-experimental/petstore_api/model/enum_test.py index 71cf60fd4823..bc0d1025261f 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/enum_test.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/enum_test.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import outer_enum + from petstore_api.model import outer_enum except ImportError: outer_enum = sys.modules[ - 'petstore_api.models.outer_enum'] + 'petstore_api.model.outer_enum'] class EnumTest(ModelNormal): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/file.py b/samples/client/petstore/python-experimental/petstore_api/model/file.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/file.py rename to samples/client/petstore/python-experimental/petstore_api/model/file.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py b/samples/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py rename to samples/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py index 79e5638ccc94..0a9471e9e420 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import file + from petstore_api.model import file except ImportError: file = sys.modules[ - 'petstore_api.models.file'] + 'petstore_api.model.file'] class FileSchemaTestClass(ModelNormal): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/format_test.py b/samples/client/petstore/python-experimental/petstore_api/model/format_test.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/format_test.py rename to samples/client/petstore/python-experimental/petstore_api/model/format_test.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/grandparent.py b/samples/client/petstore/python-experimental/petstore_api/model/grandparent.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/grandparent.py rename to samples/client/petstore/python-experimental/petstore_api/model/grandparent.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py b/samples/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py similarity index 95% rename from samples/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py rename to samples/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py index 54dc5be641d7..81947e1c497d 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py @@ -34,25 +34,25 @@ validate_get_composed_info, ) try: - from petstore_api.models import child_cat + from petstore_api.model import child_cat except ImportError: child_cat = sys.modules[ - 'petstore_api.models.child_cat'] + 'petstore_api.model.child_cat'] try: - from petstore_api.models import child_dog + from petstore_api.model import child_dog except ImportError: child_dog = sys.modules[ - 'petstore_api.models.child_dog'] + 'petstore_api.model.child_dog'] try: - from petstore_api.models import child_lizard + from petstore_api.model import child_lizard except ImportError: child_lizard = sys.modules[ - 'petstore_api.models.child_lizard'] + 'petstore_api.model.child_lizard'] try: - from petstore_api.models import parent_pet + from petstore_api.model import parent_pet except ImportError: parent_pet = sys.modules[ - 'petstore_api.models.parent_pet'] + 'petstore_api.model.parent_pet'] class GrandparentAnimal(ModelNormal): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py b/samples/client/petstore/python-experimental/petstore_api/model/has_only_read_only.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py rename to samples/client/petstore/python-experimental/petstore_api/model/has_only_read_only.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/list.py b/samples/client/petstore/python-experimental/petstore_api/model/list.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/list.py rename to samples/client/petstore/python-experimental/petstore_api/model/list.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/map_test.py b/samples/client/petstore/python-experimental/petstore_api/model/map_test.py similarity index 98% rename from samples/client/petstore/python-experimental/petstore_api/models/map_test.py rename to samples/client/petstore/python-experimental/petstore_api/model/map_test.py index 45be8a1fecfd..a22af06ce4fd 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/map_test.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/map_test.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import string_boolean_map + from petstore_api.model import string_boolean_map except ImportError: string_boolean_map = sys.modules[ - 'petstore_api.models.string_boolean_map'] + 'petstore_api.model.string_boolean_map'] class MapTest(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py rename to samples/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py index 0e584ebd43e9..a0fcac2eb019 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import animal + from petstore_api.model import animal except ImportError: animal = sys.modules[ - 'petstore_api.models.animal'] + 'petstore_api.model.animal'] class MixedPropertiesAndAdditionalPropertiesClass(ModelNormal): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/model200_response.py b/samples/client/petstore/python-experimental/petstore_api/model/model200_response.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/model200_response.py rename to samples/client/petstore/python-experimental/petstore_api/model/model200_response.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/model_return.py b/samples/client/petstore/python-experimental/petstore_api/model/model_return.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/model_return.py rename to samples/client/petstore/python-experimental/petstore_api/model/model_return.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/name.py b/samples/client/petstore/python-experimental/petstore_api/model/name.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/name.py rename to samples/client/petstore/python-experimental/petstore_api/model/name.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/number_only.py b/samples/client/petstore/python-experimental/petstore_api/model/number_only.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/number_only.py rename to samples/client/petstore/python-experimental/petstore_api/model/number_only.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/order.py b/samples/client/petstore/python-experimental/petstore_api/model/order.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/order.py rename to samples/client/petstore/python-experimental/petstore_api/model/order.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/outer_composite.py b/samples/client/petstore/python-experimental/petstore_api/model/outer_composite.py similarity index 98% rename from samples/client/petstore/python-experimental/petstore_api/models/outer_composite.py rename to samples/client/petstore/python-experimental/petstore_api/model/outer_composite.py index a64cbe37592c..5614b9afe422 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/outer_composite.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/outer_composite.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import outer_number + from petstore_api.model import outer_number except ImportError: outer_number = sys.modules[ - 'petstore_api.models.outer_number'] + 'petstore_api.model.outer_number'] class OuterComposite(ModelNormal): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/outer_enum.py b/samples/client/petstore/python-experimental/petstore_api/model/outer_enum.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/outer_enum.py rename to samples/client/petstore/python-experimental/petstore_api/model/outer_enum.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/outer_number.py b/samples/client/petstore/python-experimental/petstore_api/model/outer_number.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/outer_number.py rename to samples/client/petstore/python-experimental/petstore_api/model/outer_number.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/parent.py b/samples/client/petstore/python-experimental/petstore_api/model/parent.py similarity index 97% rename from samples/client/petstore/python-experimental/petstore_api/models/parent.py rename to samples/client/petstore/python-experimental/petstore_api/model/parent.py index 5d33beb6979d..a855a3ffd014 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/parent.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/parent.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import grandparent + from petstore_api.model import grandparent except ImportError: grandparent = sys.modules[ - 'petstore_api.models.grandparent'] + 'petstore_api.model.grandparent'] try: - from petstore_api.models import parent_all_of + from petstore_api.model import parent_all_of except ImportError: parent_all_of = sys.modules[ - 'petstore_api.models.parent_all_of'] + 'petstore_api.model.parent_all_of'] class Parent(ModelComposed): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/parent_all_of.py b/samples/client/petstore/python-experimental/petstore_api/model/parent_all_of.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/parent_all_of.py rename to samples/client/petstore/python-experimental/petstore_api/model/parent_all_of.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/parent_pet.py b/samples/client/petstore/python-experimental/petstore_api/model/parent_pet.py similarity index 96% rename from samples/client/petstore/python-experimental/petstore_api/models/parent_pet.py rename to samples/client/petstore/python-experimental/petstore_api/model/parent_pet.py index 4635ac947806..0b0b30c656f5 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/parent_pet.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/parent_pet.py @@ -34,25 +34,25 @@ validate_get_composed_info, ) try: - from petstore_api.models import child_cat + from petstore_api.model import child_cat except ImportError: child_cat = sys.modules[ - 'petstore_api.models.child_cat'] + 'petstore_api.model.child_cat'] try: - from petstore_api.models import child_dog + from petstore_api.model import child_dog except ImportError: child_dog = sys.modules[ - 'petstore_api.models.child_dog'] + 'petstore_api.model.child_dog'] try: - from petstore_api.models import child_lizard + from petstore_api.model import child_lizard except ImportError: child_lizard = sys.modules[ - 'petstore_api.models.child_lizard'] + 'petstore_api.model.child_lizard'] try: - from petstore_api.models import grandparent_animal + from petstore_api.model import grandparent_animal except ImportError: grandparent_animal = sys.modules[ - 'petstore_api.models.grandparent_animal'] + 'petstore_api.model.grandparent_animal'] class ParentPet(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pet.py b/samples/client/petstore/python-experimental/petstore_api/model/pet.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/pet.py rename to samples/client/petstore/python-experimental/petstore_api/model/pet.py index c93acd53c96c..742d7cdf04a8 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pet.py +++ b/samples/client/petstore/python-experimental/petstore_api/model/pet.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import category + from petstore_api.model import category except ImportError: category = sys.modules[ - 'petstore_api.models.category'] + 'petstore_api.model.category'] try: - from petstore_api.models import tag + from petstore_api.model import tag except ImportError: tag = sys.modules[ - 'petstore_api.models.tag'] + 'petstore_api.model.tag'] class Pet(ModelNormal): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/player.py b/samples/client/petstore/python-experimental/petstore_api/model/player.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/player.py rename to samples/client/petstore/python-experimental/petstore_api/model/player.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/read_only_first.py b/samples/client/petstore/python-experimental/petstore_api/model/read_only_first.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/read_only_first.py rename to samples/client/petstore/python-experimental/petstore_api/model/read_only_first.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/special_model_name.py b/samples/client/petstore/python-experimental/petstore_api/model/special_model_name.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/special_model_name.py rename to samples/client/petstore/python-experimental/petstore_api/model/special_model_name.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py b/samples/client/petstore/python-experimental/petstore_api/model/string_boolean_map.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py rename to samples/client/petstore/python-experimental/petstore_api/model/string_boolean_map.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/tag.py b/samples/client/petstore/python-experimental/petstore_api/model/tag.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/tag.py rename to samples/client/petstore/python-experimental/petstore_api/model/tag.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/type_holder_default.py b/samples/client/petstore/python-experimental/petstore_api/model/type_holder_default.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/type_holder_default.py rename to samples/client/petstore/python-experimental/petstore_api/model/type_holder_default.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/type_holder_example.py b/samples/client/petstore/python-experimental/petstore_api/model/type_holder_example.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/type_holder_example.py rename to samples/client/petstore/python-experimental/petstore_api/model/type_holder_example.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/user.py b/samples/client/petstore/python-experimental/petstore_api/model/user.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/user.py rename to samples/client/petstore/python-experimental/petstore_api/model/user.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/xml_item.py b/samples/client/petstore/python-experimental/petstore_api/model/xml_item.py similarity index 100% rename from samples/client/petstore/python-experimental/petstore_api/models/xml_item.py rename to samples/client/petstore/python-experimental/petstore_api/model/xml_item.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/__init__.py b/samples/client/petstore/python-experimental/petstore_api/models/__init__.py index e02c66519259..51bdb1a85a57 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/__init__.py +++ b/samples/client/petstore/python-experimental/petstore_api/models/__init__.py @@ -1,15 +1,75 @@ # coding: utf-8 # flake8: noqa -""" - 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 +# import all models into this package +# if you have many models here with many references from one model to another this may +# raise a RecursionError +# to avoid this, import only the models that you directly need like: +# from from petstore_api.model.pet import Pet +# or import this package, but before doing it, use: +# import sys +# sys.setrecursionlimit(n) - The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -# we can not import model classes here because that would create a circular -# reference which would not work in python2 +from petstore_api.model.additional_properties_any_type import AdditionalPropertiesAnyType +from petstore_api.model.additional_properties_array import AdditionalPropertiesArray +from petstore_api.model.additional_properties_boolean import AdditionalPropertiesBoolean +from petstore_api.model.additional_properties_class import AdditionalPropertiesClass +from petstore_api.model.additional_properties_integer import AdditionalPropertiesInteger +from petstore_api.model.additional_properties_number import AdditionalPropertiesNumber +from petstore_api.model.additional_properties_object import AdditionalPropertiesObject +from petstore_api.model.additional_properties_string import AdditionalPropertiesString +from petstore_api.model.animal import Animal +from petstore_api.model.api_response import ApiResponse +from petstore_api.model.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly +from petstore_api.model.array_of_number_only import ArrayOfNumberOnly +from petstore_api.model.array_test import ArrayTest +from petstore_api.model.capitalization import Capitalization +from petstore_api.model.cat import Cat +from petstore_api.model.cat_all_of import CatAllOf +from petstore_api.model.category import Category +from petstore_api.model.child import Child +from petstore_api.model.child_all_of import ChildAllOf +from petstore_api.model.child_cat import ChildCat +from petstore_api.model.child_cat_all_of import ChildCatAllOf +from petstore_api.model.child_dog import ChildDog +from petstore_api.model.child_dog_all_of import ChildDogAllOf +from petstore_api.model.child_lizard import ChildLizard +from petstore_api.model.child_lizard_all_of import ChildLizardAllOf +from petstore_api.model.class_model import ClassModel +from petstore_api.model.client import Client +from petstore_api.model.dog import Dog +from petstore_api.model.dog_all_of import DogAllOf +from petstore_api.model.enum_arrays import EnumArrays +from petstore_api.model.enum_class import EnumClass +from petstore_api.model.enum_test import EnumTest +from petstore_api.model.file import File +from petstore_api.model.file_schema_test_class import FileSchemaTestClass +from petstore_api.model.format_test import FormatTest +from petstore_api.model.grandparent import Grandparent +from petstore_api.model.grandparent_animal import GrandparentAnimal +from petstore_api.model.has_only_read_only import HasOnlyReadOnly +from petstore_api.model.list import List +from petstore_api.model.map_test import MapTest +from petstore_api.model.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass +from petstore_api.model.model200_response import Model200Response +from petstore_api.model.model_return import ModelReturn +from petstore_api.model.name import Name +from petstore_api.model.number_only import NumberOnly +from petstore_api.model.order import Order +from petstore_api.model.outer_composite import OuterComposite +from petstore_api.model.outer_enum import OuterEnum +from petstore_api.model.outer_number import OuterNumber +from petstore_api.model.parent import Parent +from petstore_api.model.parent_all_of import ParentAllOf +from petstore_api.model.parent_pet import ParentPet +from petstore_api.model.pet import Pet +from petstore_api.model.player import Player +from petstore_api.model.read_only_first import ReadOnlyFirst +from petstore_api.model.special_model_name import SpecialModelName +from petstore_api.model.string_boolean_map import StringBooleanMap +from petstore_api.model.tag import Tag +from petstore_api.model.type_holder_default import TypeHolderDefault +from petstore_api.model.type_holder_example import TypeHolderExample +from petstore_api.model.user import User +from petstore_api.model.xml_item import XmlItem diff --git a/samples/client/petstore/python-experimental/test/test_additional_properties_any_type.py b/samples/client/petstore/python-experimental/test/test_additional_properties_any_type.py index 4b6739a1faf3..ce985f76ed9e 100644 --- a/samples/client/petstore/python-experimental/test/test_additional_properties_any_type.py +++ b/samples/client/petstore/python-experimental/test/test_additional_properties_any_type.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.additional_properties_any_type import AdditionalPropertiesAnyType class TestAdditionalPropertiesAnyType(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testAdditionalPropertiesAnyType(self): """Test AdditionalPropertiesAnyType""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.additional_properties_any_type.AdditionalPropertiesAnyType() # noqa: E501 + # model = AdditionalPropertiesAnyType() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_additional_properties_array.py b/samples/client/petstore/python-experimental/test/test_additional_properties_array.py index 6c86292cd4a4..f63ca82f6c22 100644 --- a/samples/client/petstore/python-experimental/test/test_additional_properties_array.py +++ b/samples/client/petstore/python-experimental/test/test_additional_properties_array.py @@ -5,21 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.additional_properties_array import AdditionalPropertiesArray # noqa: E501 -from petstore_api.rest import ApiException -from petstore_api.exceptions import ApiTypeError - -import datetime +from petstore_api.model.additional_properties_array import AdditionalPropertiesArray class TestAdditionalPropertiesArray(unittest.TestCase): @@ -37,6 +33,7 @@ def testAdditionalPropertiesArray(self): model = AdditionalPropertiesArray() # can make one with additional properties + import datetime some_val = [] model = AdditionalPropertiesArray(some_key=some_val) assert model['some_key'] == some_val @@ -45,7 +42,7 @@ def testAdditionalPropertiesArray(self): assert model['some_key'] == some_val # type checking works on additional properties - with self.assertRaises(ApiTypeError) as exc: + with self.assertRaises(petstore_api.ApiTypeError) as exc: model = AdditionalPropertiesArray(some_key='some string') diff --git a/samples/client/petstore/python-experimental/test/test_additional_properties_boolean.py b/samples/client/petstore/python-experimental/test/test_additional_properties_boolean.py index 33bcfb90bb61..e5a13891c098 100644 --- a/samples/client/petstore/python-experimental/test/test_additional_properties_boolean.py +++ b/samples/client/petstore/python-experimental/test/test_additional_properties_boolean.py @@ -5,19 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.additional_properties_boolean import AdditionalPropertiesBoolean # noqa: E501 -from petstore_api.rest import ApiException -from petstore_api.exceptions import ApiTypeError +from petstore_api.model.additional_properties_boolean import AdditionalPropertiesBoolean class TestAdditionalPropertiesBoolean(unittest.TestCase): @@ -39,7 +37,7 @@ def testAdditionalPropertiesBoolean(self): assert model['some_key'] == True # type checking works on additional properties - with self.assertRaises(ApiTypeError) as exc: + with self.assertRaises(petstore_api.ApiTypeError) as exc: model = AdditionalPropertiesBoolean(some_key='True') diff --git a/samples/client/petstore/python-experimental/test/test_additional_properties_class.py b/samples/client/petstore/python-experimental/test/test_additional_properties_class.py index fc9df3bbb505..befc14455da2 100644 --- a/samples/client/petstore/python-experimental/test/test_additional_properties_class.py +++ b/samples/client/petstore/python-experimental/test/test_additional_properties_class.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.additional_properties_class import AdditionalPropertiesClass # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.additional_properties_class import AdditionalPropertiesClass class TestAdditionalPropertiesClass(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testAdditionalPropertiesClass(self): """Test AdditionalPropertiesClass""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.additional_properties_class.AdditionalPropertiesClass() # noqa: E501 + # model = AdditionalPropertiesClass() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_additional_properties_integer.py b/samples/client/petstore/python-experimental/test/test_additional_properties_integer.py index 0029cb9c84c5..0e08b8f87706 100644 --- a/samples/client/petstore/python-experimental/test/test_additional_properties_integer.py +++ b/samples/client/petstore/python-experimental/test/test_additional_properties_integer.py @@ -5,19 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.additional_properties_integer import AdditionalPropertiesInteger # noqa: E501 -from petstore_api.rest import ApiException -from petstore_api.exceptions import ApiTypeError +from petstore_api.model.additional_properties_integer import AdditionalPropertiesInteger class TestAdditionalPropertiesInteger(unittest.TestCase): @@ -39,7 +37,7 @@ def testAdditionalPropertiesInteger(self): assert model['some_key'] == 3 # type checking works on additional properties - with self.assertRaises(ApiTypeError) as exc: + with self.assertRaises(petstore_api.ApiTypeError) as exc: model = AdditionalPropertiesInteger(some_key=11.3) diff --git a/samples/client/petstore/python-experimental/test/test_additional_properties_number.py b/samples/client/petstore/python-experimental/test/test_additional_properties_number.py index 28d0b23377a6..90f4429e989f 100644 --- a/samples/client/petstore/python-experimental/test/test_additional_properties_number.py +++ b/samples/client/petstore/python-experimental/test/test_additional_properties_number.py @@ -5,19 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.additional_properties_number import AdditionalPropertiesNumber # noqa: E501 -from petstore_api.rest import ApiException -from petstore_api.exceptions import ApiTypeError +from petstore_api.model.additional_properties_number import AdditionalPropertiesNumber class TestAdditionalPropertiesNumber(unittest.TestCase): @@ -39,8 +37,9 @@ def testAdditionalPropertiesNumber(self): assert model['some_key'] == 11.3 # type checking works on additional properties - with self.assertRaises(ApiTypeError) as exc: + with self.assertRaises(petstore_api.ApiTypeError) as exc: model = AdditionalPropertiesNumber(some_key=10) + if __name__ == '__main__': unittest.main() diff --git a/samples/client/petstore/python-experimental/test/test_additional_properties_object.py b/samples/client/petstore/python-experimental/test/test_additional_properties_object.py index 3d135116736c..ded4a8e8a124 100644 --- a/samples/client/petstore/python-experimental/test/test_additional_properties_object.py +++ b/samples/client/petstore/python-experimental/test/test_additional_properties_object.py @@ -5,21 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.additional_properties_object import AdditionalPropertiesObject # noqa: E501 -from petstore_api.rest import ApiException -from petstore_api.exceptions import ApiTypeError - -import datetime +from petstore_api.model.additional_properties_object import AdditionalPropertiesObject class TestAdditionalPropertiesObject(unittest.TestCase): @@ -40,12 +36,13 @@ def testAdditionalPropertiesObject(self): some_val = {} model = AdditionalPropertiesObject(some_key=some_val) assert model['some_key'] == some_val + import datetime some_val = {'a': True, 'b': datetime.date(1970,1,1), 'c': datetime.datetime(1970,1,1), 'd': {}, 'e': 3.1, 'f': 1, 'g': [], 'h': 'hello'} model = AdditionalPropertiesObject(some_key=some_val) assert model['some_key'] == some_val # type checking works on additional properties - with self.assertRaises(ApiTypeError) as exc: + with self.assertRaises(petstore_api.ApiTypeError) as exc: model = AdditionalPropertiesObject(some_key='some string') diff --git a/samples/client/petstore/python-experimental/test/test_additional_properties_string.py b/samples/client/petstore/python-experimental/test/test_additional_properties_string.py index 0276334ead53..cff2c31921fe 100644 --- a/samples/client/petstore/python-experimental/test/test_additional_properties_string.py +++ b/samples/client/petstore/python-experimental/test/test_additional_properties_string.py @@ -5,19 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.additional_properties_string import AdditionalPropertiesString # noqa: E501 -from petstore_api.rest import ApiException -from petstore_api.exceptions import ApiTypeError +from petstore_api.model.additional_properties_string import AdditionalPropertiesString class TestAdditionalPropertiesString(unittest.TestCase): @@ -39,7 +37,7 @@ def testAdditionalPropertiesString(self): assert model['some_key'] == 'some_val' # type checking works on additional properties - with self.assertRaises(ApiTypeError) as exc: + with self.assertRaises(petstore_api.ApiTypeError) as exc: model = AdditionalPropertiesString(some_key=True) diff --git a/samples/client/petstore/python-experimental/test/test_animal.py b/samples/client/petstore/python-experimental/test/test_animal.py index 179f1fbd0e52..958f303f13e3 100644 --- a/samples/client/petstore/python-experimental/test/test_animal.py +++ b/samples/client/petstore/python-experimental/test/test_animal.py @@ -5,18 +5,27 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.animal import Animal # noqa: E501 -from petstore_api.rest import ApiException +try: + from petstore_api.model import cat +except ImportError: + cat = sys.modules[ + 'petstore_api.model.cat'] +try: + from petstore_api.model import dog +except ImportError: + dog = sys.modules[ + 'petstore_api.model.dog'] +from petstore_api.model.animal import Animal class TestAnimal(unittest.TestCase): @@ -31,7 +40,7 @@ def tearDown(self): def testAnimal(self): """Test Animal""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.animal.Animal() # noqa: E501 + # model = Animal() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_another_fake_api.py b/samples/client/petstore/python-experimental/test/test_another_fake_api.py index 4b80dc4eda52..f79966a26961 100644 --- a/samples/client/petstore/python-experimental/test/test_another_fake_api.py +++ b/samples/client/petstore/python-experimental/test/test_another_fake_api.py @@ -5,7 +5,7 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ @@ -16,20 +16,19 @@ import petstore_api from petstore_api.api.another_fake_api import AnotherFakeApi # noqa: E501 -from petstore_api.rest import ApiException class TestAnotherFakeApi(unittest.TestCase): """AnotherFakeApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.another_fake_api.AnotherFakeApi() # noqa: E501 + self.api = AnotherFakeApi() # noqa: E501 def tearDown(self): pass - def test_test_special_tags(self): - """Test case for test_special_tags + def test_call_123_test_special_tags(self): + """Test case for call_123_test_special_tags To test special tags # noqa: E501 """ diff --git a/samples/client/petstore/python-experimental/test/test_api_response.py b/samples/client/petstore/python-experimental/test/test_api_response.py index 5031b458a0db..9db92633f626 100644 --- a/samples/client/petstore/python-experimental/test/test_api_response.py +++ b/samples/client/petstore/python-experimental/test/test_api_response.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.api_response import ApiResponse # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.api_response import ApiResponse class TestApiResponse(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testApiResponse(self): """Test ApiResponse""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.api_response.ApiResponse() # noqa: E501 + # model = ApiResponse() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_array_of_array_of_number_only.py b/samples/client/petstore/python-experimental/test/test_array_of_array_of_number_only.py index a02233045421..4980ad17afb5 100644 --- a/samples/client/petstore/python-experimental/test/test_array_of_array_of_number_only.py +++ b/samples/client/petstore/python-experimental/test/test_array_of_array_of_number_only.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly class TestArrayOfArrayOfNumberOnly(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testArrayOfArrayOfNumberOnly(self): """Test ArrayOfArrayOfNumberOnly""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.array_of_array_of_number_only.ArrayOfArrayOfNumberOnly() # noqa: E501 + # model = ArrayOfArrayOfNumberOnly() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_array_of_number_only.py b/samples/client/petstore/python-experimental/test/test_array_of_number_only.py index 1a928bf7d2e0..479c537cada7 100644 --- a/samples/client/petstore/python-experimental/test/test_array_of_number_only.py +++ b/samples/client/petstore/python-experimental/test/test_array_of_number_only.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.array_of_number_only import ArrayOfNumberOnly # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.array_of_number_only import ArrayOfNumberOnly class TestArrayOfNumberOnly(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testArrayOfNumberOnly(self): """Test ArrayOfNumberOnly""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.array_of_number_only.ArrayOfNumberOnly() # noqa: E501 + # model = ArrayOfNumberOnly() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_array_test.py b/samples/client/petstore/python-experimental/test/test_array_test.py index c56b77b77ee3..2426b27b7e46 100644 --- a/samples/client/petstore/python-experimental/test/test_array_test.py +++ b/samples/client/petstore/python-experimental/test/test_array_test.py @@ -5,18 +5,22 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.array_test import ArrayTest # noqa: E501 -from petstore_api.rest import ApiException +try: + from petstore_api.model import read_only_first +except ImportError: + read_only_first = sys.modules[ + 'petstore_api.model.read_only_first'] +from petstore_api.model.array_test import ArrayTest class TestArrayTest(unittest.TestCase): @@ -31,7 +35,7 @@ def tearDown(self): def testArrayTest(self): """Test ArrayTest""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.array_test.ArrayTest() # noqa: E501 + # model = ArrayTest() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_capitalization.py b/samples/client/petstore/python-experimental/test/test_capitalization.py index 2ae7725b3f09..20d2649c01eb 100644 --- a/samples/client/petstore/python-experimental/test/test_capitalization.py +++ b/samples/client/petstore/python-experimental/test/test_capitalization.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.capitalization import Capitalization # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.capitalization import Capitalization class TestCapitalization(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testCapitalization(self): """Test Capitalization""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.capitalization.Capitalization() # noqa: E501 + # model = Capitalization() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_cat.py b/samples/client/petstore/python-experimental/test/test_cat.py index 5ebd7908d2db..64b525aaf118 100644 --- a/samples/client/petstore/python-experimental/test/test_cat.py +++ b/samples/client/petstore/python-experimental/test/test_cat.py @@ -5,18 +5,27 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.cat import Cat # noqa: E501 -from petstore_api.rest import ApiException +try: + from petstore_api.model import animal +except ImportError: + animal = sys.modules[ + 'petstore_api.model.animal'] +try: + from petstore_api.model import cat_all_of +except ImportError: + cat_all_of = sys.modules[ + 'petstore_api.model.cat_all_of'] +from petstore_api.model.cat import Cat class TestCat(unittest.TestCase): @@ -31,7 +40,7 @@ def tearDown(self): def testCat(self): """Test Cat""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.cat.Cat() # noqa: E501 + # model = Cat() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_cat_all_of.py b/samples/client/petstore/python-experimental/test/test_cat_all_of.py index 531443380c6e..a5bb91ac864e 100644 --- a/samples/client/petstore/python-experimental/test/test_cat_all_of.py +++ b/samples/client/petstore/python-experimental/test/test_cat_all_of.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.cat_all_of import CatAllOf # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.cat_all_of import CatAllOf class TestCatAllOf(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testCatAllOf(self): """Test CatAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.cat_all_of.CatAllOf() # noqa: E501 + # model = CatAllOf() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_category.py b/samples/client/petstore/python-experimental/test/test_category.py index 6a592521281e..59b64e5924a8 100644 --- a/samples/client/petstore/python-experimental/test/test_category.py +++ b/samples/client/petstore/python-experimental/test/test_category.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.category import Category # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.category import Category class TestCategory(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testCategory(self): """Test Category""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.category.Category() # noqa: E501 + # model = Category() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_child.py b/samples/client/petstore/python-experimental/test/test_child.py index 660cfe637d96..51c0bb129d24 100644 --- a/samples/client/petstore/python-experimental/test/test_child.py +++ b/samples/client/petstore/python-experimental/test/test_child.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import child_all_of +except ImportError: + child_all_of = sys.modules[ + 'petstore_api.model.child_all_of'] +try: + from petstore_api.model import parent +except ImportError: + parent = sys.modules[ + 'petstore_api.model.parent'] +from petstore_api.model.child import Child class TestChild(unittest.TestCase): @@ -33,7 +44,7 @@ def testChild(self): radio_waves = True tele_vision = True inter_net = True - child = petstore_api.Child( + child = Child( radio_waves=radio_waves, tele_vision=tele_vision, inter_net=inter_net @@ -64,10 +75,10 @@ def testChild(self): # setting a value that doesn't exist raises an exception # with a key - with self.assertRaises(AttributeError): + with self.assertRaises(petstore_api.ApiAttributeError): child['invalid_variable'] = 'some value' # with setattr - with self.assertRaises(AttributeError): + with self.assertRaises(petstore_api.ApiAttributeError): setattr(child, 'invalid_variable', 'some value') # with hasattr @@ -75,12 +86,12 @@ def testChild(self): # getting a value that doesn't exist raises an exception # with a key - with self.assertRaises(AttributeError): + with self.assertRaises(petstore_api.ApiAttributeError): invalid_variable = child['invalid_variable'] # with getattr self.assertEquals(getattr(child, 'invalid_variable', 'some value'), 'some value') - with self.assertRaises(AttributeError): + with self.assertRaises(petstore_api.ApiAttributeError): invalid_variable = getattr(child, 'invalid_variable') # make sure that the ModelComposed class properties are correct @@ -90,8 +101,8 @@ def testChild(self): { 'anyOf': [], 'allOf': [ - petstore_api.ChildAllOf, - petstore_api.Parent, + child_all_of.ChildAllOf, + parent.Parent, ], 'oneOf': [], } @@ -99,9 +110,9 @@ def testChild(self): # model._composed_instances is a list of the instances that were # made from the anyOf/allOf/OneOf classes in model._composed_schemas() for composed_instance in child._composed_instances: - if composed_instance.__class__ == petstore_api.Parent: + if composed_instance.__class__ == parent.Parent: parent_instance = composed_instance - elif composed_instance.__class__ == petstore_api.ChildAllOf: + elif composed_instance.__class__ == child_all_of.ChildAllOf: child_allof_instance = composed_instance self.assertEqual( child._composed_instances, @@ -132,12 +143,11 @@ def testChild(self): # including extra parameters raises an exception with self.assertRaises(petstore_api.ApiValueError): - child = petstore_api.Child( + child = Child( radio_waves=radio_waves, tele_vision=tele_vision, inter_net=inter_net, - unknown_property='some value' - ) + unknown_property='some value') if __name__ == '__main__': unittest.main() diff --git a/samples/client/petstore/python-experimental/test/test_child_all_of.py b/samples/client/petstore/python-experimental/test/test_child_all_of.py index e3f14035f625..96e479cf0796 100644 --- a/samples/client/petstore/python-experimental/test/test_child_all_of.py +++ b/samples/client/petstore/python-experimental/test/test_child_all_of.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.child_all_of import ChildAllOf class TestChildAllOf(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testChildAllOf(self): """Test ChildAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ChildAllOf() # noqa: E501 + # model = ChildAllOf() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_child_cat.py b/samples/client/petstore/python-experimental/test/test_child_cat.py index c42c3b583aae..34c085515a80 100644 --- a/samples/client/petstore/python-experimental/test/test_child_cat.py +++ b/samples/client/petstore/python-experimental/test/test_child_cat.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import child_cat_all_of +except ImportError: + child_cat_all_of = sys.modules[ + 'petstore_api.model.child_cat_all_of'] +try: + from petstore_api.model import parent_pet +except ImportError: + parent_pet = sys.modules[ + 'petstore_api.model.parent_pet'] +from petstore_api.model.child_cat import ChildCat class TestChildCat(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testChildCat(self): """Test ChildCat""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ChildCat() # noqa: E501 + # model = ChildCat() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_child_cat_all_of.py b/samples/client/petstore/python-experimental/test/test_child_cat_all_of.py index 3304a81a2321..2a7aab100fbf 100644 --- a/samples/client/petstore/python-experimental/test/test_child_cat_all_of.py +++ b/samples/client/petstore/python-experimental/test/test_child_cat_all_of.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.child_cat_all_of import ChildCatAllOf class TestChildCatAllOf(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testChildCatAllOf(self): """Test ChildCatAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ChildCatAllOf() # noqa: E501 + # model = ChildCatAllOf() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_child_dog.py b/samples/client/petstore/python-experimental/test/test_child_dog.py index 9c56f27bbc49..dfb09213e40c 100644 --- a/samples/client/petstore/python-experimental/test/test_child_dog.py +++ b/samples/client/petstore/python-experimental/test/test_child_dog.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import child_dog_all_of +except ImportError: + child_dog_all_of = sys.modules[ + 'petstore_api.model.child_dog_all_of'] +try: + from petstore_api.model import parent_pet +except ImportError: + parent_pet = sys.modules[ + 'petstore_api.model.parent_pet'] +from petstore_api.model.child_dog import ChildDog class TestChildDog(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testChildDog(self): """Test ChildDog""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ChildDog() # noqa: E501 + # model = ChildDog() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_child_dog_all_of.py b/samples/client/petstore/python-experimental/test/test_child_dog_all_of.py index a9124db412b7..ca75000c650e 100644 --- a/samples/client/petstore/python-experimental/test/test_child_dog_all_of.py +++ b/samples/client/petstore/python-experimental/test/test_child_dog_all_of.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.child_dog_all_of import ChildDogAllOf class TestChildDogAllOf(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testChildDogAllOf(self): """Test ChildDogAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ChildDogAllOf() # noqa: E501 + # model = ChildDogAllOf() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_child_lizard.py b/samples/client/petstore/python-experimental/test/test_child_lizard.py index 21ba88480aad..975dc1612a9f 100644 --- a/samples/client/petstore/python-experimental/test/test_child_lizard.py +++ b/samples/client/petstore/python-experimental/test/test_child_lizard.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import child_lizard_all_of +except ImportError: + child_lizard_all_of = sys.modules[ + 'petstore_api.model.child_lizard_all_of'] +try: + from petstore_api.model import parent_pet +except ImportError: + parent_pet = sys.modules[ + 'petstore_api.model.parent_pet'] +from petstore_api.model.child_lizard import ChildLizard class TestChildLizard(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testChildLizard(self): """Test ChildLizard""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ChildLizard() # noqa: E501 + # model = ChildLizard() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_child_lizard_all_of.py b/samples/client/petstore/python-experimental/test/test_child_lizard_all_of.py index 824e376f855b..1b3bf4dba943 100644 --- a/samples/client/petstore/python-experimental/test/test_child_lizard_all_of.py +++ b/samples/client/petstore/python-experimental/test/test_child_lizard_all_of.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.child_lizard_all_of import ChildLizardAllOf class TestChildLizardAllOf(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testChildLizardAllOf(self): """Test ChildLizardAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ChildLizardAllOf() # noqa: E501 + # model = ChildLizardAllOf() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_class_model.py b/samples/client/petstore/python-experimental/test/test_class_model.py index 12b7fb99402e..060df39e4b5e 100644 --- a/samples/client/petstore/python-experimental/test/test_class_model.py +++ b/samples/client/petstore/python-experimental/test/test_class_model.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.class_model import ClassModel # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.class_model import ClassModel class TestClassModel(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testClassModel(self): """Test ClassModel""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.class_model.ClassModel() # noqa: E501 + # model = ClassModel() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_client.py b/samples/client/petstore/python-experimental/test/test_client.py index 9e18c4310d96..ab5e3a80d377 100644 --- a/samples/client/petstore/python-experimental/test/test_client.py +++ b/samples/client/petstore/python-experimental/test/test_client.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.client import Client # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.client import Client class TestClient(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testClient(self): """Test Client""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.client.Client() # noqa: E501 + # model = Client() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_dog.py b/samples/client/petstore/python-experimental/test/test_dog.py index 91f9318b9c68..26949b34ae7f 100644 --- a/samples/client/petstore/python-experimental/test/test_dog.py +++ b/samples/client/petstore/python-experimental/test/test_dog.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import animal +except ImportError: + animal = sys.modules[ + 'petstore_api.model.animal'] +try: + from petstore_api.model import dog_all_of +except ImportError: + dog_all_of = sys.modules[ + 'petstore_api.model.dog_all_of'] +from petstore_api.model.dog import Dog class TestDog(unittest.TestCase): @@ -33,7 +44,7 @@ def testDog(self): class_name = 'Dog' color = 'white' breed = 'Jack Russel Terrier' - dog = petstore_api.Dog( + dog = Dog( class_name=class_name, color=color, breed=breed @@ -87,8 +98,8 @@ def testDog(self): { 'anyOf': [], 'allOf': [ - petstore_api.Animal, - petstore_api.DogAllOf, + animal.Animal, + dog_all_of.DogAllOf, ], 'oneOf': [], } @@ -96,9 +107,9 @@ def testDog(self): # model._composed_instances is a list of the instances that were # made from the anyOf/allOf/OneOf classes in model._composed_schemas() for composed_instance in dog._composed_instances: - if composed_instance.__class__ == petstore_api.Animal: + if composed_instance.__class__ == animal.Animal: animal_instance = composed_instance - elif composed_instance.__class__ == petstore_api.DogAllOf: + elif composed_instance.__class__ == dog_all_of.DogAllOf: dog_allof_instance = composed_instance self.assertEqual( dog._composed_instances, @@ -129,13 +140,12 @@ def testDog(self): # including extra parameters raises an exception with self.assertRaises(petstore_api.ApiValueError): - dog = petstore_api.Dog( + dog = Dog( class_name=class_name, color=color, breed=breed, unknown_property='some value' ) - if __name__ == '__main__': unittest.main() diff --git a/samples/client/petstore/python-experimental/test/test_dog_all_of.py b/samples/client/petstore/python-experimental/test/test_dog_all_of.py index 3d79f2888c96..7ab4e8ae79d8 100644 --- a/samples/client/petstore/python-experimental/test/test_dog_all_of.py +++ b/samples/client/petstore/python-experimental/test/test_dog_all_of.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.dog_all_of import DogAllOf # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.dog_all_of import DogAllOf class TestDogAllOf(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testDogAllOf(self): """Test DogAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.dog_all_of.DogAllOf() # noqa: E501 + # model = DogAllOf() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_enum_arrays.py b/samples/client/petstore/python-experimental/test/test_enum_arrays.py index be572508ef22..64ad5fd7dc08 100644 --- a/samples/client/petstore/python-experimental/test/test_enum_arrays.py +++ b/samples/client/petstore/python-experimental/test/test_enum_arrays.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.enum_arrays import EnumArrays # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.enum_arrays import EnumArrays class TestEnumArrays(unittest.TestCase): @@ -28,12 +27,136 @@ def setUp(self): def tearDown(self): pass - def testEnumArrays(self): - """Test EnumArrays""" - # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.enum_arrays.EnumArrays() # noqa: E501 - pass + def test_enumarrays_init(self): + # + # Check various combinations of valid values. + # + fish_or_crab = EnumArrays(just_symbol=">=") + self.assertEqual(fish_or_crab.just_symbol, ">=") + # if optional property is unset we raise an exception + with self.assertRaises(petstore_api.ApiAttributeError) as exc: + self.assertEqual(fish_or_crab.array_enum, None) + + fish_or_crab = EnumArrays(just_symbol="$", array_enum=["fish"]) + self.assertEqual(fish_or_crab.just_symbol, "$") + self.assertEqual(fish_or_crab.array_enum, ["fish"]) + + fish_or_crab = EnumArrays(just_symbol=">=", array_enum=["fish"]) + self.assertEqual(fish_or_crab.just_symbol, ">=") + self.assertEqual(fish_or_crab.array_enum, ["fish"]) + + fish_or_crab = EnumArrays(just_symbol="$", array_enum=["crab"]) + self.assertEqual(fish_or_crab.just_symbol, "$") + self.assertEqual(fish_or_crab.array_enum, ["crab"]) + + + # + # Check if setting invalid values fails + # + with self.assertRaises(petstore_api.ApiValueError) as exc: + fish_or_crab = EnumArrays(just_symbol="<=") + + with self.assertRaises(petstore_api.ApiValueError) as exc: + fish_or_crab = EnumArrays(just_symbol="$", array_enum=["dog"]) + + with self.assertRaises(petstore_api.ApiTypeError) as exc: + fish_or_crab = EnumArrays(just_symbol=["$"], array_enum=["crab"]) + + + def test_enumarrays_setter(self): + + # + # Check various combinations of valid values + # + fish_or_crab = EnumArrays() + + fish_or_crab.just_symbol = ">=" + self.assertEqual(fish_or_crab.just_symbol, ">=") + + fish_or_crab.just_symbol = "$" + self.assertEqual(fish_or_crab.just_symbol, "$") + + fish_or_crab.array_enum = [] + self.assertEqual(fish_or_crab.array_enum, []) + + fish_or_crab.array_enum = ["fish"] + self.assertEqual(fish_or_crab.array_enum, ["fish"]) + + fish_or_crab.array_enum = ["fish", "fish", "fish"] + self.assertEqual(fish_or_crab.array_enum, ["fish", "fish", "fish"]) + + fish_or_crab.array_enum = ["crab"] + self.assertEqual(fish_or_crab.array_enum, ["crab"]) + + fish_or_crab.array_enum = ["crab", "fish"] + self.assertEqual(fish_or_crab.array_enum, ["crab", "fish"]) + + fish_or_crab.array_enum = ["crab", "fish", "crab", "fish"] + self.assertEqual(fish_or_crab.array_enum, ["crab", "fish", "crab", "fish"]) + + # + # Check if setting invalid values fails + # + fish_or_crab = EnumArrays() + with self.assertRaises(petstore_api.ApiValueError) as exc: + fish_or_crab.just_symbol = "!=" + + with self.assertRaises(petstore_api.ApiTypeError) as exc: + fish_or_crab.just_symbol = ["fish"] + + with self.assertRaises(petstore_api.ApiValueError) as exc: + fish_or_crab.array_enum = ["cat"] + + with self.assertRaises(petstore_api.ApiValueError) as exc: + fish_or_crab.array_enum = ["fish", "crab", "dog"] + + with self.assertRaises(petstore_api.ApiTypeError) as exc: + fish_or_crab.array_enum = "fish" + + + def test_todict(self): + # + # Check if dictionary serialization works + # + dollar_fish_crab_dict = { + 'just_symbol': "$", + 'array_enum': ["fish", "crab"] + } + + dollar_fish_crab = EnumArrays( + just_symbol="$", array_enum=["fish", "crab"]) + + self.assertEqual(dollar_fish_crab_dict, dollar_fish_crab.to_dict()) + + # + # Sanity check for different arrays + # + dollar_crab_fish_dict = { + 'just_symbol': "$", + 'array_enum': ["crab", "fish"] + } + + dollar_fish_crab = EnumArrays( + just_symbol="$", array_enum=["fish", "crab"]) + + self.assertNotEqual(dollar_crab_fish_dict, dollar_fish_crab.to_dict()) + + + def test_equals(self): + # + # Check if object comparison works + # + fish1 = EnumArrays(just_symbol="$", array_enum=["fish"]) + fish2 = EnumArrays(just_symbol="$", array_enum=["fish"]) + self.assertEqual(fish1, fish2) + + fish = EnumArrays(just_symbol="$", array_enum=["fish"]) + crab = EnumArrays(just_symbol="$", array_enum=["crab"]) + self.assertNotEqual(fish, crab) + dollar = EnumArrays(just_symbol="$") + greater = EnumArrays(just_symbol=">=") + self.assertNotEqual(dollar, greater) if __name__ == '__main__': unittest.main() diff --git a/samples/client/petstore/python-experimental/test/test_enum_class.py b/samples/client/petstore/python-experimental/test/test_enum_class.py index 57eb14558a7d..f910231c9d02 100644 --- a/samples/client/petstore/python-experimental/test/test_enum_class.py +++ b/samples/client/petstore/python-experimental/test/test_enum_class.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.enum_class import EnumClass # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.enum_class import EnumClass class TestEnumClass(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testEnumClass(self): """Test EnumClass""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.enum_class.EnumClass() # noqa: E501 + # model = EnumClass() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_enum_test.py b/samples/client/petstore/python-experimental/test/test_enum_test.py index ecd43afc709d..0ada34cdc1f2 100644 --- a/samples/client/petstore/python-experimental/test/test_enum_test.py +++ b/samples/client/petstore/python-experimental/test/test_enum_test.py @@ -5,18 +5,22 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.enum_test import EnumTest # noqa: E501 -from petstore_api.rest import ApiException +try: + from petstore_api.model import outer_enum +except ImportError: + outer_enum = sys.modules[ + 'petstore_api.model.outer_enum'] +from petstore_api.model.enum_test import EnumTest class TestEnumTest(unittest.TestCase): @@ -31,7 +35,7 @@ def tearDown(self): def testEnumTest(self): """Test EnumTest""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.enum_test.EnumTest() # noqa: E501 + # model = EnumTest() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_fake_api.py b/samples/client/petstore/python-experimental/test/test_fake_api.py index 7a6f1d6810a0..d55e538b8608 100644 --- a/samples/client/petstore/python-experimental/test/test_fake_api.py +++ b/samples/client/petstore/python-experimental/test/test_fake_api.py @@ -11,24 +11,18 @@ from __future__ import absolute_import -import six import unittest -if six.PY3: - from unittest.mock import patch -else: - from mock import patch import petstore_api from petstore_api.api.fake_api import FakeApi # noqa: E501 -from petstore_api.rest import ApiException class TestFakeApi(unittest.TestCase): """FakeApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.fake_api.FakeApi() # noqa: E501 + self.api = FakeApi() # noqa: E501 def tearDown(self): pass @@ -57,18 +51,20 @@ def test_fake_outer_enum_serialize(self): """ # verify that the input and output are type OuterEnum + from petstore_api.model import outer_enum endpoint = self.api.fake_outer_enum_serialize - assert endpoint.openapi_types['body'] == (petstore_api.OuterEnum,) - assert endpoint.settings['response_type'] == (petstore_api.OuterEnum,) + assert endpoint.openapi_types['body'] == (outer_enum.OuterEnum,) + assert endpoint.settings['response_type'] == (outer_enum.OuterEnum,) def test_fake_outer_number_serialize(self): """Test case for fake_outer_number_serialize """ # verify that the input and output are the correct type + from petstore_api.model import outer_number endpoint = self.api.fake_outer_number_serialize - assert endpoint.openapi_types['body'] == (petstore_api.OuterNumber,) - assert endpoint.settings['response_type'] == (petstore_api.OuterNumber,) + assert endpoint.openapi_types['body'] == (outer_number.OuterNumber,) + assert endpoint.settings['response_type'] == (outer_number.OuterNumber,) def test_fake_outer_string_serialize(self): """Test case for fake_outer_string_serialize @@ -101,6 +97,11 @@ def test_test_endpoint_enums_length_one(self): """ # when we omit the required enums of length one, they are still set endpoint = self.api.test_endpoint_enums_length_one + import six + if six.PY3: + from unittest.mock import patch + else: + from mock import patch with patch.object(endpoint, 'call_with_http_info') as call_with_http_info: endpoint() call_with_http_info.assert_called_with( diff --git a/samples/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py b/samples/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py index 87cac0b9ef85..1ade31405a62 100644 --- a/samples/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py +++ b/samples/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py @@ -5,25 +5,24 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api # noqa: E501 -from petstore_api.rest import ApiException class TestFakeClassnameTags123Api(unittest.TestCase): """FakeClassnameTags123Api unit test stubs""" def setUp(self): - self.api = petstore_api.api.fake_classname_tags_123_api.FakeClassnameTags123Api() # noqa: E501 + self.api = FakeClassnameTags123Api() # noqa: E501 def tearDown(self): pass diff --git a/samples/client/petstore/python-experimental/test/test_file.py b/samples/client/petstore/python-experimental/test/test_file.py index cc32edb7b523..8d60f64e01cc 100644 --- a/samples/client/petstore/python-experimental/test/test_file.py +++ b/samples/client/petstore/python-experimental/test/test_file.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.file import File # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.file import File class TestFile(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testFile(self): """Test File""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.file.File() # noqa: E501 + # model = File() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_file_schema_test_class.py b/samples/client/petstore/python-experimental/test/test_file_schema_test_class.py index 91e1b6a1c745..9a4f6d38dfef 100644 --- a/samples/client/petstore/python-experimental/test/test_file_schema_test_class.py +++ b/samples/client/petstore/python-experimental/test/test_file_schema_test_class.py @@ -5,18 +5,22 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.file_schema_test_class import FileSchemaTestClass # noqa: E501 -from petstore_api.rest import ApiException +try: + from petstore_api.model import file +except ImportError: + file = sys.modules[ + 'petstore_api.model.file'] +from petstore_api.model.file_schema_test_class import FileSchemaTestClass class TestFileSchemaTestClass(unittest.TestCase): @@ -31,7 +35,7 @@ def tearDown(self): def testFileSchemaTestClass(self): """Test FileSchemaTestClass""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.file_schema_test_class.FileSchemaTestClass() # noqa: E501 + # model = FileSchemaTestClass() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_format_test.py b/samples/client/petstore/python-experimental/test/test_format_test.py index e7a32e3253ff..ca37b005fd96 100644 --- a/samples/client/petstore/python-experimental/test/test_format_test.py +++ b/samples/client/petstore/python-experimental/test/test_format_test.py @@ -2,26 +2,27 @@ """ 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 - OpenAPI spec version: 1.0.0 + + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - -import datetime +import sys import unittest import petstore_api -from petstore_api.models.format_test import FormatTest # noqa: E501 -from petstore_api import ApiValueError +from petstore_api.model.format_test import FormatTest class TestFormatTest(unittest.TestCase): """FormatTest unit test stubs""" def setUp(self): + import datetime self.required_named_args = dict( number=40.1, byte='what', @@ -37,7 +38,7 @@ def test_integer(self): key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)] for key, adder in key_adder_pairs: # value outside the bounds throws an error - with self.assertRaises(ApiValueError): + with self.assertRaises(petstore_api.ApiValueError): keyword_args[var_name] = validations[key] + adder FormatTest(**keyword_args) @@ -54,7 +55,7 @@ def test_int32(self): key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)] for key, adder in key_adder_pairs: # value outside the bounds throws an error - with self.assertRaises(ApiValueError): + with self.assertRaises(petstore_api.ApiValueError): keyword_args[var_name] = validations[key] + adder FormatTest(**keyword_args) @@ -71,7 +72,7 @@ def test_number(self): key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)] for key, adder in key_adder_pairs: # value outside the bounds throws an error - with self.assertRaises(ApiValueError): + with self.assertRaises(petstore_api.ApiValueError): keyword_args[var_name] = validations[key] + adder FormatTest(**keyword_args) @@ -88,7 +89,7 @@ def test_float(self): key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)] for key, adder in key_adder_pairs: # value outside the bounds throws an error - with self.assertRaises(ApiValueError): + with self.assertRaises(petstore_api.ApiValueError): keyword_args[var_name] = validations[key] + adder FormatTest(**keyword_args) @@ -105,7 +106,7 @@ def test_double(self): key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)] for key, adder in key_adder_pairs: # value outside the bounds throws an error - with self.assertRaises(ApiValueError): + with self.assertRaises(petstore_api.ApiValueError): keyword_args[var_name] = validations[key] + adder FormatTest(**keyword_args) @@ -122,7 +123,7 @@ def test_password(self): key_adder_pairs = [('max_length', 1), ('min_length', -1)] for key, adder in key_adder_pairs: # value outside the bounds throws an error - with self.assertRaises(ApiValueError): + with self.assertRaises(petstore_api.ApiValueError): keyword_args[var_name] = 'a'*(validations[key] + adder) FormatTest(**keyword_args) @@ -139,7 +140,7 @@ def test_string(self): values_invalid = ['abc3', '1', '.', ' ', 'مرحبا', ''] for value_invalid in values_invalid: # invalid values throw exceptions - with self.assertRaises(ApiValueError): + with self.assertRaises(petstore_api.ApiValueError): keyword_args[var_name] = value_invalid FormatTest(**keyword_args) @@ -148,6 +149,5 @@ def test_string(self): keyword_args[var_name] = value_valid assert getattr(FormatTest(**keyword_args), var_name) == value_valid - if __name__ == '__main__': unittest.main() diff --git a/samples/client/petstore/python-experimental/test/test_grandparent.py b/samples/client/petstore/python-experimental/test/test_grandparent.py index 44f594c086e4..2972d01161cd 100644 --- a/samples/client/petstore/python-experimental/test/test_grandparent.py +++ b/samples/client/petstore/python-experimental/test/test_grandparent.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.grandparent import Grandparent class TestGrandparent(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testGrandparent(self): """Test Grandparent""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Grandparent() # noqa: E501 + # model = Grandparent() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_grandparent_animal.py b/samples/client/petstore/python-experimental/test/test_grandparent_animal.py index dc0d300cdaea..cabe4d81f98e 100644 --- a/samples/client/petstore/python-experimental/test/test_grandparent_animal.py +++ b/samples/client/petstore/python-experimental/test/test_grandparent_animal.py @@ -11,10 +11,31 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import child_cat +except ImportError: + child_cat = sys.modules[ + 'petstore_api.model.child_cat'] +try: + from petstore_api.model import child_dog +except ImportError: + child_dog = sys.modules[ + 'petstore_api.model.child_dog'] +try: + from petstore_api.model import child_lizard +except ImportError: + child_lizard = sys.modules[ + 'petstore_api.model.child_lizard'] +try: + from petstore_api.model import parent_pet +except ImportError: + parent_pet = sys.modules[ + 'petstore_api.model.parent_pet'] +from petstore_api.model.grandparent_animal import GrandparentAnimal class TestGrandparentAnimal(unittest.TestCase): @@ -29,7 +50,7 @@ def tearDown(self): def testGrandparentAnimal(self): """Test GrandparentAnimal""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.GrandparentAnimal() # noqa: E501 + # model = GrandparentAnimal() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_has_only_read_only.py b/samples/client/petstore/python-experimental/test/test_has_only_read_only.py index 2dc052a328a0..9ebd7683b398 100644 --- a/samples/client/petstore/python-experimental/test/test_has_only_read_only.py +++ b/samples/client/petstore/python-experimental/test/test_has_only_read_only.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.has_only_read_only import HasOnlyReadOnly # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.has_only_read_only import HasOnlyReadOnly class TestHasOnlyReadOnly(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testHasOnlyReadOnly(self): """Test HasOnlyReadOnly""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.has_only_read_only.HasOnlyReadOnly() # noqa: E501 + # model = HasOnlyReadOnly() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_list.py b/samples/client/petstore/python-experimental/test/test_list.py index a538a6b1ad36..52156adfed2e 100644 --- a/samples/client/petstore/python-experimental/test/test_list.py +++ b/samples/client/petstore/python-experimental/test/test_list.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.list import List # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.list import List class TestList(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testList(self): """Test List""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.list.List() # noqa: E501 + # model = List() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_map_test.py b/samples/client/petstore/python-experimental/test/test_map_test.py index 0ba6481903e6..3feda0f688df 100644 --- a/samples/client/petstore/python-experimental/test/test_map_test.py +++ b/samples/client/petstore/python-experimental/test/test_map_test.py @@ -5,18 +5,22 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.map_test import MapTest # noqa: E501 -from petstore_api.rest import ApiException +try: + from petstore_api.model import string_boolean_map +except ImportError: + string_boolean_map = sys.modules[ + 'petstore_api.model.string_boolean_map'] +from petstore_api.model.map_test import MapTest class TestMapTest(unittest.TestCase): @@ -28,12 +32,94 @@ def setUp(self): def tearDown(self): pass - def testMapTest(self): - """Test MapTest""" - # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.map_test.MapTest() # noqa: E501 - pass + def test_maptest_init(self): + # + # Test MapTest construction with valid values + # + up_or_low_dict = { + 'UPPER': "UP", + 'lower': "low" + } + map_enum_test = MapTest(map_of_enum_string=up_or_low_dict) + + self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict) + + map_of_map_of_strings = { + 'valueDict': up_or_low_dict + } + map_enum_test = MapTest(map_map_of_string=map_of_map_of_strings) + + self.assertEqual(map_enum_test.map_map_of_string, map_of_map_of_strings) + + # + # Make sure that the init fails for invalid enum values + # + black_or_white_dict = { + 'black': "UP", + 'white': "low" + } + with self.assertRaises(petstore_api.ApiValueError): + MapTest(map_of_enum_string=black_or_white_dict) + + def test_maptest_setter(self): + # + # Check with some valid values + # + map_enum_test = MapTest() + up_or_low_dict = { + 'UPPER': "UP", + 'lower': "low" + } + map_enum_test.map_of_enum_string = up_or_low_dict + self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict) + + # + # Check if the setter fails for invalid enum values + # + map_enum_test = MapTest() + black_or_white_dict = { + 'black': "UP", + 'white': "low" + } + with self.assertRaises(petstore_api.ApiValueError): + map_enum_test.map_of_enum_string = black_or_white_dict + + def test_todict(self): + # + # Check dictionary serialization + # + map_enum_test = MapTest() + up_or_low_dict = { + 'UPPER': "UP", + 'lower': "low" + } + map_of_map_of_strings = { + 'valueDict': up_or_low_dict + } + indirect_map = string_boolean_map.StringBooleanMap(**{ + 'option1': True + }) + direct_map = { + 'option2': False + } + map_enum_test.map_of_enum_string = up_or_low_dict + map_enum_test.map_map_of_string = map_of_map_of_strings + map_enum_test.indirect_map = indirect_map + map_enum_test.direct_map = direct_map + + self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict) + self.assertEqual(map_enum_test.map_map_of_string, map_of_map_of_strings) + self.assertEqual(map_enum_test.indirect_map, indirect_map) + self.assertEqual(map_enum_test.direct_map, direct_map) + + expected_dict = { + 'map_of_enum_string': up_or_low_dict, + 'map_map_of_string': map_of_map_of_strings, + 'indirect_map': indirect_map.to_dict(), + 'direct_map': direct_map + } + self.assertEqual(map_enum_test.to_dict(), expected_dict) if __name__ == '__main__': unittest.main() diff --git a/samples/client/petstore/python-experimental/test/test_mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python-experimental/test/test_mixed_properties_and_additional_properties_class.py index 8893bdaf44ee..4dcb5ad4268c 100644 --- a/samples/client/petstore/python-experimental/test/test_mixed_properties_and_additional_properties_class.py +++ b/samples/client/petstore/python-experimental/test/test_mixed_properties_and_additional_properties_class.py @@ -5,18 +5,22 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass # noqa: E501 -from petstore_api.rest import ApiException +try: + from petstore_api.model import animal +except ImportError: + animal = sys.modules[ + 'petstore_api.model.animal'] +from petstore_api.model.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass class TestMixedPropertiesAndAdditionalPropertiesClass(unittest.TestCase): @@ -31,7 +35,7 @@ def tearDown(self): def testMixedPropertiesAndAdditionalPropertiesClass(self): """Test MixedPropertiesAndAdditionalPropertiesClass""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.mixed_properties_and_additional_properties_class.MixedPropertiesAndAdditionalPropertiesClass() # noqa: E501 + # model = MixedPropertiesAndAdditionalPropertiesClass() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_model200_response.py b/samples/client/petstore/python-experimental/test/test_model200_response.py index fab761f4edba..4012eaae3362 100644 --- a/samples/client/petstore/python-experimental/test/test_model200_response.py +++ b/samples/client/petstore/python-experimental/test/test_model200_response.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.model200_response import Model200Response # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.model200_response import Model200Response class TestModel200Response(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testModel200Response(self): """Test Model200Response""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.model200_response.Model200Response() # noqa: E501 + # model = Model200Response() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_model_return.py b/samples/client/petstore/python-experimental/test/test_model_return.py index ae3f15ee6b83..54c98b33cd66 100644 --- a/samples/client/petstore/python-experimental/test/test_model_return.py +++ b/samples/client/petstore/python-experimental/test/test_model_return.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.model_return import ModelReturn # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.model_return import ModelReturn class TestModelReturn(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testModelReturn(self): """Test ModelReturn""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.model_return.ModelReturn() # noqa: E501 + # model = ModelReturn() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_name.py b/samples/client/petstore/python-experimental/test/test_name.py index d6c72563991f..6a9be99d1a57 100644 --- a/samples/client/petstore/python-experimental/test/test_name.py +++ b/samples/client/petstore/python-experimental/test/test_name.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.name import Name # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.name import Name class TestName(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testName(self): """Test Name""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.name.Name() # noqa: E501 + # model = Name() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_number_only.py b/samples/client/petstore/python-experimental/test/test_number_only.py index 7f6df65c8058..07aab1d78af7 100644 --- a/samples/client/petstore/python-experimental/test/test_number_only.py +++ b/samples/client/petstore/python-experimental/test/test_number_only.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.number_only import NumberOnly # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.number_only import NumberOnly class TestNumberOnly(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testNumberOnly(self): """Test NumberOnly""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.number_only.NumberOnly() # noqa: E501 + # model = NumberOnly() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_order.py b/samples/client/petstore/python-experimental/test/test_order.py index 3e7d517d5c79..ee6988e28ccd 100644 --- a/samples/client/petstore/python-experimental/test/test_order.py +++ b/samples/client/petstore/python-experimental/test/test_order.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.order import Order # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.order import Order class TestOrder(unittest.TestCase): @@ -30,9 +29,12 @@ def tearDown(self): def testOrder(self): """Test Order""" - # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.order.Order() # noqa: E501 - pass + order = Order() + order.status = "placed" + self.assertEqual("placed", order.status) + with self.assertRaises(petstore_api.ApiValueError): + order.status = "invalid" + if __name__ == '__main__': diff --git a/samples/client/petstore/python-experimental/test/test_outer_composite.py b/samples/client/petstore/python-experimental/test/test_outer_composite.py index dcb078cd2164..f3ad1beff9e4 100644 --- a/samples/client/petstore/python-experimental/test/test_outer_composite.py +++ b/samples/client/petstore/python-experimental/test/test_outer_composite.py @@ -5,18 +5,22 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.outer_composite import OuterComposite # noqa: E501 -from petstore_api.rest import ApiException +try: + from petstore_api.model import outer_number +except ImportError: + outer_number = sys.modules[ + 'petstore_api.model.outer_number'] +from petstore_api.model.outer_composite import OuterComposite class TestOuterComposite(unittest.TestCase): @@ -31,7 +35,7 @@ def tearDown(self): def testOuterComposite(self): """Test OuterComposite""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.outer_composite.OuterComposite() # noqa: E501 + # model = OuterComposite() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_outer_enum.py b/samples/client/petstore/python-experimental/test/test_outer_enum.py index 50bfff0869b7..ff84ad3ba6d4 100644 --- a/samples/client/petstore/python-experimental/test/test_outer_enum.py +++ b/samples/client/petstore/python-experimental/test/test_outer_enum.py @@ -11,12 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.outer_enum import OuterEnum # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.outer_enum import OuterEnum class TestOuterEnum(unittest.TestCase): @@ -43,5 +42,6 @@ def testOuterEnum(self): valid_value = OuterEnum.allowed_values[('value',)]['PLACED'] assert valid_value == OuterEnum(valid_value).value + if __name__ == '__main__': unittest.main() diff --git a/samples/client/petstore/python-experimental/test/test_outer_number.py b/samples/client/petstore/python-experimental/test/test_outer_number.py index 31c9c41755dc..e0ab10d91d61 100644 --- a/samples/client/petstore/python-experimental/test/test_outer_number.py +++ b/samples/client/petstore/python-experimental/test/test_outer_number.py @@ -11,12 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.outer_number import OuterNumber # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.outer_number import OuterNumber class TestOuterNumber(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testOuterNumber(self): """Test OuterNumber""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.outer_number.OuterNumber() # noqa: E501 + # model = OuterNumber() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_parent.py b/samples/client/petstore/python-experimental/test/test_parent.py index f719771bdcfb..20282dfb41ea 100644 --- a/samples/client/petstore/python-experimental/test/test_parent.py +++ b/samples/client/petstore/python-experimental/test/test_parent.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import grandparent +except ImportError: + grandparent = sys.modules[ + 'petstore_api.model.grandparent'] +try: + from petstore_api.model import parent_all_of +except ImportError: + parent_all_of = sys.modules[ + 'petstore_api.model.parent_all_of'] +from petstore_api.model.parent import Parent class TestParent(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testParent(self): """Test Parent""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Parent() # noqa: E501 + # model = Parent() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_parent_all_of.py b/samples/client/petstore/python-experimental/test/test_parent_all_of.py index c1c152afe18a..ca87189bba50 100644 --- a/samples/client/petstore/python-experimental/test/test_parent_all_of.py +++ b/samples/client/petstore/python-experimental/test/test_parent_all_of.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.parent_all_of import ParentAllOf class TestParentAllOf(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testParentAllOf(self): """Test ParentAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ParentAllOf() # noqa: E501 + # model = ParentAllOf() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_parent_pet.py b/samples/client/petstore/python-experimental/test/test_parent_pet.py index b3ec1a94532c..17a4d60e75dc 100644 --- a/samples/client/petstore/python-experimental/test/test_parent_pet.py +++ b/samples/client/petstore/python-experimental/test/test_parent_pet.py @@ -11,10 +11,31 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import child_cat +except ImportError: + child_cat = sys.modules[ + 'petstore_api.model.child_cat'] +try: + from petstore_api.model import child_dog +except ImportError: + child_dog = sys.modules[ + 'petstore_api.model.child_dog'] +try: + from petstore_api.model import child_lizard +except ImportError: + child_lizard = sys.modules[ + 'petstore_api.model.child_lizard'] +try: + from petstore_api.model import grandparent_animal +except ImportError: + grandparent_animal = sys.modules[ + 'petstore_api.model.grandparent_animal'] +from petstore_api.model.parent_pet import ParentPet class TestParentPet(unittest.TestCase): @@ -29,7 +50,7 @@ def tearDown(self): def testParentPet(self): """Test ParentPet""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ParentPet() # noqa: E501 + # model = ParentPet() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_pet.py b/samples/client/petstore/python-experimental/test/test_pet.py index bc5cc30fac0d..b072cff5e9ad 100644 --- a/samples/client/petstore/python-experimental/test/test_pet.py +++ b/samples/client/petstore/python-experimental/test/test_pet.py @@ -5,18 +5,27 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.pet import Pet # noqa: E501 -from petstore_api.rest import ApiException +try: + from petstore_api.model import category +except ImportError: + category = sys.modules[ + 'petstore_api.model.category'] +try: + from petstore_api.models import tag +except ImportError: + tag = sys.modules[ + 'petstore_api.model.tag'] +from petstore_api.model.pet import Pet class TestPet(unittest.TestCase): @@ -28,11 +37,52 @@ def setUp(self): def tearDown(self): pass - def testPet(self): - """Test Pet""" - # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.pet.Pet() # noqa: E501 - pass + def test_to_str(self): + pet = Pet(name="test name", photo_urls=["string"]) + pet.id = 1 + pet.status = "available" + cate = category.Category() + cate.id = 1 + cate.name = "dog" + pet.category = cate + tag1 = tag.Tag() + tag1.id = 1 + pet.tags = [tag1] + + data = ("{'category': {'id': 1, 'name': 'dog'},\n" + " 'id': 1,\n" + " 'name': 'test name',\n" + " 'photo_urls': ['string'],\n" + " 'status': 'available',\n" + " 'tags': [{'id': 1}]}") + self.assertEqual(data, pet.to_str()) + + def test_equal(self): + pet1 = Pet(name="test name", photo_urls=["string"]) + pet1.id = 1 + pet1.status = "available" + cate1 = category.Category() + cate1.id = 1 + cate1.name = "dog" + tag1 = tag.Tag() + tag1.id = 1 + pet1.tags = [tag1] + + pet2 = Pet(name="test name", photo_urls=["string"]) + pet2.id = 1 + pet2.status = "available" + cate2 = category.Category() + cate2.id = 1 + cate2.name = "dog" + tag2 = tag.Tag() + tag2.id = 1 + pet2.tags = [tag2] + + self.assertTrue(pet1 == pet2) + + # reset pet1 tags to empty array so that object comparison returns false + pet1.tags = [] + self.assertFalse(pet1 == pet2) if __name__ == '__main__': diff --git a/samples/client/petstore/python-experimental/test/test_pet_api.py b/samples/client/petstore/python-experimental/test/test_pet_api.py index ffd3e25c4c64..091b30cf8ac0 100644 --- a/samples/client/petstore/python-experimental/test/test_pet_api.py +++ b/samples/client/petstore/python-experimental/test/test_pet_api.py @@ -5,25 +5,24 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api from petstore_api.api.pet_api import PetApi # noqa: E501 -from petstore_api.rest import ApiException class TestPetApi(unittest.TestCase): """PetApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.pet_api.PetApi() # noqa: E501 + self.api = PetApi() # noqa: E501 def tearDown(self): pass @@ -84,6 +83,13 @@ def test_upload_file(self): """ pass + def test_upload_file_with_required_file(self): + """Test case for upload_file_with_required_file + + uploads an image (required) # noqa: E501 + """ + pass + if __name__ == '__main__': unittest.main() diff --git a/samples/client/petstore/python-experimental/test/test_player.py b/samples/client/petstore/python-experimental/test/test_player.py index b100dd798943..ee7b95a677f1 100644 --- a/samples/client/petstore/python-experimental/test/test_player.py +++ b/samples/client/petstore/python-experimental/test/test_player.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.player import Player class TestPlayer(unittest.TestCase): @@ -29,13 +30,13 @@ def tearDown(self): def testPlayer(self): """Test Player""" # we can make a player without an enemy_player property - jane = petstore_api.Player(name="Jane") + jane = Player(name="Jane") # we can make a player with an enemy_player - sally = petstore_api.Player(name="Sally", enemy_player=jane) + sally = Player(name="Sally", enemy_player=jane) # we can make a player with an inline enemy_player - jim = petstore_api.Player( + jim = Player( name="Jim", - enemy_player=petstore_api.Player(name="Sam") + enemy_player=Player(name="Sam") ) diff --git a/samples/client/petstore/python-experimental/test/test_read_only_first.py b/samples/client/petstore/python-experimental/test/test_read_only_first.py index 2b647b83fc89..c2dcde240e77 100644 --- a/samples/client/petstore/python-experimental/test/test_read_only_first.py +++ b/samples/client/petstore/python-experimental/test/test_read_only_first.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.read_only_first import ReadOnlyFirst # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.read_only_first import ReadOnlyFirst class TestReadOnlyFirst(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testReadOnlyFirst(self): """Test ReadOnlyFirst""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.read_only_first.ReadOnlyFirst() # noqa: E501 + # model = ReadOnlyFirst() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_special_model_name.py b/samples/client/petstore/python-experimental/test/test_special_model_name.py index 4edfec164f7d..6124525f5170 100644 --- a/samples/client/petstore/python-experimental/test/test_special_model_name.py +++ b/samples/client/petstore/python-experimental/test/test_special_model_name.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.special_model_name import SpecialModelName # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.special_model_name import SpecialModelName class TestSpecialModelName(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testSpecialModelName(self): """Test SpecialModelName""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.special_model_name.SpecialModelName() # noqa: E501 + # model = SpecialModelName() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_store_api.py b/samples/client/petstore/python-experimental/test/test_store_api.py index 37bf771d13a6..0d9cc3dd36ea 100644 --- a/samples/client/petstore/python-experimental/test/test_store_api.py +++ b/samples/client/petstore/python-experimental/test/test_store_api.py @@ -5,7 +5,7 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ @@ -16,14 +16,13 @@ import petstore_api from petstore_api.api.store_api import StoreApi # noqa: E501 -from petstore_api.rest import ApiException class TestStoreApi(unittest.TestCase): """StoreApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.store_api.StoreApi() # noqa: E501 + self.api = StoreApi() # noqa: E501 def tearDown(self): pass diff --git a/samples/client/petstore/python-experimental/test/test_string_boolean_map.py b/samples/client/petstore/python-experimental/test/test_string_boolean_map.py index 31c1ebeec5db..e2e9d8b420b8 100644 --- a/samples/client/petstore/python-experimental/test/test_string_boolean_map.py +++ b/samples/client/petstore/python-experimental/test/test_string_boolean_map.py @@ -11,12 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.string_boolean_map import StringBooleanMap # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.string_boolean_map import StringBooleanMap class TestStringBooleanMap(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testStringBooleanMap(self): """Test StringBooleanMap""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.string_boolean_map.StringBooleanMap() # noqa: E501 + # model = StringBooleanMap() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_tag.py b/samples/client/petstore/python-experimental/test/test_tag.py index 2c3c5157e718..68a3b9046bf4 100644 --- a/samples/client/petstore/python-experimental/test/test_tag.py +++ b/samples/client/petstore/python-experimental/test/test_tag.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.tag import Tag # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.tag import Tag class TestTag(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testTag(self): """Test Tag""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.tag.Tag() # noqa: E501 + # model = Tag() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_type_holder_default.py b/samples/client/petstore/python-experimental/test/test_type_holder_default.py index 08a201b854d0..f9c050b81a82 100644 --- a/samples/client/petstore/python-experimental/test/test_type_holder_default.py +++ b/samples/client/petstore/python-experimental/test/test_type_holder_default.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.type_holder_default import TypeHolderDefault # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.type_holder_default import TypeHolderDefault class TestTypeHolderDefault(unittest.TestCase): diff --git a/samples/client/petstore/python-experimental/test/test_type_holder_example.py b/samples/client/petstore/python-experimental/test/test_type_holder_example.py index 7a2621494857..e1ee7c368628 100644 --- a/samples/client/petstore/python-experimental/test/test_type_holder_example.py +++ b/samples/client/petstore/python-experimental/test/test_type_holder_example.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.type_holder_example import TypeHolderExample # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.type_holder_example import TypeHolderExample class TestTypeHolderExample(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testTypeHolderExample(self): """Test TypeHolderExample""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.type_holder_example.TypeHolderExample() # noqa: E501 + # model = TypeHolderExample() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_user.py b/samples/client/petstore/python-experimental/test/test_user.py index ad9386b6908e..7241bb589c52 100644 --- a/samples/client/petstore/python-experimental/test/test_user.py +++ b/samples/client/petstore/python-experimental/test/test_user.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.user import User # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.user import User class TestUser(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testUser(self): """Test User""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.user.User() # noqa: E501 + # model = User() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/test/test_user_api.py b/samples/client/petstore/python-experimental/test/test_user_api.py index 6e8aed4f18c7..df306da07761 100644 --- a/samples/client/petstore/python-experimental/test/test_user_api.py +++ b/samples/client/petstore/python-experimental/test/test_user_api.py @@ -5,7 +5,7 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ @@ -16,14 +16,13 @@ import petstore_api from petstore_api.api.user_api import UserApi # noqa: E501 -from petstore_api.rest import ApiException class TestUserApi(unittest.TestCase): """UserApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.user_api.UserApi() # noqa: E501 + self.api = UserApi() # noqa: E501 def tearDown(self): pass diff --git a/samples/client/petstore/python-experimental/test/test_xml_item.py b/samples/client/petstore/python-experimental/test/test_xml_item.py index 121f1ccb6623..4354664815ff 100644 --- a/samples/client/petstore/python-experimental/test/test_xml_item.py +++ b/samples/client/petstore/python-experimental/test/test_xml_item.py @@ -5,18 +5,17 @@ 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 - OpenAPI spec version: 1.0.0 + The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import - +import sys import unittest import petstore_api -from petstore_api.models.xml_item import XmlItem # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.model.xml_item import XmlItem class TestXmlItem(unittest.TestCase): @@ -31,7 +30,7 @@ def tearDown(self): def testXmlItem(self): """Test XmlItem""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.models.xml_item.XmlItem() # noqa: E501 + # model = XmlItem() # noqa: E501 pass diff --git a/samples/client/petstore/python-experimental/tests/test_api_client.py b/samples/client/petstore/python-experimental/tests/test_api_client.py index f36762e84e8e..c249bf1fc5e8 100644 --- a/samples/client/petstore/python-experimental/tests/test_api_client.py +++ b/samples/client/petstore/python-experimental/tests/test_api_client.py @@ -171,16 +171,20 @@ def test_sanitize_for_serialization(self): "status": "available", "photoUrls": ["http://foo.bar.com/3", "http://foo.bar.com/4"]} - pet = petstore_api.Pet(name=pet_dict["name"], photo_urls=pet_dict["photoUrls"]) + from petstore_api.model.pet import Pet + from petstore_api.model.category import Category + from petstore_api.model.tag import Tag + from petstore_api.model.string_boolean_map import StringBooleanMap + pet = Pet(name=pet_dict["name"], photo_urls=pet_dict["photoUrls"]) pet.id = pet_dict["id"] - cate = petstore_api.Category() + cate = Category() cate.id = pet_dict["category"]["id"] cate.name = pet_dict["category"]["name"] pet.category = cate - tag1 = petstore_api.Tag() + tag1 = Tag() tag1.id = pet_dict["tags"][0]["id"] tag1.full_name = pet_dict["tags"][0]["fullName"] - tag2 = petstore_api.Tag() + tag2 = Tag() tag2.id = pet_dict["tags"][1]["id"] tag2.full_name = pet_dict["tags"][1]["fullName"] pet.tags = [tag1, tag2] @@ -198,7 +202,7 @@ def test_sanitize_for_serialization(self): # model with additional proerties model_dict = {'some_key': True} - model = petstore_api.StringBooleanMap(**model_dict) + model = StringBooleanMap(**model_dict) result = self.api_client.sanitize_for_serialization(model) self.assertEqual(result, model_dict) diff --git a/samples/client/petstore/python-experimental/tests/test_api_exception.py b/samples/client/petstore/python-experimental/tests/test_api_exception.py index b26ef5252bbf..0d0771b57850 100644 --- a/samples/client/petstore/python-experimental/tests/test_api_exception.py +++ b/samples/client/petstore/python-experimental/tests/test_api_exception.py @@ -15,7 +15,6 @@ import unittest import petstore_api -from petstore_api.rest import ApiException from .util import id_gen @@ -23,17 +22,19 @@ class ApiExceptionTests(unittest.TestCase): def setUp(self): self.api_client = petstore_api.ApiClient() - self.pet_api = petstore_api.PetApi(self.api_client) + from petstore_api.api.pet_api import PetApi + self.pet_api = PetApi(self.api_client) self.setUpModels() def setUpModels(self): - self.category = petstore_api.Category() + from petstore_api.model import category, tag, pet + self.category = category.Category() self.category.id = id_gen() self.category.name = "dog" - self.tag = petstore_api.Tag() + self.tag = tag.Tag() self.tag.id = id_gen() self.tag.full_name = "blank" - self.pet = petstore_api.Pet(name="hello kity", photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"]) + self.pet = pet.Pet(name="hello kity", photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"]) self.pet.id = id_gen() self.pet.status = "sold" self.pet.category = self.category @@ -43,12 +44,12 @@ def test_404_error(self): self.pet_api.add_pet(self.pet) self.pet_api.delete_pet(pet_id=self.pet.id) - with self.checkRaiseRegex(ApiException, "Pet not found"): + with self.checkRaiseRegex(petstore_api.ApiException, "Pet not found"): self.pet_api.get_pet_by_id(pet_id=self.pet.id) try: self.pet_api.get_pet_by_id(pet_id=self.pet.id) - except ApiException as e: + except petstore_api.ApiException as e: self.assertEqual(e.status, 404) self.assertEqual(e.reason, "Not Found") self.checkRegex(e.body, "Pet not found") @@ -56,7 +57,7 @@ def test_404_error(self): def test_500_error(self): self.pet_api.add_pet(self.pet) - with self.checkRaiseRegex(ApiException, "Internal Server Error"): + with self.checkRaiseRegex(petstore_api.ApiException, "Internal Server Error"): self.pet_api.upload_file( pet_id=self.pet.id, additional_metadata="special" @@ -67,7 +68,7 @@ def test_500_error(self): pet_id=self.pet.id, additional_metadata="special" ) - except ApiException as e: + except petstore_api.ApiException as e: self.assertEqual(e.status, 500) self.assertEqual(e.reason, "Internal Server Error") self.checkRegex(e.body, "Error 500 Internal Server Error") diff --git a/samples/client/petstore/python-experimental/tests/test_deserialization.py b/samples/client/petstore/python-experimental/tests/test_deserialization.py index 83ecabe81d25..f73af24a9425 100644 --- a/samples/client/petstore/python-experimental/tests/test_deserialization.py +++ b/samples/client/petstore/python-experimental/tests/test_deserialization.py @@ -24,7 +24,18 @@ ApiKeyError, ApiValueError, ) - +from petstore_api.model import ( + enum_test, + pet, + animal, + dog, + parent_pet, + child_lizard, + category, + outer_enum, + outer_number, + string_boolean_map, +) from petstore_api.model_utils import ( file_type, int, @@ -56,19 +67,19 @@ def test_enum_test(self): response = MockResponse(data=json.dumps(data)) deserialized = self.deserialize(response, - ({str: (petstore_api.EnumTest,)},), True) + ({str: (enum_test.EnumTest,)},), True) self.assertTrue(isinstance(deserialized, dict)) self.assertTrue( - isinstance(deserialized['enum_test'], petstore_api.EnumTest)) - outer_enum_value = ( - petstore_api.OuterEnum.allowed_values[('value',)]["PLACED"]) - outer_enum = petstore_api.OuterEnum(outer_enum_value) - sample_instance = petstore_api.EnumTest( + isinstance(deserialized['enum_test'], enum_test.EnumTest)) + value = ( + outer_enum.OuterEnum.allowed_values[('value',)]["PLACED"]) + outer_enum_val = outer_enum.OuterEnum(value) + sample_instance = enum_test.EnumTest( enum_string="UPPER", enum_string_required="lower", enum_integer=1, enum_number=1.1, - outer_enum=outer_enum + outer_enum=outer_enum_val ) self.assertEqual(deserialized['enum_test'], sample_instance) @@ -97,9 +108,9 @@ def test_deserialize_dict_str_pet(self): response = MockResponse(data=json.dumps(data)) deserialized = self.deserialize(response, - ({str: (petstore_api.Pet,)},), True) + ({str: (pet.Pet,)},), True) self.assertTrue(isinstance(deserialized, dict)) - self.assertTrue(isinstance(deserialized['pet'], petstore_api.Pet)) + self.assertTrue(isinstance(deserialized['pet'], pet.Pet)) def test_deserialize_dict_str_dog(self): """ deserialize dict(str, Dog), use discriminator""" @@ -113,13 +124,13 @@ def test_deserialize_dict_str_dog(self): response = MockResponse(data=json.dumps(data)) deserialized = self.deserialize(response, - ({str: (petstore_api.Animal,)},), True) + ({str: (animal.Animal,)},), True) self.assertTrue(isinstance(deserialized, dict)) - dog = deserialized['dog'] - self.assertTrue(isinstance(dog, petstore_api.Dog)) - self.assertEqual(dog.class_name, "Dog") - self.assertEqual(dog.color, "white") - self.assertEqual(dog.breed, "Jack Russel Terrier") + dog_inst = deserialized['dog'] + self.assertTrue(isinstance(dog_inst, dog.Dog)) + self.assertEqual(dog_inst.class_name, "Dog") + self.assertEqual(dog_inst.color, "white") + self.assertEqual(dog_inst.breed, "Jack Russel Terrier") def test_deserialize_lizard(self): """ deserialize ChildLizard, use discriminator""" @@ -130,8 +141,8 @@ def test_deserialize_lizard(self): response = MockResponse(data=json.dumps(data)) lizard = self.deserialize(response, - (petstore_api.ParentPet,), True) - self.assertTrue(isinstance(lizard, petstore_api.ChildLizard)) + (parent_pet.ParentPet,), True) + self.assertTrue(isinstance(lizard, child_lizard.ChildLizard)) self.assertEqual(lizard.pet_type, "ChildLizard") self.assertEqual(lizard.loves_rocks, True) @@ -192,11 +203,11 @@ def test_deserialize_pet(self): } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Pet,), True) - self.assertTrue(isinstance(deserialized, petstore_api.Pet)) + deserialized = self.deserialize(response, (pet.Pet,), True) + self.assertTrue(isinstance(deserialized, pet.Pet)) self.assertEqual(deserialized.id, 0) self.assertEqual(deserialized.name, "doggie") - self.assertTrue(isinstance(deserialized.category, petstore_api.Category)) + self.assertTrue(isinstance(deserialized.category, category.Category)) self.assertEqual(deserialized.category.name, "string") self.assertTrue(isinstance(deserialized.tags, list)) self.assertEqual(deserialized.tags[0].full_name, "string") @@ -243,9 +254,9 @@ def test_deserialize_list_of_pet(self): response = MockResponse(data=json.dumps(data)) deserialized = self.deserialize(response, - ([petstore_api.Pet],), True) + ([pet.Pet],), True) self.assertTrue(isinstance(deserialized, list)) - self.assertTrue(isinstance(deserialized[0], petstore_api.Pet)) + self.assertTrue(isinstance(deserialized[0], pet.Pet)) self.assertEqual(deserialized[0].id, 0) self.assertEqual(deserialized[1].id, 1) self.assertEqual(deserialized[0].name, "doggie0") @@ -294,19 +305,19 @@ def test_deserialize_OuterEnum(self): with self.assertRaises(ApiValueError): self.deserialize( MockResponse(data=json.dumps("test str")), - (petstore_api.OuterEnum,), + (outer_enum.OuterEnum,), True ) # valid value works placed_str = ( - petstore_api.OuterEnum.allowed_values[('value',)]["PLACED"] + outer_enum.OuterEnum.allowed_values[('value',)]["PLACED"] ) response = MockResponse(data=json.dumps(placed_str)) - outer_enum = self.deserialize(response, - (petstore_api.OuterEnum,), True) - self.assertTrue(isinstance(outer_enum, petstore_api.OuterEnum)) - self.assertTrue(outer_enum.value == placed_str) + deserialized = self.deserialize(response, + (outer_enum.OuterEnum,), True) + self.assertTrue(isinstance(deserialized, outer_enum.OuterEnum)) + self.assertTrue(deserialized.value == placed_str) def test_deserialize_OuterNumber(self): """ deserialize OuterNumber """ @@ -314,7 +325,7 @@ def test_deserialize_OuterNumber(self): with self.assertRaises(ApiTypeError): deserialized = self.deserialize( MockResponse(data=json.dumps("test str")), - (petstore_api.OuterNumber,), + (outer_number.OuterNumber,), True ) @@ -322,17 +333,17 @@ def test_deserialize_OuterNumber(self): with self.assertRaises(ApiValueError): deserialized = self.deserialize( MockResponse(data=json.dumps(21.0)), - (petstore_api.OuterNumber,), + (outer_number.OuterNumber,), True ) # valid value works number_val = 11.0 response = MockResponse(data=json.dumps(number_val)) - outer_number = self.deserialize(response, - (petstore_api.OuterNumber,), True) - self.assertTrue(isinstance(outer_number, petstore_api.OuterNumber)) - self.assertTrue(outer_number.value == number_val) + number = self.deserialize(response, + (outer_number.OuterNumber,), True) + self.assertTrue(isinstance(number, outer_number.OuterNumber)) + self.assertTrue(number.value == number_val) def test_deserialize_file(self): """Ensures that file deserialization works""" @@ -416,17 +427,17 @@ def test_deserialize_string_boolean_map(self): with self.assertRaises(ApiTypeError): deserialized = self.deserialize( MockResponse(data=json.dumps("test str")), - (petstore_api.StringBooleanMap,), + (string_boolean_map.StringBooleanMap,), True ) # valid value works item_val = {'some_key': True} response = MockResponse(data=json.dumps(item_val)) - model = petstore_api.StringBooleanMap(**item_val) + model = string_boolean_map.StringBooleanMap(**item_val) deserialized = self.deserialize(response, - (petstore_api.StringBooleanMap,), True) - self.assertTrue(isinstance(deserialized, petstore_api.StringBooleanMap)) + (string_boolean_map.StringBooleanMap,), True) + self.assertTrue(isinstance(deserialized, string_boolean_map.StringBooleanMap)) self.assertTrue(deserialized['some_key'] == True) self.assertTrue(deserialized == model) diff --git a/samples/client/petstore/python-experimental/tests/test_enum_arrays.py b/samples/client/petstore/python-experimental/tests/test_enum_arrays.py deleted file mode 100644 index 96edf49c43a9..000000000000 --- a/samples/client/petstore/python-experimental/tests/test_enum_arrays.py +++ /dev/null @@ -1,155 +0,0 @@ -# coding: utf-8 - -# flake8: noqa - -""" -Run the tests. -$ pip install nose (optional) -$ cd petstore_api-python -$ nosetests -v -""" - -import os -import time -import unittest - -import petstore_api - -from petstore_api.exceptions import ( - ApiTypeError, - ApiKeyError, - ApiValueError, -) - -class EnumArraysTests(unittest.TestCase): - - def test_enumarrays_init(self): - # - # Check various combinations of valid values. - # - fish_or_crab = petstore_api.EnumArrays(just_symbol=">=") - self.assertEqual(fish_or_crab.just_symbol, ">=") - # if optional property is unset we raise an exception - with self.assertRaises(AttributeError) as exc: - self.assertEqual(fish_or_crab.array_enum, None) - - fish_or_crab = petstore_api.EnumArrays(just_symbol="$", array_enum=["fish"]) - self.assertEqual(fish_or_crab.just_symbol, "$") - self.assertEqual(fish_or_crab.array_enum, ["fish"]) - - fish_or_crab = petstore_api.EnumArrays(just_symbol=">=", array_enum=["fish"]) - self.assertEqual(fish_or_crab.just_symbol, ">=") - self.assertEqual(fish_or_crab.array_enum, ["fish"]) - - fish_or_crab = petstore_api.EnumArrays(just_symbol="$", array_enum=["crab"]) - self.assertEqual(fish_or_crab.just_symbol, "$") - self.assertEqual(fish_or_crab.array_enum, ["crab"]) - - - # - # Check if setting invalid values fails - # - with self.assertRaises(ApiValueError) as exc: - fish_or_crab = petstore_api.EnumArrays(just_symbol="<=") - - with self.assertRaises(ApiValueError) as exc: - fish_or_crab = petstore_api.EnumArrays(just_symbol="$", array_enum=["dog"]) - - with self.assertRaises(ApiTypeError) as exc: - fish_or_crab = petstore_api.EnumArrays(just_symbol=["$"], array_enum=["crab"]) - - - def test_enumarrays_setter(self): - - # - # Check various combinations of valid values - # - fish_or_crab = petstore_api.EnumArrays() - - fish_or_crab.just_symbol = ">=" - self.assertEqual(fish_or_crab.just_symbol, ">=") - - fish_or_crab.just_symbol = "$" - self.assertEqual(fish_or_crab.just_symbol, "$") - - fish_or_crab.array_enum = [] - self.assertEqual(fish_or_crab.array_enum, []) - - fish_or_crab.array_enum = ["fish"] - self.assertEqual(fish_or_crab.array_enum, ["fish"]) - - fish_or_crab.array_enum = ["fish", "fish", "fish"] - self.assertEqual(fish_or_crab.array_enum, ["fish", "fish", "fish"]) - - fish_or_crab.array_enum = ["crab"] - self.assertEqual(fish_or_crab.array_enum, ["crab"]) - - fish_or_crab.array_enum = ["crab", "fish"] - self.assertEqual(fish_or_crab.array_enum, ["crab", "fish"]) - - fish_or_crab.array_enum = ["crab", "fish", "crab", "fish"] - self.assertEqual(fish_or_crab.array_enum, ["crab", "fish", "crab", "fish"]) - - # - # Check if setting invalid values fails - # - fish_or_crab = petstore_api.EnumArrays() - with self.assertRaises(ApiValueError) as exc: - fish_or_crab.just_symbol = "!=" - - with self.assertRaises(ApiTypeError) as exc: - fish_or_crab.just_symbol = ["fish"] - - with self.assertRaises(ApiValueError) as exc: - fish_or_crab.array_enum = ["cat"] - - with self.assertRaises(ApiValueError) as exc: - fish_or_crab.array_enum = ["fish", "crab", "dog"] - - with self.assertRaises(ApiTypeError) as exc: - fish_or_crab.array_enum = "fish" - - - def test_todict(self): - # - # Check if dictionary serialization works - # - dollar_fish_crab_dict = { - 'just_symbol': "$", - 'array_enum': ["fish", "crab"] - } - - dollar_fish_crab = petstore_api.EnumArrays( - just_symbol="$", array_enum=["fish", "crab"]) - - self.assertEqual(dollar_fish_crab_dict, dollar_fish_crab.to_dict()) - - # - # Sanity check for different arrays - # - dollar_crab_fish_dict = { - 'just_symbol': "$", - 'array_enum': ["crab", "fish"] - } - - dollar_fish_crab = petstore_api.EnumArrays( - just_symbol="$", array_enum=["fish", "crab"]) - - self.assertNotEqual(dollar_crab_fish_dict, dollar_fish_crab.to_dict()) - - - def test_equals(self): - # - # Check if object comparison works - # - fish1 = petstore_api.EnumArrays(just_symbol="$", array_enum=["fish"]) - fish2 = petstore_api.EnumArrays(just_symbol="$", array_enum=["fish"]) - self.assertEqual(fish1, fish2) - - fish = petstore_api.EnumArrays(just_symbol="$", array_enum=["fish"]) - crab = petstore_api.EnumArrays(just_symbol="$", array_enum=["crab"]) - self.assertNotEqual(fish, crab) - - dollar = petstore_api.EnumArrays(just_symbol="$") - greater = petstore_api.EnumArrays(just_symbol=">=") - self.assertNotEqual(dollar, greater) diff --git a/samples/client/petstore/python-experimental/tests/test_map_test.py b/samples/client/petstore/python-experimental/tests/test_map_test.py deleted file mode 100644 index 13db5181c9ed..000000000000 --- a/samples/client/petstore/python-experimental/tests/test_map_test.py +++ /dev/null @@ -1,117 +0,0 @@ -# coding: utf-8 - -# flake8: noqa - -""" -Run the tests. -$ pip install nose (optional) -$ cd petstore_api-python -$ nosetests -v -""" - -import os -import time -import unittest - -import petstore_api - -from petstore_api.exceptions import ( - ApiTypeError, - ApiKeyError, - ApiValueError, -) - - -class MapTestTests(unittest.TestCase): - - def test_maptest_init(self): - # - # Test MapTest construction with valid values - # - up_or_low_dict = { - 'UPPER': "UP", - 'lower': "low" - } - map_enum_test = petstore_api.MapTest(map_of_enum_string=up_or_low_dict) - - self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict) - - map_of_map_of_strings = { - 'valueDict': up_or_low_dict - } - map_enum_test = petstore_api.MapTest(map_map_of_string=map_of_map_of_strings) - - self.assertEqual(map_enum_test.map_map_of_string, map_of_map_of_strings) - - # - # Make sure that the init fails for invalid enum values - # - black_or_white_dict = { - 'black': "UP", - 'white': "low" - } - try: - map_enum_test = petstore_api.MapTest(map_of_enum_string=black_or_white_dict) - self.assertTrue(0) - except ValueError: - self.assertTrue(1) - - def test_maptest_setter(self): - # - # Check with some valid values - # - map_enum_test = petstore_api.MapTest() - up_or_low_dict = { - 'UPPER': "UP", - 'lower': "low" - } - map_enum_test.map_of_enum_string = up_or_low_dict - self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict) - - # - # Check if the setter fails for invalid enum values - # - map_enum_test = petstore_api.MapTest() - black_or_white_dict = { - 'black': "UP", - 'white': "low" - } - with self.assertRaises(ApiValueError) as exc: - map_enum_test.map_of_enum_string = black_or_white_dict - - def test_todict(self): - # - # Check dictionary serialization - # - map_enum_test = petstore_api.MapTest() - up_or_low_dict = { - 'UPPER': "UP", - 'lower': "low" - } - map_of_map_of_strings = { - 'valueDict': up_or_low_dict - } - indirect_map = petstore_api.StringBooleanMap(**{ - 'option1': True - }) - direct_map = { - 'option2': False - } - map_enum_test.map_of_enum_string = up_or_low_dict - map_enum_test.map_map_of_string = map_of_map_of_strings - map_enum_test.indirect_map = indirect_map - map_enum_test.direct_map = direct_map - - self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict) - self.assertEqual(map_enum_test.map_map_of_string, map_of_map_of_strings) - self.assertEqual(map_enum_test.indirect_map, indirect_map) - self.assertEqual(map_enum_test.direct_map, direct_map) - - expected_dict = { - 'map_of_enum_string': up_or_low_dict, - 'map_map_of_string': map_of_map_of_strings, - 'indirect_map': indirect_map.to_dict(), - 'direct_map': direct_map - } - - self.assertEqual(map_enum_test.to_dict(), expected_dict) diff --git a/samples/client/petstore/python-experimental/tests/test_order_model.py b/samples/client/petstore/python-experimental/tests/test_order_model.py deleted file mode 100644 index 31dc6e3661cd..000000000000 --- a/samples/client/petstore/python-experimental/tests/test_order_model.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding: utf-8 - -# flake8: noqa - -""" -Run the tests. -$ pip install nose (optional) -$ cd petstore_api-python -$ nosetests -v -""" - -import os -import time -import unittest - -import petstore_api - - -class OrderModelTests(unittest.TestCase): - - def test_status(self): - order = petstore_api.Order() - order.status = "placed" - self.assertEqual("placed", order.status) - - with self.assertRaises(ValueError): - order.status = "invalid" diff --git a/samples/client/petstore/python-experimental/tests/test_pet_api.py b/samples/client/petstore/python-experimental/tests/test_pet_api.py index ee7e53ecad85..38d7a1cc0b82 100644 --- a/samples/client/petstore/python-experimental/tests/test_pet_api.py +++ b/samples/client/petstore/python-experimental/tests/test_pet_api.py @@ -30,7 +30,8 @@ ApiValueError, ApiTypeError, ) - +from petstore_api.api.pet_api import PetApi +from petstore_api.model import pet from .util import id_gen import urllib3 @@ -75,18 +76,19 @@ def setUp(self): config.host = HOST config.access_token = 'ACCESS_TOKEN' self.api_client = petstore_api.ApiClient(config) - self.pet_api = petstore_api.PetApi(self.api_client) + self.pet_api = PetApi(self.api_client) self.setUpModels() self.setUpFiles() def setUpModels(self): - self.category = petstore_api.Category() + from petstore_api.model import category, tag + self.category = category.Category() self.category.id = id_gen() self.category.name = "dog" - self.tag = petstore_api.Tag() + self.tag = tag.Tag() self.tag.id = id_gen() self.tag.name = "python-pet-tag" - self.pet = petstore_api.Pet(name="hello kity", photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"]) + self.pet = pet.Pet(name="hello kity", photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"]) self.pet.id = id_gen() self.pet.status = "sold" self.pet.category = self.category @@ -162,8 +164,8 @@ def test_timeout(self): self.pet_api.add_pet(self.pet, _request_timeout=(1, 2)) def test_separate_default_client_instances(self): - pet_api = petstore_api.PetApi() - pet_api2 = petstore_api.PetApi() + pet_api = PetApi() + pet_api2 = PetApi() self.assertNotEqual(pet_api.api_client, pet_api2.api_client) pet_api.api_client.user_agent = 'api client 3' @@ -172,8 +174,8 @@ def test_separate_default_client_instances(self): self.assertNotEqual(pet_api.api_client.user_agent, pet_api2.api_client.user_agent) def test_separate_default_config_instances(self): - pet_api = petstore_api.PetApi() - pet_api2 = petstore_api.PetApi() + pet_api = PetApi() + pet_api2 = PetApi() self.assertNotEqual(pet_api.api_client.configuration, pet_api2.api_client.configuration) pet_api.api_client.configuration.host = 'somehost' @@ -187,7 +189,7 @@ def test_async_request(self): thread = self.pet_api.get_pet_by_id(self.pet.id, async_req=True) result = thread.get() - self.assertIsInstance(result, petstore_api.Pet) + self.assertIsInstance(result, pet.Pet) def test_async_with_result(self): self.pet_api.add_pet(self.pet, async_req=False) @@ -208,7 +210,7 @@ def test_async_with_http_info(self): _return_http_data_only=False) data, status, headers = thread.get() - self.assertIsInstance(data, petstore_api.Pet) + self.assertIsInstance(data, pet.Pet) self.assertEqual(status, 200) def test_async_exception(self): diff --git a/samples/client/petstore/python-experimental/tests/test_pet_model.py b/samples/client/petstore/python-experimental/tests/test_pet_model.py deleted file mode 100644 index c3352015b973..000000000000 --- a/samples/client/petstore/python-experimental/tests/test_pet_model.py +++ /dev/null @@ -1,69 +0,0 @@ -# coding: utf-8 - -# flake8: noqa - -""" -Run the tests. -$ pip install nose (optional) -$ cd petstore_api-python -$ nosetests -v -""" - -import os -import time -import unittest - -import petstore_api - - -class PetModelTests(unittest.TestCase): - - def setUp(self): - self.pet = petstore_api.Pet(name="test name", photo_urls=["string"]) - self.pet.id = 1 - self.pet.status = "available" - cate = petstore_api.Category() - cate.id = 1 - cate.name = "dog" - self.pet.category = cate - tag = petstore_api.Tag() - tag.id = 1 - self.pet.tags = [tag] - - def test_to_str(self): - data = ("{'category': {'id': 1, 'name': 'dog'},\n" - " 'id': 1,\n" - " 'name': 'test name',\n" - " 'photo_urls': ['string'],\n" - " 'status': 'available',\n" - " 'tags': [{'id': 1}]}") - self.assertEqual(data, self.pet.to_str()) - - def test_equal(self): - self.pet1 = petstore_api.Pet(name="test name", photo_urls=["string"]) - self.pet1.id = 1 - self.pet1.status = "available" - cate1 = petstore_api.Category() - cate1.id = 1 - cate1.name = "dog" - self.pet.category = cate1 - tag1 = petstore_api.Tag() - tag1.id = 1 - self.pet1.tags = [tag1] - - self.pet2 = petstore_api.Pet(name="test name", photo_urls=["string"]) - self.pet2.id = 1 - self.pet2.status = "available" - cate2 = petstore_api.Category() - cate2.id = 1 - cate2.name = "dog" - self.pet.category = cate2 - tag2 = petstore_api.Tag() - tag2.id = 1 - self.pet2.tags = [tag2] - - self.assertTrue(self.pet1 == self.pet2) - - # reset pet1 tags to empty array so that object comparison returns false - self.pet1.tags = [] - self.assertFalse(self.pet1 == self.pet2) diff --git a/samples/client/petstore/python-experimental/tests/test_store_api.py b/samples/client/petstore/python-experimental/tests/test_store_api.py index 1817477aba69..a7c1d5dd6670 100644 --- a/samples/client/petstore/python-experimental/tests/test_store_api.py +++ b/samples/client/petstore/python-experimental/tests/test_store_api.py @@ -14,13 +14,13 @@ import unittest import petstore_api -from petstore_api.rest import ApiException +from petstore_api.api.store_api import StoreApi class StoreApiTests(unittest.TestCase): def setUp(self): - self.store_api = petstore_api.StoreApi() + self.store_api = StoreApi() def tearDown(self): # sleep 1 sec between two every 2 tests diff --git a/samples/client/petstore/ruby-faraday/.openapi-generator/FILES b/samples/client/petstore/ruby-faraday/.openapi-generator/FILES index dff9045f9ba1..f78e5fd459eb 100644 --- a/samples/client/petstore/ruby-faraday/.openapi-generator/FILES +++ b/samples/client/petstore/ruby-faraday/.openapi-generator/FILES @@ -127,4 +127,10 @@ lib/petstore/version.rb petstore.gemspec spec/api_client_spec.rb spec/configuration_spec.rb +spec/models/inline_object1_spec.rb +spec/models/inline_object2_spec.rb +spec/models/inline_object3_spec.rb +spec/models/inline_object4_spec.rb +spec/models/inline_object5_spec.rb +spec/models/inline_object_spec.rb spec/spec_helper.rb diff --git a/samples/client/petstore/ruby/.openapi-generator/FILES b/samples/client/petstore/ruby/.openapi-generator/FILES index dff9045f9ba1..f78e5fd459eb 100644 --- a/samples/client/petstore/ruby/.openapi-generator/FILES +++ b/samples/client/petstore/ruby/.openapi-generator/FILES @@ -127,4 +127,10 @@ lib/petstore/version.rb petstore.gemspec spec/api_client_spec.rb spec/configuration_spec.rb +spec/models/inline_object1_spec.rb +spec/models/inline_object2_spec.rb +spec/models/inline_object3_spec.rb +spec/models/inline_object4_spec.rb +spec/models/inline_object5_spec.rb +spec/models/inline_object_spec.rb spec/spec_helper.rb diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/.openapi-generator/FILES b/samples/openapi3/client/petstore/java/jersey2-java8/.openapi-generator/FILES index 25518623866e..ac1d4a1cd1b9 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/java/jersey2-java8/.openapi-generator/FILES @@ -1,61 +1,95 @@ .gitignore +.openapi-generator-ignore .travis.yml README.md api/openapi.yaml build.gradle build.sbt -docs/AdditionalPropertiesAnyType.md -docs/AdditionalPropertiesArray.md -docs/AdditionalPropertiesBoolean.md docs/AdditionalPropertiesClass.md -docs/AdditionalPropertiesInteger.md -docs/AdditionalPropertiesNumber.md -docs/AdditionalPropertiesObject.md -docs/AdditionalPropertiesString.md docs/Animal.md docs/AnotherFakeApi.md +docs/Apple.md +docs/AppleReq.md docs/ArrayOfArrayOfNumberOnly.md docs/ArrayOfNumberOnly.md docs/ArrayTest.md -docs/BigCat.md -docs/BigCatAllOf.md +docs/Banana.md +docs/BananaReq.md +docs/BasquePig.md docs/Capitalization.md docs/Cat.md docs/CatAllOf.md docs/Category.md +docs/ChildCat.md +docs/ChildCatAllOf.md docs/ClassModel.md docs/Client.md +docs/ComplexQuadrilateral.md +docs/DanishPig.md +docs/DefaultApi.md docs/Dog.md docs/DogAllOf.md +docs/Drawing.md docs/EnumArrays.md docs/EnumClass.md docs/EnumTest.md +docs/EquilateralTriangle.md docs/FakeApi.md docs/FakeClassnameTags123Api.md docs/FileSchemaTestClass.md +docs/Foo.md docs/FormatTest.md +docs/Fruit.md +docs/FruitReq.md +docs/GmFruit.md +docs/GrandparentAnimal.md docs/HasOnlyReadOnly.md +docs/HealthCheckResult.md +docs/InlineObject.md +docs/InlineObject1.md +docs/InlineObject2.md +docs/InlineObject3.md +docs/InlineObject4.md +docs/InlineObject5.md +docs/InlineResponseDefault.md +docs/IsoscelesTriangle.md +docs/Mammal.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md docs/Model200Response.md docs/ModelApiResponse.md docs/ModelReturn.md docs/Name.md +docs/NullableClass.md +docs/NullableShape.md docs/NumberOnly.md docs/Order.md docs/OuterComposite.md docs/OuterEnum.md +docs/OuterEnumDefaultValue.md +docs/OuterEnumInteger.md +docs/OuterEnumIntegerDefaultValue.md +docs/ParentPet.md docs/Pet.md docs/PetApi.md +docs/Pig.md +docs/Quadrilateral.md +docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md +docs/ScaleneTriangle.md +docs/Shape.md +docs/ShapeInterface.md +docs/ShapeOrNull.md +docs/SimpleQuadrilateral.md docs/SpecialModelName.md docs/StoreApi.md docs/Tag.md -docs/TypeHolderDefault.md -docs/TypeHolderExample.md +docs/Triangle.md +docs/TriangleInterface.md docs/User.md docs/UserApi.md -docs/XmlItem.md +docs/Whale.md +docs/Zebra.md git_push.sh gradle.properties gradle/wrapper/gradle-wrapper.jar @@ -76,6 +110,7 @@ src/main/java/org/openapitools/client/ServerConfiguration.java src/main/java/org/openapitools/client/ServerVariable.java src/main/java/org/openapitools/client/StringUtil.java src/main/java/org/openapitools/client/api/AnotherFakeApi.java +src/main/java/org/openapitools/client/api/DefaultApi.java src/main/java/org/openapitools/client/api/FakeApi.java src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java src/main/java/org/openapitools/client/api/PetApi.java @@ -85,52 +120,170 @@ src/main/java/org/openapitools/client/auth/ApiKeyAuth.java src/main/java/org/openapitools/client/auth/Authentication.java src/main/java/org/openapitools/client/auth/HttpBasicAuth.java src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java src/main/java/org/openapitools/client/auth/OAuth.java src/main/java/org/openapitools/client/auth/OAuthFlow.java src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java -src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java -src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java -src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java -src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java -src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java -src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java -src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java src/main/java/org/openapitools/client/model/Animal.java +src/main/java/org/openapitools/client/model/Apple.java +src/main/java/org/openapitools/client/model/AppleReq.java src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java src/main/java/org/openapitools/client/model/ArrayTest.java -src/main/java/org/openapitools/client/model/BigCat.java -src/main/java/org/openapitools/client/model/BigCatAllOf.java +src/main/java/org/openapitools/client/model/Banana.java +src/main/java/org/openapitools/client/model/BananaReq.java +src/main/java/org/openapitools/client/model/BasquePig.java src/main/java/org/openapitools/client/model/Capitalization.java src/main/java/org/openapitools/client/model/Cat.java src/main/java/org/openapitools/client/model/CatAllOf.java src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/ChildCat.java +src/main/java/org/openapitools/client/model/ChildCatAllOf.java src/main/java/org/openapitools/client/model/ClassModel.java src/main/java/org/openapitools/client/model/Client.java +src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java +src/main/java/org/openapitools/client/model/DanishPig.java src/main/java/org/openapitools/client/model/Dog.java src/main/java/org/openapitools/client/model/DogAllOf.java +src/main/java/org/openapitools/client/model/Drawing.java src/main/java/org/openapitools/client/model/EnumArrays.java src/main/java/org/openapitools/client/model/EnumClass.java src/main/java/org/openapitools/client/model/EnumTest.java +src/main/java/org/openapitools/client/model/EquilateralTriangle.java src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +src/main/java/org/openapitools/client/model/Foo.java src/main/java/org/openapitools/client/model/FormatTest.java +src/main/java/org/openapitools/client/model/Fruit.java +src/main/java/org/openapitools/client/model/FruitReq.java +src/main/java/org/openapitools/client/model/GmFruit.java +src/main/java/org/openapitools/client/model/GrandparentAnimal.java src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +src/main/java/org/openapitools/client/model/HealthCheckResult.java +src/main/java/org/openapitools/client/model/InlineObject.java +src/main/java/org/openapitools/client/model/InlineObject1.java +src/main/java/org/openapitools/client/model/InlineObject2.java +src/main/java/org/openapitools/client/model/InlineObject3.java +src/main/java/org/openapitools/client/model/InlineObject4.java +src/main/java/org/openapitools/client/model/InlineObject5.java +src/main/java/org/openapitools/client/model/InlineResponseDefault.java +src/main/java/org/openapitools/client/model/IsoscelesTriangle.java +src/main/java/org/openapitools/client/model/Mammal.java src/main/java/org/openapitools/client/model/MapTest.java src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java src/main/java/org/openapitools/client/model/Model200Response.java src/main/java/org/openapitools/client/model/ModelApiResponse.java src/main/java/org/openapitools/client/model/ModelReturn.java src/main/java/org/openapitools/client/model/Name.java +src/main/java/org/openapitools/client/model/NullableClass.java +src/main/java/org/openapitools/client/model/NullableShape.java src/main/java/org/openapitools/client/model/NumberOnly.java src/main/java/org/openapitools/client/model/Order.java src/main/java/org/openapitools/client/model/OuterComposite.java src/main/java/org/openapitools/client/model/OuterEnum.java +src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java +src/main/java/org/openapitools/client/model/OuterEnumInteger.java +src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java +src/main/java/org/openapitools/client/model/ParentPet.java src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/Pig.java +src/main/java/org/openapitools/client/model/Quadrilateral.java +src/main/java/org/openapitools/client/model/QuadrilateralInterface.java src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +src/main/java/org/openapitools/client/model/ScaleneTriangle.java +src/main/java/org/openapitools/client/model/Shape.java +src/main/java/org/openapitools/client/model/ShapeInterface.java +src/main/java/org/openapitools/client/model/ShapeOrNull.java +src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java src/main/java/org/openapitools/client/model/SpecialModelName.java src/main/java/org/openapitools/client/model/Tag.java -src/main/java/org/openapitools/client/model/TypeHolderDefault.java -src/main/java/org/openapitools/client/model/TypeHolderExample.java +src/main/java/org/openapitools/client/model/Triangle.java +src/main/java/org/openapitools/client/model/TriangleInterface.java src/main/java/org/openapitools/client/model/User.java -src/main/java/org/openapitools/client/model/XmlItem.java +src/main/java/org/openapitools/client/model/Whale.java +src/main/java/org/openapitools/client/model/Zebra.java +src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java +src/test/java/org/openapitools/client/api/DefaultApiTest.java +src/test/java/org/openapitools/client/api/FakeApiTest.java +src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java +src/test/java/org/openapitools/client/api/PetApiTest.java +src/test/java/org/openapitools/client/api/StoreApiTest.java +src/test/java/org/openapitools/client/api/UserApiTest.java +src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java +src/test/java/org/openapitools/client/model/AnimalTest.java +src/test/java/org/openapitools/client/model/AppleReqTest.java +src/test/java/org/openapitools/client/model/AppleTest.java +src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java +src/test/java/org/openapitools/client/model/ArrayOfNumberOnlyTest.java +src/test/java/org/openapitools/client/model/ArrayTestTest.java +src/test/java/org/openapitools/client/model/BananaReqTest.java +src/test/java/org/openapitools/client/model/BananaTest.java +src/test/java/org/openapitools/client/model/BasquePigTest.java +src/test/java/org/openapitools/client/model/CapitalizationTest.java +src/test/java/org/openapitools/client/model/CatAllOfTest.java +src/test/java/org/openapitools/client/model/CatTest.java +src/test/java/org/openapitools/client/model/CategoryTest.java +src/test/java/org/openapitools/client/model/ChildCatAllOfTest.java +src/test/java/org/openapitools/client/model/ChildCatTest.java +src/test/java/org/openapitools/client/model/ClassModelTest.java +src/test/java/org/openapitools/client/model/ClientTest.java +src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java +src/test/java/org/openapitools/client/model/DanishPigTest.java +src/test/java/org/openapitools/client/model/DogAllOfTest.java +src/test/java/org/openapitools/client/model/DogTest.java +src/test/java/org/openapitools/client/model/DrawingTest.java +src/test/java/org/openapitools/client/model/EnumArraysTest.java +src/test/java/org/openapitools/client/model/EnumClassTest.java +src/test/java/org/openapitools/client/model/EnumTestTest.java +src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java +src/test/java/org/openapitools/client/model/FileSchemaTestClassTest.java +src/test/java/org/openapitools/client/model/FooTest.java +src/test/java/org/openapitools/client/model/FormatTestTest.java +src/test/java/org/openapitools/client/model/FruitReqTest.java +src/test/java/org/openapitools/client/model/FruitTest.java +src/test/java/org/openapitools/client/model/GmFruitTest.java +src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java +src/test/java/org/openapitools/client/model/HasOnlyReadOnlyTest.java +src/test/java/org/openapitools/client/model/HealthCheckResultTest.java +src/test/java/org/openapitools/client/model/InlineObject1Test.java +src/test/java/org/openapitools/client/model/InlineObject2Test.java +src/test/java/org/openapitools/client/model/InlineObject3Test.java +src/test/java/org/openapitools/client/model/InlineObject4Test.java +src/test/java/org/openapitools/client/model/InlineObject5Test.java +src/test/java/org/openapitools/client/model/InlineObjectTest.java +src/test/java/org/openapitools/client/model/InlineResponseDefaultTest.java +src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java +src/test/java/org/openapitools/client/model/MammalTest.java +src/test/java/org/openapitools/client/model/MapTestTest.java +src/test/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClassTest.java +src/test/java/org/openapitools/client/model/Model200ResponseTest.java +src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +src/test/java/org/openapitools/client/model/ModelReturnTest.java +src/test/java/org/openapitools/client/model/NameTest.java +src/test/java/org/openapitools/client/model/NullableClassTest.java +src/test/java/org/openapitools/client/model/NullableShapeTest.java +src/test/java/org/openapitools/client/model/NumberOnlyTest.java +src/test/java/org/openapitools/client/model/OrderTest.java +src/test/java/org/openapitools/client/model/OuterCompositeTest.java +src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java +src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java +src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java +src/test/java/org/openapitools/client/model/OuterEnumTest.java +src/test/java/org/openapitools/client/model/ParentPetTest.java +src/test/java/org/openapitools/client/model/PetTest.java +src/test/java/org/openapitools/client/model/PigTest.java +src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java +src/test/java/org/openapitools/client/model/QuadrilateralTest.java +src/test/java/org/openapitools/client/model/ReadOnlyFirstTest.java +src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java +src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java +src/test/java/org/openapitools/client/model/ShapeOrNullTest.java +src/test/java/org/openapitools/client/model/ShapeTest.java +src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java +src/test/java/org/openapitools/client/model/SpecialModelNameTest.java +src/test/java/org/openapitools/client/model/TagTest.java +src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java +src/test/java/org/openapitools/client/model/TriangleTest.java +src/test/java/org/openapitools/client/model/UserTest.java +src/test/java/org/openapitools/client/model/WhaleTest.java +src/test/java/org/openapitools/client/model/ZebraTest.java diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/README.md b/samples/openapi3/client/petstore/java/jersey2-java8/README.md index 6de6c6fdb7a5..fed6ba75e3de 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/README.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/README.md @@ -84,9 +84,9 @@ public class AnotherFakeApiExample { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); - Client body = new Client(); // Client | client model + Client client = new Client(); // Client | client model try { - Client result = apiInstance.call123testSpecialTags(body); + Client result = apiInstance.call123testSpecialTags(client); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); @@ -107,7 +107,8 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags -*FakeApi* | [**createXmlItem**](docs/FakeApi.md#createXmlItem) | **POST** /fake/create_xml_item | creates an XmlItem +*DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooGet) | **GET** /foo | +*FakeApi* | [**fakeHealthGet**](docs/FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint *FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | *FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | *FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | @@ -115,7 +116,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | *FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model -*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters *FakeApi* | [**testGroupParameters**](docs/FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) *FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties @@ -147,52 +148,84 @@ Class | Method | HTTP request | Description ## Documentation for Models - - [AdditionalPropertiesAnyType](docs/AdditionalPropertiesAnyType.md) - - [AdditionalPropertiesArray](docs/AdditionalPropertiesArray.md) - - [AdditionalPropertiesBoolean](docs/AdditionalPropertiesBoolean.md) - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) - - [AdditionalPropertiesInteger](docs/AdditionalPropertiesInteger.md) - - [AdditionalPropertiesNumber](docs/AdditionalPropertiesNumber.md) - - [AdditionalPropertiesObject](docs/AdditionalPropertiesObject.md) - - [AdditionalPropertiesString](docs/AdditionalPropertiesString.md) - [Animal](docs/Animal.md) + - [Apple](docs/Apple.md) + - [AppleReq](docs/AppleReq.md) - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) - [ArrayTest](docs/ArrayTest.md) - - [BigCat](docs/BigCat.md) - - [BigCatAllOf](docs/BigCatAllOf.md) + - [Banana](docs/Banana.md) + - [BananaReq](docs/BananaReq.md) + - [BasquePig](docs/BasquePig.md) - [Capitalization](docs/Capitalization.md) - [Cat](docs/Cat.md) - [CatAllOf](docs/CatAllOf.md) - [Category](docs/Category.md) + - [ChildCat](docs/ChildCat.md) + - [ChildCatAllOf](docs/ChildCatAllOf.md) - [ClassModel](docs/ClassModel.md) - [Client](docs/Client.md) + - [ComplexQuadrilateral](docs/ComplexQuadrilateral.md) + - [DanishPig](docs/DanishPig.md) - [Dog](docs/Dog.md) - [DogAllOf](docs/DogAllOf.md) + - [Drawing](docs/Drawing.md) - [EnumArrays](docs/EnumArrays.md) - [EnumClass](docs/EnumClass.md) - [EnumTest](docs/EnumTest.md) + - [EquilateralTriangle](docs/EquilateralTriangle.md) - [FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [Foo](docs/Foo.md) - [FormatTest](docs/FormatTest.md) + - [Fruit](docs/Fruit.md) + - [FruitReq](docs/FruitReq.md) + - [GmFruit](docs/GmFruit.md) + - [GrandparentAnimal](docs/GrandparentAnimal.md) - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [HealthCheckResult](docs/HealthCheckResult.md) + - [InlineObject](docs/InlineObject.md) + - [InlineObject1](docs/InlineObject1.md) + - [InlineObject2](docs/InlineObject2.md) + - [InlineObject3](docs/InlineObject3.md) + - [InlineObject4](docs/InlineObject4.md) + - [InlineObject5](docs/InlineObject5.md) + - [InlineResponseDefault](docs/InlineResponseDefault.md) + - [IsoscelesTriangle](docs/IsoscelesTriangle.md) + - [Mammal](docs/Mammal.md) - [MapTest](docs/MapTest.md) - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) - [Model200Response](docs/Model200Response.md) - [ModelApiResponse](docs/ModelApiResponse.md) - [ModelReturn](docs/ModelReturn.md) - [Name](docs/Name.md) + - [NullableClass](docs/NullableClass.md) + - [NullableShape](docs/NullableShape.md) - [NumberOnly](docs/NumberOnly.md) - [Order](docs/Order.md) - [OuterComposite](docs/OuterComposite.md) - [OuterEnum](docs/OuterEnum.md) + - [OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md) + - [OuterEnumInteger](docs/OuterEnumInteger.md) + - [OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md) + - [ParentPet](docs/ParentPet.md) - [Pet](docs/Pet.md) + - [Pig](docs/Pig.md) + - [Quadrilateral](docs/Quadrilateral.md) + - [QuadrilateralInterface](docs/QuadrilateralInterface.md) - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [ScaleneTriangle](docs/ScaleneTriangle.md) + - [Shape](docs/Shape.md) + - [ShapeInterface](docs/ShapeInterface.md) + - [ShapeOrNull](docs/ShapeOrNull.md) + - [SimpleQuadrilateral](docs/SimpleQuadrilateral.md) - [SpecialModelName](docs/SpecialModelName.md) - [Tag](docs/Tag.md) - - [TypeHolderDefault](docs/TypeHolderDefault.md) - - [TypeHolderExample](docs/TypeHolderExample.md) + - [Triangle](docs/Triangle.md) + - [TriangleInterface](docs/TriangleInterface.md) - [User](docs/User.md) - - [XmlItem](docs/XmlItem.md) + - [Whale](docs/Whale.md) + - [Zebra](docs/Zebra.md) ## Documentation for Authorization @@ -212,9 +245,19 @@ Authentication schemes defined for the API: - **API key parameter name**: api_key_query - **Location**: URL query string +### bearer_test + + +- **Type**: HTTP basic authentication + ### http_basic_test +- **Type**: HTTP basic authentication + +### http_signature_test + + - **Type**: HTTP basic authentication ### petstore_auth diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml b/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml index a49359fd348c..b254bf2c4b1e 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml +++ b/samples/openapi3/client/petstore/java/jersey2-java8/api/openapi.yaml @@ -1,4 +1,4 @@ -openapi: 3.0.1 +openapi: 3.0.0 info: description: 'This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: @@ -9,7 +9,28 @@ info: title: OpenAPI Petstore version: 1.0.0 servers: -- url: http://petstore.swagger.io:80/v2 +- description: petstore server + url: http://{server}.swagger.io:{port}/v2 + variables: + server: + default: petstore + enum: + - petstore + - qa-petstore + - dev-petstore + port: + default: "80" + enum: + - "80" + - "8080" +- description: The local server + url: https://localhost:8080/{version} + variables: + version: + default: v2 + enum: + - v1 + - v2 tags: - description: Everything about your Pets name: pet @@ -18,71 +39,58 @@ tags: - description: Operations about user name: user paths: + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/inline_response_default' + description: response + x-accepts: application/json /pet: post: operationId: addPet requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - application/xml: - schema: - $ref: '#/components/schemas/Pet' - description: Pet object that needs to be added to the store - required: true + $ref: '#/components/requestBodies/Pet' responses: - "200": - content: {} - description: successful operation "405": - content: {} description: Invalid input security: + - http_signature_test: [] - petstore_auth: - write:pets - read:pets summary: Add a new pet to the store tags: - pet - x-codegen-request-body-name: body x-contentType: application/json x-accepts: application/json put: operationId: updatePet requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - application/xml: - schema: - $ref: '#/components/schemas/Pet' - description: Pet object that needs to be added to the store - required: true + $ref: '#/components/requestBodies/Pet' responses: - "200": - content: {} - description: successful operation "400": - content: {} description: Invalid ID supplied "404": - content: {} description: Pet not found "405": - content: {} description: Validation exception security: + - http_signature_test: [] - petstore_auth: - write:pets - read:pets summary: Update an existing pet tags: - pet - x-codegen-request-body-name: body x-contentType: application/json x-accepts: application/json + servers: + - url: http://petstore.swagger.io/v2 + - url: http://path-server-test.petstore.local/v2 /pet/findByStatus: get: description: Multiple status values can be provided with comma separated strings @@ -118,9 +126,9 @@ paths: type: array description: successful operation "400": - content: {} description: Invalid status value security: + - http_signature_test: [] - petstore_auth: - write:pets - read:pets @@ -144,7 +152,6 @@ paths: items: type: string type: array - uniqueItems: true style: form responses: "200": @@ -154,18 +161,16 @@ paths: items: $ref: '#/components/schemas/Pet' type: array - uniqueItems: true application/json: schema: items: $ref: '#/components/schemas/Pet' type: array - uniqueItems: true description: successful operation "400": - content: {} description: Invalid tag value security: + - http_signature_test: [] - petstore_auth: - write:pets - read:pets @@ -177,23 +182,24 @@ paths: delete: operationId: deletePet parameters: - - in: header + - explode: false + in: header name: api_key + required: false schema: type: string + style: simple - description: Pet id to delete + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple responses: - "200": - content: {} - description: successful operation "400": - content: {} description: Invalid pet value security: - petstore_auth: @@ -208,12 +214,14 @@ paths: operationId: getPetById parameters: - description: ID of pet to return + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple responses: "200": content: @@ -225,10 +233,8 @@ paths: $ref: '#/components/schemas/Pet' description: successful operation "400": - content: {} description: Invalid ID supplied "404": - content: {} description: Pet not found security: - api_key: [] @@ -240,13 +246,16 @@ paths: operationId: updatePetWithForm parameters: - description: ID of pet that needs to be updated + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple requestBody: + $ref: '#/components/requestBodies/inline_object' content: application/x-www-form-urlencoded: schema: @@ -257,9 +266,9 @@ paths: status: description: Updated status of the pet type: string + type: object responses: "405": - content: {} description: Invalid input security: - petstore_auth: @@ -275,13 +284,16 @@ paths: operationId: uploadFile parameters: - description: ID of pet to update + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple requestBody: + $ref: '#/components/requestBodies/inline_object_1' content: multipart/form-data: schema: @@ -293,6 +305,7 @@ paths: description: file to upload format: binary type: string + type: object responses: "200": content: @@ -334,7 +347,7 @@ paths: operationId: placeOrder requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/Order' description: order placed for purchasing the pet @@ -350,13 +363,11 @@ paths: $ref: '#/components/schemas/Order' description: successful operation "400": - content: {} description: Invalid Order summary: Place an order for a pet tags: - store - x-codegen-request-body-name: body - x-contentType: '*/*' + x-contentType: application/json x-accepts: application/json /store/order/{order_id}: delete: @@ -365,17 +376,17 @@ paths: operationId: deleteOrder parameters: - description: ID of the order that needs to be deleted + explode: false in: path name: order_id required: true schema: type: string + style: simple responses: "400": - content: {} description: Invalid ID supplied "404": - content: {} description: Order not found summary: Delete purchase order by ID tags: @@ -387,6 +398,7 @@ paths: operationId: getOrderById parameters: - description: ID of pet that needs to be fetched + explode: false in: path name: order_id required: true @@ -395,6 +407,7 @@ paths: maximum: 5 minimum: 1 type: integer + style: simple responses: "200": content: @@ -406,10 +419,8 @@ paths: $ref: '#/components/schemas/Order' description: successful operation "400": - content: {} description: Invalid ID supplied "404": - content: {} description: Order not found summary: Find purchase order by ID tags: @@ -421,81 +432,65 @@ paths: operationId: createUser requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/User' description: Created user object required: true responses: default: - content: {} description: successful operation summary: Create user tags: - user - x-codegen-request-body-name: body - x-contentType: '*/*' + x-contentType: application/json x-accepts: application/json /user/createWithArray: post: operationId: createUsersWithArrayInput requestBody: - content: - '*/*': - schema: - items: - $ref: '#/components/schemas/User' - type: array - description: List of user object - required: true + $ref: '#/components/requestBodies/UserArray' responses: default: - content: {} description: successful operation summary: Creates list of users with given input array tags: - user - x-codegen-request-body-name: body - x-contentType: '*/*' + x-contentType: application/json x-accepts: application/json /user/createWithList: post: operationId: createUsersWithListInput requestBody: - content: - '*/*': - schema: - items: - $ref: '#/components/schemas/User' - type: array - description: List of user object - required: true + $ref: '#/components/requestBodies/UserArray' responses: default: - content: {} description: successful operation summary: Creates list of users with given input array tags: - user - x-codegen-request-body-name: body - x-contentType: '*/*' + x-contentType: application/json x-accepts: application/json /user/login: get: operationId: loginUser parameters: - description: The user name for login + explode: true in: query name: username required: true schema: type: string + style: form - description: The password for login in clear text + explode: true in: query name: password required: true schema: type: string + style: form responses: "200": content: @@ -509,16 +504,19 @@ paths: headers: X-Rate-Limit: description: calls per hour allowed by the user + explode: false schema: format: int32 type: integer + style: simple X-Expires-After: description: date in UTC when token expires + explode: false schema: format: date-time type: string + style: simple "400": - content: {} description: Invalid username/password supplied summary: Logs user into the system tags: @@ -529,7 +527,6 @@ paths: operationId: logoutUser responses: default: - content: {} description: successful operation summary: Logs out current logged in user session tags: @@ -541,17 +538,17 @@ paths: operationId: deleteUser parameters: - description: The name that needs to be deleted + explode: false in: path name: username required: true schema: type: string + style: simple responses: "400": - content: {} description: Invalid username supplied "404": - content: {} description: User not found summary: Delete user tags: @@ -561,11 +558,13 @@ paths: operationId: getUserByName parameters: - description: The name that needs to be fetched. Use user1 for testing. + explode: false in: path name: username required: true schema: type: string + style: simple responses: "200": content: @@ -577,10 +576,8 @@ paths: $ref: '#/components/schemas/User' description: successful operation "400": - content: {} description: Invalid username supplied "404": - content: {} description: User not found summary: Get user by user name tags: @@ -591,42 +588,36 @@ paths: operationId: updateUser parameters: - description: name that need to be deleted + explode: false in: path name: username required: true schema: type: string + style: simple requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/User' description: Updated user object required: true responses: "400": - content: {} description: Invalid user supplied "404": - content: {} description: User not found summary: Updated user tags: - user - x-codegen-request-body-name: body - x-contentType: '*/*' + x-contentType: application/json x-accepts: application/json /fake_classname_test: patch: description: To test class name in snake case operationId: testClassname requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Client' - description: client model - required: true + $ref: '#/components/requestBodies/Client' responses: "200": content: @@ -639,7 +630,6 @@ paths: summary: To test class name in snake case tags: - fake_classname_tags 123#$%^ - x-codegen-request-body-name: body x-contentType: application/json x-accepts: application/json /fake: @@ -648,44 +638,60 @@ paths: operationId: testGroupParameters parameters: - description: Required String in group parameters + explode: true in: query name: required_string_group required: true schema: type: integer + style: form - description: Required Boolean in group parameters + explode: false in: header name: required_boolean_group required: true schema: type: boolean + style: simple - description: Required Integer in group parameters + explode: true in: query name: required_int64_group required: true schema: format: int64 type: integer + style: form - description: String in group parameters + explode: true in: query name: string_group + required: false schema: type: integer + style: form - description: Boolean in group parameters + explode: false in: header name: boolean_group + required: false schema: type: boolean + style: simple - description: Integer in group parameters + explode: true in: query name: int64_group + required: false schema: format: int64 type: integer + style: form responses: "400": - content: {} description: Someting wrong + security: + - bearer_test: [] summary: Fake endpoint to test group parameters (optional) tags: - fake @@ -699,6 +705,7 @@ paths: explode: false in: header name: enum_header_string_array + required: false schema: items: default: $ @@ -709,8 +716,10 @@ paths: type: array style: simple - description: Header parameter enum test (string) + explode: false in: header name: enum_header_string + required: false schema: default: -efg enum: @@ -718,10 +727,12 @@ paths: - -efg - (xyz) type: string + style: simple - description: Query parameter enum test (string array) - explode: false + explode: true in: query name: enum_query_string_array + required: false schema: items: default: $ @@ -732,8 +743,10 @@ paths: type: array style: form - description: Query parameter enum test (string) + explode: true in: query name: enum_query_string + required: false schema: default: -efg enum: @@ -741,25 +754,33 @@ paths: - -efg - (xyz) type: string + style: form - description: Query parameter enum test (double) + explode: true in: query name: enum_query_integer + required: false schema: enum: - 1 - -2 format: int32 type: integer + style: form - description: Query parameter enum test (double) + explode: true in: query name: enum_query_double + required: false schema: enum: - 1.1 - -1.2 format: double type: number + style: form requestBody: + $ref: '#/components/requestBodies/inline_object_2' content: application/x-www-form-urlencoded: schema: @@ -781,12 +802,11 @@ paths: - -efg - (xyz) type: string + type: object responses: "400": - content: {} description: Invalid request "404": - content: {} description: Not found summary: To test enum parameters tags: @@ -797,12 +817,7 @@ paths: description: To test "client" model operationId: testClientModel requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Client' - description: client model - required: true + $ref: '#/components/requestBodies/Client' responses: "200": content: @@ -813,24 +828,23 @@ paths: summary: To test "client" model tags: - fake - x-codegen-request-body-name: body x-contentType: application/json x-accepts: application/json post: - description: |- + description: | Fake endpoint for testing various parameters - 假端點 - 偽のエンドポイント - 가짜 엔드 포인트 + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 operationId: testEndpointParameters requestBody: + $ref: '#/components/requestBodies/inline_object_3' content: application/x-www-form-urlencoded: schema: properties: integer: description: None - format: int32 maximum: 100 minimum: 10 type: integer @@ -898,21 +912,19 @@ paths: - double - number - pattern_without_delimiter - required: true + type: object responses: "400": - content: {} description: Invalid username supplied "404": - content: {} description: User not found security: - http_basic_test: [] - summary: |- + summary: | Fake endpoint for testing various parameters - 假端點 - 偽のエンドポイント - 가짜 엔드 포인트 + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 tags: - fake x-contentType: application/x-www-form-urlencoded @@ -923,11 +935,10 @@ paths: operationId: fakeOuterNumberSerialize requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/OuterNumber' description: Input number as post body - required: false responses: "200": content: @@ -937,8 +948,7 @@ paths: description: Output number tags: - fake - x-codegen-request-body-name: body - x-contentType: '*/*' + x-contentType: application/json x-accepts: '*/*' /fake/outer/string: post: @@ -946,11 +956,10 @@ paths: operationId: fakeOuterStringSerialize requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/OuterString' description: Input string as post body - required: false responses: "200": content: @@ -960,8 +969,7 @@ paths: description: Output string tags: - fake - x-codegen-request-body-name: body - x-contentType: '*/*' + x-contentType: application/json x-accepts: '*/*' /fake/outer/boolean: post: @@ -969,11 +977,10 @@ paths: operationId: fakeOuterBooleanSerialize requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/OuterBoolean' description: Input boolean as post body - required: false responses: "200": content: @@ -983,8 +990,7 @@ paths: description: Output boolean tags: - fake - x-codegen-request-body-name: body - x-contentType: '*/*' + x-contentType: application/json x-accepts: '*/*' /fake/outer/composite: post: @@ -992,11 +998,10 @@ paths: operationId: fakeOuterCompositeSerialize requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/OuterComposite' description: Input composite as post body - required: false responses: "200": content: @@ -1006,13 +1011,13 @@ paths: description: Output composite tags: - fake - x-codegen-request-body-name: body - x-contentType: '*/*' + x-contentType: application/json x-accepts: '*/*' /fake/jsonFormData: get: operationId: testJsonFormData requestBody: + $ref: '#/components/requestBodies/inline_object_4' content: application/x-www-form-urlencoded: schema: @@ -1026,10 +1031,9 @@ paths: required: - param - param2 - required: true + type: object responses: "200": - content: {} description: successful operation summary: test json serialization of form data tags: @@ -1050,23 +1054,23 @@ paths: required: true responses: "200": - content: {} description: successful operation summary: test inline additionalProperties tags: - fake - x-codegen-request-body-name: param x-contentType: application/json x-accepts: application/json /fake/body-with-query-params: put: operationId: testBodyWithQueryParams parameters: - - in: query + - explode: true + in: query name: query required: true schema: type: string + style: form requestBody: content: application/json: @@ -1075,60 +1079,17 @@ paths: required: true responses: "200": - content: {} description: Success tags: - fake - x-codegen-request-body-name: body x-contentType: application/json x-accepts: application/json - /fake/create_xml_item: - post: - description: this route creates an XmlItem - operationId: createXmlItem - requestBody: - content: - application/xml: - schema: - $ref: '#/components/schemas/XmlItem' - application/xml; charset=utf-8: - schema: - $ref: '#/components/schemas/XmlItem' - application/xml; charset=utf-16: - schema: - $ref: '#/components/schemas/XmlItem' - text/xml: - schema: - $ref: '#/components/schemas/XmlItem' - text/xml; charset=utf-8: - schema: - $ref: '#/components/schemas/XmlItem' - text/xml; charset=utf-16: - schema: - $ref: '#/components/schemas/XmlItem' - description: XmlItem Body - required: true - responses: - "200": - content: {} - description: successful operation - summary: creates an XmlItem - tags: - - fake - x-codegen-request-body-name: XmlItem - x-contentType: application/xml - x-accepts: application/json /another-fake/dummy: patch: description: To test special tags and operation ID starting with number operationId: 123_test_@#$%_special_tags requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Client' - description: client model - required: true + $ref: '#/components/requestBodies/Client' responses: "200": content: @@ -1139,7 +1100,6 @@ paths: summary: To test special tags tags: - $another-fake? - x-codegen-request-body-name: body x-contentType: application/json x-accepts: application/json /fake/body-with-file-schema: @@ -1155,11 +1115,9 @@ paths: required: true responses: "200": - content: {} description: Success tags: - fake - x-codegen-request-body-name: body x-contentType: application/json x-accepts: application/json /fake/test-query-paramters: @@ -1167,7 +1125,7 @@ paths: description: To test the collection format in query parameters operationId: testQueryParameterCollectionFormat parameters: - - explode: false + - explode: true in: query name: pipe required: true @@ -1176,14 +1134,17 @@ paths: type: string type: array style: form - - in: query + - explode: false + in: query name: ioutil required: true schema: items: type: string type: array - - in: query + style: form + - explode: false + in: query name: http required: true schema: @@ -1211,7 +1172,6 @@ paths: style: form responses: "200": - content: {} description: Success tags: - fake @@ -1221,13 +1181,16 @@ paths: operationId: uploadFileWithRequiredFile parameters: - description: ID of pet to update + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple requestBody: + $ref: '#/components/requestBodies/inline_object_5' content: multipart/form-data: schema: @@ -1241,7 +1204,7 @@ paths: type: string required: - requiredFile - required: true + type: object responses: "200": content: @@ -1258,8 +1221,89 @@ paths: - pet x-contentType: multipart/form-data x-accepts: application/json + /fake/health: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/HealthCheckResult' + description: The instance started successfully + summary: Health check endpoint + tags: + - fake + x-accepts: application/json components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + Client: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + inline_object: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object' + inline_object_1: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object_1' + inline_object_2: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object_2' + inline_object_3: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object_3' + inline_object_4: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object_4' + inline_object_5: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object_5' schemas: + Foo: + example: + bar: bar + properties: + bar: + default: bar + type: string + type: object + Bar: + default: bar + type: string Order: example: petId: 6 @@ -1316,9 +1360,13 @@ components: lastName: lastName password: password userStatus: 6 + objectWithNoDeclaredPropsNullable: '{}' phone: phone + objectWithNoDeclaredProps: '{}' id: 0 + anyTypePropNullable: "" email: email + anyTypeProp: "" username: username properties: id: @@ -1341,6 +1389,25 @@ components: description: User Status format: int32 type: integer + objectWithNoDeclaredProps: + description: test code generation for objects Value must be a map of strings + to values. It cannot be the 'null' value. + type: object + objectWithNoDeclaredPropsNullable: + description: test code generation for nullable objects. Value must be a + map of strings to values or the 'null' value. + nullable: true + type: object + anyTypeProp: + description: test code generation for any type Here the 'type' attribute + is not specified, which means the value can be anything, including the + null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 + anyTypePropNullable: + description: test code generation for any type Here the 'type' attribute + is not specified, which means the value can be anything, including the + null value, string, number, boolean, array or object. The 'nullable' attribute + does not change the allowed values. + nullable: true type: object xml: name: User @@ -1387,7 +1454,6 @@ components: items: type: string type: array - uniqueItems: true xml: name: photoUrl wrapped: true @@ -1425,21 +1491,12 @@ components: message: type: string type: object - $special[model.name]: - properties: - $special[property.name]: - format: int64 - type: integer - type: object - xml: - name: $special[model.name] Return: description: Model for testing reserved words properties: return: format: int32 type: integer - type: object xml: name: Return Name: @@ -1459,7 +1516,6 @@ components: type: integer required: - name - type: object xml: name: Name "200_response": @@ -1470,7 +1526,6 @@ components: type: integer class: type: string - type: object xml: name: Name ClassModel: @@ -1478,7 +1533,6 @@ components: properties: _class: type: string - type: object Dog: allOf: - $ref: '#/components/schemas/Animal' @@ -1486,11 +1540,12 @@ components: Cat: allOf: - $ref: '#/components/schemas/Animal' + - $ref: '#/components/schemas/Address' - $ref: '#/components/schemas/Cat_allOf' - BigCat: - allOf: - - $ref: '#/components/schemas/Cat' - - $ref: '#/components/schemas/BigCat_allOf' + Address: + additionalProperties: + type: integer + type: object Animal: discriminator: propertyName: className @@ -1510,13 +1565,14 @@ components: format_test: properties: integer: - maximum: 1E+2 - minimum: 1E+1 + maximum: 100 + minimum: 10 + multipleOf: 2 type: integer int32: format: int32 - maximum: 2E+2 - minimum: 2E+1 + maximum: 200 + minimum: 20 type: integer int64: format: int64 @@ -1524,6 +1580,7 @@ components: number: maximum: 543.2 minimum: 32.1 + multipleOf: 32.5 type: number float: format: float @@ -1540,7 +1597,6 @@ components: type: string byte: format: byte - pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ type: string binary: format: binary @@ -1560,8 +1616,14 @@ components: maxLength: 64 minLength: 10 type: string - BigDecimal: - format: number + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + pattern: ^\d{10}$ + type: string + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one + to three digits following i.e. Image_01. + pattern: /^image_\d{1,3}$/i type: string required: - byte @@ -1604,155 +1666,83 @@ components: type: number outerEnum: $ref: '#/components/schemas/OuterEnum' + outerEnumInteger: + $ref: '#/components/schemas/OuterEnumInteger' + outerEnumDefaultValue: + $ref: '#/components/schemas/OuterEnumDefaultValue' + outerEnumIntegerDefaultValue: + $ref: '#/components/schemas/OuterEnumIntegerDefaultValue' required: - enum_string_required type: object AdditionalPropertiesClass: properties: - map_string: + map_property: additionalProperties: type: string type: object - map_number: - additionalProperties: - type: number - type: object - map_integer: - additionalProperties: - type: integer - type: object - map_boolean: - additionalProperties: - type: boolean - type: object - map_array_integer: - additionalProperties: - items: - type: integer - type: array - type: object - map_array_anytype: - additionalProperties: - items: - properties: {} - type: object - type: array - type: object - map_map_string: + map_of_map_property: additionalProperties: additionalProperties: type: string type: object type: object - map_map_anytype: - additionalProperties: - additionalProperties: - properties: {} - type: object - type: object + anytype_1: {} + map_with_undeclared_properties_anytype_1: type: object - anytype_1: + map_with_undeclared_properties_anytype_2: properties: {} type: object - anytype_2: + map_with_undeclared_properties_anytype_3: + additionalProperties: true type: object - anytype_3: - properties: {} + empty_map: + additionalProperties: false + description: an object with no declared properties and no undeclared properties, + hence it's an empty map. + type: object + map_with_undeclared_properties_string: + additionalProperties: + type: string type: object type: object - AdditionalPropertiesString: - additionalProperties: - type: string + MixedPropertiesAndAdditionalPropertiesClass: properties: - name: + uuid: + format: uuid + type: string + dateTime: + format: date-time type: string + map: + additionalProperties: + $ref: '#/components/schemas/Animal' + type: object type: object - AdditionalPropertiesInteger: - additionalProperties: - type: integer + List: properties: - name: + "123-list": type: string type: object - AdditionalPropertiesNumber: - additionalProperties: - type: number + Client: + example: + client: client properties: - name: + client: type: string type: object - AdditionalPropertiesBoolean: - additionalProperties: - type: boolean + ReadOnlyFirst: properties: - name: + bar: + readOnly: true + type: string + baz: type: string type: object - AdditionalPropertiesArray: - additionalProperties: - items: - properties: {} - type: object - type: array + hasOnlyReadOnly: properties: - name: - type: string - type: object - AdditionalPropertiesObject: - additionalProperties: - additionalProperties: - properties: {} - type: object - type: object - properties: - name: - type: string - type: object - AdditionalPropertiesAnyType: - additionalProperties: - properties: {} - type: object - properties: - name: - type: string - type: object - MixedPropertiesAndAdditionalPropertiesClass: - properties: - uuid: - format: uuid - type: string - dateTime: - format: date-time - type: string - map: - additionalProperties: - $ref: '#/components/schemas/Animal' - type: object - type: object - List: - properties: - "123-list": - type: string - type: object - Client: - example: - client: client - properties: - client: - type: string - type: object - ReadOnlyFirst: - properties: - bar: - readOnly: true - type: string - baz: - type: string - type: object - hasOnlyReadOnly: - properties: - bar: - readOnly: true + bar: + readOnly: true type: string foo: readOnly: true @@ -1856,11 +1846,32 @@ components: type: array type: object OuterEnum: + enum: + - placed + - approved + - delivered + nullable: true + type: string + OuterEnumInteger: + enum: + - 0 + - 1 + - 2 + type: integer + OuterEnumDefaultValue: + default: placed enum: - placed - approved - delivered type: string + OuterEnumIntegerDefaultValue: + default: 0 + enum: + - 0 + - 1 + - 2 + type: integer OuterComposite: example: my_string: my_string @@ -1910,243 +1921,441 @@ components: description: Test capitalization type: string type: object - TypeHolderDefault: + _special_model.name_: properties: - string_item: - default: what - type: string - number_item: - type: number - integer_item: + $special[property.name]: + format: int64 type: integer - bool_item: - default: true - type: boolean - array_item: - items: - type: integer - type: array - required: - - array_item - - bool_item - - integer_item - - number_item - - string_item - type: object - TypeHolderExample: + xml: + name: $special[model.name] + HealthCheckResult: + description: Just a string to inform instance is up and running. Make it nullable + in hope to get it as pointer in generated model. + example: + NullableMessage: NullableMessage properties: - string_item: - example: what + NullableMessage: + nullable: true type: string - number_item: - example: 1.234 - type: number - float_item: - example: 1.234 - format: float - type: number - integer_item: - example: -2 - type: integer - bool_item: - example: true - type: boolean - array_item: - example: - - 0 - - 1 - - 2 - - 3 - items: - type: integer - type: array - required: - - array_item - - bool_item - - float_item - - integer_item - - number_item - - string_item type: object - XmlItem: + NullableClass: + additionalProperties: + nullable: true + type: object properties: - attribute_string: - example: string - type: string - xml: - attribute: true - attribute_number: - example: 1.234 - type: number - xml: - attribute: true - attribute_integer: - example: -2 + integer_prop: + nullable: true type: integer - xml: - attribute: true - attribute_boolean: - example: true + number_prop: + nullable: true + type: number + boolean_prop: + nullable: true type: boolean - xml: - attribute: true - wrapped_array: + string_prop: + nullable: true + type: string + date_prop: + format: date + nullable: true + type: string + datetime_prop: + format: date-time + nullable: true + type: string + array_nullable_prop: items: - type: integer + type: object + nullable: true type: array - xml: - wrapped: true - name_string: - example: string - type: string - xml: - name: xml_name_string - name_number: - example: 1.234 - type: number - xml: - name: xml_name_number - name_integer: - example: -2 - type: integer - xml: - name: xml_name_integer - name_boolean: - example: true - type: boolean - xml: - name: xml_name_boolean - name_array: + array_and_items_nullable_prop: items: - type: integer - xml: - name: xml_name_array_item + nullable: true + type: object + nullable: true type: array - name_wrapped_array: + array_items_nullable: items: - type: integer - xml: - name: xml_name_wrapped_array_item + nullable: true + type: object type: array - xml: - name: xml_name_wrapped_array - wrapped: true - prefix_string: - example: string + object_nullable_prop: + additionalProperties: + type: object + nullable: true + type: object + object_and_items_nullable_prop: + additionalProperties: + nullable: true + type: object + nullable: true + type: object + object_items_nullable: + additionalProperties: + nullable: true + type: object + type: object + type: object + fruit: + additionalProperties: false + oneOf: + - $ref: '#/components/schemas/apple' + - $ref: '#/components/schemas/banana' + properties: + color: type: string - xml: - prefix: ab - prefix_number: - example: 1.234 + apple: + nullable: true + properties: + cultivar: + pattern: ^[a-zA-Z\s]*$ + type: string + origin: + pattern: /^[A-Z\s]*$/i + type: string + type: object + banana: + properties: + lengthCm: type: number - xml: - prefix: cd - prefix_integer: - example: -2 - type: integer - xml: - prefix: ef - prefix_boolean: - example: true + type: object + mammal: + discriminator: + propertyName: className + oneOf: + - $ref: '#/components/schemas/whale' + - $ref: '#/components/schemas/zebra' + - $ref: '#/components/schemas/Pig' + whale: + properties: + hasBaleen: type: boolean - xml: - prefix: gh - prefix_array: - items: - type: integer - xml: - prefix: ij - type: array - prefix_wrapped_array: - items: - type: integer - xml: - prefix: mn - type: array - xml: - prefix: kl - wrapped: true - namespace_string: - example: string + hasTeeth: + type: boolean + className: type: string - xml: - namespace: http://a.com/schema - namespace_number: - example: 1.234 + required: + - className + type: object + zebra: + additionalProperties: true + properties: + type: + enum: + - plains + - mountain + - grevys + type: string + className: + type: string + required: + - className + type: object + Pig: + discriminator: + propertyName: className + oneOf: + - $ref: '#/components/schemas/BasquePig' + - $ref: '#/components/schemas/DanishPig' + BasquePig: + properties: + className: + type: string + required: + - className + type: object + DanishPig: + properties: + className: + type: string + required: + - className + type: object + gmFruit: + additionalProperties: false + anyOf: + - $ref: '#/components/schemas/apple' + - $ref: '#/components/schemas/banana' + properties: + color: + type: string + fruitReq: + additionalProperties: false + oneOf: + - type: "null" + - $ref: '#/components/schemas/appleReq' + - $ref: '#/components/schemas/bananaReq' + appleReq: + additionalProperties: false + properties: + cultivar: + type: string + mealy: + type: boolean + required: + - cultivar + type: object + bananaReq: + additionalProperties: false + properties: + lengthCm: type: number - xml: - namespace: http://b.com/schema - namespace_integer: - example: -2 - type: integer - xml: - namespace: http://c.com/schema - namespace_boolean: - example: true + sweet: type: boolean - xml: - namespace: http://d.com/schema - namespace_array: + required: + - lengthCm + type: object + Drawing: + additionalProperties: + $ref: '#/components/schemas/fruit' + properties: + mainShape: + $ref: '#/components/schemas/Shape' + shapeOrNull: + $ref: '#/components/schemas/ShapeOrNull' + nullableShape: + $ref: '#/components/schemas/NullableShape' + shapes: items: - type: integer - xml: - namespace: http://e.com/schema + $ref: '#/components/schemas/Shape' type: array - namespace_wrapped_array: + type: object + Shape: + discriminator: + propertyName: shapeType + oneOf: + - $ref: '#/components/schemas/Triangle' + - $ref: '#/components/schemas/Quadrilateral' + ShapeOrNull: + description: The value may be a shape or the 'null' value. This is introduced + in OAS schema >= 3.1. + discriminator: + propertyName: shapeType + oneOf: + - type: "null" + - $ref: '#/components/schemas/Triangle' + - $ref: '#/components/schemas/Quadrilateral' + NullableShape: + description: The value may be a shape or the 'null' value. The 'nullable' attribute + was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema + >= 3.1. + discriminator: + propertyName: shapeType + nullable: true + oneOf: + - $ref: '#/components/schemas/Triangle' + - $ref: '#/components/schemas/Quadrilateral' + ShapeInterface: + properties: + shapeType: + type: string + required: + - shapeType + TriangleInterface: + properties: + triangleType: + type: string + required: + - triangleType + Triangle: + discriminator: + propertyName: triangleType + oneOf: + - $ref: '#/components/schemas/EquilateralTriangle' + - $ref: '#/components/schemas/IsoscelesTriangle' + - $ref: '#/components/schemas/ScaleneTriangle' + EquilateralTriangle: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' + IsoscelesTriangle: + additionalProperties: false + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' + ScaleneTriangle: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/TriangleInterface' + QuadrilateralInterface: + properties: + quadrilateralType: + type: string + required: + - quadrilateralType + Quadrilateral: + discriminator: + propertyName: quadrilateralType + oneOf: + - $ref: '#/components/schemas/SimpleQuadrilateral' + - $ref: '#/components/schemas/ComplexQuadrilateral' + SimpleQuadrilateral: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/QuadrilateralInterface' + ComplexQuadrilateral: + allOf: + - $ref: '#/components/schemas/ShapeInterface' + - $ref: '#/components/schemas/QuadrilateralInterface' + GrandparentAnimal: + discriminator: + propertyName: pet_type + properties: + pet_type: + type: string + required: + - pet_type + type: object + ParentPet: + allOf: + - $ref: '#/components/schemas/GrandparentAnimal' + type: object + ChildCat: + allOf: + - $ref: '#/components/schemas/ParentPet' + - $ref: '#/components/schemas/ChildCat_allOf' + inline_response_default: + example: + string: + bar: bar + properties: + string: + $ref: '#/components/schemas/Foo' + inline_object: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + inline_object_1: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + inline_object_2: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) items: - type: integer - xml: - namespace: http://g.com/schema + default: $ + enum: + - '>' + - $ + type: string type: array - xml: - namespace: http://f.com/schema - wrapped: true - prefix_ns_string: - example: string + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) type: string - xml: - namespace: http://a.com/schema - prefix: a - prefix_ns_number: - example: 1.234 - type: number - xml: - namespace: http://b.com/schema - prefix: b - prefix_ns_integer: - example: -2 + type: object + inline_object_3: + properties: + integer: + description: None + maximum: 100 + minimum: 10 type: integer - xml: - namespace: http://c.com/schema - prefix: c - prefix_ns_boolean: - example: true - type: boolean - xml: - namespace: http://d.com/schema - prefix: d - prefix_ns_array: - items: - type: integer - xml: - namespace: http://e.com/schema - prefix: e - type: array - prefix_ns_wrapped_array: - items: - type: integer - xml: - namespace: http://g.com/schema - prefix: g - type: array - xml: - namespace: http://f.com/schema - prefix: f - wrapped: true + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: /[a-z]/i + type: string + pattern_without_delimiter: + description: None + pattern: ^[A-Z].* + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + format: date + type: string + dateTime: + description: None + format: date-time + type: string + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + type: object + inline_object_4: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + inline_object_5: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile type: object - xml: - namespace: http://a.com/schema - prefix: pre Dog_allOf: properties: breed: @@ -2155,14 +2364,9 @@ components: properties: declawed: type: boolean - BigCat_allOf: + ChildCat_allOf: properties: - kind: - enum: - - lions - - tigers - - leopards - - jaguars + name: type: string securitySchemes: petstore_auth: @@ -2184,4 +2388,11 @@ components: http_basic_test: scheme: basic type: http + bearer_test: + bearerFormat: JWT + scheme: bearer + type: http + http_signature_test: + scheme: signature + type: http diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesClass.md index ffab911c1be8..07d5223bc5c9 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesClass.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesClass.md @@ -6,17 +6,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**mapString** | **Map<String, String>** | | [optional] -**mapNumber** | [**Map<String, BigDecimal>**](BigDecimal.md) | | [optional] -**mapInteger** | **Map<String, Integer>** | | [optional] -**mapBoolean** | **Map<String, Boolean>** | | [optional] -**mapArrayInteger** | [**Map<String, List<Integer>>**](List.md) | | [optional] -**mapArrayAnytype** | [**Map<String, List<Object>>**](List.md) | | [optional] -**mapMapString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] -**mapMapAnytype** | [**Map<String, Map<String, Object>>**](Map.md) | | [optional] +**mapProperty** | **Map<String, String>** | | [optional] +**mapOfMapProperty** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **anytype1** | **Object** | | [optional] -**anytype2** | **Object** | | [optional] -**anytype3** | **Object** | | [optional] +**mapWithUndeclaredPropertiesAnytype1** | **Object** | | [optional] +**mapWithUndeclaredPropertiesAnytype2** | **Object** | | [optional] +**mapWithUndeclaredPropertiesAnytype3** | **Map<String, Object>** | | [optional] +**emptyMap** | **Object** | an object with no declared properties and no undeclared properties, hence it's an empty map. | [optional] +**mapWithUndeclaredPropertiesString** | **Map<String, String>** | | [optional] diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AnotherFakeApi.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/AnotherFakeApi.md index 059616ec6baa..6740d5770dae 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AnotherFakeApi.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/AnotherFakeApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## call123testSpecialTags -> Client call123testSpecialTags(body) +> Client call123testSpecialTags(client) To test special tags @@ -32,9 +32,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); - Client body = new Client(); // Client | client model + Client client = new Client(); // Client | client model try { - Client result = apiInstance.call123testSpecialTags(body); + Client result = apiInstance.call123testSpecialTags(client); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); @@ -52,7 +52,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Client**](Client.md)| client model | + **client** | [**Client**](Client.md)| client model | ### Return type diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/Apple.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Apple.md new file mode 100644 index 000000000000..5a34a5a33a60 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Apple.md @@ -0,0 +1,13 @@ + + +# Apple + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cultivar** | **String** | | [optional] +**origin** | **String** | | [optional] + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AppleReq.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/AppleReq.md new file mode 100644 index 000000000000..dd50fef8c0fb --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/AppleReq.md @@ -0,0 +1,13 @@ + + +# AppleReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cultivar** | **String** | | +**mealy** | **Boolean** | | [optional] + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesBoolean.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Banana.md similarity index 61% rename from samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesBoolean.md rename to samples/openapi3/client/petstore/java/jersey2-java8/docs/Banana.md index 6b53e7ba73a1..09f700d3c382 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesBoolean.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Banana.md @@ -1,12 +1,12 @@ -# AdditionalPropertiesBoolean +# Banana ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **String** | | [optional] +**lengthCm** | [**BigDecimal**](BigDecimal.md) | | [optional] diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/BananaReq.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/BananaReq.md new file mode 100644 index 000000000000..a5054746cf50 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/BananaReq.md @@ -0,0 +1,13 @@ + + +# BananaReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**lengthCm** | [**BigDecimal**](BigDecimal.md) | | +**sweet** | **Boolean** | | [optional] + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesObject.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/BasquePig.md similarity index 63% rename from samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesObject.md rename to samples/openapi3/client/petstore/java/jersey2-java8/docs/BasquePig.md index 98ac8d2e5fe0..af67d7e9c97c 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesObject.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/BasquePig.md @@ -1,12 +1,12 @@ -# AdditionalPropertiesObject +# BasquePig ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **String** | | [optional] +**className** | **String** | | diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/BigCat.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/BigCat.md deleted file mode 100644 index 8a075304abf8..000000000000 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/BigCat.md +++ /dev/null @@ -1,23 +0,0 @@ - - -# 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/openapi3/client/petstore/java/jersey2-java8/docs/BigCatAllOf.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/BigCatAllOf.md deleted file mode 100644 index 21177dbf089d..000000000000 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/BigCatAllOf.md +++ /dev/null @@ -1,23 +0,0 @@ - - -# 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/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesArray.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/ChildCat.md similarity index 84% rename from samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesArray.md rename to samples/openapi3/client/petstore/java/jersey2-java8/docs/ChildCat.md index cb7fe9b3903d..e6548f036ffb 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesArray.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/ChildCat.md @@ -1,6 +1,6 @@ -# AdditionalPropertiesArray +# ChildCat ## Properties diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesNumber.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/ChildCatAllOf.md similarity index 84% rename from samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesNumber.md rename to samples/openapi3/client/petstore/java/jersey2-java8/docs/ChildCatAllOf.md index 53f6e81e7176..abd7adedbcc5 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesNumber.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/ChildCatAllOf.md @@ -1,6 +1,6 @@ -# AdditionalPropertiesNumber +# ChildCatAllOf ## Properties diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/ComplexQuadrilateral.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/ComplexQuadrilateral.md new file mode 100644 index 000000000000..21602809de4b --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/ComplexQuadrilateral.md @@ -0,0 +1,13 @@ + + +# ComplexQuadrilateral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shapeType** | **String** | | +**quadrilateralType** | **String** | | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesString.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/DanishPig.md similarity index 63% rename from samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesString.md rename to samples/openapi3/client/petstore/java/jersey2-java8/docs/DanishPig.md index d7970cdfe190..889ee86cd4eb 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesString.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/DanishPig.md @@ -1,12 +1,12 @@ -# AdditionalPropertiesString +# DanishPig ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **String** | | [optional] +**className** | **String** | | diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/DefaultApi.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/DefaultApi.md new file mode 100644 index 000000000000..afb01fb82916 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/DefaultApi.md @@ -0,0 +1,68 @@ +# DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | + + + +## fooGet + +> InlineResponseDefault fooGet() + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + try { + InlineResponseDefault result = apiInstance.fooGet(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fooGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**InlineResponseDefault**](InlineResponseDefault.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | response | - | + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/Drawing.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Drawing.md new file mode 100644 index 000000000000..66dd1d879e09 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Drawing.md @@ -0,0 +1,15 @@ + + +# Drawing + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mainShape** | [**Shape**](Shape.md) | | [optional] +**shapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional] +**nullableShape** | [**NullableShape**](NullableShape.md) | | [optional] +**shapes** | [**List<Shape>**](Shape.md) | | [optional] + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/EnumTest.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/EnumTest.md index 61eb95f22fe9..1692bd664d04 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/EnumTest.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/EnumTest.md @@ -11,6 +11,9 @@ Name | Type | Description | Notes **enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] **outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] +**outerEnumInteger** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] +**outerEnumDefaultValue** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] +**outerEnumIntegerDefaultValue** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/EquilateralTriangle.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/EquilateralTriangle.md new file mode 100644 index 000000000000..afe879d01a5d --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/EquilateralTriangle.md @@ -0,0 +1,13 @@ + + +# EquilateralTriangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shapeType** | **String** | | +**triangleType** | **String** | | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeApi.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeApi.md index 543c51f066c5..184fa525ad6b 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeApi.md @@ -4,7 +4,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**createXmlItem**](FakeApi.md#createXmlItem) | **POST** /fake/create_xml_item | creates an XmlItem +[**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | @@ -12,7 +12,7 @@ Method | HTTP request | Description [**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | [**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model -[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters [**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) [**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties @@ -21,13 +21,11 @@ Method | HTTP request | Description -## createXmlItem +## fakeHealthGet -> createXmlItem(xmlItem) +> HealthCheckResult fakeHealthGet() -creates an XmlItem - -this route creates an XmlItem +Health check endpoint ### Example @@ -45,11 +43,11 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); FakeApi apiInstance = new FakeApi(defaultClient); - XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body try { - apiInstance.createXmlItem(xmlItem); + HealthCheckResult result = apiInstance.fakeHealthGet(); + System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Exception when calling FakeApi#fakeHealthGet"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -61,14 +59,11 @@ public class Example { ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **xmlItem** | [**XmlItem**](XmlItem.md)| XmlItem Body | +This endpoint does not need any parameter. ### Return type -null (empty response body) +[**HealthCheckResult**](HealthCheckResult.md) ### Authorization @@ -76,13 +71,13 @@ No authorization required ### HTTP request headers -- **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 -- **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | - | +| **200** | The instance started successfully | - | ## fakeOuterBooleanSerialize @@ -141,7 +136,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: */* ### HTTP response details @@ -152,7 +147,7 @@ No authorization required ## fakeOuterCompositeSerialize -> OuterComposite fakeOuterCompositeSerialize(body) +> OuterComposite fakeOuterCompositeSerialize(outerComposite) @@ -174,9 +169,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); FakeApi apiInstance = new FakeApi(defaultClient); - OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + OuterComposite outerComposite = new OuterComposite(); // OuterComposite | Input composite as post body try { - OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(outerComposite); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); @@ -194,7 +189,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + **outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] ### Return type @@ -206,7 +201,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: */* ### HTTP response details @@ -271,7 +266,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: */* ### HTTP response details @@ -336,7 +331,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: */* ### HTTP response details @@ -347,7 +342,7 @@ No authorization required ## testBodyWithFileSchema -> testBodyWithFileSchema(body) +> testBodyWithFileSchema(fileSchemaTestClass) @@ -369,9 +364,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); FakeApi apiInstance = new FakeApi(defaultClient); - FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + FileSchemaTestClass fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | try { - apiInstance.testBodyWithFileSchema(body); + apiInstance.testBodyWithFileSchema(fileSchemaTestClass); } catch (ApiException e) { System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); System.err.println("Status code: " + e.getCode()); @@ -388,7 +383,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | ### Return type @@ -411,7 +406,7 @@ No authorization required ## testBodyWithQueryParams -> testBodyWithQueryParams(query, body) +> testBodyWithQueryParams(query, user) @@ -432,9 +427,9 @@ public class Example { FakeApi apiInstance = new FakeApi(defaultClient); String query = "query_example"; // String | - User body = new User(); // User | + User user = new User(); // User | try { - apiInstance.testBodyWithQueryParams(query, body); + apiInstance.testBodyWithQueryParams(query, user); } catch (ApiException e) { System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); System.err.println("Status code: " + e.getCode()); @@ -452,7 +447,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **query** | **String**| | - **body** | [**User**](User.md)| | + **user** | [**User**](User.md)| | ### Return type @@ -475,7 +470,7 @@ No authorization required ## testClientModel -> Client testClientModel(body) +> Client testClientModel(client) To test \"client\" model @@ -497,9 +492,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); FakeApi apiInstance = new FakeApi(defaultClient); - Client body = new Client(); // Client | client model + Client client = new Client(); // Client | client model try { - Client result = apiInstance.testClientModel(body); + Client result = apiInstance.testClientModel(client); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FakeApi#testClientModel"); @@ -517,7 +512,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Client**](Client.md)| client model | + **client** | [**Client**](Client.md)| client model | ### Return type @@ -542,12 +537,13 @@ No authorization required > testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback) -Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters - 假端點 - 偽のエンドポイント - 가짜 엔드 포인트 +假端點 +偽のエンドポイント +가짜 엔드 포인트 + ### Example @@ -732,6 +728,7 @@ Fake endpoint to test group parameters (optional) import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; import org.openapitools.client.models.*; import org.openapitools.client.api.FakeApi; @@ -739,6 +736,10 @@ public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP bearer authorization: bearer_test + HttpBearerAuth bearer_test = (HttpBearerAuth) defaultClient.getAuthentication("bearer_test"); + bearer_test.setBearerToken("BEARER TOKEN"); FakeApi apiInstance = new FakeApi(defaultClient); Integer requiredStringGroup = 56; // Integer | Required String in group parameters @@ -785,7 +786,7 @@ null (empty response body) ### Authorization -No authorization required +[bearer_test](../README.md#bearer_test) ### HTTP request headers @@ -800,7 +801,7 @@ No authorization required ## testInlineAdditionalProperties -> testInlineAdditionalProperties(param) +> testInlineAdditionalProperties(requestBody) test inline additionalProperties @@ -820,9 +821,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); FakeApi apiInstance = new FakeApi(defaultClient); - Map param = new HashMap(); // Map | request body + Map requestBody = new HashMap(); // Map | request body try { - apiInstance.testInlineAdditionalProperties(param); + apiInstance.testInlineAdditionalProperties(requestBody); } catch (ApiException e) { System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); System.err.println("Status code: " + e.getCode()); @@ -839,7 +840,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | [**Map<String, String>**](String.md)| request body | + **requestBody** | [**Map<String, String>**](String.md)| request body | ### Return type diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeClassnameTags123Api.md index 14a74a37a4e2..db98afa721ec 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeClassnameTags123Api.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/FakeClassnameTags123Api.md @@ -10,7 +10,7 @@ Method | HTTP request | Description ## testClassname -> Client testClassname(body) +> Client testClassname(client) To test class name in snake case @@ -39,9 +39,9 @@ public class Example { //api_key_query.setApiKeyPrefix("Token"); FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); - Client body = new Client(); // Client | client model + Client client = new Client(); // Client | client model try { - Client result = apiInstance.testClassname(body); + Client result = apiInstance.testClassname(client); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); @@ -59,7 +59,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Client**](Client.md)| client model | + **client** | [**Client**](Client.md)| client model | ### Return type diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/Foo.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Foo.md new file mode 100644 index 000000000000..02c7ef53f5fa --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Foo.md @@ -0,0 +1,12 @@ + + +# Foo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/FormatTest.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/FormatTest.md index d138e921902a..742bccb77e98 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/FormatTest.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/FormatTest.md @@ -19,7 +19,8 @@ Name | Type | Description | Notes **dateTime** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional] **uuid** | [**UUID**](UUID.md) | | [optional] **password** | **String** | | -**bigDecimal** | [**BigDecimal**](BigDecimal.md) | | [optional] +**patternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] +**patternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/Fruit.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Fruit.md new file mode 100644 index 000000000000..996ca25a611c --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Fruit.md @@ -0,0 +1,15 @@ + + +# Fruit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**color** | **String** | | [optional] +**cultivar** | **String** | | [optional] +**origin** | **String** | | [optional] +**lengthCm** | [**BigDecimal**](BigDecimal.md) | | [optional] + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/FruitReq.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/FruitReq.md new file mode 100644 index 000000000000..fee546976b09 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/FruitReq.md @@ -0,0 +1,15 @@ + + +# FruitReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cultivar** | **String** | | +**mealy** | **Boolean** | | [optional] +**lengthCm** | [**BigDecimal**](BigDecimal.md) | | +**sweet** | **Boolean** | | [optional] + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/GmFruit.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/GmFruit.md new file mode 100644 index 000000000000..eca752bf3120 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/GmFruit.md @@ -0,0 +1,15 @@ + + +# GmFruit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**color** | **String** | | [optional] +**cultivar** | **String** | | [optional] +**origin** | **String** | | [optional] +**lengthCm** | [**BigDecimal**](BigDecimal.md) | | [optional] + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/GrandparentAnimal.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/GrandparentAnimal.md new file mode 100644 index 000000000000..d47f146ed7f9 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/GrandparentAnimal.md @@ -0,0 +1,12 @@ + + +# GrandparentAnimal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**petType** | **String** | | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/HealthCheckResult.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/HealthCheckResult.md new file mode 100644 index 000000000000..11bb9026e461 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/HealthCheckResult.md @@ -0,0 +1,13 @@ + + +# HealthCheckResult + +Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nullableMessage** | **String** | | [optional] + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineObject.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineObject.md new file mode 100644 index 000000000000..999fe3ef00ad --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineObject.md @@ -0,0 +1,13 @@ + + +# InlineObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Updated name of the pet | [optional] +**status** | **String** | Updated status of the pet | [optional] + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineObject1.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineObject1.md new file mode 100644 index 000000000000..b3828dfae456 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineObject1.md @@ -0,0 +1,13 @@ + + +# InlineObject1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**additionalMetadata** | **String** | Additional data to pass to server | [optional] +**file** | [**File**](File.md) | file to upload | [optional] + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineObject2.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineObject2.md new file mode 100644 index 000000000000..7e4ed7591c2a --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineObject2.md @@ -0,0 +1,32 @@ + + +# InlineObject2 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumFormStringArray** | [**List<EnumFormStringArrayEnum>**](#List<EnumFormStringArrayEnum>) | Form parameter enum test (string array) | [optional] +**enumFormString** | [**EnumFormStringEnum**](#EnumFormStringEnum) | Form parameter enum test (string) | [optional] + + + +## Enum: List<EnumFormStringArrayEnum> + +Name | Value +---- | ----- +GREATER_THAN | ">" +DOLLAR | "$" + + + +## Enum: EnumFormStringEnum + +Name | Value +---- | ----- +_ABC | "_abc" +_EFG | "-efg" +_XYZ_ | "(xyz)" + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineObject3.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineObject3.md new file mode 100644 index 000000000000..c1ebfe2578d6 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineObject3.md @@ -0,0 +1,25 @@ + + +# InlineObject3 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **Integer** | None | [optional] +**int32** | **Integer** | None | [optional] +**int64** | **Long** | None | [optional] +**number** | [**BigDecimal**](BigDecimal.md) | None | +**_float** | **Float** | None | [optional] +**_double** | **Double** | None | +**string** | **String** | None | [optional] +**patternWithoutDelimiter** | **String** | None | +**_byte** | **byte[]** | None | +**binary** | [**File**](File.md) | None | [optional] +**date** | [**LocalDate**](LocalDate.md) | None | [optional] +**dateTime** | [**OffsetDateTime**](OffsetDateTime.md) | None | [optional] +**password** | **String** | None | [optional] +**callback** | **String** | None | [optional] + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineObject4.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineObject4.md new file mode 100644 index 000000000000..5ebef872403a --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineObject4.md @@ -0,0 +1,13 @@ + + +# InlineObject4 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**param** | **String** | field1 | +**param2** | **String** | field2 | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineObject5.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineObject5.md new file mode 100644 index 000000000000..42d2673574b7 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineObject5.md @@ -0,0 +1,13 @@ + + +# InlineObject5 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**additionalMetadata** | **String** | Additional data to pass to server | [optional] +**requiredFile** | [**File**](File.md) | file to upload | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesAnyType.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineResponseDefault.md similarity index 61% rename from samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesAnyType.md rename to samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineResponseDefault.md index 87b468bb7ca3..63c30c2b7334 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesAnyType.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/InlineResponseDefault.md @@ -1,12 +1,12 @@ -# AdditionalPropertiesAnyType +# InlineResponseDefault ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **String** | | [optional] +**string** | [**Foo**](Foo.md) | | [optional] diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/IsoscelesTriangle.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/IsoscelesTriangle.md new file mode 100644 index 000000000000..31c0788e0229 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/IsoscelesTriangle.md @@ -0,0 +1,13 @@ + + +# IsoscelesTriangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shapeType** | **String** | | +**triangleType** | **String** | | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/Mammal.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Mammal.md new file mode 100644 index 000000000000..24eaa1de4f50 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Mammal.md @@ -0,0 +1,25 @@ + + +# Mammal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**hasBaleen** | **Boolean** | | [optional] +**hasTeeth** | **Boolean** | | [optional] +**className** | **String** | | +**type** | [**TypeEnum**](#TypeEnum) | | [optional] + + + +## Enum: TypeEnum + +Name | Value +---- | ----- +PLAINS | "plains" +MOUNTAIN | "mountain" +GREVYS | "grevys" + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/NullableClass.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/NullableClass.md new file mode 100644 index 000000000000..7567ec0c0579 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/NullableClass.md @@ -0,0 +1,23 @@ + + +# NullableClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integerProp** | **Integer** | | [optional] +**numberProp** | [**BigDecimal**](BigDecimal.md) | | [optional] +**booleanProp** | **Boolean** | | [optional] +**stringProp** | **String** | | [optional] +**dateProp** | [**LocalDate**](LocalDate.md) | | [optional] +**datetimeProp** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional] +**arrayNullableProp** | **List<Object>** | | [optional] +**arrayAndItemsNullableProp** | **List<Object>** | | [optional] +**arrayItemsNullable** | **List<Object>** | | [optional] +**objectNullableProp** | **Map<String, Object>** | | [optional] +**objectAndItemsNullableProp** | **Map<String, Object>** | | [optional] +**objectItemsNullable** | **Map<String, Object>** | | [optional] + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/NullableShape.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/NullableShape.md new file mode 100644 index 000000000000..11a9785c3bad --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/NullableShape.md @@ -0,0 +1,14 @@ + + +# NullableShape + +The value may be a shape or the 'null' value. The 'nullable' attribute was introduced in OAS schema >= 3.0 and has been deprecated in OAS schema >= 3.1. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shapeType** | **String** | | +**quadrilateralType** | **String** | | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/OuterEnumDefaultValue.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..cbc7f4ba54d2 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/OuterEnumDefaultValue.md @@ -0,0 +1,15 @@ + + +# OuterEnumDefaultValue + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/OuterEnumInteger.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/OuterEnumInteger.md new file mode 100644 index 000000000000..f71dea30ad00 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/OuterEnumInteger.md @@ -0,0 +1,15 @@ + + +# OuterEnumInteger + +## Enum + + +* `NUMBER_0` (value: `0`) + +* `NUMBER_1` (value: `1`) + +* `NUMBER_2` (value: `2`) + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/OuterEnumIntegerDefaultValue.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..99e6389f4278 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,15 @@ + + +# OuterEnumIntegerDefaultValue + +## Enum + + +* `NUMBER_0` (value: `0`) + +* `NUMBER_1` (value: `1`) + +* `NUMBER_2` (value: `2`) + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/ParentPet.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/ParentPet.md new file mode 100644 index 000000000000..e1fabb2e4aa7 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/ParentPet.md @@ -0,0 +1,11 @@ + + +# ParentPet + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/Pet.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Pet.md index bdcdad6b3e60..37ac007b7931 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/Pet.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Pet.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **id** | **Long** | | [optional] **category** | [**Category**](Category.md) | | [optional] **name** | **String** | | -**photoUrls** | **Set<String>** | | +**photoUrls** | **List<String>** | | **tags** | [**List<Tag>**](Tag.md) | | [optional] **status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/PetApi.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/PetApi.md index d56efcd59677..481aad16d4c9 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/PetApi.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/PetApi.md @@ -18,7 +18,7 @@ Method | HTTP request | Description ## addPet -> addPet(body) +> addPet(pet) Add a new pet to the store @@ -38,14 +38,15 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(defaultClient); - Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { - apiInstance.addPet(body); + apiInstance.addPet(pet); } catch (ApiException e) { System.err.println("Exception when calling PetApi#addPet"); System.err.println("Status code: " + e.getCode()); @@ -62,7 +63,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -70,7 +71,7 @@ null (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth) +[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) ### HTTP request headers @@ -80,7 +81,6 @@ null (empty response body) ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | - | | **405** | Invalid input | - | @@ -150,7 +150,6 @@ null (empty response body) ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | - | | **400** | Invalid pet value | - | @@ -178,6 +177,7 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); @@ -211,7 +211,7 @@ Name | Type | Description | Notes ### Authorization -[petstore_auth](../README.md#petstore_auth) +[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) ### HTTP request headers @@ -227,7 +227,7 @@ Name | Type | Description | Notes ## findPetsByTags -> Set<Pet> findPetsByTags(tags) +> List<Pet> findPetsByTags(tags) Finds Pets by tags @@ -249,14 +249,15 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(defaultClient); - Set tags = Arrays.asList(); // Set | Tags to filter by + List tags = Arrays.asList(); // List | Tags to filter by try { - Set result = apiInstance.findPetsByTags(tags); + List result = apiInstance.findPetsByTags(tags); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling PetApi#findPetsByTags"); @@ -274,15 +275,15 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**Set<String>**](String.md)| Tags to filter by | + **tags** | [**List<String>**](String.md)| Tags to filter by | ### Return type -[**Set<Pet>**](Pet.md) +[**List<Pet>**](Pet.md) ### Authorization -[petstore_auth](../README.md#petstore_auth) +[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) ### HTTP request headers @@ -372,7 +373,7 @@ Name | Type | Description | Notes ## updatePet -> updatePet(body) +> updatePet(pet) Update an existing pet @@ -392,14 +393,15 @@ public class Example { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + // Configure OAuth2 access token for authorization: petstore_auth OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(defaultClient); - Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store try { - apiInstance.updatePet(body); + apiInstance.updatePet(pet); } catch (ApiException e) { System.err.println("Exception when calling PetApi#updatePet"); System.err.println("Status code: " + e.getCode()); @@ -416,7 +418,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -424,7 +426,7 @@ null (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth) +[http_signature_test](../README.md#http_signature_test), [petstore_auth](../README.md#petstore_auth) ### HTTP request headers @@ -434,7 +436,6 @@ null (empty response body) ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -| **200** | successful operation | - | | **400** | Invalid ID supplied | - | | **404** | Pet not found | - | | **405** | Validation exception | - | diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/Pig.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Pig.md new file mode 100644 index 000000000000..46c64ad2039c --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Pig.md @@ -0,0 +1,12 @@ + + +# Pig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/Quadrilateral.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Quadrilateral.md new file mode 100644 index 000000000000..66243e75dd0d --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Quadrilateral.md @@ -0,0 +1,13 @@ + + +# Quadrilateral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shapeType** | **String** | | +**quadrilateralType** | **String** | | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/QuadrilateralInterface.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/QuadrilateralInterface.md new file mode 100644 index 000000000000..24050740c873 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/QuadrilateralInterface.md @@ -0,0 +1,12 @@ + + +# QuadrilateralInterface + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**quadrilateralType** | **String** | | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/ScaleneTriangle.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/ScaleneTriangle.md new file mode 100644 index 000000000000..5d30088669b5 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/ScaleneTriangle.md @@ -0,0 +1,13 @@ + + +# ScaleneTriangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shapeType** | **String** | | +**triangleType** | **String** | | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/Shape.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Shape.md new file mode 100644 index 000000000000..06c79169b0b1 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Shape.md @@ -0,0 +1,13 @@ + + +# Shape + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shapeType** | **String** | | +**quadrilateralType** | **String** | | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/ShapeInterface.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/ShapeInterface.md new file mode 100644 index 000000000000..f9d200d032b0 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/ShapeInterface.md @@ -0,0 +1,12 @@ + + +# ShapeInterface + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shapeType** | **String** | | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/ShapeOrNull.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/ShapeOrNull.md new file mode 100644 index 000000000000..a4b9f4f00580 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/ShapeOrNull.md @@ -0,0 +1,14 @@ + + +# ShapeOrNull + +The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shapeType** | **String** | | +**quadrilateralType** | **String** | | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/SimpleQuadrilateral.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/SimpleQuadrilateral.md new file mode 100644 index 000000000000..b944413849ce --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/SimpleQuadrilateral.md @@ -0,0 +1,13 @@ + + +# SimpleQuadrilateral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shapeType** | **String** | | +**quadrilateralType** | **String** | | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/StoreApi.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/StoreApi.md index 6625d5969ee4..5d2d7ad5118b 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/StoreApi.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/StoreApi.md @@ -213,7 +213,7 @@ No authorization required ## placeOrder -> Order placeOrder(body) +> Order placeOrder(order) Place an order for a pet @@ -233,9 +233,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); StoreApi apiInstance = new StoreApi(defaultClient); - Order body = new Order(); // Order | order placed for purchasing the pet + Order order = new Order(); // Order | order placed for purchasing the pet try { - Order result = apiInstance.placeOrder(body); + Order result = apiInstance.placeOrder(order); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling StoreApi#placeOrder"); @@ -253,7 +253,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | + **order** | [**Order**](Order.md)| order placed for purchasing the pet | ### Return type @@ -265,7 +265,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/xml, application/json ### HTTP response details diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesInteger.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Triangle.md similarity index 59% rename from samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesInteger.md rename to samples/openapi3/client/petstore/java/jersey2-java8/docs/Triangle.md index d2ed7fb1a460..80d75b28e70f 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/AdditionalPropertiesInteger.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Triangle.md @@ -1,12 +1,13 @@ -# AdditionalPropertiesInteger +# Triangle ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **String** | | [optional] +**shapeType** | **String** | | +**triangleType** | **String** | | diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/TriangleInterface.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/TriangleInterface.md new file mode 100644 index 000000000000..c15bd90f0bac --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/TriangleInterface.md @@ -0,0 +1,12 @@ + + +# TriangleInterface + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**triangleType** | **String** | | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/TypeHolderDefault.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/TypeHolderDefault.md deleted file mode 100644 index a338fc900cb1..000000000000 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/TypeHolderDefault.md +++ /dev/null @@ -1,16 +0,0 @@ - - -# TypeHolderDefault - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**stringItem** | **String** | | -**numberItem** | [**BigDecimal**](BigDecimal.md) | | -**integerItem** | **Integer** | | -**boolItem** | **Boolean** | | -**arrayItem** | **List<Integer>** | | - - - diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/TypeHolderExample.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/TypeHolderExample.md deleted file mode 100644 index f8858da60664..000000000000 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/TypeHolderExample.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# TypeHolderExample - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**stringItem** | **String** | | -**numberItem** | [**BigDecimal**](BigDecimal.md) | | -**floatItem** | **Float** | | -**integerItem** | **Integer** | | -**boolItem** | **Boolean** | | -**arrayItem** | **List<Integer>** | | - - - diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/User.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/User.md index c4ea94b7fc17..93243ceb71ac 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/User.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/User.md @@ -14,6 +14,10 @@ Name | Type | Description | Notes **password** | **String** | | [optional] **phone** | **String** | | [optional] **userStatus** | **Integer** | User Status | [optional] +**objectWithNoDeclaredProps** | **Object** | test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. | [optional] +**objectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] +**anyTypeProp** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 | [optional] +**anyTypePropNullable** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. | [optional] diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/UserApi.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/UserApi.md index ca9f550c3167..d7e613c24af5 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/UserApi.md +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/UserApi.md @@ -17,7 +17,7 @@ Method | HTTP request | Description ## createUser -> createUser(body) +> createUser(user) Create user @@ -39,9 +39,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); UserApi apiInstance = new UserApi(defaultClient); - User body = new User(); // User | Created user object + User user = new User(); // User | Created user object try { - apiInstance.createUser(body); + apiInstance.createUser(user); } catch (ApiException e) { System.err.println("Exception when calling UserApi#createUser"); System.err.println("Status code: " + e.getCode()); @@ -58,7 +58,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | + **user** | [**User**](User.md)| Created user object | ### Return type @@ -70,7 +70,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: Not defined ### HTTP response details @@ -81,7 +81,7 @@ No authorization required ## createUsersWithArrayInput -> createUsersWithArrayInput(body) +> createUsersWithArrayInput(user) Creates list of users with given input array @@ -101,9 +101,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); UserApi apiInstance = new UserApi(defaultClient); - List body = Arrays.asList(); // List | List of user object + List user = Arrays.asList(); // List | List of user object try { - apiInstance.createUsersWithArrayInput(body); + apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); System.err.println("Status code: " + e.getCode()); @@ -120,7 +120,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | + **user** | [**List<User>**](User.md)| List of user object | ### Return type @@ -132,7 +132,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: Not defined ### HTTP response details @@ -143,7 +143,7 @@ No authorization required ## createUsersWithListInput -> createUsersWithListInput(body) +> createUsersWithListInput(user) Creates list of users with given input array @@ -163,9 +163,9 @@ public class Example { defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); UserApi apiInstance = new UserApi(defaultClient); - List body = Arrays.asList(); // List | List of user object + List user = Arrays.asList(); // List | List of user object try { - apiInstance.createUsersWithListInput(body); + apiInstance.createUsersWithListInput(user); } catch (ApiException e) { System.err.println("Exception when calling UserApi#createUsersWithListInput"); System.err.println("Status code: " + e.getCode()); @@ -182,7 +182,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | + **user** | [**List<User>**](User.md)| List of user object | ### Return type @@ -194,7 +194,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: Not defined ### HTTP response details @@ -459,7 +459,7 @@ No authorization required ## updateUser -> updateUser(username, body) +> updateUser(username, user) Updated user @@ -482,9 +482,9 @@ public class Example { UserApi apiInstance = new UserApi(defaultClient); String username = "username_example"; // String | name that need to be deleted - User body = new User(); // User | Updated user object + User user = new User(); // User | Updated user object try { - apiInstance.updateUser(username, body); + apiInstance.updateUser(username, user); } catch (ApiException e) { System.err.println("Exception when calling UserApi#updateUser"); System.err.println("Status code: " + e.getCode()); @@ -502,7 +502,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **String**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | + **user** | [**User**](User.md)| Updated user object | ### Return type @@ -514,7 +514,7 @@ No authorization required ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: Not defined ### HTTP response details diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/Whale.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Whale.md new file mode 100644 index 000000000000..562b49786da0 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Whale.md @@ -0,0 +1,14 @@ + + +# Whale + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**hasBaleen** | **Boolean** | | [optional] +**hasTeeth** | **Boolean** | | [optional] +**className** | **String** | | + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/XmlItem.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/XmlItem.md deleted file mode 100644 index 6065fd1f4e59..000000000000 --- a/samples/openapi3/client/petstore/java/jersey2-java8/docs/XmlItem.md +++ /dev/null @@ -1,40 +0,0 @@ - - -# XmlItem - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**attributeString** | **String** | | [optional] -**attributeNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] -**attributeInteger** | **Integer** | | [optional] -**attributeBoolean** | **Boolean** | | [optional] -**wrappedArray** | **List<Integer>** | | [optional] -**nameString** | **String** | | [optional] -**nameNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] -**nameInteger** | **Integer** | | [optional] -**nameBoolean** | **Boolean** | | [optional] -**nameArray** | **List<Integer>** | | [optional] -**nameWrappedArray** | **List<Integer>** | | [optional] -**prefixString** | **String** | | [optional] -**prefixNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] -**prefixInteger** | **Integer** | | [optional] -**prefixBoolean** | **Boolean** | | [optional] -**prefixArray** | **List<Integer>** | | [optional] -**prefixWrappedArray** | **List<Integer>** | | [optional] -**namespaceString** | **String** | | [optional] -**namespaceNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] -**namespaceInteger** | **Integer** | | [optional] -**namespaceBoolean** | **Boolean** | | [optional] -**namespaceArray** | **List<Integer>** | | [optional] -**namespaceWrappedArray** | **List<Integer>** | | [optional] -**prefixNsString** | **String** | | [optional] -**prefixNsNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] -**prefixNsInteger** | **Integer** | | [optional] -**prefixNsBoolean** | **Boolean** | | [optional] -**prefixNsArray** | **List<Integer>** | | [optional] -**prefixNsWrappedArray** | **List<Integer>** | | [optional] - - - diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/docs/Zebra.md b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Zebra.md new file mode 100644 index 000000000000..156de233f7f0 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/docs/Zebra.md @@ -0,0 +1,23 @@ + + +# Zebra + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**TypeEnum**](#TypeEnum) | | [optional] +**className** | **String** | | + + + +## Enum: TypeEnum + +Name | Value +---- | ----- +PLAINS | "plains" +MOUNTAIN | "mountain" +GREVYS | "grevys" + + + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml b/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml index 2f56f2f29636..9652f6687d4c 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml +++ b/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml @@ -273,6 +273,11 @@ jackson-datatype-jsr310 ${jackson-version} + + org.tomitribe + tomitribe-http-signatures + ${http-signature-version} + com.github.scribejava scribejava-apis @@ -294,6 +299,7 @@ 2.10.4 0.2.1 4.13 + 1.4 6.9.0 diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java index a4ebc69f5678..67bb225a52eb 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java @@ -28,6 +28,8 @@ import java.nio.file.Files; import java.nio.file.StandardCopyOption; import org.glassfish.jersey.logging.LoggingFeature; +import java.util.logging.Level; +import java.util.logging.Logger; import java.util.Collection; import java.util.Collections; import java.util.Map; @@ -51,6 +53,7 @@ import org.openapitools.client.auth.Authentication; import org.openapitools.client.auth.HttpBasicAuth; import org.openapitools.client.auth.HttpBearerAuth; +import org.openapitools.client.auth.HttpSignatureAuth; import org.openapitools.client.auth.ApiKeyAuth; import org.openapitools.client.auth.OAuth; import org.openapitools.client.model.AbstractOpenApiSchema; @@ -60,16 +63,82 @@ public class ApiClient { protected Map defaultHeaderMap = new HashMap(); protected Map defaultCookieMap = new HashMap(); protected String basePath = "http://petstore.swagger.io:80/v2"; + private static final Logger log = Logger.getLogger(ApiClient.class.getName()); + protected List servers = new ArrayList(Arrays.asList( new ServerConfiguration( - "http://petstore.swagger.io:80/v2", - "No description provided", - new HashMap() + "http://{server}.swagger.io:{port}/v2", + "petstore server", + new HashMap() {{ + put("server", new ServerVariable( + "No description provided", + "petstore", + new HashSet( + Arrays.asList( + "petstore", + "qa-petstore", + "dev-petstore" + ) + ) + )); + put("port", new ServerVariable( + "No description provided", + "80", + new HashSet( + Arrays.asList( + "80", + "8080" + ) + ) + )); + }} + ), + new ServerConfiguration( + "https://localhost:8080/{version}", + "The local server", + new HashMap() {{ + put("version", new ServerVariable( + "No description provided", + "v2", + new HashSet( + Arrays.asList( + "v1", + "v2" + ) + ) + )); + }} ) )); protected Integer serverIndex = 0; protected Map serverVariables = null; protected Map> operationServers = new HashMap>() {{ + put("PetApi.addPet", new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io/v2", + "No description provided", + new HashMap() + ), + + new ServerConfiguration( + "http://path-server-test.petstore.local/v2", + "No description provided", + new HashMap() + ) + ))); + put("PetApi.updatePet", new ArrayList(Arrays.asList( + new ServerConfiguration( + "http://petstore.swagger.io/v2", + "No description provided", + new HashMap() + ), + + new ServerConfiguration( + "http://path-server-test.petstore.local/v2", + "No description provided", + new HashMap() + ) + ))); }}; protected Map operationServerIndex = new HashMap(); protected Map> operationServerVariables = new HashMap>(); @@ -126,6 +195,14 @@ public ApiClient(Map authMap) { } else { authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); } + if (authMap != null) { + auth = authMap.get("bearer_test"); + } + if (auth instanceof HttpBearerAuth) { + authentications.put("bearer_test", auth); + } else { + authentications.put("bearer_test", new HttpBearerAuth("bearer")); + } if (authMap != null) { auth = authMap.get("http_basic_test"); } @@ -134,6 +211,12 @@ public ApiClient(Map authMap) { } else { authentications.put("http_basic_test", new HttpBasicAuth()); } + if (authMap != null) { + auth = authMap.get("http_signature_test"); + } + if (auth instanceof HttpSignatureAuth) { + authentications.put("http_signature_test", auth); + } if (authMap != null) { auth = authMap.get("petstore_auth"); } @@ -845,6 +928,9 @@ public AbstractOpenApiSchema deserializeSchemas(Response response, AbstractOpenA } } catch (Exception ex) { // failed to deserialize, do nothing and try next one (schema) + // Logging the error may be useful to troubleshoot why a payload fails to match + // the schema. + log.log(Level.FINE, "Input data does not match schema '" + schemaName + "'", ex); } } else {// unknown type throw new ApiException(schemaType.getClass() + " is not a GenericType and cannot be handled properly in deserialization."); @@ -855,7 +941,7 @@ public AbstractOpenApiSchema deserializeSchemas(Response response, AbstractOpenA if (matchCounter > 1 && "oneOf".equals(schema.getSchemaType())) {// more than 1 match for oneOf throw new ApiException("Response body is invalid as it matches more than one schema (" + StringUtil.join(matchSchemas, ", ") + ") defined in the oneOf model: " + schema.getClass().getName()); } else if (matchCounter == 0) { // fail to match any in oneOf/anyOf schemas - throw new ApiException("Response body is invalid as it doens't match any schemas (" + StringUtil.join(schema.getSchemas().keySet(), ", ") + ") defined in the oneOf/anyOf model: " + schema.getClass().getName()); + throw new ApiException("Response body is invalid as it does not match any schemas (" + StringUtil.join(schema.getSchemas().keySet(), ", ") + ") defined in the oneOf/anyOf model: " + schema.getClass().getName()); } else { // only one matched schema.setActualInstance(result); return schema; diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 0fac43ffba33..4d808ec6f5f1 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -48,7 +48,7 @@ public void setApiClient(ApiClient apiClient) { /** * To test special tags * To test special tags and operation ID starting with number - * @param body client model (required) + * @param client client model (required) * @return Client * @throws ApiException if fails to make API call * @http.response.details @@ -57,14 +57,14 @@ public void setApiClient(ApiClient apiClient) { 200 successful operation - */ - public Client call123testSpecialTags(Client body) throws ApiException { - return call123testSpecialTagsWithHttpInfo(body).getData(); + public Client call123testSpecialTags(Client client) throws ApiException { + return call123testSpecialTagsWithHttpInfo(client).getData(); } /** * To test special tags * To test special tags and operation ID starting with number - * @param body client model (required) + * @param client client model (required) * @return ApiResponse<Client> * @throws ApiException if fails to make API call * @http.response.details @@ -73,12 +73,12 @@ public Client call123testSpecialTags(Client body) throws ApiException { 200 successful operation - */ - public ApiResponse call123testSpecialTagsWithHttpInfo(Client body) throws ApiException { - Object localVarPostBody = body; + public ApiResponse call123testSpecialTagsWithHttpInfo(Client client) throws ApiException { + Object localVarPostBody = client; - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling call123testSpecialTags"); + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException(400, "Missing the required parameter 'client' when calling call123testSpecialTags"); } // create path and map variables diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/DefaultApi.java new file mode 100644 index 000000000000..eb269e49f800 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -0,0 +1,108 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.Pair; + +import javax.ws.rs.core.GenericType; + +import org.openapitools.client.model.InlineResponseDefault; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class DefaultApi { + private ApiClient apiClient; + + public DefaultApi() { + this(Configuration.getDefaultApiClient()); + } + + public DefaultApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API cilent + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API cilent + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * + * + * @return InlineResponseDefault + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 response -
+ */ + public InlineResponseDefault fooGet() throws ApiException { + return fooGetWithHttpInfo().getData(); + } + + /** + * + * + * @return ApiResponse<InlineResponseDefault> + * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 response -
+ */ + public ApiResponse fooGetWithHttpInfo() throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/foo"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("DefaultApi.fooGet", localVarPath, "GET", localVarQueryParams, localVarPostBody, + localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, + localVarAuthNames, localVarReturnType, null); + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java index e3fa8df3bdd8..c57ccaa41570 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java @@ -12,11 +12,11 @@ import org.openapitools.client.model.Client; import java.io.File; import org.openapitools.client.model.FileSchemaTestClass; +import org.openapitools.client.model.HealthCheckResult; import java.time.LocalDate; import java.time.OffsetDateTime; import org.openapitools.client.model.OuterComposite; import org.openapitools.client.model.User; -import org.openapitools.client.model.XmlItem; import java.util.ArrayList; import java.util.HashMap; @@ -54,42 +54,36 @@ public void setApiClient(ApiClient apiClient) { } /** - * creates an XmlItem - * this route creates an XmlItem - * @param xmlItem XmlItem Body (required) + * Health check endpoint + * + * @return HealthCheckResult * @throws ApiException if fails to make API call * @http.response.details - +
Status Code Description Response Headers
200 successful operation -
200 The instance started successfully -
*/ - public void createXmlItem(XmlItem xmlItem) throws ApiException { - createXmlItemWithHttpInfo(xmlItem); + public HealthCheckResult fakeHealthGet() throws ApiException { + return fakeHealthGetWithHttpInfo().getData(); } /** - * creates an XmlItem - * this route creates an XmlItem - * @param xmlItem XmlItem Body (required) - * @return ApiResponse<Void> + * Health check endpoint + * + * @return ApiResponse<HealthCheckResult> * @throws ApiException if fails to make API call * @http.response.details - +
Status Code Description Response Headers
200 successful operation -
200 The instance started successfully -
*/ - public ApiResponse createXmlItemWithHttpInfo(XmlItem xmlItem) throws ApiException { - Object localVarPostBody = xmlItem; - - // verify the required parameter 'xmlItem' is set - if (xmlItem == null) { - throw new ApiException(400, "Missing the required parameter 'xmlItem' when calling createXmlItem"); - } + public ApiResponse fakeHealthGetWithHttpInfo() throws ApiException { + Object localVarPostBody = null; // create path and map variables - String localVarPath = "/fake/create_xml_item"; + String localVarPath = "/fake/health"; // query params List localVarQueryParams = new ArrayList(); @@ -102,20 +96,22 @@ public ApiResponse createXmlItemWithHttpInfo(XmlItem xmlItem) throws ApiEx final String[] localVarAccepts = { - + "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { - "application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16" + }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { }; - return apiClient.invokeAPI("FakeApi.createXmlItem", localVarPath, "POST", localVarQueryParams, localVarPostBody, + GenericType localVarReturnType = new GenericType() {}; + + return apiClient.invokeAPI("FakeApi.fakeHealthGet", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, - localVarAuthNames, null, null); + localVarAuthNames, localVarReturnType, null); } /** * @@ -167,7 +163,7 @@ public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { - + "application/json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); @@ -182,7 +178,7 @@ public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) /** * * Test serialization of object with outer number type - * @param body Input composite as post body (optional) + * @param outerComposite Input composite as post body (optional) * @return OuterComposite * @throws ApiException if fails to make API call * @http.response.details @@ -191,14 +187,14 @@ public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) 200 Output composite - */ - public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws ApiException { - return fakeOuterCompositeSerializeWithHttpInfo(body).getData(); + public OuterComposite fakeOuterCompositeSerialize(OuterComposite outerComposite) throws ApiException { + return fakeOuterCompositeSerializeWithHttpInfo(outerComposite).getData(); } /** * * Test serialization of object with outer number type - * @param body Input composite as post body (optional) + * @param outerComposite Input composite as post body (optional) * @return ApiResponse<OuterComposite> * @throws ApiException if fails to make API call * @http.response.details @@ -207,8 +203,8 @@ public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws Ap 200 Output composite - */ - public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(OuterComposite body) throws ApiException { - Object localVarPostBody = body; + public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(OuterComposite outerComposite) throws ApiException { + Object localVarPostBody = outerComposite; // create path and map variables String localVarPath = "/fake/outer/composite"; @@ -229,7 +225,7 @@ public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(Outer final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { - + "application/json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); @@ -291,7 +287,7 @@ public ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal b final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { - + "application/json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); @@ -353,7 +349,7 @@ public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) thr final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { - + "application/json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); @@ -368,7 +364,7 @@ public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) thr /** * * For this test, the body for this request much reference a schema named `File`. - * @param body (required) + * @param fileSchemaTestClass (required) * @throws ApiException if fails to make API call * @http.response.details @@ -376,14 +372,14 @@ public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) thr
200 Success -
*/ - public void testBodyWithFileSchema(FileSchemaTestClass body) throws ApiException { - testBodyWithFileSchemaWithHttpInfo(body); + public void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) throws ApiException { + testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); } /** * * For this test, the body for this request much reference a schema named `File`. - * @param body (required) + * @param fileSchemaTestClass (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details @@ -392,12 +388,12 @@ public void testBodyWithFileSchema(FileSchemaTestClass body) throws ApiException 200 Success - */ - public ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass body) throws ApiException { - Object localVarPostBody = body; + public ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass) throws ApiException { + Object localVarPostBody = fileSchemaTestClass; - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithFileSchema"); + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) { + throw new ApiException(400, "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema"); } // create path and map variables @@ -433,7 +429,7 @@ public ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass * * * @param query (required) - * @param body (required) + * @param user (required) * @throws ApiException if fails to make API call * @http.response.details @@ -441,15 +437,15 @@ public ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass
200 Success -
*/ - public void testBodyWithQueryParams(String query, User body) throws ApiException { - testBodyWithQueryParamsWithHttpInfo(query, body); + public void testBodyWithQueryParams(String query, User user) throws ApiException { + testBodyWithQueryParamsWithHttpInfo(query, user); } /** * * * @param query (required) - * @param body (required) + * @param user (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details @@ -458,17 +454,17 @@ public void testBodyWithQueryParams(String query, User body) throws ApiException 200 Success - */ - public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, User body) throws ApiException { - Object localVarPostBody = body; + public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, User user) throws ApiException { + Object localVarPostBody = user; // verify the required parameter 'query' is set if (query == null) { throw new ApiException(400, "Missing the required parameter 'query' when calling testBodyWithQueryParams"); } - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling testBodyWithQueryParams"); + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling testBodyWithQueryParams"); } // create path and map variables @@ -504,7 +500,7 @@ public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, User /** * To test \"client\" model * To test \"client\" model - * @param body client model (required) + * @param client client model (required) * @return Client * @throws ApiException if fails to make API call * @http.response.details @@ -513,14 +509,14 @@ public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, User 200 successful operation - */ - public Client testClientModel(Client body) throws ApiException { - return testClientModelWithHttpInfo(body).getData(); + public Client testClientModel(Client client) throws ApiException { + return testClientModelWithHttpInfo(client).getData(); } /** * To test \"client\" model * To test \"client\" model - * @param body client model (required) + * @param client client model (required) * @return ApiResponse<Client> * @throws ApiException if fails to make API call * @http.response.details @@ -529,12 +525,12 @@ public Client testClientModel(Client body) throws ApiException { 200 successful operation - */ - public ApiResponse testClientModelWithHttpInfo(Client body) throws ApiException { - Object localVarPostBody = body; + public ApiResponse testClientModelWithHttpInfo(Client client) throws ApiException { + Object localVarPostBody = client; - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling testClientModel"); + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException(400, "Missing the required parameter 'client' when calling testClientModel"); } // create path and map variables @@ -569,8 +565,8 @@ public ApiResponse testClientModelWithHttpInfo(Client body) throws ApiEx localVarAuthNames, localVarReturnType, null); } /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * @param number None (required) * @param _double None (required) * @param patternWithoutDelimiter None (required) @@ -598,8 +594,8 @@ public void testEndpointParameters(BigDecimal number, Double _double, String pat } /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * @param number None (required) * @param _double None (required) * @param patternWithoutDelimiter None (required) @@ -758,7 +754,7 @@ public ApiResponse testEnumParametersWithHttpInfo(List enumHeaderS Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "enum_query_string_array", enumQueryStringArray)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "enum_query_string_array", enumQueryStringArray)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_string", enumQueryString)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_integer", enumQueryInteger)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "enum_query_double", enumQueryDouble)); @@ -840,7 +836,7 @@ private ApiResponse testGroupParametersWithHttpInfo(Integer requiredString }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { }; + String[] localVarAuthNames = new String[] { "bearer_test" }; return apiClient.invokeAPI("FakeApi.testGroupParameters", localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, @@ -964,7 +960,7 @@ public APItestGroupParametersRequest testGroupParameters() throws ApiException { /** * test inline additionalProperties * - * @param param request body (required) + * @param requestBody request body (required) * @throws ApiException if fails to make API call * @http.response.details @@ -972,14 +968,14 @@ public APItestGroupParametersRequest testGroupParameters() throws ApiException {
200 successful operation -
*/ - public void testInlineAdditionalProperties(Map param) throws ApiException { - testInlineAdditionalPropertiesWithHttpInfo(param); + public void testInlineAdditionalProperties(Map requestBody) throws ApiException { + testInlineAdditionalPropertiesWithHttpInfo(requestBody); } /** * test inline additionalProperties * - * @param param request body (required) + * @param requestBody request body (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details @@ -988,12 +984,12 @@ public void testInlineAdditionalProperties(Map param) throws Api 200 successful operation - */ - public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(Map param) throws ApiException { - Object localVarPostBody = param; + public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(Map requestBody) throws ApiException { + Object localVarPostBody = requestBody; - // verify the required parameter 'param' is set - if (param == null) { - throw new ApiException(400, "Missing the required parameter 'param' when calling testInlineAdditionalProperties"); + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties"); } // create path and map variables @@ -1172,7 +1168,7 @@ public ApiResponse testQueryParameterCollectionFormatWithHttpInfo(List localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "pipe", pipe)); + localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "pipe", pipe)); localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "ioutil", ioutil)); localVarQueryParams.addAll(apiClient.parameterToPairs("space", "http", http)); localVarQueryParams.addAll(apiClient.parameterToPairs("csv", "url", url)); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index c3fc1748396a..339851556a57 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -48,7 +48,7 @@ public void setApiClient(ApiClient apiClient) { /** * To test class name in snake case * To test class name in snake case - * @param body client model (required) + * @param client client model (required) * @return Client * @throws ApiException if fails to make API call * @http.response.details @@ -57,14 +57,14 @@ public void setApiClient(ApiClient apiClient) { 200 successful operation - */ - public Client testClassname(Client body) throws ApiException { - return testClassnameWithHttpInfo(body).getData(); + public Client testClassname(Client client) throws ApiException { + return testClassnameWithHttpInfo(client).getData(); } /** * To test class name in snake case * To test class name in snake case - * @param body client model (required) + * @param client client model (required) * @return ApiResponse<Client> * @throws ApiException if fails to make API call * @http.response.details @@ -73,12 +73,12 @@ public Client testClassname(Client body) throws ApiException { 200 successful operation - */ - public ApiResponse testClassnameWithHttpInfo(Client body) throws ApiException { - Object localVarPostBody = body; + public ApiResponse testClassnameWithHttpInfo(Client client) throws ApiException { + Object localVarPostBody = client; - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling testClassname"); + // verify the required parameter 'client' is set + if (client == null) { + throw new ApiException(400, "Missing the required parameter 'client' when calling testClassname"); } // create path and map variables diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java index 8f2c6c9f99a5..d1bd8c6a5104 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java @@ -11,7 +11,6 @@ import java.io.File; import org.openapitools.client.model.ModelApiResponse; import org.openapitools.client.model.Pet; -import java.util.Set; import java.util.ArrayList; import java.util.HashMap; @@ -51,38 +50,36 @@ public void setApiClient(ApiClient apiClient) { /** * Add a new pet to the store * - * @param body Pet object that needs to be added to the store (required) + * @param pet Pet object that needs to be added to the store (required) * @throws ApiException if fails to make API call * @http.response.details -
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
*/ - public void addPet(Pet body) throws ApiException { - addPetWithHttpInfo(body); + public void addPet(Pet pet) throws ApiException { + addPetWithHttpInfo(pet); } /** * Add a new pet to the store * - * @param body Pet object that needs to be added to the store (required) + * @param pet Pet object that needs to be added to the store (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details -
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
*/ - public ApiResponse addPetWithHttpInfo(Pet body) throws ApiException { - Object localVarPostBody = body; + public ApiResponse addPetWithHttpInfo(Pet pet) throws ApiException { + Object localVarPostBody = pet; - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling addPet"); + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException(400, "Missing the required parameter 'pet' when calling addPet"); } // create path and map variables @@ -108,7 +105,7 @@ public ApiResponse addPetWithHttpInfo(Pet body) throws ApiException { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "petstore_auth" }; + String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; return apiClient.invokeAPI("PetApi.addPet", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, @@ -123,7 +120,6 @@ public ApiResponse addPetWithHttpInfo(Pet body) throws ApiException { * @http.response.details -
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
*/ @@ -141,7 +137,6 @@ public void deletePet(Long petId, String apiKey) throws ApiException { * @http.response.details -
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
*/ @@ -247,7 +242,7 @@ public ApiResponse> findPetsByStatusWithHttpInfo(List status) }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "petstore_auth" }; + String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; GenericType> localVarReturnType = new GenericType>() {}; @@ -259,7 +254,7 @@ public ApiResponse> findPetsByStatusWithHttpInfo(List status) * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by (required) - * @return Set<Pet> + * @return List<Pet> * @throws ApiException if fails to make API call * @http.response.details @@ -270,7 +265,7 @@ public ApiResponse> findPetsByStatusWithHttpInfo(List status) * @deprecated */ @Deprecated - public Set findPetsByTags(Set tags) throws ApiException { + public List findPetsByTags(List tags) throws ApiException { return findPetsByTagsWithHttpInfo(tags).getData(); } @@ -278,7 +273,7 @@ public Set findPetsByTags(Set tags) throws ApiException { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by (required) - * @return ApiResponse<Set<Pet>> + * @return ApiResponse<List<Pet>> * @throws ApiException if fails to make API call * @http.response.details
@@ -289,7 +284,7 @@ public Set findPetsByTags(Set tags) throws ApiException { * @deprecated */ @Deprecated - public ApiResponse> findPetsByTagsWithHttpInfo(Set tags) throws ApiException { + public ApiResponse> findPetsByTagsWithHttpInfo(List tags) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'tags' is set @@ -321,9 +316,9 @@ public ApiResponse> findPetsByTagsWithHttpInfo(Set tags) throws }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "petstore_auth" }; + String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; - GenericType> localVarReturnType = new GenericType>() {}; + GenericType> localVarReturnType = new GenericType>() {}; return apiClient.invokeAPI("PetApi.findPetsByTags", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, @@ -404,42 +399,40 @@ public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { /** * Update an existing pet * - * @param body Pet object that needs to be added to the store (required) + * @param pet Pet object that needs to be added to the store (required) * @throws ApiException if fails to make API call * @http.response.details
-
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
*/ - public void updatePet(Pet body) throws ApiException { - updatePetWithHttpInfo(body); + public void updatePet(Pet pet) throws ApiException { + updatePetWithHttpInfo(pet); } /** * Update an existing pet * - * @param body Pet object that needs to be added to the store (required) + * @param pet Pet object that needs to be added to the store (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details -
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
*/ - public ApiResponse updatePetWithHttpInfo(Pet body) throws ApiException { - Object localVarPostBody = body; + public ApiResponse updatePetWithHttpInfo(Pet pet) throws ApiException { + Object localVarPostBody = pet; - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updatePet"); + // verify the required parameter 'pet' is set + if (pet == null) { + throw new ApiException(400, "Missing the required parameter 'pet' when calling updatePet"); } // create path and map variables @@ -465,7 +458,7 @@ public ApiResponse updatePetWithHttpInfo(Pet body) throws ApiException { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); - String[] localVarAuthNames = new String[] { "petstore_auth" }; + String[] localVarAuthNames = new String[] { "http_signature_test", "petstore_auth" }; return apiClient.invokeAPI("PetApi.updatePet", localVarPath, "PUT", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java index b5ca41442db5..0e29deb7564f 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java @@ -247,7 +247,7 @@ public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiExcep /** * Place an order for a pet * - * @param body order placed for purchasing the pet (required) + * @param order order placed for purchasing the pet (required) * @return Order * @throws ApiException if fails to make API call * @http.response.details @@ -257,14 +257,14 @@ public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiExcep 400 Invalid Order - */ - public Order placeOrder(Order body) throws ApiException { - return placeOrderWithHttpInfo(body).getData(); + public Order placeOrder(Order order) throws ApiException { + return placeOrderWithHttpInfo(order).getData(); } /** * Place an order for a pet * - * @param body order placed for purchasing the pet (required) + * @param order order placed for purchasing the pet (required) * @return ApiResponse<Order> * @throws ApiException if fails to make API call * @http.response.details @@ -274,12 +274,12 @@ public Order placeOrder(Order body) throws ApiException { 400 Invalid Order - */ - public ApiResponse placeOrderWithHttpInfo(Order body) throws ApiException { - Object localVarPostBody = body; + public ApiResponse placeOrderWithHttpInfo(Order order) throws ApiException { + Object localVarPostBody = order; - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling placeOrder"); + // verify the required parameter 'order' is set + if (order == null) { + throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder"); } // create path and map variables @@ -301,7 +301,7 @@ public ApiResponse placeOrderWithHttpInfo(Order body) throws ApiException final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { - + "application/json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java index 4aa5531f4eb6..9b6250da568d 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java @@ -48,7 +48,7 @@ public void setApiClient(ApiClient apiClient) { /** * Create user * This can only be done by the logged in user. - * @param body Created user object (required) + * @param user Created user object (required) * @throws ApiException if fails to make API call * @http.response.details @@ -56,14 +56,14 @@ public void setApiClient(ApiClient apiClient) {
0 successful operation -
*/ - public void createUser(User body) throws ApiException { - createUserWithHttpInfo(body); + public void createUser(User user) throws ApiException { + createUserWithHttpInfo(user); } /** * Create user * This can only be done by the logged in user. - * @param body Created user object (required) + * @param user Created user object (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details @@ -72,12 +72,12 @@ public void createUser(User body) throws ApiException { 0 successful operation - */ - public ApiResponse createUserWithHttpInfo(User body) throws ApiException { - Object localVarPostBody = body; + public ApiResponse createUserWithHttpInfo(User user) throws ApiException { + Object localVarPostBody = user; - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createUser"); + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUser"); } // create path and map variables @@ -99,7 +99,7 @@ public ApiResponse createUserWithHttpInfo(User body) throws ApiException { final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { - + "application/json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); @@ -112,7 +112,7 @@ public ApiResponse createUserWithHttpInfo(User body) throws ApiException { /** * Creates list of users with given input array * - * @param body List of user object (required) + * @param user List of user object (required) * @throws ApiException if fails to make API call * @http.response.details @@ -120,14 +120,14 @@ public ApiResponse createUserWithHttpInfo(User body) throws ApiException {
0 successful operation -
*/ - public void createUsersWithArrayInput(List body) throws ApiException { - createUsersWithArrayInputWithHttpInfo(body); + public void createUsersWithArrayInput(List user) throws ApiException { + createUsersWithArrayInputWithHttpInfo(user); } /** * Creates list of users with given input array * - * @param body List of user object (required) + * @param user List of user object (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details @@ -136,12 +136,12 @@ public void createUsersWithArrayInput(List body) throws ApiException { 0 successful operation - */ - public ApiResponse createUsersWithArrayInputWithHttpInfo(List body) throws ApiException { - Object localVarPostBody = body; + public ApiResponse createUsersWithArrayInputWithHttpInfo(List user) throws ApiException { + Object localVarPostBody = user; - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithArrayInput"); + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput"); } // create path and map variables @@ -163,7 +163,7 @@ public ApiResponse createUsersWithArrayInputWithHttpInfo(List body) final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { - + "application/json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); @@ -176,7 +176,7 @@ public ApiResponse createUsersWithArrayInputWithHttpInfo(List body) /** * Creates list of users with given input array * - * @param body List of user object (required) + * @param user List of user object (required) * @throws ApiException if fails to make API call * @http.response.details @@ -184,14 +184,14 @@ public ApiResponse createUsersWithArrayInputWithHttpInfo(List body)
0 successful operation -
*/ - public void createUsersWithListInput(List body) throws ApiException { - createUsersWithListInputWithHttpInfo(body); + public void createUsersWithListInput(List user) throws ApiException { + createUsersWithListInputWithHttpInfo(user); } /** * Creates list of users with given input array * - * @param body List of user object (required) + * @param user List of user object (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details @@ -200,12 +200,12 @@ public void createUsersWithListInput(List body) throws ApiException { 0 successful operation - */ - public ApiResponse createUsersWithListInputWithHttpInfo(List body) throws ApiException { - Object localVarPostBody = body; + public ApiResponse createUsersWithListInputWithHttpInfo(List user) throws ApiException { + Object localVarPostBody = user; - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling createUsersWithListInput"); + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithListInput"); } // create path and map variables @@ -227,7 +227,7 @@ public ApiResponse createUsersWithListInputWithHttpInfo(List body) t final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { - + "application/json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); @@ -515,7 +515,7 @@ public ApiResponse logoutUserWithHttpInfo() throws ApiException { * Updated user * This can only be done by the logged in user. * @param username name that need to be deleted (required) - * @param body Updated user object (required) + * @param user Updated user object (required) * @throws ApiException if fails to make API call * @http.response.details @@ -524,15 +524,15 @@ public ApiResponse logoutUserWithHttpInfo() throws ApiException {
404 User not found -
*/ - public void updateUser(String username, User body) throws ApiException { - updateUserWithHttpInfo(username, body); + public void updateUser(String username, User user) throws ApiException { + updateUserWithHttpInfo(username, user); } /** * Updated user * This can only be done by the logged in user. * @param username name that need to be deleted (required) - * @param body Updated user object (required) + * @param user Updated user object (required) * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details @@ -542,17 +542,17 @@ public void updateUser(String username, User body) throws ApiException { 404 User not found - */ - public ApiResponse updateUserWithHttpInfo(String username, User body) throws ApiException { - Object localVarPostBody = body; + public ApiResponse updateUserWithHttpInfo(String username, User user) throws ApiException { + Object localVarPostBody = user; // verify the required parameter 'username' is set if (username == null) { throw new ApiException(400, "Missing the required parameter 'username' when calling updateUser"); } - // verify the required parameter 'body' is set - if (body == null) { - throw new ApiException(400, "Missing the required parameter 'body' when calling updateUser"); + // verify the required parameter 'user' is set + if (user == null) { + throw new ApiException(400, "Missing the required parameter 'user' when calling updateUser"); } // create path and map variables @@ -575,7 +575,7 @@ public ApiResponse updateUserWithHttpInfo(String username, User body) thro final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { - + "application/json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java new file mode 100644 index 000000000000..5f0e4dba3509 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java @@ -0,0 +1,265 @@ +/* + * 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.auth; + +import org.openapitools.client.Pair; +import org.openapitools.client.ApiException; + +import java.net.URI; +import java.net.URLEncoder; +import java.security.MessageDigest; +import java.security.Key; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Date; +import java.util.Locale; +import java.util.Map; +import java.util.List; +import java.security.spec.AlgorithmParameterSpec; +import java.security.InvalidKeyException; + +import org.tomitribe.auth.signatures.Algorithm; +import org.tomitribe.auth.signatures.Signer; +import org.tomitribe.auth.signatures.Signature; +import org.tomitribe.auth.signatures.SigningAlgorithm; + +/** + * A Configuration object for the HTTP message signature security scheme. + */ +public class HttpSignatureAuth implements Authentication { + + private Signer signer; + + // An opaque string that the server can use to look up the component they need to validate the signature. + private String keyId; + + // The HTTP signature algorithm. + private SigningAlgorithm signingAlgorithm; + + // The HTTP cryptographic algorithm. + private Algorithm algorithm; + + // The cryptographic parameters. + private AlgorithmParameterSpec parameterSpec; + + // The list of HTTP headers that should be included in the HTTP signature. + private List headers; + + // The digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + private String digestAlgorithm; + + /** + * Construct a new HTTP signature auth configuration object. + * + * @param keyId An opaque string that the server can use to look up the component they need to validate the signature. + * @param signingAlgorithm The signature algorithm. + * @param algorithm The cryptographic algorithm. + * @param digestAlgorithm The digest algorithm. + * @param headers The list of HTTP headers that should be included in the HTTP signature. + */ + public HttpSignatureAuth(String keyId, + SigningAlgorithm signingAlgorithm, + Algorithm algorithm, + String digestAlgorithm, + AlgorithmParameterSpec parameterSpec, + List headers) { + this.keyId = keyId; + this.signingAlgorithm = signingAlgorithm; + this.algorithm = algorithm; + this.parameterSpec = parameterSpec; + this.digestAlgorithm = digestAlgorithm; + this.headers = headers; + } + + /** + * Returns the opaque string that the server can use to look up the component they need to validate the signature. + * + * @return The keyId. + */ + public String getKeyId() { + return keyId; + } + + /** + * Set the HTTP signature key id. + * + * @param keyId An opaque string that the server can use to look up the component they need to validate the signature. + */ + public void setKeyId(String keyId) { + this.keyId = keyId; + } + + /** + * Returns the HTTP signature algorithm which is used to sign HTTP requests. + */ + public SigningAlgorithm getSigningAlgorithm() { + return signingAlgorithm; + } + + /** + * Sets the HTTP signature algorithm which is used to sign HTTP requests. + * + * @param signingAlgorithm The HTTP signature algorithm. + */ + public void setSigningAlgorithm(SigningAlgorithm signingAlgorithm) { + this.signingAlgorithm = signingAlgorithm; + } + + /** + * Returns the HTTP cryptographic algorithm which is used to sign HTTP requests. + */ + public Algorithm getAlgorithm() { + return algorithm; + } + + /** + * Sets the HTTP cryptographic algorithm which is used to sign HTTP requests. + * + * @param algorithm The HTTP signature algorithm. + */ + public void setAlgorithm(Algorithm algorithm) { + this.algorithm = algorithm; + } + + /** + * Returns the cryptographic parameters which are used to sign HTTP requests. + */ + public AlgorithmParameterSpec getAlgorithmParameterSpec() { + return parameterSpec; + } + + /** + * Sets the cryptographic parameters which are used to sign HTTP requests. + * + * @param parameterSpec The cryptographic parameters. + */ + public void setAlgorithmParameterSpec(AlgorithmParameterSpec parameterSpec) { + this.parameterSpec = parameterSpec; + } + + /** + * Returns the digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + * + * @see java.security.MessageDigest + */ + public String getDigestAlgorithm() { + return digestAlgorithm; + } + + /** + * Sets the digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. + * + * The exact list of supported digest algorithms depends on the installed security providers. + * Every implementation of the Java platform is required to support "MD5", "SHA-1" and "SHA-256". + * Do not use "MD5" and "SHA-1", they are vulnerable to multiple known attacks. + * By default, "SHA-256" is used. + * + * @param digestAlgorithm The digest algorithm. + * + * @see java.security.MessageDigest + */ + public void setDigestAlgorithm(String digestAlgorithm) { + this.digestAlgorithm = digestAlgorithm; + } + + /** + * Returns the list of HTTP headers that should be included in the HTTP signature. + */ + public List getHeaders() { + return headers; + } + + /** + * Sets the list of HTTP headers that should be included in the HTTP signature. + * + * @param headers The HTTP headers. + */ + public void setHeaders(List headers) { + this.headers = headers; + } + + /** + * Returns the signer instance used to sign HTTP messages. + * + * @return the signer instance. + */ + public Signer getSigner() { + return signer; + } + + /** + * Sets the signer instance used to sign HTTP messages. + * + * @param signer The signer instance to set. + */ + public void setSigner(Signer signer) { + this.signer = signer; + } + + /** + * Set the private key used to sign HTTP requests using the HTTP signature scheme. + * + * @param key The private key. + * + * @throws InvalidKeyException Unable to parse the key, or the security provider for this key + * is not installed. + */ + public void setPrivateKey(Key key) throws InvalidKeyException, ApiException { + if (key == null) { + throw new ApiException("Private key (java.security.Key) cannot be null"); + } + signer = new Signer(key, new Signature(keyId, signingAlgorithm, algorithm, parameterSpec, null, headers)); + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + try { + if (headers.contains("host")) { + headerParams.put("host", uri.getHost()); + } + + if (headers.contains("date")) { + headerParams.put("date", new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US).format(new Date())); + } + + if (headers.contains("digest")) { + headerParams.put("digest", + this.digestAlgorithm + "=" + + new String(Base64.getEncoder().encode(MessageDigest.getInstance(this.digestAlgorithm).digest(payload.getBytes())))); + } + + if (signer == null) { + throw new ApiException("Signer cannot be null. Please call the method `setPrivateKey` to set it up correctly"); + } + + // construct the path with the URL query string + String path = uri.getPath(); + + List urlQueries = new ArrayList(); + for (Pair queryParam : queryParams) { + urlQueries.add(queryParam.getName() + "=" + URLEncoder.encode(queryParam.getValue(), "utf8").replaceAll("\\+", "%20")); + } + + if (!urlQueries.isEmpty()) { + path = path + "?" + String.join("&", urlQueries); + } + + headerParams.put("Authorization", signer.sign(method, path, headerParams).toString()); + } catch (Exception ex) { + throw new ApiException("Failed to create signature in the HTTP request header: " + ex.toString()); + } + } +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index fa85ab77596a..624b19e97f3d 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -21,400 +21,293 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * AdditionalPropertiesClass */ @JsonPropertyOrder({ - AdditionalPropertiesClass.JSON_PROPERTY_MAP_STRING, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_NUMBER, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_INTEGER, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_BOOLEAN, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_ARRAY_INTEGER, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_ARRAY_ANYTYPE, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_MAP_STRING, - AdditionalPropertiesClass.JSON_PROPERTY_MAP_MAP_ANYTYPE, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_PROPERTY, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_OF_MAP_PROPERTY, AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE1, - AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE2, - AdditionalPropertiesClass.JSON_PROPERTY_ANYTYPE3 + AdditionalPropertiesClass.JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3, + AdditionalPropertiesClass.JSON_PROPERTY_EMPTY_MAP, + AdditionalPropertiesClass.JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING }) public class AdditionalPropertiesClass { - public static final String JSON_PROPERTY_MAP_STRING = "map_string"; - private Map mapString = null; + public static final String JSON_PROPERTY_MAP_PROPERTY = "map_property"; + private Map mapProperty = null; - public static final String JSON_PROPERTY_MAP_NUMBER = "map_number"; - private Map mapNumber = null; - - public static final String JSON_PROPERTY_MAP_INTEGER = "map_integer"; - private Map mapInteger = null; - - public static final String JSON_PROPERTY_MAP_BOOLEAN = "map_boolean"; - private Map mapBoolean = null; - - public static final String JSON_PROPERTY_MAP_ARRAY_INTEGER = "map_array_integer"; - private Map> mapArrayInteger = null; - - public static final String JSON_PROPERTY_MAP_ARRAY_ANYTYPE = "map_array_anytype"; - private Map> mapArrayAnytype = null; - - public static final String JSON_PROPERTY_MAP_MAP_STRING = "map_map_string"; - private Map> mapMapString = null; - - public static final String JSON_PROPERTY_MAP_MAP_ANYTYPE = "map_map_anytype"; - private Map> mapMapAnytype = null; + public static final String JSON_PROPERTY_MAP_OF_MAP_PROPERTY = "map_of_map_property"; + private Map> mapOfMapProperty = null; public static final String JSON_PROPERTY_ANYTYPE1 = "anytype_1"; - private Object anytype1; - - public static final String JSON_PROPERTY_ANYTYPE2 = "anytype_2"; - private Object anytype2; - - public static final String JSON_PROPERTY_ANYTYPE3 = "anytype_3"; - private Object anytype3; - - - public AdditionalPropertiesClass mapString(Map mapString) { - - this.mapString = mapString; - return this; - } + private JsonNullable anytype1 = JsonNullable.of(null); - public AdditionalPropertiesClass putMapStringItem(String key, String mapStringItem) { - if (this.mapString == null) { - this.mapString = new HashMap<>(); - } - this.mapString.put(key, mapStringItem); - return this; - } + public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1 = "map_with_undeclared_properties_anytype_1"; + private Object mapWithUndeclaredPropertiesAnytype1; - /** - * Get mapString - * @return mapString - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2 = "map_with_undeclared_properties_anytype_2"; + private Object mapWithUndeclaredPropertiesAnytype2; - public Map getMapString() { - return mapString; - } + public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3 = "map_with_undeclared_properties_anytype_3"; + private Map mapWithUndeclaredPropertiesAnytype3 = null; + public static final String JSON_PROPERTY_EMPTY_MAP = "empty_map"; + private Object emptyMap; - public void setMapString(Map mapString) { - this.mapString = mapString; - } + public static final String JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING = "map_with_undeclared_properties_string"; + private Map mapWithUndeclaredPropertiesString = null; - public AdditionalPropertiesClass mapNumber(Map mapNumber) { + public AdditionalPropertiesClass mapProperty(Map mapProperty) { - this.mapNumber = mapNumber; + this.mapProperty = mapProperty; return this; } - public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumberItem) { - if (this.mapNumber == null) { - this.mapNumber = new HashMap<>(); + public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { + if (this.mapProperty == null) { + this.mapProperty = new HashMap<>(); } - this.mapNumber.put(key, mapNumberItem); + this.mapProperty.put(key, mapPropertyItem); return this; } /** - * Get mapNumber - * @return mapNumber + * Get mapProperty + * @return mapProperty **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_NUMBER) + @JsonProperty(JSON_PROPERTY_MAP_PROPERTY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Map getMapNumber() { - return mapNumber; + public Map getMapProperty() { + return mapProperty; } - public void setMapNumber(Map mapNumber) { - this.mapNumber = mapNumber; + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; } - public AdditionalPropertiesClass mapInteger(Map mapInteger) { + public AdditionalPropertiesClass mapOfMapProperty(Map> mapOfMapProperty) { - this.mapInteger = mapInteger; + this.mapOfMapProperty = mapOfMapProperty; return this; } - public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntegerItem) { - if (this.mapInteger == null) { - this.mapInteger = new HashMap<>(); + public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map mapOfMapPropertyItem) { + if (this.mapOfMapProperty == null) { + this.mapOfMapProperty = new HashMap<>(); } - this.mapInteger.put(key, mapIntegerItem); + this.mapOfMapProperty.put(key, mapOfMapPropertyItem); return this; } /** - * Get mapInteger - * @return mapInteger + * Get mapOfMapProperty + * @return mapOfMapProperty **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_INTEGER) + @JsonProperty(JSON_PROPERTY_MAP_OF_MAP_PROPERTY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Map getMapInteger() { - return mapInteger; + public Map> getMapOfMapProperty() { + return mapOfMapProperty; } - public void setMapInteger(Map mapInteger) { - this.mapInteger = mapInteger; + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; } - public AdditionalPropertiesClass mapBoolean(Map mapBoolean) { + public AdditionalPropertiesClass anytype1(Object anytype1) { + this.anytype1 = JsonNullable.of(anytype1); - this.mapBoolean = mapBoolean; - return this; - } - - public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBooleanItem) { - if (this.mapBoolean == null) { - this.mapBoolean = new HashMap<>(); - } - this.mapBoolean.put(key, mapBooleanItem); return this; } /** - * Get mapBoolean - * @return mapBoolean + * Get anytype1 + * @return anytype1 **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Map getMapBoolean() { - return mapBoolean; - } + @JsonIgnore - - public void setMapBoolean(Map mapBoolean) { - this.mapBoolean = mapBoolean; - } - - - public AdditionalPropertiesClass mapArrayInteger(Map> mapArrayInteger) { - - this.mapArrayInteger = mapArrayInteger; - return this; - } - - public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List mapArrayIntegerItem) { - if (this.mapArrayInteger == null) { - this.mapArrayInteger = new HashMap<>(); - } - this.mapArrayInteger.put(key, mapArrayIntegerItem); - return this; + public Object getAnytype1() { + return anytype1.orElse(null); } - /** - * Get mapArrayInteger - * @return mapArrayInteger - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_ARRAY_INTEGER) + @JsonProperty(JSON_PROPERTY_ANYTYPE1) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Map> getMapArrayInteger() { - return mapArrayInteger; + public JsonNullable getAnytype1_JsonNullable() { + return anytype1; + } + + @JsonProperty(JSON_PROPERTY_ANYTYPE1) + public void setAnytype1_JsonNullable(JsonNullable anytype1) { + this.anytype1 = anytype1; } - - public void setMapArrayInteger(Map> mapArrayInteger) { - this.mapArrayInteger = mapArrayInteger; + public void setAnytype1(Object anytype1) { + this.anytype1 = JsonNullable.of(anytype1); } - public AdditionalPropertiesClass mapArrayAnytype(Map> mapArrayAnytype) { + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype1(Object mapWithUndeclaredPropertiesAnytype1) { - this.mapArrayAnytype = mapArrayAnytype; - return this; - } - - public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List mapArrayAnytypeItem) { - if (this.mapArrayAnytype == null) { - this.mapArrayAnytype = new HashMap<>(); - } - this.mapArrayAnytype.put(key, mapArrayAnytypeItem); + this.mapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; return this; } /** - * Get mapArrayAnytype - * @return mapArrayAnytype + * Get mapWithUndeclaredPropertiesAnytype1 + * @return mapWithUndeclaredPropertiesAnytype1 **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_ARRAY_ANYTYPE) + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE1) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Map> getMapArrayAnytype() { - return mapArrayAnytype; + public Object getMapWithUndeclaredPropertiesAnytype1() { + return mapWithUndeclaredPropertiesAnytype1; } - public void setMapArrayAnytype(Map> mapArrayAnytype) { - this.mapArrayAnytype = mapArrayAnytype; + public void setMapWithUndeclaredPropertiesAnytype1(Object mapWithUndeclaredPropertiesAnytype1) { + this.mapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; } - public AdditionalPropertiesClass mapMapString(Map> mapMapString) { + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype2(Object mapWithUndeclaredPropertiesAnytype2) { - this.mapMapString = mapMapString; - return this; - } - - public AdditionalPropertiesClass putMapMapStringItem(String key, Map mapMapStringItem) { - if (this.mapMapString == null) { - this.mapMapString = new HashMap<>(); - } - this.mapMapString.put(key, mapMapStringItem); + this.mapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; return this; } /** - * Get mapMapString - * @return mapMapString + * Get mapWithUndeclaredPropertiesAnytype2 + * @return mapWithUndeclaredPropertiesAnytype2 **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_MAP_STRING) + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE2) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Map> getMapMapString() { - return mapMapString; + public Object getMapWithUndeclaredPropertiesAnytype2() { + return mapWithUndeclaredPropertiesAnytype2; } - public void setMapMapString(Map> mapMapString) { - this.mapMapString = mapMapString; + public void setMapWithUndeclaredPropertiesAnytype2(Object mapWithUndeclaredPropertiesAnytype2) { + this.mapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; } - public AdditionalPropertiesClass mapMapAnytype(Map> mapMapAnytype) { + public AdditionalPropertiesClass mapWithUndeclaredPropertiesAnytype3(Map mapWithUndeclaredPropertiesAnytype3) { - this.mapMapAnytype = mapMapAnytype; + this.mapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3; return this; } - public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map mapMapAnytypeItem) { - if (this.mapMapAnytype == null) { - this.mapMapAnytype = new HashMap<>(); + public AdditionalPropertiesClass putMapWithUndeclaredPropertiesAnytype3Item(String key, Object mapWithUndeclaredPropertiesAnytype3Item) { + if (this.mapWithUndeclaredPropertiesAnytype3 == null) { + this.mapWithUndeclaredPropertiesAnytype3 = new HashMap<>(); } - this.mapMapAnytype.put(key, mapMapAnytypeItem); + this.mapWithUndeclaredPropertiesAnytype3.put(key, mapWithUndeclaredPropertiesAnytype3Item); return this; } /** - * Get mapMapAnytype - * @return mapMapAnytype + * Get mapWithUndeclaredPropertiesAnytype3 + * @return mapWithUndeclaredPropertiesAnytype3 **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_MAP_MAP_ANYTYPE) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_ANYTYPE3) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) - public Map> getMapMapAnytype() { - return mapMapAnytype; + public Map getMapWithUndeclaredPropertiesAnytype3() { + return mapWithUndeclaredPropertiesAnytype3; } - public void setMapMapAnytype(Map> mapMapAnytype) { - this.mapMapAnytype = mapMapAnytype; + public void setMapWithUndeclaredPropertiesAnytype3(Map mapWithUndeclaredPropertiesAnytype3) { + this.mapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3; } - public AdditionalPropertiesClass anytype1(Object anytype1) { + public AdditionalPropertiesClass emptyMap(Object emptyMap) { - this.anytype1 = anytype1; + this.emptyMap = emptyMap; return this; } /** - * Get anytype1 - * @return anytype1 + * an object with no declared properties and no undeclared properties, hence it's an empty map. + * @return emptyMap **/ @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ANYTYPE1) + @ApiModelProperty(value = "an object with no declared properties and no undeclared properties, hence it's an empty map.") + @JsonProperty(JSON_PROPERTY_EMPTY_MAP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Object getAnytype1() { - return anytype1; + public Object getEmptyMap() { + return emptyMap; } - public void setAnytype1(Object anytype1) { - this.anytype1 = anytype1; + public void setEmptyMap(Object emptyMap) { + this.emptyMap = emptyMap; } - public AdditionalPropertiesClass anytype2(Object anytype2) { + public AdditionalPropertiesClass mapWithUndeclaredPropertiesString(Map mapWithUndeclaredPropertiesString) { - this.anytype2 = anytype2; + this.mapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString; return this; } - /** - * Get anytype2 - * @return anytype2 - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ANYTYPE2) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Object getAnytype2() { - return anytype2; - } - - - public void setAnytype2(Object anytype2) { - this.anytype2 = anytype2; - } - - - public AdditionalPropertiesClass anytype3(Object anytype3) { - - this.anytype3 = anytype3; + public AdditionalPropertiesClass putMapWithUndeclaredPropertiesStringItem(String key, String mapWithUndeclaredPropertiesStringItem) { + if (this.mapWithUndeclaredPropertiesString == null) { + this.mapWithUndeclaredPropertiesString = new HashMap<>(); + } + this.mapWithUndeclaredPropertiesString.put(key, mapWithUndeclaredPropertiesStringItem); return this; } /** - * Get anytype3 - * @return anytype3 + * Get mapWithUndeclaredPropertiesString + * @return mapWithUndeclaredPropertiesString **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_ANYTYPE3) + @JsonProperty(JSON_PROPERTY_MAP_WITH_UNDECLARED_PROPERTIES_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Object getAnytype3() { - return anytype3; + public Map getMapWithUndeclaredPropertiesString() { + return mapWithUndeclaredPropertiesString; } - public void setAnytype3(Object anytype3) { - this.anytype3 = anytype3; + public void setMapWithUndeclaredPropertiesString(Map mapWithUndeclaredPropertiesString) { + this.mapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString; } @@ -427,22 +320,19 @@ public boolean equals(java.lang.Object o) { return false; } AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; - return Objects.equals(this.mapString, additionalPropertiesClass.mapString) && - Objects.equals(this.mapNumber, additionalPropertiesClass.mapNumber) && - Objects.equals(this.mapInteger, additionalPropertiesClass.mapInteger) && - Objects.equals(this.mapBoolean, additionalPropertiesClass.mapBoolean) && - Objects.equals(this.mapArrayInteger, additionalPropertiesClass.mapArrayInteger) && - Objects.equals(this.mapArrayAnytype, additionalPropertiesClass.mapArrayAnytype) && - Objects.equals(this.mapMapString, additionalPropertiesClass.mapMapString) && - Objects.equals(this.mapMapAnytype, additionalPropertiesClass.mapMapAnytype) && + return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty) && Objects.equals(this.anytype1, additionalPropertiesClass.anytype1) && - Objects.equals(this.anytype2, additionalPropertiesClass.anytype2) && - Objects.equals(this.anytype3, additionalPropertiesClass.anytype3); + Objects.equals(this.mapWithUndeclaredPropertiesAnytype1, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype1) && + Objects.equals(this.mapWithUndeclaredPropertiesAnytype2, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype2) && + Objects.equals(this.mapWithUndeclaredPropertiesAnytype3, additionalPropertiesClass.mapWithUndeclaredPropertiesAnytype3) && + Objects.equals(this.emptyMap, additionalPropertiesClass.emptyMap) && + Objects.equals(this.mapWithUndeclaredPropertiesString, additionalPropertiesClass.mapWithUndeclaredPropertiesString); } @Override public int hashCode() { - return Objects.hash(mapString, mapNumber, mapInteger, mapBoolean, mapArrayInteger, mapArrayAnytype, mapMapString, mapMapAnytype, anytype1, anytype2, anytype3); + return Objects.hash(mapProperty, mapOfMapProperty, anytype1, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, emptyMap, mapWithUndeclaredPropertiesString); } @@ -450,17 +340,14 @@ public int hashCode() { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AdditionalPropertiesClass {\n"); - sb.append(" mapString: ").append(toIndentedString(mapString)).append("\n"); - sb.append(" mapNumber: ").append(toIndentedString(mapNumber)).append("\n"); - sb.append(" mapInteger: ").append(toIndentedString(mapInteger)).append("\n"); - sb.append(" mapBoolean: ").append(toIndentedString(mapBoolean)).append("\n"); - sb.append(" mapArrayInteger: ").append(toIndentedString(mapArrayInteger)).append("\n"); - sb.append(" mapArrayAnytype: ").append(toIndentedString(mapArrayAnytype)).append("\n"); - sb.append(" mapMapString: ").append(toIndentedString(mapMapString)).append("\n"); - sb.append(" mapMapAnytype: ").append(toIndentedString(mapMapAnytype)).append("\n"); + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n"); sb.append(" anytype1: ").append(toIndentedString(anytype1)).append("\n"); - sb.append(" anytype2: ").append(toIndentedString(anytype2)).append("\n"); - sb.append(" anytype3: ").append(toIndentedString(anytype3)).append("\n"); + sb.append(" mapWithUndeclaredPropertiesAnytype1: ").append(toIndentedString(mapWithUndeclaredPropertiesAnytype1)).append("\n"); + sb.append(" mapWithUndeclaredPropertiesAnytype2: ").append(toIndentedString(mapWithUndeclaredPropertiesAnytype2)).append("\n"); + sb.append(" mapWithUndeclaredPropertiesAnytype3: ").append(toIndentedString(mapWithUndeclaredPropertiesAnytype3)).append("\n"); + sb.append(" emptyMap: ").append(toIndentedString(emptyMap)).append("\n"); + sb.append(" mapWithUndeclaredPropertiesString: ").append(toIndentedString(mapWithUndeclaredPropertiesString)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java index 67751ea072f8..307baecc9634 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java @@ -23,7 +23,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.openapitools.client.model.BigCat; import org.openapitools.client.model.Cat; import org.openapitools.client.model.Dog; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -38,7 +37,6 @@ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true) @JsonSubTypes({ - @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), @JsonSubTypes.Type(value = Cat.class, name = "Cat"), @JsonSubTypes.Type(value = Dog.class, name = "Dog"), }) diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCatAllOf.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Apple.java similarity index 56% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCatAllOf.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Apple.java index 7ce0ddb21f5a..e74a41ea1991 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCatAllOf.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Apple.java @@ -24,78 +24,68 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** - * BigCatAllOf + * Apple */ @JsonPropertyOrder({ - BigCatAllOf.JSON_PROPERTY_KIND + Apple.JSON_PROPERTY_CULTIVAR, + Apple.JSON_PROPERTY_ORIGIN }) -public class BigCatAllOf { - /** - * Gets or Sets kind - */ - public enum KindEnum { - LIONS("lions"), - - TIGERS("tigers"), - - LEOPARDS("leopards"), - - JAGUARS("jaguars"); +public class Apple { + public static final String JSON_PROPERTY_CULTIVAR = "cultivar"; + private String cultivar; - private String value; + public static final String JSON_PROPERTY_ORIGIN = "origin"; + private String origin; - KindEnum(String value) { - this.value = value; - } - @JsonValue - public String getValue() { - return value; - } + public Apple cultivar(String cultivar) { + + this.cultivar = cultivar; + return this; + } - @Override - public String toString() { - return String.valueOf(value); - } + /** + * Get cultivar + * @return cultivar + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_CULTIVAR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - @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 String getCultivar() { + return cultivar; } - public static final String JSON_PROPERTY_KIND = "kind"; - private KindEnum kind; + + public void setCultivar(String cultivar) { + this.cultivar = cultivar; + } - public BigCatAllOf kind(KindEnum kind) { + public Apple origin(String origin) { - this.kind = kind; + this.origin = origin; return this; } /** - * Get kind - * @return kind + * Get origin + * @return origin **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_KIND) + @JsonProperty(JSON_PROPERTY_ORIGIN) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public KindEnum getKind() { - return kind; + public String getOrigin() { + return origin; } - public void setKind(KindEnum kind) { - this.kind = kind; + public void setOrigin(String origin) { + this.origin = origin; } @@ -107,21 +97,23 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - BigCatAllOf bigCatAllOf = (BigCatAllOf) o; - return Objects.equals(this.kind, bigCatAllOf.kind); + Apple apple = (Apple) o; + return Objects.equals(this.cultivar, apple.cultivar) && + Objects.equals(this.origin, apple.origin); } @Override public int hashCode() { - return Objects.hash(kind); + return Objects.hash(cultivar, origin); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class BigCatAllOf {\n"); - sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append("class Apple {\n"); + sb.append(" cultivar: ").append(toIndentedString(cultivar)).append("\n"); + sb.append(" origin: ").append(toIndentedString(origin)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AppleReq.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AppleReq.java new file mode 100644 index 000000000000..90a3207fc704 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AppleReq.java @@ -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. + */ + + +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; + +/** + * AppleReq + */ +@JsonPropertyOrder({ + AppleReq.JSON_PROPERTY_CULTIVAR, + AppleReq.JSON_PROPERTY_MEALY +}) + +public class AppleReq { + public static final String JSON_PROPERTY_CULTIVAR = "cultivar"; + private String cultivar; + + public static final String JSON_PROPERTY_MEALY = "mealy"; + private Boolean mealy; + + + public AppleReq cultivar(String cultivar) { + + this.cultivar = cultivar; + return this; + } + + /** + * Get cultivar + * @return cultivar + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CULTIVAR) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getCultivar() { + return cultivar; + } + + + public void setCultivar(String cultivar) { + this.cultivar = cultivar; + } + + + public AppleReq mealy(Boolean mealy) { + + this.mealy = mealy; + return this; + } + + /** + * Get mealy + * @return mealy + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MEALY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getMealy() { + return mealy; + } + + + public void setMealy(Boolean mealy) { + this.mealy = mealy; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AppleReq appleReq = (AppleReq) o; + return Objects.equals(this.cultivar, appleReq.cultivar) && + Objects.equals(this.mealy, appleReq.mealy); + } + + @Override + public int hashCode() { + return Objects.hash(cultivar, mealy); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppleReq {\n"); + sb.append(" cultivar: ").append(toIndentedString(cultivar)).append("\n"); + sb.append(" mealy: ").append(toIndentedString(mealy)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Banana.java similarity index 63% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Banana.java index da407ccdc473..bb8fd654e455 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesNumber.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Banana.java @@ -22,44 +22,42 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; -import java.util.HashMap; -import java.util.Map; import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** - * AdditionalPropertiesNumber + * Banana */ @JsonPropertyOrder({ - AdditionalPropertiesNumber.JSON_PROPERTY_NAME + Banana.JSON_PROPERTY_LENGTH_CM }) -public class AdditionalPropertiesNumber extends HashMap { - public static final String JSON_PROPERTY_NAME = "name"; - private String name; +public class Banana { + public static final String JSON_PROPERTY_LENGTH_CM = "lengthCm"; + private BigDecimal lengthCm; - public AdditionalPropertiesNumber name(String name) { + public Banana lengthCm(BigDecimal lengthCm) { - this.name = name; + this.lengthCm = lengthCm; return this; } /** - * Get name - * @return name + * Get lengthCm + * @return lengthCm **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) + @JsonProperty(JSON_PROPERTY_LENGTH_CM) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getName() { - return name; + public BigDecimal getLengthCm() { + return lengthCm; } - public void setName(String name) { - this.name = name; + public void setLengthCm(BigDecimal lengthCm) { + this.lengthCm = lengthCm; } @@ -71,23 +69,21 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - AdditionalPropertiesNumber additionalPropertiesNumber = (AdditionalPropertiesNumber) o; - return Objects.equals(this.name, additionalPropertiesNumber.name) && - super.equals(o); + Banana banana = (Banana) o; + return Objects.equals(this.lengthCm, banana.lengthCm); } @Override public int hashCode() { - return Objects.hash(name, super.hashCode()); + return Objects.hash(lengthCm); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesNumber {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("class Banana {\n"); + sb.append(" lengthCm: ").append(toIndentedString(lengthCm)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BananaReq.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BananaReq.java new file mode 100644 index 000000000000..719d1034095d --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BananaReq.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.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 java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * BananaReq + */ +@JsonPropertyOrder({ + BananaReq.JSON_PROPERTY_LENGTH_CM, + BananaReq.JSON_PROPERTY_SWEET +}) + +public class BananaReq { + public static final String JSON_PROPERTY_LENGTH_CM = "lengthCm"; + private BigDecimal lengthCm; + + public static final String JSON_PROPERTY_SWEET = "sweet"; + private Boolean sweet; + + + public BananaReq lengthCm(BigDecimal lengthCm) { + + this.lengthCm = lengthCm; + return this; + } + + /** + * Get lengthCm + * @return lengthCm + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_LENGTH_CM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getLengthCm() { + return lengthCm; + } + + + public void setLengthCm(BigDecimal lengthCm) { + this.lengthCm = lengthCm; + } + + + public BananaReq sweet(Boolean sweet) { + + this.sweet = sweet; + return this; + } + + /** + * Get sweet + * @return sweet + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SWEET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getSweet() { + return sweet; + } + + + public void setSweet(Boolean sweet) { + this.sweet = sweet; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BananaReq bananaReq = (BananaReq) o; + return Objects.equals(this.lengthCm, bananaReq.lengthCm) && + Objects.equals(this.sweet, bananaReq.sweet); + } + + @Override + public int hashCode() { + return Objects.hash(lengthCm, sweet); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BananaReq {\n"); + sb.append(" lengthCm: ").append(toIndentedString(lengthCm)).append("\n"); + sb.append(" sweet: ").append(toIndentedString(sweet)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BasquePig.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BasquePig.java new file mode 100644 index 000000000000..d13bc304b2da --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BasquePig.java @@ -0,0 +1,101 @@ +/* + * 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; + +/** + * BasquePig + */ +@JsonPropertyOrder({ + BasquePig.JSON_PROPERTY_CLASS_NAME +}) + +public class BasquePig { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + private String className; + + + public BasquePig className(String className) { + + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + + public void setClassName(String className) { + this.className = className; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BasquePig basquePig = (BasquePig) o; + return Objects.equals(this.className, basquePig.className); + } + + @Override + public int hashCode() { + return Objects.hash(className); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BasquePig {\n"); + sb.append(" className: ").append(toIndentedString(className)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java index 11ce48991b06..05e080b32291 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java @@ -24,7 +24,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.client.model.Animal; -import org.openapitools.client.model.BigCat; import org.openapitools.client.model.CatAllOf; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -37,7 +36,6 @@ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true) @JsonSubTypes({ - @JsonSubTypes.Type(value = BigCat.class, name = "BigCat"), }) public class Cat extends Animal { diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCat.java similarity index 78% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCat.java index c03535ab9471..272be70fc2a6 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesArray.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCat.java @@ -18,27 +18,32 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import org.openapitools.client.model.ChildCatAllOf; +import org.openapitools.client.model.ParentPet; import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** - * AdditionalPropertiesArray + * ChildCat */ @JsonPropertyOrder({ - AdditionalPropertiesArray.JSON_PROPERTY_NAME + ChildCat.JSON_PROPERTY_NAME }) -public class AdditionalPropertiesArray extends HashMap { +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "pet_type", visible = true) +@JsonSubTypes({ +}) + +public class ChildCat extends ParentPet { public static final String JSON_PROPERTY_NAME = "name"; private String name; - public AdditionalPropertiesArray name(String name) { + public ChildCat name(String name) { this.name = name; return this; @@ -71,8 +76,8 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - AdditionalPropertiesArray additionalPropertiesArray = (AdditionalPropertiesArray) o; - return Objects.equals(this.name, additionalPropertiesArray.name) && + ChildCat childCat = (ChildCat) o; + return Objects.equals(this.name, childCat.name) && super.equals(o); } @@ -85,7 +90,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesArray {\n"); + sb.append("class ChildCat {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append("}"); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCatAllOf.java similarity index 76% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCatAllOf.java index 5e468870311e..aa495e74cd43 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesObject.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ChildCatAllOf.java @@ -21,23 +21,21 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.HashMap; -import java.util.Map; import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** - * AdditionalPropertiesObject + * ChildCatAllOf */ @JsonPropertyOrder({ - AdditionalPropertiesObject.JSON_PROPERTY_NAME + ChildCatAllOf.JSON_PROPERTY_NAME }) -public class AdditionalPropertiesObject extends HashMap { +public class ChildCatAllOf { public static final String JSON_PROPERTY_NAME = "name"; private String name; - public AdditionalPropertiesObject name(String name) { + public ChildCatAllOf name(String name) { this.name = name; return this; @@ -70,22 +68,20 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - AdditionalPropertiesObject additionalPropertiesObject = (AdditionalPropertiesObject) o; - return Objects.equals(this.name, additionalPropertiesObject.name) && - super.equals(o); + ChildCatAllOf childCatAllOf = (ChildCatAllOf) o; + return Objects.equals(this.name, childCatAllOf.name); } @Override public int hashCode() { - return Objects.hash(name, super.hashCode()); + return Objects.hash(name); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesObject {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("class ChildCatAllOf {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.java new file mode 100644 index 000000000000..7e99e3ec4bf6 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ComplexQuadrilateral.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.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.QuadrilateralInterface; +import org.openapitools.client.model.ShapeInterface; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ComplexQuadrilateral + */ +@JsonPropertyOrder({ + ComplexQuadrilateral.JSON_PROPERTY_SHAPE_TYPE, + ComplexQuadrilateral.JSON_PROPERTY_QUADRILATERAL_TYPE +}) + +public class ComplexQuadrilateral { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + private String shapeType; + + public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType"; + private String quadrilateralType; + + + public ComplexQuadrilateral shapeType(String shapeType) { + + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + + public void setShapeType(String shapeType) { + this.shapeType = shapeType; + } + + + public ComplexQuadrilateral quadrilateralType(String quadrilateralType) { + + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getQuadrilateralType() { + return quadrilateralType; + } + + + public void setQuadrilateralType(String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ComplexQuadrilateral complexQuadrilateral = (ComplexQuadrilateral) o; + return Objects.equals(this.shapeType, complexQuadrilateral.shapeType) && + Objects.equals(this.quadrilateralType, complexQuadrilateral.quadrilateralType); + } + + @Override + public int hashCode() { + return Objects.hash(shapeType, quadrilateralType); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ComplexQuadrilateral {\n"); + sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); + sb.append(" quadrilateralType: ").append(toIndentedString(quadrilateralType)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DanishPig.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DanishPig.java new file mode 100644 index 000000000000..cf4907374211 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/DanishPig.java @@ -0,0 +1,101 @@ +/* + * 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; + +/** + * DanishPig + */ +@JsonPropertyOrder({ + DanishPig.JSON_PROPERTY_CLASS_NAME +}) + +public class DanishPig { + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + private String className; + + + public DanishPig className(String className) { + + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + + public void setClassName(String className) { + this.className = className; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DanishPig danishPig = (DanishPig) o; + return Objects.equals(this.className, danishPig.className); + } + + @Override + public int hashCode() { + return Objects.hash(className); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DanishPig {\n"); + sb.append(" className: ").append(toIndentedString(className)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Drawing.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Drawing.java new file mode 100644 index 000000000000..f92f7d3f461d --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Drawing.java @@ -0,0 +1,226 @@ +/* + * 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 java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.client.model.Fruit; +import org.openapitools.client.model.NullableShape; +import org.openapitools.client.model.Shape; +import org.openapitools.client.model.ShapeOrNull; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Drawing + */ +@JsonPropertyOrder({ + Drawing.JSON_PROPERTY_MAIN_SHAPE, + Drawing.JSON_PROPERTY_SHAPE_OR_NULL, + Drawing.JSON_PROPERTY_NULLABLE_SHAPE, + Drawing.JSON_PROPERTY_SHAPES +}) + +public class Drawing extends HashMap { + public static final String JSON_PROPERTY_MAIN_SHAPE = "mainShape"; + private Shape mainShape = null; + + public static final String JSON_PROPERTY_SHAPE_OR_NULL = "shapeOrNull"; + private ShapeOrNull shapeOrNull = null; + + public static final String JSON_PROPERTY_NULLABLE_SHAPE = "nullableShape"; + private JsonNullable nullableShape = JsonNullable.of(null); + + public static final String JSON_PROPERTY_SHAPES = "shapes"; + private List shapes = null; + + + public Drawing mainShape(Shape mainShape) { + + this.mainShape = mainShape; + return this; + } + + /** + * Get mainShape + * @return mainShape + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_MAIN_SHAPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Shape getMainShape() { + return mainShape; + } + + + public void setMainShape(Shape mainShape) { + this.mainShape = mainShape; + } + + + public Drawing shapeOrNull(ShapeOrNull shapeOrNull) { + + this.shapeOrNull = shapeOrNull; + return this; + } + + /** + * Get shapeOrNull + * @return shapeOrNull + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_OR_NULL) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public ShapeOrNull getShapeOrNull() { + return shapeOrNull; + } + + + public void setShapeOrNull(ShapeOrNull shapeOrNull) { + this.shapeOrNull = shapeOrNull; + } + + + public Drawing nullableShape(NullableShape nullableShape) { + this.nullableShape = JsonNullable.of(nullableShape); + + return this; + } + + /** + * Get nullableShape + * @return nullableShape + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public NullableShape getNullableShape() { + return nullableShape.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NULLABLE_SHAPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNullableShape_JsonNullable() { + return nullableShape; + } + + @JsonProperty(JSON_PROPERTY_NULLABLE_SHAPE) + public void setNullableShape_JsonNullable(JsonNullable nullableShape) { + this.nullableShape = nullableShape; + } + + public void setNullableShape(NullableShape nullableShape) { + this.nullableShape = JsonNullable.of(nullableShape); + } + + + public Drawing shapes(List shapes) { + + this.shapes = shapes; + return this; + } + + public Drawing addShapesItem(Shape shapesItem) { + if (this.shapes == null) { + this.shapes = new ArrayList<>(); + } + this.shapes.add(shapesItem); + return this; + } + + /** + * Get shapes + * @return shapes + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_SHAPES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getShapes() { + return shapes; + } + + + public void setShapes(List shapes) { + this.shapes = shapes; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Drawing drawing = (Drawing) o; + return Objects.equals(this.mainShape, drawing.mainShape) && + Objects.equals(this.shapeOrNull, drawing.shapeOrNull) && + Objects.equals(this.nullableShape, drawing.nullableShape) && + Objects.equals(this.shapes, drawing.shapes) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(mainShape, shapeOrNull, nullableShape, shapes, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Drawing {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" mainShape: ").append(toIndentedString(mainShape)).append("\n"); + sb.append(" shapeOrNull: ").append(toIndentedString(shapeOrNull)).append("\n"); + sb.append(" nullableShape: ").append(toIndentedString(nullableShape)).append("\n"); + sb.append(" shapes: ").append(toIndentedString(shapes)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java index 51a1a645a109..cf6d574a5f97 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java @@ -22,6 +22,12 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.OuterEnumDefaultValue; +import org.openapitools.client.model.OuterEnumInteger; +import org.openapitools.client.model.OuterEnumIntegerDefaultValue; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** @@ -32,7 +38,10 @@ EnumTest.JSON_PROPERTY_ENUM_STRING_REQUIRED, EnumTest.JSON_PROPERTY_ENUM_INTEGER, EnumTest.JSON_PROPERTY_ENUM_NUMBER, - EnumTest.JSON_PROPERTY_OUTER_ENUM + EnumTest.JSON_PROPERTY_OUTER_ENUM, + EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER, + EnumTest.JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE, + EnumTest.JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE }) public class EnumTest { @@ -193,7 +202,16 @@ public static EnumNumberEnum fromValue(Double value) { private EnumNumberEnum enumNumber; public static final String JSON_PROPERTY_OUTER_ENUM = "outerEnum"; - private OuterEnum outerEnum; + private JsonNullable outerEnum = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_OUTER_ENUM_INTEGER = "outerEnumInteger"; + private OuterEnumInteger outerEnumInteger; + + public static final String JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE = "outerEnumDefaultValue"; + private OuterEnumDefaultValue outerEnumDefaultValue = OuterEnumDefaultValue.PLACED; + + public static final String JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE = "outerEnumIntegerDefaultValue"; + private OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue = OuterEnumIntegerDefaultValue.NUMBER_0; public EnumTest enumString(EnumStringEnum enumString) { @@ -296,8 +314,8 @@ public void setEnumNumber(EnumNumberEnum enumNumber) { public EnumTest outerEnum(OuterEnum outerEnum) { + this.outerEnum = JsonNullable.of(outerEnum); - this.outerEnum = outerEnum; return this; } @@ -307,16 +325,101 @@ public EnumTest outerEnum(OuterEnum outerEnum) { **/ @javax.annotation.Nullable @ApiModelProperty(value = "") + @JsonIgnore + + public OuterEnum getOuterEnum() { + return outerEnum.orElse(null); + } + @JsonProperty(JSON_PROPERTY_OUTER_ENUM) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OuterEnum getOuterEnum() { + public JsonNullable getOuterEnum_JsonNullable() { return outerEnum; } - + + @JsonProperty(JSON_PROPERTY_OUTER_ENUM) + public void setOuterEnum_JsonNullable(JsonNullable outerEnum) { + this.outerEnum = outerEnum; + } public void setOuterEnum(OuterEnum outerEnum) { - this.outerEnum = outerEnum; + this.outerEnum = JsonNullable.of(outerEnum); + } + + + public EnumTest outerEnumInteger(OuterEnumInteger outerEnumInteger) { + + this.outerEnumInteger = outerEnumInteger; + return this; + } + + /** + * Get outerEnumInteger + * @return outerEnumInteger + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnumInteger getOuterEnumInteger() { + return outerEnumInteger; + } + + + public void setOuterEnumInteger(OuterEnumInteger outerEnumInteger) { + this.outerEnumInteger = outerEnumInteger; + } + + + public EnumTest outerEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + + this.outerEnumDefaultValue = outerEnumDefaultValue; + return this; + } + + /** + * Get outerEnumDefaultValue + * @return outerEnumDefaultValue + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_DEFAULT_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnumDefaultValue getOuterEnumDefaultValue() { + return outerEnumDefaultValue; + } + + + public void setOuterEnumDefaultValue(OuterEnumDefaultValue outerEnumDefaultValue) { + this.outerEnumDefaultValue = outerEnumDefaultValue; + } + + + public EnumTest outerEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; + return this; + } + + /** + * Get outerEnumIntegerDefaultValue + * @return outerEnumIntegerDefaultValue + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OUTER_ENUM_INTEGER_DEFAULT_VALUE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OuterEnumIntegerDefaultValue getOuterEnumIntegerDefaultValue() { + return outerEnumIntegerDefaultValue; + } + + + public void setOuterEnumIntegerDefaultValue(OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) { + this.outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; } @@ -333,12 +436,15 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && Objects.equals(this.enumInteger, enumTest.enumInteger) && Objects.equals(this.enumNumber, enumTest.enumNumber) && - Objects.equals(this.outerEnum, enumTest.outerEnum); + Objects.equals(this.outerEnum, enumTest.outerEnum) && + Objects.equals(this.outerEnumInteger, enumTest.outerEnumInteger) && + Objects.equals(this.outerEnumDefaultValue, enumTest.outerEnumDefaultValue) && + Objects.equals(this.outerEnumIntegerDefaultValue, enumTest.outerEnumIntegerDefaultValue); } @Override public int hashCode() { - return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum, outerEnumInteger, outerEnumDefaultValue, outerEnumIntegerDefaultValue); } @@ -351,6 +457,9 @@ public String toString() { sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); + sb.append(" outerEnumInteger: ").append(toIndentedString(outerEnumInteger)).append("\n"); + sb.append(" outerEnumDefaultValue: ").append(toIndentedString(outerEnumDefaultValue)).append("\n"); + sb.append(" outerEnumIntegerDefaultValue: ").append(toIndentedString(outerEnumIntegerDefaultValue)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EquilateralTriangle.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EquilateralTriangle.java new file mode 100644 index 000000000000..6e93c9efbf8d --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EquilateralTriangle.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.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.ShapeInterface; +import org.openapitools.client.model.TriangleInterface; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * EquilateralTriangle + */ +@JsonPropertyOrder({ + EquilateralTriangle.JSON_PROPERTY_SHAPE_TYPE, + EquilateralTriangle.JSON_PROPERTY_TRIANGLE_TYPE +}) + +public class EquilateralTriangle { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + private String shapeType; + + public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType"; + private String triangleType; + + + public EquilateralTriangle shapeType(String shapeType) { + + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + + public void setShapeType(String shapeType) { + this.shapeType = shapeType; + } + + + public EquilateralTriangle triangleType(String triangleType) { + + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + + public void setTriangleType(String triangleType) { + this.triangleType = triangleType; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EquilateralTriangle equilateralTriangle = (EquilateralTriangle) o; + return Objects.equals(this.shapeType, equilateralTriangle.shapeType) && + Objects.equals(this.triangleType, equilateralTriangle.triangleType); + } + + @Override + public int hashCode() { + return Objects.hash(shapeType, triangleType); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EquilateralTriangle {\n"); + sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); + sb.append(" triangleType: ").append(toIndentedString(triangleType)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Foo.java similarity index 63% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Foo.java index ed080254966e..e531ce87dbf2 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesString.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Foo.java @@ -21,44 +21,42 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.HashMap; -import java.util.Map; import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** - * AdditionalPropertiesString + * Foo */ @JsonPropertyOrder({ - AdditionalPropertiesString.JSON_PROPERTY_NAME + Foo.JSON_PROPERTY_BAR }) -public class AdditionalPropertiesString extends HashMap { - public static final String JSON_PROPERTY_NAME = "name"; - private String name; +public class Foo { + public static final String JSON_PROPERTY_BAR = "bar"; + private String bar = "bar"; - public AdditionalPropertiesString name(String name) { + public Foo bar(String bar) { - this.name = name; + this.bar = bar; return this; } /** - * Get name - * @return name + * Get bar + * @return bar **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) + @JsonProperty(JSON_PROPERTY_BAR) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getName() { - return name; + public String getBar() { + return bar; } - public void setName(String name) { - this.name = name; + public void setBar(String bar) { + this.bar = bar; } @@ -70,23 +68,21 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - AdditionalPropertiesString additionalPropertiesString = (AdditionalPropertiesString) o; - return Objects.equals(this.name, additionalPropertiesString.name) && - super.equals(o); + Foo foo = (Foo) o; + return Objects.equals(this.bar, foo.bar); } @Override public int hashCode() { - return Objects.hash(name, super.hashCode()); + return Objects.hash(bar); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesString {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("class Foo {\n"); + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java index 72ed8740e4d7..4440eda8d8e7 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java @@ -45,7 +45,8 @@ FormatTest.JSON_PROPERTY_DATE_TIME, FormatTest.JSON_PROPERTY_UUID, FormatTest.JSON_PROPERTY_PASSWORD, - FormatTest.JSON_PROPERTY_BIG_DECIMAL + FormatTest.JSON_PROPERTY_PATTERN_WITH_DIGITS, + FormatTest.JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER }) public class FormatTest { @@ -88,8 +89,11 @@ public class FormatTest { public static final String JSON_PROPERTY_PASSWORD = "password"; private String password; - public static final String JSON_PROPERTY_BIG_DECIMAL = "BigDecimal"; - private BigDecimal bigDecimal; + public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS = "pattern_with_digits"; + private String patternWithDigits; + + public static final String JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER = "pattern_with_digits_and_delimiter"; + private String patternWithDigitsAndDelimiter; public FormatTest integer(Integer integer) { @@ -423,28 +427,53 @@ public void setPassword(String password) { } - public FormatTest bigDecimal(BigDecimal bigDecimal) { + public FormatTest patternWithDigits(String patternWithDigits) { - this.bigDecimal = bigDecimal; + this.patternWithDigits = patternWithDigits; return this; } /** - * Get bigDecimal - * @return bigDecimal + * A string that is a 10 digit number. Can have leading zeros. + * @return patternWithDigits **/ @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_BIG_DECIMAL) + @ApiModelProperty(value = "A string that is a 10 digit number. Can have leading zeros.") + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPatternWithDigits() { + return patternWithDigits; + } + + + public void setPatternWithDigits(String patternWithDigits) { + this.patternWithDigits = patternWithDigits; + } + + + public FormatTest patternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + return this; + } + + /** + * A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + * @return patternWithDigitsAndDelimiter + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") + @JsonProperty(JSON_PROPERTY_PATTERN_WITH_DIGITS_AND_DELIMITER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public BigDecimal getBigDecimal() { - return bigDecimal; + public String getPatternWithDigitsAndDelimiter() { + return patternWithDigitsAndDelimiter; } - public void setBigDecimal(BigDecimal bigDecimal) { - this.bigDecimal = bigDecimal; + public void setPatternWithDigitsAndDelimiter(String patternWithDigitsAndDelimiter) { + this.patternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; } @@ -470,12 +499,13 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.dateTime, formatTest.dateTime) && Objects.equals(this.uuid, formatTest.uuid) && Objects.equals(this.password, formatTest.password) && - Objects.equals(this.bigDecimal, formatTest.bigDecimal); + Objects.equals(this.patternWithDigits, formatTest.patternWithDigits) && + Objects.equals(this.patternWithDigitsAndDelimiter, formatTest.patternWithDigitsAndDelimiter); } @Override public int hashCode() { - return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, bigDecimal); + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password, patternWithDigits, patternWithDigitsAndDelimiter); } @@ -496,7 +526,8 @@ public String toString() { sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); sb.append(" password: ").append(toIndentedString(password)).append("\n"); - sb.append(" bigDecimal: ").append(toIndentedString(bigDecimal)).append("\n"); + sb.append(" patternWithDigits: ").append(toIndentedString(patternWithDigits)).append("\n"); + sb.append(" patternWithDigitsAndDelimiter: ").append(toIndentedString(patternWithDigitsAndDelimiter)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Fruit.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Fruit.java new file mode 100644 index 000000000000..a9eeee525b6e --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Fruit.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 java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=Fruit.FruitDeserializer.class) +public class Fruit extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Fruit.class.getName()); + + public static class FruitDeserializer extends StdDeserializer { + public FruitDeserializer() { + this(Fruit.class); + } + + public FruitDeserializer(Class vc) { + super(vc); + } + + @Override + public Fruit deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + + int match = 0; + Object deserialized = null; + // deserialize Apple + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Apple.class); + match++; + log.log(Level.FINER, "Input data matches schema 'Apple'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Apple'", e); + } + + // deserialize Banana + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Banana.class); + match++; + log.log(Level.FINER, "Input data matches schema 'Banana'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Banana'", e); + } + + if (match == 1) { + Fruit ret = new Fruit(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for Fruit: %d classes match result, expected 1", match)); + } + } + + // store a list of schema names defined in oneOf + public final static Map schemas = new HashMap(); + + public Fruit() { + super("oneOf", Boolean.FALSE); + } + + public Fruit(Apple o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Fruit(Banana o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Apple", new GenericType() { + }); + schemas.put("Banana", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return Fruit.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof Apple) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof Banana) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Apple, Banana"); + } + + + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FruitReq.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FruitReq.java new file mode 100644 index 000000000000..2a46202a7ed3 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FruitReq.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 java.math.BigDecimal; +import org.openapitools.client.model.AppleReq; +import org.openapitools.client.model.BananaReq; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=FruitReq.FruitReqDeserializer.class) +public class FruitReq extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(FruitReq.class.getName()); + + public static class FruitReqDeserializer extends StdDeserializer { + public FruitReqDeserializer() { + this(FruitReq.class); + } + + public FruitReqDeserializer(Class vc) { + super(vc); + } + + @Override + public FruitReq deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + + int match = 0; + Object deserialized = null; + // deserialize AppleReq + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(AppleReq.class); + match++; + log.log(Level.FINER, "Input data matches schema 'AppleReq'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'AppleReq'", e); + } + + // deserialize BananaReq + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(BananaReq.class); + match++; + log.log(Level.FINER, "Input data matches schema 'BananaReq'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'BananaReq'", e); + } + + if (match == 1) { + FruitReq ret = new FruitReq(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for FruitReq: %d classes match result, expected 1", match)); + } + } + + // store a list of schema names defined in oneOf + public final static Map schemas = new HashMap(); + + public FruitReq() { + super("oneOf", Boolean.TRUE); + } + + public FruitReq(AppleReq o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + public FruitReq(BananaReq o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + static { + schemas.put("AppleReq", new GenericType() { + }); + schemas.put("BananaReq", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return FruitReq.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof AppleReq) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof BananaReq) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be AppleReq, BananaReq"); + } + + + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/GmFruit.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/GmFruit.java new file mode 100644 index 000000000000..6dd57e7c3a55 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/GmFruit.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.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 java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=GmFruit.GmFruitDeserializer.class) +public class GmFruit extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GmFruit.class.getName()); + + public static class GmFruitDeserializer extends StdDeserializer { + public GmFruitDeserializer() { + this(GmFruit.class); + } + + public GmFruitDeserializer(Class vc) { + super(vc); + } + + @Override + public GmFruit deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + + Object deserialized = null; + // deserialzie Apple + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Apple.class); + GmFruit ret = new GmFruit(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'GmFruit'", e); + } + + // deserialzie Banana + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Banana.class); + GmFruit ret = new GmFruit(); + ret.setActualInstance(deserialized); + return ret; + } catch (Exception e) { + // deserialization failed, continue, log to help debugging + log.log(Level.FINER, "Input data does not match 'GmFruit'", e); + } + + throw new IOException(String.format("Failed deserialization for GmFruit: no match found")); + } + } + + // store a list of schema names defined in anyOf + public final static Map schemas = new HashMap(); + + public GmFruit() { + super("anyOf", Boolean.FALSE); + } + + public GmFruit(Apple o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + public GmFruit(Banana o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Apple", new GenericType() { + }); + schemas.put("Banana", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return GmFruit.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof Apple) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof Banana) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Apple, Banana"); + } +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/GrandparentAnimal.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/GrandparentAnimal.java new file mode 100644 index 000000000000..18f7c9f55be0 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/GrandparentAnimal.java @@ -0,0 +1,111 @@ +/* + * 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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ChildCat; +import org.openapitools.client.model.ParentPet; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * GrandparentAnimal + */ +@JsonPropertyOrder({ + GrandparentAnimal.JSON_PROPERTY_PET_TYPE +}) + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "pet_type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = ChildCat.class, name = "ChildCat"), + @JsonSubTypes.Type(value = ParentPet.class, name = "ParentPet"), +}) + +public class GrandparentAnimal { + public static final String JSON_PROPERTY_PET_TYPE = "pet_type"; + private String petType; + + + public GrandparentAnimal petType(String petType) { + + this.petType = petType; + return this; + } + + /** + * Get petType + * @return petType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_PET_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPetType() { + return petType; + } + + + public void setPetType(String petType) { + this.petType = petType; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GrandparentAnimal grandparentAnimal = (GrandparentAnimal) o; + return Objects.equals(this.petType, grandparentAnimal.petType); + } + + @Override + public int hashCode() { + return Objects.hash(petType); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GrandparentAnimal {\n"); + sb.append(" petType: ").append(toIndentedString(petType)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HealthCheckResult.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HealthCheckResult.java new file mode 100644 index 000000000000..efb77061df17 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HealthCheckResult.java @@ -0,0 +1,116 @@ +/* + * 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.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + */ +@ApiModel(description = "Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.") +@JsonPropertyOrder({ + HealthCheckResult.JSON_PROPERTY_NULLABLE_MESSAGE +}) + +public class HealthCheckResult { + public static final String JSON_PROPERTY_NULLABLE_MESSAGE = "NullableMessage"; + private JsonNullable nullableMessage = JsonNullable.undefined(); + + + public HealthCheckResult nullableMessage(String nullableMessage) { + this.nullableMessage = JsonNullable.of(nullableMessage); + + return this; + } + + /** + * Get nullableMessage + * @return nullableMessage + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public String getNullableMessage() { + return nullableMessage.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NULLABLE_MESSAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNullableMessage_JsonNullable() { + return nullableMessage; + } + + @JsonProperty(JSON_PROPERTY_NULLABLE_MESSAGE) + public void setNullableMessage_JsonNullable(JsonNullable nullableMessage) { + this.nullableMessage = nullableMessage; + } + + public void setNullableMessage(String nullableMessage) { + this.nullableMessage = JsonNullable.of(nullableMessage); + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HealthCheckResult healthCheckResult = (HealthCheckResult) o; + return Objects.equals(this.nullableMessage, healthCheckResult.nullableMessage); + } + + @Override + public int hashCode() { + return Objects.hash(nullableMessage); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HealthCheckResult {\n"); + sb.append(" nullableMessage: ").append(toIndentedString(nullableMessage)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject.java similarity index 64% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject.java index 4356a4f8c1eb..bb0804c5240e 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesBoolean.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject.java @@ -21,34 +21,36 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.HashMap; -import java.util.Map; import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** - * AdditionalPropertiesBoolean + * InlineObject */ @JsonPropertyOrder({ - AdditionalPropertiesBoolean.JSON_PROPERTY_NAME + InlineObject.JSON_PROPERTY_NAME, + InlineObject.JSON_PROPERTY_STATUS }) -public class AdditionalPropertiesBoolean extends HashMap { +public class InlineObject { public static final String JSON_PROPERTY_NAME = "name"; private String name; + public static final String JSON_PROPERTY_STATUS = "status"; + private String status; - public AdditionalPropertiesBoolean name(String name) { + + public InlineObject name(String name) { this.name = name; return this; } /** - * Get name + * Updated name of the pet * @return name **/ @javax.annotation.Nullable - @ApiModelProperty(value = "") + @ApiModelProperty(value = "Updated name of the pet") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) @@ -62,6 +64,31 @@ public void setName(String name) { } + public InlineObject status(String status) { + + this.status = status; + return this; + } + + /** + * Updated status of the pet + * @return status + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Updated status of the pet") + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -70,23 +97,23 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - AdditionalPropertiesBoolean additionalPropertiesBoolean = (AdditionalPropertiesBoolean) o; - return Objects.equals(this.name, additionalPropertiesBoolean.name) && - super.equals(o); + InlineObject inlineObject = (InlineObject) o; + return Objects.equals(this.name, inlineObject.name) && + Objects.equals(this.status, inlineObject.status); } @Override public int hashCode() { - return Objects.hash(name, super.hashCode()); + return Objects.hash(name, status); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesBoolean {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("class InlineObject {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject1.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject1.java new file mode 100644 index 000000000000..99b98f4c848e --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject1.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.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 java.io.File; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * InlineObject1 + */ +@JsonPropertyOrder({ + InlineObject1.JSON_PROPERTY_ADDITIONAL_METADATA, + InlineObject1.JSON_PROPERTY_FILE +}) + +public class InlineObject1 { + public static final String JSON_PROPERTY_ADDITIONAL_METADATA = "additionalMetadata"; + private String additionalMetadata; + + public static final String JSON_PROPERTY_FILE = "file"; + private File file; + + + public InlineObject1 additionalMetadata(String additionalMetadata) { + + this.additionalMetadata = additionalMetadata; + return this; + } + + /** + * Additional data to pass to server + * @return additionalMetadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Additional data to pass to server") + @JsonProperty(JSON_PROPERTY_ADDITIONAL_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAdditionalMetadata() { + return additionalMetadata; + } + + + public void setAdditionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + } + + + public InlineObject1 file(File file) { + + this.file = file; + return this; + } + + /** + * file to upload + * @return file + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "file to upload") + @JsonProperty(JSON_PROPERTY_FILE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public File getFile() { + return file; + } + + + public void setFile(File file) { + this.file = file; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject1 inlineObject1 = (InlineObject1) o; + return Objects.equals(this.additionalMetadata, inlineObject1.additionalMetadata) && + Objects.equals(this.file, inlineObject1.file); + } + + @Override + public int hashCode() { + return Objects.hash(additionalMetadata, file); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject1 {\n"); + sb.append(" additionalMetadata: ").append(toIndentedString(additionalMetadata)).append("\n"); + sb.append(" file: ").append(toIndentedString(file)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject2.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject2.java new file mode 100644 index 000000000000..468545bb3427 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject2.java @@ -0,0 +1,215 @@ +/* + * 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 java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * InlineObject2 + */ +@JsonPropertyOrder({ + InlineObject2.JSON_PROPERTY_ENUM_FORM_STRING_ARRAY, + InlineObject2.JSON_PROPERTY_ENUM_FORM_STRING +}) + +public class InlineObject2 { + /** + * Gets or Sets enumFormStringArray + */ + public enum EnumFormStringArrayEnum { + GREATER_THAN(">"), + + DOLLAR("$"); + + private String value; + + EnumFormStringArrayEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumFormStringArrayEnum fromValue(String value) { + for (EnumFormStringArrayEnum b : EnumFormStringArrayEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_FORM_STRING_ARRAY = "enum_form_string_array"; + private List enumFormStringArray = null; + + /** + * Form parameter enum test (string) + */ + public enum EnumFormStringEnum { + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumFormStringEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumFormStringEnum fromValue(String value) { + for (EnumFormStringEnum b : EnumFormStringEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ENUM_FORM_STRING = "enum_form_string"; + private EnumFormStringEnum enumFormString = EnumFormStringEnum._EFG; + + + public InlineObject2 enumFormStringArray(List enumFormStringArray) { + + this.enumFormStringArray = enumFormStringArray; + return this; + } + + public InlineObject2 addEnumFormStringArrayItem(EnumFormStringArrayEnum enumFormStringArrayItem) { + if (this.enumFormStringArray == null) { + this.enumFormStringArray = new ArrayList<>(); + } + this.enumFormStringArray.add(enumFormStringArrayItem); + return this; + } + + /** + * Form parameter enum test (string array) + * @return enumFormStringArray + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Form parameter enum test (string array)") + @JsonProperty(JSON_PROPERTY_ENUM_FORM_STRING_ARRAY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getEnumFormStringArray() { + return enumFormStringArray; + } + + + public void setEnumFormStringArray(List enumFormStringArray) { + this.enumFormStringArray = enumFormStringArray; + } + + + public InlineObject2 enumFormString(EnumFormStringEnum enumFormString) { + + this.enumFormString = enumFormString; + return this; + } + + /** + * Form parameter enum test (string) + * @return enumFormString + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Form parameter enum test (string)") + @JsonProperty(JSON_PROPERTY_ENUM_FORM_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public EnumFormStringEnum getEnumFormString() { + return enumFormString; + } + + + public void setEnumFormString(EnumFormStringEnum enumFormString) { + this.enumFormString = enumFormString; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject2 inlineObject2 = (InlineObject2) o; + return Objects.equals(this.enumFormStringArray, inlineObject2.enumFormStringArray) && + Objects.equals(this.enumFormString, inlineObject2.enumFormString); + } + + @Override + public int hashCode() { + return Objects.hash(enumFormStringArray, enumFormString); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject2 {\n"); + sb.append(" enumFormStringArray: ").append(toIndentedString(enumFormStringArray)).append("\n"); + sb.append(" enumFormString: ").append(toIndentedString(enumFormString)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject3.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject3.java new file mode 100644 index 000000000000..ed083c6ab539 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject3.java @@ -0,0 +1,514 @@ +/* + * 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 java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * InlineObject3 + */ +@JsonPropertyOrder({ + InlineObject3.JSON_PROPERTY_INTEGER, + InlineObject3.JSON_PROPERTY_INT32, + InlineObject3.JSON_PROPERTY_INT64, + InlineObject3.JSON_PROPERTY_NUMBER, + InlineObject3.JSON_PROPERTY_FLOAT, + InlineObject3.JSON_PROPERTY_DOUBLE, + InlineObject3.JSON_PROPERTY_STRING, + InlineObject3.JSON_PROPERTY_PATTERN_WITHOUT_DELIMITER, + InlineObject3.JSON_PROPERTY_BYTE, + InlineObject3.JSON_PROPERTY_BINARY, + InlineObject3.JSON_PROPERTY_DATE, + InlineObject3.JSON_PROPERTY_DATE_TIME, + InlineObject3.JSON_PROPERTY_PASSWORD, + InlineObject3.JSON_PROPERTY_CALLBACK +}) + +public class InlineObject3 { + public static final String JSON_PROPERTY_INTEGER = "integer"; + private Integer integer; + + public static final String JSON_PROPERTY_INT32 = "int32"; + private Integer int32; + + public static final String JSON_PROPERTY_INT64 = "int64"; + private Long int64; + + public static final String JSON_PROPERTY_NUMBER = "number"; + private BigDecimal number; + + public static final String JSON_PROPERTY_FLOAT = "float"; + private Float _float; + + public static final String JSON_PROPERTY_DOUBLE = "double"; + private Double _double; + + public static final String JSON_PROPERTY_STRING = "string"; + private String string; + + public static final String JSON_PROPERTY_PATTERN_WITHOUT_DELIMITER = "pattern_without_delimiter"; + private String patternWithoutDelimiter; + + public static final String JSON_PROPERTY_BYTE = "byte"; + private byte[] _byte; + + public static final String JSON_PROPERTY_BINARY = "binary"; + private File binary; + + public static final String JSON_PROPERTY_DATE = "date"; + private LocalDate date; + + public static final String JSON_PROPERTY_DATE_TIME = "dateTime"; + private OffsetDateTime dateTime; + + public static final String JSON_PROPERTY_PASSWORD = "password"; + private String password; + + public static final String JSON_PROPERTY_CALLBACK = "callback"; + private String callback; + + + public InlineObject3 integer(Integer integer) { + + this.integer = integer; + return this; + } + + /** + * None + * minimum: 10 + * maximum: 100 + * @return integer + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_INTEGER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getInteger() { + return integer; + } + + + public void setInteger(Integer integer) { + this.integer = integer; + } + + + public InlineObject3 int32(Integer int32) { + + this.int32 = int32; + return this; + } + + /** + * None + * minimum: 20 + * maximum: 200 + * @return int32 + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_INT32) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Integer getInt32() { + return int32; + } + + + public void setInt32(Integer int32) { + this.int32 = int32; + } + + + public InlineObject3 int64(Long int64) { + + this.int64 = int64; + return this; + } + + /** + * None + * @return int64 + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_INT64) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Long getInt64() { + return int64; + } + + + public void setInt64(Long int64) { + this.int64 = int64; + } + + + public InlineObject3 number(BigDecimal number) { + + this.number = number; + return this; + } + + /** + * None + * minimum: 32.1 + * maximum: 543.2 + * @return number + **/ + @ApiModelProperty(required = true, value = "None") + @JsonProperty(JSON_PROPERTY_NUMBER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public BigDecimal getNumber() { + return number; + } + + + public void setNumber(BigDecimal number) { + this.number = number; + } + + + public InlineObject3 _float(Float _float) { + + this._float = _float; + return this; + } + + /** + * None + * maximum: 987.6 + * @return _float + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_FLOAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Float getFloat() { + return _float; + } + + + public void setFloat(Float _float) { + this._float = _float; + } + + + public InlineObject3 _double(Double _double) { + + this._double = _double; + return this; + } + + /** + * None + * minimum: 67.8 + * maximum: 123.4 + * @return _double + **/ + @ApiModelProperty(required = true, value = "None") + @JsonProperty(JSON_PROPERTY_DOUBLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public Double getDouble() { + return _double; + } + + + public void setDouble(Double _double) { + this._double = _double; + } + + + public InlineObject3 string(String string) { + + this.string = string; + return this; + } + + /** + * None + * @return string + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_STRING) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getString() { + return string; + } + + + public void setString(String string) { + this.string = string; + } + + + public InlineObject3 patternWithoutDelimiter(String patternWithoutDelimiter) { + + this.patternWithoutDelimiter = patternWithoutDelimiter; + return this; + } + + /** + * None + * @return patternWithoutDelimiter + **/ + @ApiModelProperty(required = true, value = "None") + @JsonProperty(JSON_PROPERTY_PATTERN_WITHOUT_DELIMITER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getPatternWithoutDelimiter() { + return patternWithoutDelimiter; + } + + + public void setPatternWithoutDelimiter(String patternWithoutDelimiter) { + this.patternWithoutDelimiter = patternWithoutDelimiter; + } + + + public InlineObject3 _byte(byte[] _byte) { + + this._byte = _byte; + return this; + } + + /** + * None + * @return _byte + **/ + @ApiModelProperty(required = true, value = "None") + @JsonProperty(JSON_PROPERTY_BYTE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public byte[] getByte() { + return _byte; + } + + + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + + public InlineObject3 binary(File binary) { + + this.binary = binary; + return this; + } + + /** + * None + * @return binary + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_BINARY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public File getBinary() { + return binary; + } + + + public void setBinary(File binary) { + this.binary = binary; + } + + + public InlineObject3 date(LocalDate date) { + + this.date = date; + return this; + } + + /** + * None + * @return date + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_DATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public LocalDate getDate() { + return date; + } + + + public void setDate(LocalDate date) { + this.date = date; + } + + + public InlineObject3 dateTime(OffsetDateTime dateTime) { + + this.dateTime = dateTime; + return this; + } + + /** + * None + * @return dateTime + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_DATE_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public OffsetDateTime getDateTime() { + return dateTime; + } + + + public void setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + + public InlineObject3 password(String password) { + + this.password = password; + return this; + } + + /** + * None + * @return password + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_PASSWORD) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public InlineObject3 callback(String callback) { + + this.callback = callback; + return this; + } + + /** + * None + * @return callback + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "None") + @JsonProperty(JSON_PROPERTY_CALLBACK) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getCallback() { + return callback; + } + + + public void setCallback(String callback) { + this.callback = callback; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject3 inlineObject3 = (InlineObject3) o; + return Objects.equals(this.integer, inlineObject3.integer) && + Objects.equals(this.int32, inlineObject3.int32) && + Objects.equals(this.int64, inlineObject3.int64) && + Objects.equals(this.number, inlineObject3.number) && + Objects.equals(this._float, inlineObject3._float) && + Objects.equals(this._double, inlineObject3._double) && + Objects.equals(this.string, inlineObject3.string) && + Objects.equals(this.patternWithoutDelimiter, inlineObject3.patternWithoutDelimiter) && + Arrays.equals(this._byte, inlineObject3._byte) && + Objects.equals(this.binary, inlineObject3.binary) && + Objects.equals(this.date, inlineObject3.date) && + Objects.equals(this.dateTime, inlineObject3.dateTime) && + Objects.equals(this.password, inlineObject3.password) && + Objects.equals(this.callback, inlineObject3.callback); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, string, patternWithoutDelimiter, Arrays.hashCode(_byte), binary, date, dateTime, password, callback); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject3 {\n"); + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" patternWithoutDelimiter: ").append(toIndentedString(patternWithoutDelimiter)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" callback: ").append(toIndentedString(callback)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject4.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject4.java new file mode 100644 index 000000000000..953ca1d5b2bc --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject4.java @@ -0,0 +1,131 @@ +/* + * 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; + +/** + * InlineObject4 + */ +@JsonPropertyOrder({ + InlineObject4.JSON_PROPERTY_PARAM, + InlineObject4.JSON_PROPERTY_PARAM2 +}) + +public class InlineObject4 { + public static final String JSON_PROPERTY_PARAM = "param"; + private String param; + + public static final String JSON_PROPERTY_PARAM2 = "param2"; + private String param2; + + + public InlineObject4 param(String param) { + + this.param = param; + return this; + } + + /** + * field1 + * @return param + **/ + @ApiModelProperty(required = true, value = "field1") + @JsonProperty(JSON_PROPERTY_PARAM) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getParam() { + return param; + } + + + public void setParam(String param) { + this.param = param; + } + + + public InlineObject4 param2(String param2) { + + this.param2 = param2; + return this; + } + + /** + * field2 + * @return param2 + **/ + @ApiModelProperty(required = true, value = "field2") + @JsonProperty(JSON_PROPERTY_PARAM2) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getParam2() { + return param2; + } + + + public void setParam2(String param2) { + this.param2 = param2; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject4 inlineObject4 = (InlineObject4) o; + return Objects.equals(this.param, inlineObject4.param) && + Objects.equals(this.param2, inlineObject4.param2); + } + + @Override + public int hashCode() { + return Objects.hash(param, param2); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject4 {\n"); + sb.append(" param: ").append(toIndentedString(param)).append("\n"); + sb.append(" param2: ").append(toIndentedString(param2)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject5.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject5.java new file mode 100644 index 000000000000..1b079adfcf91 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineObject5.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.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 java.io.File; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * InlineObject5 + */ +@JsonPropertyOrder({ + InlineObject5.JSON_PROPERTY_ADDITIONAL_METADATA, + InlineObject5.JSON_PROPERTY_REQUIRED_FILE +}) + +public class InlineObject5 { + public static final String JSON_PROPERTY_ADDITIONAL_METADATA = "additionalMetadata"; + private String additionalMetadata; + + public static final String JSON_PROPERTY_REQUIRED_FILE = "requiredFile"; + private File requiredFile; + + + public InlineObject5 additionalMetadata(String additionalMetadata) { + + this.additionalMetadata = additionalMetadata; + return this; + } + + /** + * Additional data to pass to server + * @return additionalMetadata + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Additional data to pass to server") + @JsonProperty(JSON_PROPERTY_ADDITIONAL_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public String getAdditionalMetadata() { + return additionalMetadata; + } + + + public void setAdditionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + } + + + public InlineObject5 requiredFile(File requiredFile) { + + this.requiredFile = requiredFile; + return this; + } + + /** + * file to upload + * @return requiredFile + **/ + @ApiModelProperty(required = true, value = "file to upload") + @JsonProperty(JSON_PROPERTY_REQUIRED_FILE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public File getRequiredFile() { + return requiredFile; + } + + + public void setRequiredFile(File requiredFile) { + this.requiredFile = requiredFile; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InlineObject5 inlineObject5 = (InlineObject5) o; + return Objects.equals(this.additionalMetadata, inlineObject5.additionalMetadata) && + Objects.equals(this.requiredFile, inlineObject5.requiredFile); + } + + @Override + public int hashCode() { + return Objects.hash(additionalMetadata, requiredFile); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject5 {\n"); + sb.append(" additionalMetadata: ").append(toIndentedString(additionalMetadata)).append("\n"); + sb.append(" requiredFile: ").append(toIndentedString(requiredFile)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineResponseDefault.java similarity index 63% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineResponseDefault.java index 0f1223c2bc61..6b90bf2a18fa 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/InlineResponseDefault.java @@ -21,44 +21,43 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.HashMap; -import java.util.Map; +import org.openapitools.client.model.Foo; import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** - * AdditionalPropertiesAnyType + * InlineResponseDefault */ @JsonPropertyOrder({ - AdditionalPropertiesAnyType.JSON_PROPERTY_NAME + InlineResponseDefault.JSON_PROPERTY_STRING }) -public class AdditionalPropertiesAnyType extends HashMap { - public static final String JSON_PROPERTY_NAME = "name"; - private String name; +public class InlineResponseDefault { + public static final String JSON_PROPERTY_STRING = "string"; + private Foo string; - public AdditionalPropertiesAnyType name(String name) { + public InlineResponseDefault string(Foo string) { - this.name = name; + this.string = string; return this; } /** - * Get name - * @return name + * Get string + * @return string **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) + @JsonProperty(JSON_PROPERTY_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public String getName() { - return name; + public Foo getString() { + return string; } - public void setName(String name) { - this.name = name; + public void setString(Foo string) { + this.string = string; } @@ -70,23 +69,21 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - AdditionalPropertiesAnyType additionalPropertiesAnyType = (AdditionalPropertiesAnyType) o; - return Objects.equals(this.name, additionalPropertiesAnyType.name) && - super.equals(o); + InlineResponseDefault inlineResponseDefault = (InlineResponseDefault) o; + return Objects.equals(this.string, inlineResponseDefault.string); } @Override public int hashCode() { - return Objects.hash(name, super.hashCode()); + return Objects.hash(string); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesAnyType {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("class InlineResponseDefault {\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/IsoscelesTriangle.java new file mode 100644 index 000000000000..6282304a20bd --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/IsoscelesTriangle.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.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.ShapeInterface; +import org.openapitools.client.model.TriangleInterface; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * IsoscelesTriangle + */ +@JsonPropertyOrder({ + IsoscelesTriangle.JSON_PROPERTY_SHAPE_TYPE, + IsoscelesTriangle.JSON_PROPERTY_TRIANGLE_TYPE +}) + +public class IsoscelesTriangle { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + private String shapeType; + + public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType"; + private String triangleType; + + + public IsoscelesTriangle shapeType(String shapeType) { + + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + + public void setShapeType(String shapeType) { + this.shapeType = shapeType; + } + + + public IsoscelesTriangle triangleType(String triangleType) { + + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + + public void setTriangleType(String triangleType) { + this.triangleType = triangleType; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IsoscelesTriangle isoscelesTriangle = (IsoscelesTriangle) o; + return Objects.equals(this.shapeType, isoscelesTriangle.shapeType) && + Objects.equals(this.triangleType, isoscelesTriangle.triangleType); + } + + @Override + public int hashCode() { + return Objects.hash(shapeType, triangleType); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IsoscelesTriangle {\n"); + sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); + sb.append(" triangleType: ").append(toIndentedString(triangleType)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Mammal.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Mammal.java new file mode 100644 index 000000000000..dff6e3b29c0b --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Mammal.java @@ -0,0 +1,165 @@ +/* + * 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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=Mammal.MammalDeserializer.class) +public class Mammal extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Mammal.class.getName()); + + public static class MammalDeserializer extends StdDeserializer { + public MammalDeserializer() { + this(Mammal.class); + } + + public MammalDeserializer(Class vc) { + super(vc); + } + + @Override + public Mammal deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + + int match = 0; + Object deserialized = null; + // deserialize Pig + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Pig.class); + match++; + log.log(Level.FINER, "Input data matches schema 'Pig'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Pig'", e); + } + + // deserialize Whale + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Whale.class); + match++; + log.log(Level.FINER, "Input data matches schema 'Whale'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Whale'", e); + } + + // deserialize Zebra + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Zebra.class); + match++; + log.log(Level.FINER, "Input data matches schema 'Zebra'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Zebra'", e); + } + + if (match == 1) { + Mammal ret = new Mammal(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for Mammal: %d classes match result, expected 1", match)); + } + } + + // store a list of schema names defined in oneOf + public final static Map schemas = new HashMap(); + + public Mammal() { + super("oneOf", Boolean.FALSE); + } + + public Mammal(Pig o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Mammal(Whale o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Mammal(Zebra o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Pig", new GenericType() { + }); + schemas.put("Whale", new GenericType() { + }); + schemas.put("Zebra", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return Mammal.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof Pig) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof Whale) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof Zebra) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Pig, Whale, Zebra"); + } + + + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableClass.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableClass.java new file mode 100644 index 000000000000..6ade4828624e --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableClass.java @@ -0,0 +1,619 @@ +/* + * 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 java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * NullableClass + */ +@JsonPropertyOrder({ + NullableClass.JSON_PROPERTY_INTEGER_PROP, + NullableClass.JSON_PROPERTY_NUMBER_PROP, + NullableClass.JSON_PROPERTY_BOOLEAN_PROP, + NullableClass.JSON_PROPERTY_STRING_PROP, + NullableClass.JSON_PROPERTY_DATE_PROP, + NullableClass.JSON_PROPERTY_DATETIME_PROP, + NullableClass.JSON_PROPERTY_ARRAY_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_ARRAY_ITEMS_NULLABLE, + NullableClass.JSON_PROPERTY_OBJECT_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP, + NullableClass.JSON_PROPERTY_OBJECT_ITEMS_NULLABLE +}) + +public class NullableClass extends HashMap { + public static final String JSON_PROPERTY_INTEGER_PROP = "integer_prop"; + private JsonNullable integerProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_NUMBER_PROP = "number_prop"; + private JsonNullable numberProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_BOOLEAN_PROP = "boolean_prop"; + private JsonNullable booleanProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_STRING_PROP = "string_prop"; + private JsonNullable stringProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DATE_PROP = "date_prop"; + private JsonNullable dateProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DATETIME_PROP = "datetime_prop"; + private JsonNullable datetimeProp = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ARRAY_NULLABLE_PROP = "array_nullable_prop"; + private JsonNullable> arrayNullableProp = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP = "array_and_items_nullable_prop"; + private JsonNullable> arrayAndItemsNullableProp = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_ARRAY_ITEMS_NULLABLE = "array_items_nullable"; + private List arrayItemsNullable = null; + + public static final String JSON_PROPERTY_OBJECT_NULLABLE_PROP = "object_nullable_prop"; + private JsonNullable> objectNullableProp = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP = "object_and_items_nullable_prop"; + private JsonNullable> objectAndItemsNullableProp = JsonNullable.>undefined(); + + public static final String JSON_PROPERTY_OBJECT_ITEMS_NULLABLE = "object_items_nullable"; + private Map objectItemsNullable = null; + + + public NullableClass integerProp(Integer integerProp) { + this.integerProp = JsonNullable.of(integerProp); + + return this; + } + + /** + * Get integerProp + * @return integerProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public Integer getIntegerProp() { + return integerProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INTEGER_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getIntegerProp_JsonNullable() { + return integerProp; + } + + @JsonProperty(JSON_PROPERTY_INTEGER_PROP) + public void setIntegerProp_JsonNullable(JsonNullable integerProp) { + this.integerProp = integerProp; + } + + public void setIntegerProp(Integer integerProp) { + this.integerProp = JsonNullable.of(integerProp); + } + + + public NullableClass numberProp(BigDecimal numberProp) { + this.numberProp = JsonNullable.of(numberProp); + + return this; + } + + /** + * Get numberProp + * @return numberProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public BigDecimal getNumberProp() { + return numberProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_NUMBER_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getNumberProp_JsonNullable() { + return numberProp; + } + + @JsonProperty(JSON_PROPERTY_NUMBER_PROP) + public void setNumberProp_JsonNullable(JsonNullable numberProp) { + this.numberProp = numberProp; + } + + public void setNumberProp(BigDecimal numberProp) { + this.numberProp = JsonNullable.of(numberProp); + } + + + public NullableClass booleanProp(Boolean booleanProp) { + this.booleanProp = JsonNullable.of(booleanProp); + + return this; + } + + /** + * Get booleanProp + * @return booleanProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public Boolean getBooleanProp() { + return booleanProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_BOOLEAN_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getBooleanProp_JsonNullable() { + return booleanProp; + } + + @JsonProperty(JSON_PROPERTY_BOOLEAN_PROP) + public void setBooleanProp_JsonNullable(JsonNullable booleanProp) { + this.booleanProp = booleanProp; + } + + public void setBooleanProp(Boolean booleanProp) { + this.booleanProp = JsonNullable.of(booleanProp); + } + + + public NullableClass stringProp(String stringProp) { + this.stringProp = JsonNullable.of(stringProp); + + return this; + } + + /** + * Get stringProp + * @return stringProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public String getStringProp() { + return stringProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_STRING_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getStringProp_JsonNullable() { + return stringProp; + } + + @JsonProperty(JSON_PROPERTY_STRING_PROP) + public void setStringProp_JsonNullable(JsonNullable stringProp) { + this.stringProp = stringProp; + } + + public void setStringProp(String stringProp) { + this.stringProp = JsonNullable.of(stringProp); + } + + + public NullableClass dateProp(LocalDate dateProp) { + this.dateProp = JsonNullable.of(dateProp); + + return this; + } + + /** + * Get dateProp + * @return dateProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public LocalDate getDateProp() { + return dateProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DATE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDateProp_JsonNullable() { + return dateProp; + } + + @JsonProperty(JSON_PROPERTY_DATE_PROP) + public void setDateProp_JsonNullable(JsonNullable dateProp) { + this.dateProp = dateProp; + } + + public void setDateProp(LocalDate dateProp) { + this.dateProp = JsonNullable.of(dateProp); + } + + + public NullableClass datetimeProp(OffsetDateTime datetimeProp) { + this.datetimeProp = JsonNullable.of(datetimeProp); + + return this; + } + + /** + * Get datetimeProp + * @return datetimeProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public OffsetDateTime getDatetimeProp() { + return datetimeProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DATETIME_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getDatetimeProp_JsonNullable() { + return datetimeProp; + } + + @JsonProperty(JSON_PROPERTY_DATETIME_PROP) + public void setDatetimeProp_JsonNullable(JsonNullable datetimeProp) { + this.datetimeProp = datetimeProp; + } + + public void setDatetimeProp(OffsetDateTime datetimeProp) { + this.datetimeProp = JsonNullable.of(datetimeProp); + } + + + public NullableClass arrayNullableProp(List arrayNullableProp) { + this.arrayNullableProp = JsonNullable.>of(arrayNullableProp); + + return this; + } + + public NullableClass addArrayNullablePropItem(Object arrayNullablePropItem) { + if (this.arrayNullableProp == null || !this.arrayNullableProp.isPresent()) { + this.arrayNullableProp = JsonNullable.>of(new ArrayList<>()); + } + try { + this.arrayNullableProp.get().add(arrayNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get arrayNullableProp + * @return arrayNullableProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public List getArrayNullableProp() { + return arrayNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getArrayNullableProp_JsonNullable() { + return arrayNullableProp; + } + + @JsonProperty(JSON_PROPERTY_ARRAY_NULLABLE_PROP) + public void setArrayNullableProp_JsonNullable(JsonNullable> arrayNullableProp) { + this.arrayNullableProp = arrayNullableProp; + } + + public void setArrayNullableProp(List arrayNullableProp) { + this.arrayNullableProp = JsonNullable.>of(arrayNullableProp); + } + + + public NullableClass arrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = JsonNullable.>of(arrayAndItemsNullableProp); + + return this; + } + + public NullableClass addArrayAndItemsNullablePropItem(Object arrayAndItemsNullablePropItem) { + if (this.arrayAndItemsNullableProp == null || !this.arrayAndItemsNullableProp.isPresent()) { + this.arrayAndItemsNullableProp = JsonNullable.>of(new ArrayList<>()); + } + try { + this.arrayAndItemsNullableProp.get().add(arrayAndItemsNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get arrayAndItemsNullableProp + * @return arrayAndItemsNullableProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public List getArrayAndItemsNullableProp() { + return arrayAndItemsNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getArrayAndItemsNullableProp_JsonNullable() { + return arrayAndItemsNullableProp; + } + + @JsonProperty(JSON_PROPERTY_ARRAY_AND_ITEMS_NULLABLE_PROP) + public void setArrayAndItemsNullableProp_JsonNullable(JsonNullable> arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = arrayAndItemsNullableProp; + } + + public void setArrayAndItemsNullableProp(List arrayAndItemsNullableProp) { + this.arrayAndItemsNullableProp = JsonNullable.>of(arrayAndItemsNullableProp); + } + + + public NullableClass arrayItemsNullable(List arrayItemsNullable) { + + this.arrayItemsNullable = arrayItemsNullable; + return this; + } + + public NullableClass addArrayItemsNullableItem(Object arrayItemsNullableItem) { + if (this.arrayItemsNullable == null) { + this.arrayItemsNullable = new ArrayList<>(); + } + this.arrayItemsNullable.add(arrayItemsNullableItem); + return this; + } + + /** + * Get arrayItemsNullable + * @return arrayItemsNullable + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_ARRAY_ITEMS_NULLABLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public List getArrayItemsNullable() { + return arrayItemsNullable; + } + + + public void setArrayItemsNullable(List arrayItemsNullable) { + this.arrayItemsNullable = arrayItemsNullable; + } + + + public NullableClass objectNullableProp(Map objectNullableProp) { + this.objectNullableProp = JsonNullable.>of(objectNullableProp); + + return this; + } + + public NullableClass putObjectNullablePropItem(String key, Object objectNullablePropItem) { + if (this.objectNullableProp == null || !this.objectNullableProp.isPresent()) { + this.objectNullableProp = JsonNullable.>of(new HashMap<>()); + } + try { + this.objectNullableProp.get().put(key, objectNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get objectNullableProp + * @return objectNullableProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public Map getObjectNullableProp() { + return objectNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getObjectNullableProp_JsonNullable() { + return objectNullableProp; + } + + @JsonProperty(JSON_PROPERTY_OBJECT_NULLABLE_PROP) + public void setObjectNullableProp_JsonNullable(JsonNullable> objectNullableProp) { + this.objectNullableProp = objectNullableProp; + } + + public void setObjectNullableProp(Map objectNullableProp) { + this.objectNullableProp = JsonNullable.>of(objectNullableProp); + } + + + public NullableClass objectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = JsonNullable.>of(objectAndItemsNullableProp); + + return this; + } + + public NullableClass putObjectAndItemsNullablePropItem(String key, Object objectAndItemsNullablePropItem) { + if (this.objectAndItemsNullableProp == null || !this.objectAndItemsNullableProp.isPresent()) { + this.objectAndItemsNullableProp = JsonNullable.>of(new HashMap<>()); + } + try { + this.objectAndItemsNullableProp.get().put(key, objectAndItemsNullablePropItem); + } catch (java.util.NoSuchElementException e) { + // this can never happen, as we make sure above that the value is present + } + return this; + } + + /** + * Get objectAndItemsNullableProp + * @return objectAndItemsNullableProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonIgnore + + public Map getObjectAndItemsNullableProp() { + return objectAndItemsNullableProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable> getObjectAndItemsNullableProp_JsonNullable() { + return objectAndItemsNullableProp; + } + + @JsonProperty(JSON_PROPERTY_OBJECT_AND_ITEMS_NULLABLE_PROP) + public void setObjectAndItemsNullableProp_JsonNullable(JsonNullable> objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = objectAndItemsNullableProp; + } + + public void setObjectAndItemsNullableProp(Map objectAndItemsNullableProp) { + this.objectAndItemsNullableProp = JsonNullable.>of(objectAndItemsNullableProp); + } + + + public NullableClass objectItemsNullable(Map objectItemsNullable) { + + this.objectItemsNullable = objectItemsNullable; + return this; + } + + public NullableClass putObjectItemsNullableItem(String key, Object objectItemsNullableItem) { + if (this.objectItemsNullable == null) { + this.objectItemsNullable = new HashMap<>(); + } + this.objectItemsNullable.put(key, objectItemsNullableItem); + return this; + } + + /** + * Get objectItemsNullable + * @return objectItemsNullable + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_OBJECT_ITEMS_NULLABLE) + @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) + + public Map getObjectItemsNullable() { + return objectItemsNullable; + } + + + public void setObjectItemsNullable(Map objectItemsNullable) { + this.objectItemsNullable = objectItemsNullable; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NullableClass nullableClass = (NullableClass) o; + return Objects.equals(this.integerProp, nullableClass.integerProp) && + Objects.equals(this.numberProp, nullableClass.numberProp) && + Objects.equals(this.booleanProp, nullableClass.booleanProp) && + Objects.equals(this.stringProp, nullableClass.stringProp) && + Objects.equals(this.dateProp, nullableClass.dateProp) && + Objects.equals(this.datetimeProp, nullableClass.datetimeProp) && + Objects.equals(this.arrayNullableProp, nullableClass.arrayNullableProp) && + Objects.equals(this.arrayAndItemsNullableProp, nullableClass.arrayAndItemsNullableProp) && + Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) && + Objects.equals(this.objectNullableProp, nullableClass.objectNullableProp) && + Objects.equals(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) && + Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(integerProp, numberProp, booleanProp, stringProp, dateProp, datetimeProp, arrayNullableProp, arrayAndItemsNullableProp, arrayItemsNullable, objectNullableProp, objectAndItemsNullableProp, objectItemsNullable, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NullableClass {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" integerProp: ").append(toIndentedString(integerProp)).append("\n"); + sb.append(" numberProp: ").append(toIndentedString(numberProp)).append("\n"); + sb.append(" booleanProp: ").append(toIndentedString(booleanProp)).append("\n"); + sb.append(" stringProp: ").append(toIndentedString(stringProp)).append("\n"); + sb.append(" dateProp: ").append(toIndentedString(dateProp)).append("\n"); + sb.append(" datetimeProp: ").append(toIndentedString(datetimeProp)).append("\n"); + sb.append(" arrayNullableProp: ").append(toIndentedString(arrayNullableProp)).append("\n"); + sb.append(" arrayAndItemsNullableProp: ").append(toIndentedString(arrayAndItemsNullableProp)).append("\n"); + sb.append(" arrayItemsNullable: ").append(toIndentedString(arrayItemsNullable)).append("\n"); + sb.append(" objectNullableProp: ").append(toIndentedString(objectNullableProp)).append("\n"); + sb.append(" objectAndItemsNullableProp: ").append(toIndentedString(objectAndItemsNullableProp)).append("\n"); + sb.append(" objectItemsNullable: ").append(toIndentedString(objectItemsNullable)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableShape.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableShape.java new file mode 100644 index 000000000000..bdf4fc1dc388 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NullableShape.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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=NullableShape.NullableShapeDeserializer.class) +public class NullableShape extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(NullableShape.class.getName()); + + public static class NullableShapeDeserializer extends StdDeserializer { + public NullableShapeDeserializer() { + this(NullableShape.class); + } + + public NullableShapeDeserializer(Class vc) { + super(vc); + } + + @Override + public NullableShape deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + + int match = 0; + Object deserialized = null; + // deserialize Quadrilateral + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); + match++; + log.log(Level.FINER, "Input data matches schema 'Quadrilateral'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e); + } + + // deserialize Triangle + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); + match++; + log.log(Level.FINER, "Input data matches schema 'Triangle'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Triangle'", e); + } + + if (match == 1) { + NullableShape ret = new NullableShape(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for NullableShape: %d classes match result, expected 1", match)); + } + } + + // store a list of schema names defined in oneOf + public final static Map schemas = new HashMap(); + + public NullableShape() { + super("oneOf", Boolean.TRUE); + } + + public NullableShape(Quadrilateral o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + public NullableShape(Triangle o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + static { + schemas.put("Quadrilateral", new GenericType() { + }); + schemas.put("Triangle", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return NullableShape.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof Quadrilateral) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof Triangle) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnum.java index 308646a320c7..d0c0bc3c9d20 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnum.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -54,7 +54,7 @@ public static OuterEnum fromValue(String value) { return b; } } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + return null; } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java new file mode 100644 index 000000000000..7f6c2c73aa24 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumDefaultValue.java @@ -0,0 +1,60 @@ +/* + * 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.JsonPropertyOrder; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumDefaultValue + */ +public enum OuterEnumDefaultValue { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnumDefaultValue(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumDefaultValue fromValue(String value) { + for (OuterEnumDefaultValue b : OuterEnumDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumInteger.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumInteger.java new file mode 100644 index 000000000000..c747a2e6daef --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumInteger.java @@ -0,0 +1,60 @@ +/* + * 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.JsonPropertyOrder; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumInteger + */ +public enum OuterEnumInteger { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumInteger(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumInteger fromValue(Integer value) { + for (OuterEnumInteger b : OuterEnumInteger.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java new file mode 100644 index 000000000000..4f5fcd1cd95f --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterEnumIntegerDefaultValue.java @@ -0,0 +1,60 @@ +/* + * 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.JsonPropertyOrder; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnumIntegerDefaultValue + */ +public enum OuterEnumIntegerDefaultValue { + + NUMBER_0(0), + + NUMBER_1(1), + + NUMBER_2(2); + + private Integer value; + + OuterEnumIntegerDefaultValue(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnumIntegerDefaultValue fromValue(Integer value) { + for (OuterEnumIntegerDefaultValue b : OuterEnumIntegerDefaultValue.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ParentPet.java similarity index 60% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ParentPet.java index 2426e7c974c4..5b3dc1ffcaa0 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/AdditionalPropertiesInteger.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ParentPet.java @@ -18,49 +18,27 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.HashMap; -import java.util.Map; +import org.openapitools.client.model.ChildCat; +import org.openapitools.client.model.GrandparentAnimal; import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** - * AdditionalPropertiesInteger + * ParentPet */ @JsonPropertyOrder({ - AdditionalPropertiesInteger.JSON_PROPERTY_NAME }) -public class AdditionalPropertiesInteger extends HashMap { - public static final String JSON_PROPERTY_NAME = "name"; - private String name; - - - public AdditionalPropertiesInteger name(String name) { - - this.name = name; - return this; - } - - /** - * Get name - * @return name - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public String getName() { - return name; - } - - - public void setName(String name) { - this.name = name; - } +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "pet_type", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = ChildCat.class, name = "ChildCat"), +}) +public class ParentPet extends GrandparentAnimal { @Override public boolean equals(java.lang.Object o) { @@ -70,23 +48,20 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - AdditionalPropertiesInteger additionalPropertiesInteger = (AdditionalPropertiesInteger) o; - return Objects.equals(this.name, additionalPropertiesInteger.name) && - super.equals(o); + return super.equals(o); } @Override public int hashCode() { - return Objects.hash(name, super.hashCode()); + return Objects.hash(super.hashCode()); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class AdditionalPropertiesInteger {\n"); + sb.append("class ParentPet {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java index 3baccce6f9c4..2df466732f74 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java @@ -22,9 +22,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; -import java.util.LinkedHashSet; import java.util.List; -import java.util.Set; import org.openapitools.client.model.Category; import org.openapitools.client.model.Tag; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -52,7 +50,7 @@ public class Pet { private String name; public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; - private Set photoUrls = new LinkedHashSet<>(); + private List photoUrls = new ArrayList<>(); public static final String JSON_PROPERTY_TAGS = "tags"; private List tags = null; @@ -172,7 +170,7 @@ public void setName(String name) { } - public Pet photoUrls(Set photoUrls) { + public Pet photoUrls(List photoUrls) { this.photoUrls = photoUrls; return this; @@ -191,12 +189,12 @@ public Pet addPhotoUrlsItem(String photoUrlsItem) { @JsonProperty(JSON_PROPERTY_PHOTO_URLS) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public Set getPhotoUrls() { + public List getPhotoUrls() { return photoUrls; } - public void setPhotoUrls(Set photoUrls) { + public void setPhotoUrls(List photoUrls) { this.photoUrls = photoUrls; } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pig.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pig.java new file mode 100644 index 000000000000..edf17c3ce78d --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pig.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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.BasquePig; +import org.openapitools.client.model.DanishPig; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=Pig.PigDeserializer.class) +public class Pig extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Pig.class.getName()); + + public static class PigDeserializer extends StdDeserializer { + public PigDeserializer() { + this(Pig.class); + } + + public PigDeserializer(Class vc) { + super(vc); + } + + @Override + public Pig deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + + int match = 0; + Object deserialized = null; + // deserialize BasquePig + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(BasquePig.class); + match++; + log.log(Level.FINER, "Input data matches schema 'BasquePig'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'BasquePig'", e); + } + + // deserialize DanishPig + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(DanishPig.class); + match++; + log.log(Level.FINER, "Input data matches schema 'DanishPig'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'DanishPig'", e); + } + + if (match == 1) { + Pig ret = new Pig(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for Pig: %d classes match result, expected 1", match)); + } + } + + // store a list of schema names defined in oneOf + public final static Map schemas = new HashMap(); + + public Pig() { + super("oneOf", Boolean.FALSE); + } + + public Pig(BasquePig o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Pig(DanishPig o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("BasquePig", new GenericType() { + }); + schemas.put("DanishPig", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return Pig.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof BasquePig) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof DanishPig) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be BasquePig, DanishPig"); + } + + + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Quadrilateral.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Quadrilateral.java new file mode 100644 index 000000000000..a943d3b0db3a --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Quadrilateral.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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ComplexQuadrilateral; +import org.openapitools.client.model.SimpleQuadrilateral; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=Quadrilateral.QuadrilateralDeserializer.class) +public class Quadrilateral extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Quadrilateral.class.getName()); + + public static class QuadrilateralDeserializer extends StdDeserializer { + public QuadrilateralDeserializer() { + this(Quadrilateral.class); + } + + public QuadrilateralDeserializer(Class vc) { + super(vc); + } + + @Override + public Quadrilateral deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + + int match = 0; + Object deserialized = null; + // deserialize ComplexQuadrilateral + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(ComplexQuadrilateral.class); + match++; + log.log(Level.FINER, "Input data matches schema 'ComplexQuadrilateral'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ComplexQuadrilateral'", e); + } + + // deserialize SimpleQuadrilateral + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(SimpleQuadrilateral.class); + match++; + log.log(Level.FINER, "Input data matches schema 'SimpleQuadrilateral'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'SimpleQuadrilateral'", e); + } + + if (match == 1) { + Quadrilateral ret = new Quadrilateral(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for Quadrilateral: %d classes match result, expected 1", match)); + } + } + + // store a list of schema names defined in oneOf + public final static Map schemas = new HashMap(); + + public Quadrilateral() { + super("oneOf", Boolean.FALSE); + } + + public Quadrilateral(ComplexQuadrilateral o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Quadrilateral(SimpleQuadrilateral o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("ComplexQuadrilateral", new GenericType() { + }); + schemas.put("SimpleQuadrilateral", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return Quadrilateral.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof ComplexQuadrilateral) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof SimpleQuadrilateral) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be ComplexQuadrilateral, SimpleQuadrilateral"); + } + + + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java new file mode 100644 index 000000000000..7a586c4ca775 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/QuadrilateralInterface.java @@ -0,0 +1,101 @@ +/* + * 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; + +/** + * QuadrilateralInterface + */ +@JsonPropertyOrder({ + QuadrilateralInterface.JSON_PROPERTY_QUADRILATERAL_TYPE +}) + +public class QuadrilateralInterface { + public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType"; + private String quadrilateralType; + + + public QuadrilateralInterface quadrilateralType(String quadrilateralType) { + + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getQuadrilateralType() { + return quadrilateralType; + } + + + public void setQuadrilateralType(String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QuadrilateralInterface quadrilateralInterface = (QuadrilateralInterface) o; + return Objects.equals(this.quadrilateralType, quadrilateralInterface.quadrilateralType); + } + + @Override + public int hashCode() { + return Objects.hash(quadrilateralType); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QuadrilateralInterface {\n"); + sb.append(" quadrilateralType: ").append(toIndentedString(quadrilateralType)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ScaleneTriangle.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ScaleneTriangle.java new file mode 100644 index 000000000000..b8f6d9955d57 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ScaleneTriangle.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.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.ShapeInterface; +import org.openapitools.client.model.TriangleInterface; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * ScaleneTriangle + */ +@JsonPropertyOrder({ + ScaleneTriangle.JSON_PROPERTY_SHAPE_TYPE, + ScaleneTriangle.JSON_PROPERTY_TRIANGLE_TYPE +}) + +public class ScaleneTriangle { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + private String shapeType; + + public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType"; + private String triangleType; + + + public ScaleneTriangle shapeType(String shapeType) { + + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + + public void setShapeType(String shapeType) { + this.shapeType = shapeType; + } + + + public ScaleneTriangle triangleType(String triangleType) { + + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + + public void setTriangleType(String triangleType) { + this.triangleType = triangleType; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ScaleneTriangle scaleneTriangle = (ScaleneTriangle) o; + return Objects.equals(this.shapeType, scaleneTriangle.shapeType) && + Objects.equals(this.triangleType, scaleneTriangle.triangleType); + } + + @Override + public int hashCode() { + return Objects.hash(shapeType, triangleType); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ScaleneTriangle {\n"); + sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); + sb.append(" triangleType: ").append(toIndentedString(triangleType)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Shape.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Shape.java new file mode 100644 index 000000000000..b97481242e5d --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Shape.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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=Shape.ShapeDeserializer.class) +public class Shape extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Shape.class.getName()); + + public static class ShapeDeserializer extends StdDeserializer { + public ShapeDeserializer() { + this(Shape.class); + } + + public ShapeDeserializer(Class vc) { + super(vc); + } + + @Override + public Shape deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + + int match = 0; + Object deserialized = null; + // deserialize Quadrilateral + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); + match++; + log.log(Level.FINER, "Input data matches schema 'Quadrilateral'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e); + } + + // deserialize Triangle + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); + match++; + log.log(Level.FINER, "Input data matches schema 'Triangle'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Triangle'", e); + } + + if (match == 1) { + Shape ret = new Shape(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for Shape: %d classes match result, expected 1", match)); + } + } + + // store a list of schema names defined in oneOf + public final static Map schemas = new HashMap(); + + public Shape() { + super("oneOf", Boolean.FALSE); + } + + public Shape(Quadrilateral o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Shape(Triangle o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Quadrilateral", new GenericType() { + }); + schemas.put("Triangle", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return Shape.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof Quadrilateral) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof Triangle) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ShapeInterface.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ShapeInterface.java new file mode 100644 index 000000000000..2b4cf2193066 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ShapeInterface.java @@ -0,0 +1,101 @@ +/* + * 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; + +/** + * ShapeInterface + */ +@JsonPropertyOrder({ + ShapeInterface.JSON_PROPERTY_SHAPE_TYPE +}) + +public class ShapeInterface { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + private String shapeType; + + + public ShapeInterface shapeType(String shapeType) { + + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + + public void setShapeType(String shapeType) { + this.shapeType = shapeType; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ShapeInterface shapeInterface = (ShapeInterface) o; + return Objects.equals(this.shapeType, shapeInterface.shapeType); + } + + @Override + public int hashCode() { + return Objects.hash(shapeType); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ShapeInterface {\n"); + sb.append(" shapeType: ").append(toIndentedString(shapeType)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ShapeOrNull.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ShapeOrNull.java new file mode 100644 index 000000000000..6a47a10de5f0 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ShapeOrNull.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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=ShapeOrNull.ShapeOrNullDeserializer.class) +public class ShapeOrNull extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(ShapeOrNull.class.getName()); + + public static class ShapeOrNullDeserializer extends StdDeserializer { + public ShapeOrNullDeserializer() { + this(ShapeOrNull.class); + } + + public ShapeOrNullDeserializer(Class vc) { + super(vc); + } + + @Override + public ShapeOrNull deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + + int match = 0; + Object deserialized = null; + // deserialize Quadrilateral + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Quadrilateral.class); + match++; + log.log(Level.FINER, "Input data matches schema 'Quadrilateral'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Quadrilateral'", e); + } + + // deserialize Triangle + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(Triangle.class); + match++; + log.log(Level.FINER, "Input data matches schema 'Triangle'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'Triangle'", e); + } + + if (match == 1) { + ShapeOrNull ret = new ShapeOrNull(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for ShapeOrNull: %d classes match result, expected 1", match)); + } + } + + // store a list of schema names defined in oneOf + public final static Map schemas = new HashMap(); + + public ShapeOrNull() { + super("oneOf", Boolean.TRUE); + } + + public ShapeOrNull(Quadrilateral o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + public ShapeOrNull(Triangle o) { + super("oneOf", Boolean.TRUE); + setActualInstance(o); + } + + static { + schemas.put("Quadrilateral", new GenericType() { + }); + schemas.put("Triangle", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return ShapeOrNull.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof Quadrilateral) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof Triangle) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be Quadrilateral, Triangle"); + } + + + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.java new file mode 100644 index 000000000000..0ad65aa09dd6 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SimpleQuadrilateral.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.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.QuadrilateralInterface; +import org.openapitools.client.model.ShapeInterface; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +/** + * SimpleQuadrilateral + */ +@JsonPropertyOrder({ + SimpleQuadrilateral.JSON_PROPERTY_SHAPE_TYPE, + SimpleQuadrilateral.JSON_PROPERTY_QUADRILATERAL_TYPE +}) + +public class SimpleQuadrilateral { + public static final String JSON_PROPERTY_SHAPE_TYPE = "shapeType"; + private String shapeType; + + public static final String JSON_PROPERTY_QUADRILATERAL_TYPE = "quadrilateralType"; + private String quadrilateralType; + + + public SimpleQuadrilateral shapeType(String shapeType) { + + this.shapeType = shapeType; + return this; + } + + /** + * Get shapeType + * @return shapeType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_SHAPE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getShapeType() { + return shapeType; + } + + + public void setShapeType(String shapeType) { + this.shapeType = shapeType; + } + + + public SimpleQuadrilateral quadrilateralType(String quadrilateralType) { + + this.quadrilateralType = quadrilateralType; + return this; + } + + /** + * Get quadrilateralType + * @return quadrilateralType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_QUADRILATERAL_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getQuadrilateralType() { + return quadrilateralType; + } + + + public void setQuadrilateralType(String quadrilateralType) { + this.quadrilateralType = quadrilateralType; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SimpleQuadrilateral simpleQuadrilateral = (SimpleQuadrilateral) o; + return Objects.equals(this.shapeType, simpleQuadrilateral.shapeType) && + Objects.equals(this.quadrilateralType, simpleQuadrilateral.quadrilateralType); + } + + @Override + public int hashCode() { + return Objects.hash(shapeType, quadrilateralType); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SimpleQuadrilateral {\n"); + sb.append(" shapeType: ").append(toIndentedString(shapeType)).append("\n"); + sb.append(" quadrilateralType: ").append(toIndentedString(quadrilateralType)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java index 35ad3bf46994..b588ef95226b 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -68,8 +68,8 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - SpecialModelName $specialModelName = (SpecialModelName) o; - return Objects.equals(this.$specialPropertyName, $specialModelName.$specialPropertyName); + SpecialModelName specialModelName = (SpecialModelName) o; + return Objects.equals(this.$specialPropertyName, specialModelName.$specialPropertyName); } @Override diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Triangle.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Triangle.java new file mode 100644 index 000000000000..0db61e7c1601 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Triangle.java @@ -0,0 +1,165 @@ +/* + * 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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.EquilateralTriangle; +import org.openapitools.client.model.IsoscelesTriangle; +import org.openapitools.client.model.ScaleneTriangle; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import javax.ws.rs.core.GenericType; +import javax.ws.rs.core.Response; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; + + +@JsonDeserialize(using=Triangle.TriangleDeserializer.class) +public class Triangle extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Triangle.class.getName()); + + public static class TriangleDeserializer extends StdDeserializer { + public TriangleDeserializer() { + this(Triangle.class); + } + + public TriangleDeserializer(Class vc) { + super(vc); + } + + @Override + public Triangle deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + + int match = 0; + Object deserialized = null; + // deserialize EquilateralTriangle + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(EquilateralTriangle.class); + match++; + log.log(Level.FINER, "Input data matches schema 'EquilateralTriangle'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'EquilateralTriangle'", e); + } + + // deserialize IsoscelesTriangle + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(IsoscelesTriangle.class); + match++; + log.log(Level.FINER, "Input data matches schema 'IsoscelesTriangle'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'IsoscelesTriangle'", e); + } + + // deserialize ScaleneTriangle + try { + deserialized = tree.traverse(jp.getCodec()).readValueAs(ScaleneTriangle.class); + match++; + log.log(Level.FINER, "Input data matches schema 'ScaleneTriangle'"); + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ScaleneTriangle'", e); + } + + if (match == 1) { + Triangle ret = new Triangle(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format("Failed deserialization for Triangle: %d classes match result, expected 1", match)); + } + } + + // store a list of schema names defined in oneOf + public final static Map schemas = new HashMap(); + + public Triangle() { + super("oneOf", Boolean.FALSE); + } + + public Triangle(EquilateralTriangle o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Triangle(IsoscelesTriangle o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public Triangle(ScaleneTriangle o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("EquilateralTriangle", new GenericType() { + }); + schemas.put("IsoscelesTriangle", new GenericType() { + }); + schemas.put("ScaleneTriangle", new GenericType() { + }); + } + + @Override + public Map getSchemas() { + return Triangle.schemas; + } + + @Override + public void setActualInstance(Object instance) { + if (instance instanceof EquilateralTriangle) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof IsoscelesTriangle) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof ScaleneTriangle) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be EquilateralTriangle, IsoscelesTriangle, ScaleneTriangle"); + } + + + +} + diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TriangleInterface.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TriangleInterface.java new file mode 100644 index 000000000000..5064ab5e3e6a --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TriangleInterface.java @@ -0,0 +1,101 @@ +/* + * 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; + +/** + * TriangleInterface + */ +@JsonPropertyOrder({ + TriangleInterface.JSON_PROPERTY_TRIANGLE_TYPE +}) + +public class TriangleInterface { + public static final String JSON_PROPERTY_TRIANGLE_TYPE = "triangleType"; + private String triangleType; + + + public TriangleInterface triangleType(String triangleType) { + + this.triangleType = triangleType; + return this; + } + + /** + * Get triangleType + * @return triangleType + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_TRIANGLE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getTriangleType() { + return triangleType; + } + + + public void setTriangleType(String triangleType) { + this.triangleType = triangleType; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TriangleInterface triangleInterface = (TriangleInterface) o; + return Objects.equals(this.triangleType, triangleInterface.triangleType); + } + + @Override + public int hashCode() { + return Objects.hash(triangleType); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TriangleInterface {\n"); + sb.append(" triangleType: ").append(toIndentedString(triangleType)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TypeHolderDefault.java deleted file mode 100644 index f79d7b6383a7..000000000000 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * 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 java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -/** - * TypeHolderDefault - */ -@JsonPropertyOrder({ - TypeHolderDefault.JSON_PROPERTY_STRING_ITEM, - TypeHolderDefault.JSON_PROPERTY_NUMBER_ITEM, - TypeHolderDefault.JSON_PROPERTY_INTEGER_ITEM, - TypeHolderDefault.JSON_PROPERTY_BOOL_ITEM, - TypeHolderDefault.JSON_PROPERTY_ARRAY_ITEM -}) - -public class TypeHolderDefault { - public static final String JSON_PROPERTY_STRING_ITEM = "string_item"; - private String stringItem = "what"; - - public static final String JSON_PROPERTY_NUMBER_ITEM = "number_item"; - private BigDecimal numberItem; - - public static final String JSON_PROPERTY_INTEGER_ITEM = "integer_item"; - private Integer integerItem; - - public static final String JSON_PROPERTY_BOOL_ITEM = "bool_item"; - private Boolean boolItem = true; - - public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; - private List arrayItem = new ArrayList<>(); - - - public TypeHolderDefault stringItem(String stringItem) { - - this.stringItem = stringItem; - return this; - } - - /** - * Get stringItem - * @return stringItem - **/ - @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_STRING_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public String getStringItem() { - return stringItem; - } - - - public void setStringItem(String stringItem) { - this.stringItem = stringItem; - } - - - public TypeHolderDefault numberItem(BigDecimal numberItem) { - - this.numberItem = numberItem; - return this; - } - - /** - * Get numberItem - * @return numberItem - **/ - @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_NUMBER_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public BigDecimal getNumberItem() { - return numberItem; - } - - - public void setNumberItem(BigDecimal numberItem) { - this.numberItem = numberItem; - } - - - public TypeHolderDefault integerItem(Integer integerItem) { - - this.integerItem = integerItem; - return this; - } - - /** - * Get integerItem - * @return integerItem - **/ - @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_INTEGER_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public Integer getIntegerItem() { - return integerItem; - } - - - public void setIntegerItem(Integer integerItem) { - this.integerItem = integerItem; - } - - - public TypeHolderDefault boolItem(Boolean boolItem) { - - this.boolItem = boolItem; - return this; - } - - /** - * Get boolItem - * @return boolItem - **/ - @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_BOOL_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public Boolean getBoolItem() { - return boolItem; - } - - - public void setBoolItem(Boolean boolItem) { - this.boolItem = boolItem; - } - - - public TypeHolderDefault arrayItem(List arrayItem) { - - this.arrayItem = arrayItem; - return this; - } - - public TypeHolderDefault addArrayItemItem(Integer arrayItemItem) { - this.arrayItem.add(arrayItemItem); - return this; - } - - /** - * Get arrayItem - * @return arrayItem - **/ - @ApiModelProperty(required = true, value = "") - @JsonProperty(JSON_PROPERTY_ARRAY_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public List getArrayItem() { - return arrayItem; - } - - - public void setArrayItem(List arrayItem) { - this.arrayItem = arrayItem; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TypeHolderDefault typeHolderDefault = (TypeHolderDefault) o; - return Objects.equals(this.stringItem, typeHolderDefault.stringItem) && - Objects.equals(this.numberItem, typeHolderDefault.numberItem) && - Objects.equals(this.integerItem, typeHolderDefault.integerItem) && - Objects.equals(this.boolItem, typeHolderDefault.boolItem) && - Objects.equals(this.arrayItem, typeHolderDefault.arrayItem); - } - - @Override - public int hashCode() { - return Objects.hash(stringItem, numberItem, integerItem, boolItem, arrayItem); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TypeHolderDefault {\n"); - sb.append(" stringItem: ").append(toIndentedString(stringItem)).append("\n"); - sb.append(" numberItem: ").append(toIndentedString(numberItem)).append("\n"); - sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); - sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); - sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TypeHolderExample.java deleted file mode 100644 index f15b107fd18b..000000000000 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * 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 java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -/** - * TypeHolderExample - */ -@JsonPropertyOrder({ - TypeHolderExample.JSON_PROPERTY_STRING_ITEM, - TypeHolderExample.JSON_PROPERTY_NUMBER_ITEM, - TypeHolderExample.JSON_PROPERTY_FLOAT_ITEM, - TypeHolderExample.JSON_PROPERTY_INTEGER_ITEM, - TypeHolderExample.JSON_PROPERTY_BOOL_ITEM, - TypeHolderExample.JSON_PROPERTY_ARRAY_ITEM -}) - -public class TypeHolderExample { - public static final String JSON_PROPERTY_STRING_ITEM = "string_item"; - private String stringItem; - - public static final String JSON_PROPERTY_NUMBER_ITEM = "number_item"; - private BigDecimal numberItem; - - public static final String JSON_PROPERTY_FLOAT_ITEM = "float_item"; - private Float floatItem; - - public static final String JSON_PROPERTY_INTEGER_ITEM = "integer_item"; - private Integer integerItem; - - public static final String JSON_PROPERTY_BOOL_ITEM = "bool_item"; - private Boolean boolItem; - - public static final String JSON_PROPERTY_ARRAY_ITEM = "array_item"; - private List arrayItem = new ArrayList<>(); - - - public TypeHolderExample stringItem(String stringItem) { - - this.stringItem = stringItem; - return this; - } - - /** - * Get stringItem - * @return stringItem - **/ - @ApiModelProperty(example = "what", required = true, value = "") - @JsonProperty(JSON_PROPERTY_STRING_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public String getStringItem() { - return stringItem; - } - - - public void setStringItem(String stringItem) { - this.stringItem = stringItem; - } - - - public TypeHolderExample numberItem(BigDecimal numberItem) { - - this.numberItem = numberItem; - return this; - } - - /** - * Get numberItem - * @return numberItem - **/ - @ApiModelProperty(example = "1.234", required = true, value = "") - @JsonProperty(JSON_PROPERTY_NUMBER_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public BigDecimal getNumberItem() { - return numberItem; - } - - - public void setNumberItem(BigDecimal numberItem) { - this.numberItem = numberItem; - } - - - public TypeHolderExample floatItem(Float floatItem) { - - this.floatItem = floatItem; - return this; - } - - /** - * Get floatItem - * @return floatItem - **/ - @ApiModelProperty(example = "1.234", required = true, value = "") - @JsonProperty(JSON_PROPERTY_FLOAT_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public Float getFloatItem() { - return floatItem; - } - - - public void setFloatItem(Float floatItem) { - this.floatItem = floatItem; - } - - - public TypeHolderExample integerItem(Integer integerItem) { - - this.integerItem = integerItem; - return this; - } - - /** - * Get integerItem - * @return integerItem - **/ - @ApiModelProperty(example = "-2", required = true, value = "") - @JsonProperty(JSON_PROPERTY_INTEGER_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public Integer getIntegerItem() { - return integerItem; - } - - - public void setIntegerItem(Integer integerItem) { - this.integerItem = integerItem; - } - - - public TypeHolderExample boolItem(Boolean boolItem) { - - this.boolItem = boolItem; - return this; - } - - /** - * Get boolItem - * @return boolItem - **/ - @ApiModelProperty(example = "true", required = true, value = "") - @JsonProperty(JSON_PROPERTY_BOOL_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public Boolean getBoolItem() { - return boolItem; - } - - - public void setBoolItem(Boolean boolItem) { - this.boolItem = boolItem; - } - - - public TypeHolderExample arrayItem(List arrayItem) { - - this.arrayItem = arrayItem; - return this; - } - - public TypeHolderExample addArrayItemItem(Integer arrayItemItem) { - this.arrayItem.add(arrayItemItem); - return this; - } - - /** - * Get arrayItem - * @return arrayItem - **/ - @ApiModelProperty(example = "[0, 1, 2, 3]", required = true, value = "") - @JsonProperty(JSON_PROPERTY_ARRAY_ITEM) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - - public List getArrayItem() { - return arrayItem; - } - - - public void setArrayItem(List arrayItem) { - this.arrayItem = arrayItem; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TypeHolderExample typeHolderExample = (TypeHolderExample) o; - return Objects.equals(this.stringItem, typeHolderExample.stringItem) && - Objects.equals(this.numberItem, typeHolderExample.numberItem) && - Objects.equals(this.floatItem, typeHolderExample.floatItem) && - Objects.equals(this.integerItem, typeHolderExample.integerItem) && - Objects.equals(this.boolItem, typeHolderExample.boolItem) && - Objects.equals(this.arrayItem, typeHolderExample.arrayItem); - } - - @Override - public int hashCode() { - return Objects.hash(stringItem, numberItem, floatItem, integerItem, boolItem, arrayItem); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TypeHolderExample {\n"); - sb.append(" stringItem: ").append(toIndentedString(stringItem)).append("\n"); - sb.append(" numberItem: ").append(toIndentedString(numberItem)).append("\n"); - sb.append(" floatItem: ").append(toIndentedString(floatItem)).append("\n"); - sb.append(" integerItem: ").append(toIndentedString(integerItem)).append("\n"); - sb.append(" boolItem: ").append(toIndentedString(boolItem)).append("\n"); - sb.append(" arrayItem: ").append(toIndentedString(arrayItem)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java index b7e74643dab2..570d1ace3ff4 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java @@ -21,6 +21,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** @@ -34,7 +37,11 @@ User.JSON_PROPERTY_EMAIL, User.JSON_PROPERTY_PASSWORD, User.JSON_PROPERTY_PHONE, - User.JSON_PROPERTY_USER_STATUS + User.JSON_PROPERTY_USER_STATUS, + User.JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS, + User.JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE, + User.JSON_PROPERTY_ANY_TYPE_PROP, + User.JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE }) public class User { @@ -62,6 +69,18 @@ public class User { public static final String JSON_PROPERTY_USER_STATUS = "userStatus"; private Integer userStatus; + public static final String JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS = "objectWithNoDeclaredProps"; + private Object objectWithNoDeclaredProps; + + public static final String JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE = "objectWithNoDeclaredPropsNullable"; + private JsonNullable objectWithNoDeclaredPropsNullable = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ANY_TYPE_PROP = "anyTypeProp"; + private JsonNullable anyTypeProp = JsonNullable.of(null); + + public static final String JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE = "anyTypePropNullable"; + private JsonNullable anyTypePropNullable = JsonNullable.of(null); + public User id(Long id) { @@ -263,6 +282,136 @@ public void setUserStatus(Integer userStatus) { } + public User objectWithNoDeclaredProps(Object objectWithNoDeclaredProps) { + + this.objectWithNoDeclaredProps = objectWithNoDeclaredProps; + return this; + } + + /** + * test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + * @return objectWithNoDeclaredProps + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value.") + @JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Object getObjectWithNoDeclaredProps() { + return objectWithNoDeclaredProps; + } + + + public void setObjectWithNoDeclaredProps(Object objectWithNoDeclaredProps) { + this.objectWithNoDeclaredProps = objectWithNoDeclaredProps; + } + + + public User objectWithNoDeclaredPropsNullable(Object objectWithNoDeclaredPropsNullable) { + this.objectWithNoDeclaredPropsNullable = JsonNullable.of(objectWithNoDeclaredPropsNullable); + + return this; + } + + /** + * test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + * @return objectWithNoDeclaredPropsNullable + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "test code generation for nullable objects. Value must be a map of strings to values or the 'null' value.") + @JsonIgnore + + public Object getObjectWithNoDeclaredPropsNullable() { + return objectWithNoDeclaredPropsNullable.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getObjectWithNoDeclaredPropsNullable_JsonNullable() { + return objectWithNoDeclaredPropsNullable; + } + + @JsonProperty(JSON_PROPERTY_OBJECT_WITH_NO_DECLARED_PROPS_NULLABLE) + public void setObjectWithNoDeclaredPropsNullable_JsonNullable(JsonNullable objectWithNoDeclaredPropsNullable) { + this.objectWithNoDeclaredPropsNullable = objectWithNoDeclaredPropsNullable; + } + + public void setObjectWithNoDeclaredPropsNullable(Object objectWithNoDeclaredPropsNullable) { + this.objectWithNoDeclaredPropsNullable = JsonNullable.of(objectWithNoDeclaredPropsNullable); + } + + + public User anyTypeProp(Object anyTypeProp) { + this.anyTypeProp = JsonNullable.of(anyTypeProp); + + return this; + } + + /** + * test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 + * @return anyTypeProp + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389") + @JsonIgnore + + public Object getAnyTypeProp() { + return anyTypeProp.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAnyTypeProp_JsonNullable() { + return anyTypeProp; + } + + @JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP) + public void setAnyTypeProp_JsonNullable(JsonNullable anyTypeProp) { + this.anyTypeProp = anyTypeProp; + } + + public void setAnyTypeProp(Object anyTypeProp) { + this.anyTypeProp = JsonNullable.of(anyTypeProp); + } + + + public User anyTypePropNullable(Object anyTypePropNullable) { + this.anyTypePropNullable = JsonNullable.of(anyTypePropNullable); + + return this; + } + + /** + * test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. + * @return anyTypePropNullable + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values.") + @JsonIgnore + + public Object getAnyTypePropNullable() { + return anyTypePropNullable.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public JsonNullable getAnyTypePropNullable_JsonNullable() { + return anyTypePropNullable; + } + + @JsonProperty(JSON_PROPERTY_ANY_TYPE_PROP_NULLABLE) + public void setAnyTypePropNullable_JsonNullable(JsonNullable anyTypePropNullable) { + this.anyTypePropNullable = anyTypePropNullable; + } + + public void setAnyTypePropNullable(Object anyTypePropNullable) { + this.anyTypePropNullable = JsonNullable.of(anyTypePropNullable); + } + + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -279,12 +428,16 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.email, user.email) && Objects.equals(this.password, user.password) && Objects.equals(this.phone, user.phone) && - Objects.equals(this.userStatus, user.userStatus); + Objects.equals(this.userStatus, user.userStatus) && + Objects.equals(this.objectWithNoDeclaredProps, user.objectWithNoDeclaredProps) && + Objects.equals(this.objectWithNoDeclaredPropsNullable, user.objectWithNoDeclaredPropsNullable) && + Objects.equals(this.anyTypeProp, user.anyTypeProp) && + Objects.equals(this.anyTypePropNullable, user.anyTypePropNullable); } @Override public int hashCode() { - return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, objectWithNoDeclaredProps, objectWithNoDeclaredPropsNullable, anyTypeProp, anyTypePropNullable); } @@ -300,6 +453,10 @@ public String toString() { sb.append(" password: ").append(toIndentedString(password)).append("\n"); sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); + sb.append(" objectWithNoDeclaredProps: ").append(toIndentedString(objectWithNoDeclaredProps)).append("\n"); + sb.append(" objectWithNoDeclaredPropsNullable: ").append(toIndentedString(objectWithNoDeclaredPropsNullable)).append("\n"); + sb.append(" anyTypeProp: ").append(toIndentedString(anyTypeProp)).append("\n"); + sb.append(" anyTypePropNullable: ").append(toIndentedString(anyTypePropNullable)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Whale.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Whale.java new file mode 100644 index 000000000000..64c82e711aca --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Whale.java @@ -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 + * + * + * 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; + +/** + * Whale + */ +@JsonPropertyOrder({ + Whale.JSON_PROPERTY_HAS_BALEEN, + Whale.JSON_PROPERTY_HAS_TEETH, + Whale.JSON_PROPERTY_CLASS_NAME +}) + +public class Whale { + public static final String JSON_PROPERTY_HAS_BALEEN = "hasBaleen"; + private Boolean hasBaleen; + + public static final String JSON_PROPERTY_HAS_TEETH = "hasTeeth"; + private Boolean hasTeeth; + + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + private String className; + + + public Whale hasBaleen(Boolean hasBaleen) { + + this.hasBaleen = hasBaleen; + return this; + } + + /** + * Get hasBaleen + * @return hasBaleen + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_HAS_BALEEN) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getHasBaleen() { + return hasBaleen; + } + + + public void setHasBaleen(Boolean hasBaleen) { + this.hasBaleen = hasBaleen; + } + + + public Whale hasTeeth(Boolean hasTeeth) { + + this.hasTeeth = hasTeeth; + return this; + } + + /** + * Get hasTeeth + * @return hasTeeth + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_HAS_TEETH) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Boolean getHasTeeth() { + return hasTeeth; + } + + + public void setHasTeeth(Boolean hasTeeth) { + this.hasTeeth = hasTeeth; + } + + + public Whale className(String className) { + + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; + } + + + public void setClassName(String className) { + this.className = className; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Whale whale = (Whale) o; + return Objects.equals(this.hasBaleen, whale.hasBaleen) && + Objects.equals(this.hasTeeth, whale.hasTeeth) && + Objects.equals(this.className, whale.className); + } + + @Override + public int hashCode() { + return Objects.hash(hasBaleen, hasTeeth, className); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Whale {\n"); + sb.append(" hasBaleen: ").append(toIndentedString(hasBaleen)).append("\n"); + sb.append(" hasTeeth: ").append(toIndentedString(hasTeeth)).append("\n"); + sb.append(" className: ").append(toIndentedString(className)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/XmlItem.java deleted file mode 100644 index b3fbdce31b9b..000000000000 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/XmlItem.java +++ /dev/null @@ -1,1045 +0,0 @@ -/* - * 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 java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -/** - * XmlItem - */ -@JsonPropertyOrder({ - XmlItem.JSON_PROPERTY_ATTRIBUTE_STRING, - XmlItem.JSON_PROPERTY_ATTRIBUTE_NUMBER, - XmlItem.JSON_PROPERTY_ATTRIBUTE_INTEGER, - XmlItem.JSON_PROPERTY_ATTRIBUTE_BOOLEAN, - XmlItem.JSON_PROPERTY_WRAPPED_ARRAY, - XmlItem.JSON_PROPERTY_NAME_STRING, - XmlItem.JSON_PROPERTY_NAME_NUMBER, - XmlItem.JSON_PROPERTY_NAME_INTEGER, - XmlItem.JSON_PROPERTY_NAME_BOOLEAN, - XmlItem.JSON_PROPERTY_NAME_ARRAY, - XmlItem.JSON_PROPERTY_NAME_WRAPPED_ARRAY, - XmlItem.JSON_PROPERTY_PREFIX_STRING, - XmlItem.JSON_PROPERTY_PREFIX_NUMBER, - XmlItem.JSON_PROPERTY_PREFIX_INTEGER, - XmlItem.JSON_PROPERTY_PREFIX_BOOLEAN, - XmlItem.JSON_PROPERTY_PREFIX_ARRAY, - XmlItem.JSON_PROPERTY_PREFIX_WRAPPED_ARRAY, - XmlItem.JSON_PROPERTY_NAMESPACE_STRING, - XmlItem.JSON_PROPERTY_NAMESPACE_NUMBER, - XmlItem.JSON_PROPERTY_NAMESPACE_INTEGER, - XmlItem.JSON_PROPERTY_NAMESPACE_BOOLEAN, - XmlItem.JSON_PROPERTY_NAMESPACE_ARRAY, - XmlItem.JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY, - XmlItem.JSON_PROPERTY_PREFIX_NS_STRING, - XmlItem.JSON_PROPERTY_PREFIX_NS_NUMBER, - XmlItem.JSON_PROPERTY_PREFIX_NS_INTEGER, - XmlItem.JSON_PROPERTY_PREFIX_NS_BOOLEAN, - XmlItem.JSON_PROPERTY_PREFIX_NS_ARRAY, - XmlItem.JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY -}) - -public class XmlItem { - public static final String JSON_PROPERTY_ATTRIBUTE_STRING = "attribute_string"; - private String attributeString; - - public static final String JSON_PROPERTY_ATTRIBUTE_NUMBER = "attribute_number"; - private BigDecimal attributeNumber; - - public static final String JSON_PROPERTY_ATTRIBUTE_INTEGER = "attribute_integer"; - private Integer attributeInteger; - - public static final String JSON_PROPERTY_ATTRIBUTE_BOOLEAN = "attribute_boolean"; - private Boolean attributeBoolean; - - public static final String JSON_PROPERTY_WRAPPED_ARRAY = "wrapped_array"; - private List wrappedArray = null; - - public static final String JSON_PROPERTY_NAME_STRING = "name_string"; - private String nameString; - - public static final String JSON_PROPERTY_NAME_NUMBER = "name_number"; - private BigDecimal nameNumber; - - public static final String JSON_PROPERTY_NAME_INTEGER = "name_integer"; - private Integer nameInteger; - - public static final String JSON_PROPERTY_NAME_BOOLEAN = "name_boolean"; - private Boolean nameBoolean; - - public static final String JSON_PROPERTY_NAME_ARRAY = "name_array"; - private List nameArray = null; - - public static final String JSON_PROPERTY_NAME_WRAPPED_ARRAY = "name_wrapped_array"; - private List nameWrappedArray = null; - - public static final String JSON_PROPERTY_PREFIX_STRING = "prefix_string"; - private String prefixString; - - public static final String JSON_PROPERTY_PREFIX_NUMBER = "prefix_number"; - private BigDecimal prefixNumber; - - public static final String JSON_PROPERTY_PREFIX_INTEGER = "prefix_integer"; - private Integer prefixInteger; - - public static final String JSON_PROPERTY_PREFIX_BOOLEAN = "prefix_boolean"; - private Boolean prefixBoolean; - - public static final String JSON_PROPERTY_PREFIX_ARRAY = "prefix_array"; - private List prefixArray = null; - - public static final String JSON_PROPERTY_PREFIX_WRAPPED_ARRAY = "prefix_wrapped_array"; - private List prefixWrappedArray = null; - - public static final String JSON_PROPERTY_NAMESPACE_STRING = "namespace_string"; - private String namespaceString; - - public static final String JSON_PROPERTY_NAMESPACE_NUMBER = "namespace_number"; - private BigDecimal namespaceNumber; - - public static final String JSON_PROPERTY_NAMESPACE_INTEGER = "namespace_integer"; - private Integer namespaceInteger; - - public static final String JSON_PROPERTY_NAMESPACE_BOOLEAN = "namespace_boolean"; - private Boolean namespaceBoolean; - - public static final String JSON_PROPERTY_NAMESPACE_ARRAY = "namespace_array"; - private List namespaceArray = null; - - public static final String JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY = "namespace_wrapped_array"; - private List namespaceWrappedArray = null; - - public static final String JSON_PROPERTY_PREFIX_NS_STRING = "prefix_ns_string"; - private String prefixNsString; - - public static final String JSON_PROPERTY_PREFIX_NS_NUMBER = "prefix_ns_number"; - private BigDecimal prefixNsNumber; - - public static final String JSON_PROPERTY_PREFIX_NS_INTEGER = "prefix_ns_integer"; - private Integer prefixNsInteger; - - public static final String JSON_PROPERTY_PREFIX_NS_BOOLEAN = "prefix_ns_boolean"; - private Boolean prefixNsBoolean; - - public static final String JSON_PROPERTY_PREFIX_NS_ARRAY = "prefix_ns_array"; - private List prefixNsArray = null; - - public static final String JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY = "prefix_ns_wrapped_array"; - private List prefixNsWrappedArray = null; - - - public XmlItem attributeString(String attributeString) { - - this.attributeString = attributeString; - return this; - } - - /** - * Get attributeString - * @return attributeString - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "string", value = "") - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public String getAttributeString() { - return attributeString; - } - - - public void setAttributeString(String attributeString) { - this.attributeString = attributeString; - } - - - public XmlItem attributeNumber(BigDecimal attributeNumber) { - - this.attributeNumber = attributeNumber; - return this; - } - - /** - * Get attributeNumber - * @return attributeNumber - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "1.234", value = "") - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public BigDecimal getAttributeNumber() { - return attributeNumber; - } - - - public void setAttributeNumber(BigDecimal attributeNumber) { - this.attributeNumber = attributeNumber; - } - - - public XmlItem attributeInteger(Integer attributeInteger) { - - this.attributeInteger = attributeInteger; - return this; - } - - /** - * Get attributeInteger - * @return attributeInteger - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "-2", value = "") - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Integer getAttributeInteger() { - return attributeInteger; - } - - - public void setAttributeInteger(Integer attributeInteger) { - this.attributeInteger = attributeInteger; - } - - - public XmlItem attributeBoolean(Boolean attributeBoolean) { - - this.attributeBoolean = attributeBoolean; - return this; - } - - /** - * Get attributeBoolean - * @return attributeBoolean - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "") - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Boolean getAttributeBoolean() { - return attributeBoolean; - } - - - public void setAttributeBoolean(Boolean attributeBoolean) { - this.attributeBoolean = attributeBoolean; - } - - - public XmlItem wrappedArray(List wrappedArray) { - - this.wrappedArray = wrappedArray; - return this; - } - - public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { - if (this.wrappedArray == null) { - this.wrappedArray = new ArrayList<>(); - } - this.wrappedArray.add(wrappedArrayItem); - return this; - } - - /** - * Get wrappedArray - * @return wrappedArray - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_WRAPPED_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public List getWrappedArray() { - return wrappedArray; - } - - - public void setWrappedArray(List wrappedArray) { - this.wrappedArray = wrappedArray; - } - - - public XmlItem nameString(String nameString) { - - this.nameString = nameString; - return this; - } - - /** - * Get nameString - * @return nameString - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "string", value = "") - @JsonProperty(JSON_PROPERTY_NAME_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public String getNameString() { - return nameString; - } - - - public void setNameString(String nameString) { - this.nameString = nameString; - } - - - public XmlItem nameNumber(BigDecimal nameNumber) { - - this.nameNumber = nameNumber; - return this; - } - - /** - * Get nameNumber - * @return nameNumber - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "1.234", value = "") - @JsonProperty(JSON_PROPERTY_NAME_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public BigDecimal getNameNumber() { - return nameNumber; - } - - - public void setNameNumber(BigDecimal nameNumber) { - this.nameNumber = nameNumber; - } - - - public XmlItem nameInteger(Integer nameInteger) { - - this.nameInteger = nameInteger; - return this; - } - - /** - * Get nameInteger - * @return nameInteger - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "-2", value = "") - @JsonProperty(JSON_PROPERTY_NAME_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Integer getNameInteger() { - return nameInteger; - } - - - public void setNameInteger(Integer nameInteger) { - this.nameInteger = nameInteger; - } - - - public XmlItem nameBoolean(Boolean nameBoolean) { - - this.nameBoolean = nameBoolean; - return this; - } - - /** - * Get nameBoolean - * @return nameBoolean - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "") - @JsonProperty(JSON_PROPERTY_NAME_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Boolean getNameBoolean() { - return nameBoolean; - } - - - public void setNameBoolean(Boolean nameBoolean) { - this.nameBoolean = nameBoolean; - } - - - public XmlItem nameArray(List nameArray) { - - this.nameArray = nameArray; - return this; - } - - public XmlItem addNameArrayItem(Integer nameArrayItem) { - if (this.nameArray == null) { - this.nameArray = new ArrayList<>(); - } - this.nameArray.add(nameArrayItem); - return this; - } - - /** - * Get nameArray - * @return nameArray - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public List getNameArray() { - return nameArray; - } - - - public void setNameArray(List nameArray) { - this.nameArray = nameArray; - } - - - public XmlItem nameWrappedArray(List nameWrappedArray) { - - this.nameWrappedArray = nameWrappedArray; - return this; - } - - public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { - if (this.nameWrappedArray == null) { - this.nameWrappedArray = new ArrayList<>(); - } - this.nameWrappedArray.add(nameWrappedArrayItem); - return this; - } - - /** - * Get nameWrappedArray - * @return nameWrappedArray - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAME_WRAPPED_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public List getNameWrappedArray() { - return nameWrappedArray; - } - - - public void setNameWrappedArray(List nameWrappedArray) { - this.nameWrappedArray = nameWrappedArray; - } - - - public XmlItem prefixString(String prefixString) { - - this.prefixString = prefixString; - return this; - } - - /** - * Get prefixString - * @return prefixString - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "string", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public String getPrefixString() { - return prefixString; - } - - - public void setPrefixString(String prefixString) { - this.prefixString = prefixString; - } - - - public XmlItem prefixNumber(BigDecimal prefixNumber) { - - this.prefixNumber = prefixNumber; - return this; - } - - /** - * Get prefixNumber - * @return prefixNumber - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "1.234", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public BigDecimal getPrefixNumber() { - return prefixNumber; - } - - - public void setPrefixNumber(BigDecimal prefixNumber) { - this.prefixNumber = prefixNumber; - } - - - public XmlItem prefixInteger(Integer prefixInteger) { - - this.prefixInteger = prefixInteger; - return this; - } - - /** - * Get prefixInteger - * @return prefixInteger - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "-2", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Integer getPrefixInteger() { - return prefixInteger; - } - - - public void setPrefixInteger(Integer prefixInteger) { - this.prefixInteger = prefixInteger; - } - - - public XmlItem prefixBoolean(Boolean prefixBoolean) { - - this.prefixBoolean = prefixBoolean; - return this; - } - - /** - * Get prefixBoolean - * @return prefixBoolean - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Boolean getPrefixBoolean() { - return prefixBoolean; - } - - - public void setPrefixBoolean(Boolean prefixBoolean) { - this.prefixBoolean = prefixBoolean; - } - - - public XmlItem prefixArray(List prefixArray) { - - this.prefixArray = prefixArray; - return this; - } - - public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { - if (this.prefixArray == null) { - this.prefixArray = new ArrayList<>(); - } - this.prefixArray.add(prefixArrayItem); - return this; - } - - /** - * Get prefixArray - * @return prefixArray - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public List getPrefixArray() { - return prefixArray; - } - - - public void setPrefixArray(List prefixArray) { - this.prefixArray = prefixArray; - } - - - public XmlItem prefixWrappedArray(List prefixWrappedArray) { - - this.prefixWrappedArray = prefixWrappedArray; - return this; - } - - public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { - if (this.prefixWrappedArray == null) { - this.prefixWrappedArray = new ArrayList<>(); - } - this.prefixWrappedArray.add(prefixWrappedArrayItem); - return this; - } - - /** - * Get prefixWrappedArray - * @return prefixWrappedArray - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_WRAPPED_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public List getPrefixWrappedArray() { - return prefixWrappedArray; - } - - - public void setPrefixWrappedArray(List prefixWrappedArray) { - this.prefixWrappedArray = prefixWrappedArray; - } - - - public XmlItem namespaceString(String namespaceString) { - - this.namespaceString = namespaceString; - return this; - } - - /** - * Get namespaceString - * @return namespaceString - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "string", value = "") - @JsonProperty(JSON_PROPERTY_NAMESPACE_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public String getNamespaceString() { - return namespaceString; - } - - - public void setNamespaceString(String namespaceString) { - this.namespaceString = namespaceString; - } - - - public XmlItem namespaceNumber(BigDecimal namespaceNumber) { - - this.namespaceNumber = namespaceNumber; - return this; - } - - /** - * Get namespaceNumber - * @return namespaceNumber - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "1.234", value = "") - @JsonProperty(JSON_PROPERTY_NAMESPACE_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public BigDecimal getNamespaceNumber() { - return namespaceNumber; - } - - - public void setNamespaceNumber(BigDecimal namespaceNumber) { - this.namespaceNumber = namespaceNumber; - } - - - public XmlItem namespaceInteger(Integer namespaceInteger) { - - this.namespaceInteger = namespaceInteger; - return this; - } - - /** - * Get namespaceInteger - * @return namespaceInteger - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "-2", value = "") - @JsonProperty(JSON_PROPERTY_NAMESPACE_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Integer getNamespaceInteger() { - return namespaceInteger; - } - - - public void setNamespaceInteger(Integer namespaceInteger) { - this.namespaceInteger = namespaceInteger; - } - - - public XmlItem namespaceBoolean(Boolean namespaceBoolean) { - - this.namespaceBoolean = namespaceBoolean; - return this; - } - - /** - * Get namespaceBoolean - * @return namespaceBoolean - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "") - @JsonProperty(JSON_PROPERTY_NAMESPACE_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Boolean getNamespaceBoolean() { - return namespaceBoolean; - } - - - public void setNamespaceBoolean(Boolean namespaceBoolean) { - this.namespaceBoolean = namespaceBoolean; - } - - - public XmlItem namespaceArray(List namespaceArray) { - - this.namespaceArray = namespaceArray; - return this; - } - - public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { - if (this.namespaceArray == null) { - this.namespaceArray = new ArrayList<>(); - } - this.namespaceArray.add(namespaceArrayItem); - return this; - } - - /** - * Get namespaceArray - * @return namespaceArray - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAMESPACE_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public List getNamespaceArray() { - return namespaceArray; - } - - - public void setNamespaceArray(List namespaceArray) { - this.namespaceArray = namespaceArray; - } - - - public XmlItem namespaceWrappedArray(List namespaceWrappedArray) { - - this.namespaceWrappedArray = namespaceWrappedArray; - return this; - } - - public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { - if (this.namespaceWrappedArray == null) { - this.namespaceWrappedArray = new ArrayList<>(); - } - this.namespaceWrappedArray.add(namespaceWrappedArrayItem); - return this; - } - - /** - * Get namespaceWrappedArray - * @return namespaceWrappedArray - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public List getNamespaceWrappedArray() { - return namespaceWrappedArray; - } - - - public void setNamespaceWrappedArray(List namespaceWrappedArray) { - this.namespaceWrappedArray = namespaceWrappedArray; - } - - - public XmlItem prefixNsString(String prefixNsString) { - - this.prefixNsString = prefixNsString; - return this; - } - - /** - * Get prefixNsString - * @return prefixNsString - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "string", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NS_STRING) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public String getPrefixNsString() { - return prefixNsString; - } - - - public void setPrefixNsString(String prefixNsString) { - this.prefixNsString = prefixNsString; - } - - - public XmlItem prefixNsNumber(BigDecimal prefixNsNumber) { - - this.prefixNsNumber = prefixNsNumber; - return this; - } - - /** - * Get prefixNsNumber - * @return prefixNsNumber - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "1.234", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NS_NUMBER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public BigDecimal getPrefixNsNumber() { - return prefixNsNumber; - } - - - public void setPrefixNsNumber(BigDecimal prefixNsNumber) { - this.prefixNsNumber = prefixNsNumber; - } - - - public XmlItem prefixNsInteger(Integer prefixNsInteger) { - - this.prefixNsInteger = prefixNsInteger; - return this; - } - - /** - * Get prefixNsInteger - * @return prefixNsInteger - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "-2", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NS_INTEGER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Integer getPrefixNsInteger() { - return prefixNsInteger; - } - - - public void setPrefixNsInteger(Integer prefixNsInteger) { - this.prefixNsInteger = prefixNsInteger; - } - - - public XmlItem prefixNsBoolean(Boolean prefixNsBoolean) { - - this.prefixNsBoolean = prefixNsBoolean; - return this; - } - - /** - * Get prefixNsBoolean - * @return prefixNsBoolean - **/ - @javax.annotation.Nullable - @ApiModelProperty(example = "true", value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NS_BOOLEAN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public Boolean getPrefixNsBoolean() { - return prefixNsBoolean; - } - - - public void setPrefixNsBoolean(Boolean prefixNsBoolean) { - this.prefixNsBoolean = prefixNsBoolean; - } - - - public XmlItem prefixNsArray(List prefixNsArray) { - - this.prefixNsArray = prefixNsArray; - return this; - } - - public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { - if (this.prefixNsArray == null) { - this.prefixNsArray = new ArrayList<>(); - } - this.prefixNsArray.add(prefixNsArrayItem); - return this; - } - - /** - * Get prefixNsArray - * @return prefixNsArray - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NS_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public List getPrefixNsArray() { - return prefixNsArray; - } - - - public void setPrefixNsArray(List prefixNsArray) { - this.prefixNsArray = prefixNsArray; - } - - - public XmlItem prefixNsWrappedArray(List prefixNsWrappedArray) { - - this.prefixNsWrappedArray = prefixNsWrappedArray; - return this; - } - - public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { - if (this.prefixNsWrappedArray == null) { - this.prefixNsWrappedArray = new ArrayList<>(); - } - this.prefixNsWrappedArray.add(prefixNsWrappedArrayItem); - return this; - } - - /** - * Get prefixNsWrappedArray - * @return prefixNsWrappedArray - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - - public List getPrefixNsWrappedArray() { - return prefixNsWrappedArray; - } - - - public void setPrefixNsWrappedArray(List prefixNsWrappedArray) { - this.prefixNsWrappedArray = prefixNsWrappedArray; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - XmlItem xmlItem = (XmlItem) o; - return Objects.equals(this.attributeString, xmlItem.attributeString) && - Objects.equals(this.attributeNumber, xmlItem.attributeNumber) && - Objects.equals(this.attributeInteger, xmlItem.attributeInteger) && - Objects.equals(this.attributeBoolean, xmlItem.attributeBoolean) && - Objects.equals(this.wrappedArray, xmlItem.wrappedArray) && - Objects.equals(this.nameString, xmlItem.nameString) && - Objects.equals(this.nameNumber, xmlItem.nameNumber) && - Objects.equals(this.nameInteger, xmlItem.nameInteger) && - Objects.equals(this.nameBoolean, xmlItem.nameBoolean) && - Objects.equals(this.nameArray, xmlItem.nameArray) && - Objects.equals(this.nameWrappedArray, xmlItem.nameWrappedArray) && - Objects.equals(this.prefixString, xmlItem.prefixString) && - Objects.equals(this.prefixNumber, xmlItem.prefixNumber) && - Objects.equals(this.prefixInteger, xmlItem.prefixInteger) && - Objects.equals(this.prefixBoolean, xmlItem.prefixBoolean) && - Objects.equals(this.prefixArray, xmlItem.prefixArray) && - Objects.equals(this.prefixWrappedArray, xmlItem.prefixWrappedArray) && - Objects.equals(this.namespaceString, xmlItem.namespaceString) && - Objects.equals(this.namespaceNumber, xmlItem.namespaceNumber) && - Objects.equals(this.namespaceInteger, xmlItem.namespaceInteger) && - Objects.equals(this.namespaceBoolean, xmlItem.namespaceBoolean) && - Objects.equals(this.namespaceArray, xmlItem.namespaceArray) && - Objects.equals(this.namespaceWrappedArray, xmlItem.namespaceWrappedArray) && - Objects.equals(this.prefixNsString, xmlItem.prefixNsString) && - Objects.equals(this.prefixNsNumber, xmlItem.prefixNsNumber) && - Objects.equals(this.prefixNsInteger, xmlItem.prefixNsInteger) && - Objects.equals(this.prefixNsBoolean, xmlItem.prefixNsBoolean) && - Objects.equals(this.prefixNsArray, xmlItem.prefixNsArray) && - Objects.equals(this.prefixNsWrappedArray, xmlItem.prefixNsWrappedArray); - } - - @Override - public int hashCode() { - return Objects.hash(attributeString, attributeNumber, attributeInteger, attributeBoolean, wrappedArray, nameString, nameNumber, nameInteger, nameBoolean, nameArray, nameWrappedArray, prefixString, prefixNumber, prefixInteger, prefixBoolean, prefixArray, prefixWrappedArray, namespaceString, namespaceNumber, namespaceInteger, namespaceBoolean, namespaceArray, namespaceWrappedArray, prefixNsString, prefixNsNumber, prefixNsInteger, prefixNsBoolean, prefixNsArray, prefixNsWrappedArray); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class XmlItem {\n"); - sb.append(" attributeString: ").append(toIndentedString(attributeString)).append("\n"); - sb.append(" attributeNumber: ").append(toIndentedString(attributeNumber)).append("\n"); - sb.append(" attributeInteger: ").append(toIndentedString(attributeInteger)).append("\n"); - sb.append(" attributeBoolean: ").append(toIndentedString(attributeBoolean)).append("\n"); - sb.append(" wrappedArray: ").append(toIndentedString(wrappedArray)).append("\n"); - sb.append(" nameString: ").append(toIndentedString(nameString)).append("\n"); - sb.append(" nameNumber: ").append(toIndentedString(nameNumber)).append("\n"); - sb.append(" nameInteger: ").append(toIndentedString(nameInteger)).append("\n"); - sb.append(" nameBoolean: ").append(toIndentedString(nameBoolean)).append("\n"); - sb.append(" nameArray: ").append(toIndentedString(nameArray)).append("\n"); - sb.append(" nameWrappedArray: ").append(toIndentedString(nameWrappedArray)).append("\n"); - sb.append(" prefixString: ").append(toIndentedString(prefixString)).append("\n"); - sb.append(" prefixNumber: ").append(toIndentedString(prefixNumber)).append("\n"); - sb.append(" prefixInteger: ").append(toIndentedString(prefixInteger)).append("\n"); - sb.append(" prefixBoolean: ").append(toIndentedString(prefixBoolean)).append("\n"); - sb.append(" prefixArray: ").append(toIndentedString(prefixArray)).append("\n"); - sb.append(" prefixWrappedArray: ").append(toIndentedString(prefixWrappedArray)).append("\n"); - sb.append(" namespaceString: ").append(toIndentedString(namespaceString)).append("\n"); - sb.append(" namespaceNumber: ").append(toIndentedString(namespaceNumber)).append("\n"); - sb.append(" namespaceInteger: ").append(toIndentedString(namespaceInteger)).append("\n"); - sb.append(" namespaceBoolean: ").append(toIndentedString(namespaceBoolean)).append("\n"); - sb.append(" namespaceArray: ").append(toIndentedString(namespaceArray)).append("\n"); - sb.append(" namespaceWrappedArray: ").append(toIndentedString(namespaceWrappedArray)).append("\n"); - sb.append(" prefixNsString: ").append(toIndentedString(prefixNsString)).append("\n"); - sb.append(" prefixNsNumber: ").append(toIndentedString(prefixNsNumber)).append("\n"); - sb.append(" prefixNsInteger: ").append(toIndentedString(prefixNsInteger)).append("\n"); - sb.append(" prefixNsBoolean: ").append(toIndentedString(prefixNsBoolean)).append("\n"); - sb.append(" prefixNsArray: ").append(toIndentedString(prefixNsArray)).append("\n"); - sb.append(" prefixNsWrappedArray: ").append(toIndentedString(prefixNsWrappedArray)).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/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCat.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Zebra.java similarity index 57% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCat.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Zebra.java index c4386f4e6011..84436cf0de92 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/BigCat.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Zebra.java @@ -18,42 +18,35 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; 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 java.util.HashMap; +import java.util.Map; import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** - * BigCat + * Zebra */ @JsonPropertyOrder({ - BigCat.JSON_PROPERTY_KIND + Zebra.JSON_PROPERTY_TYPE, + Zebra.JSON_PROPERTY_CLASS_NAME }) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "className", visible = true) -@JsonSubTypes({ -}) - -public class BigCat extends Cat { +public class Zebra extends HashMap { /** - * Gets or Sets kind + * Gets or Sets type */ - public enum KindEnum { - LIONS("lions"), - - TIGERS("tigers"), + public enum TypeEnum { + PLAINS("plains"), - LEOPARDS("leopards"), + MOUNTAIN("mountain"), - JAGUARS("jaguars"); + GREVYS("grevys"); private String value; - KindEnum(String value) { + TypeEnum(String value) { this.value = value; } @@ -68,8 +61,8 @@ public String toString() { } @JsonCreator - public static KindEnum fromValue(String value) { - for (KindEnum b : KindEnum.values()) { + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { if (b.value.equals(value)) { return b; } @@ -78,32 +71,59 @@ public static KindEnum fromValue(String value) { } } - public static final String JSON_PROPERTY_KIND = "kind"; - private KindEnum kind; + public static final String JSON_PROPERTY_TYPE = "type"; + private TypeEnum type; + public static final String JSON_PROPERTY_CLASS_NAME = "className"; + private String className; - public BigCat kind(KindEnum kind) { + + public Zebra type(TypeEnum type) { - this.kind = kind; + this.type = type; return this; } /** - * Get kind - * @return kind + * Get type + * @return type **/ @javax.annotation.Nullable @ApiModelProperty(value = "") - @JsonProperty(JSON_PROPERTY_KIND) + @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public KindEnum getKind() { - return kind; + public TypeEnum getType() { + return type; + } + + + public void setType(TypeEnum type) { + this.type = type; + } + + + public Zebra className(String className) { + + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @ApiModelProperty(required = true, value = "") + @JsonProperty(JSON_PROPERTY_CLASS_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + + public String getClassName() { + return className; } - public void setKind(KindEnum kind) { - this.kind = kind; + public void setClassName(String className) { + this.className = className; } @@ -115,23 +135,25 @@ public boolean equals(java.lang.Object o) { if (o == null || getClass() != o.getClass()) { return false; } - BigCat bigCat = (BigCat) o; - return Objects.equals(this.kind, bigCat.kind) && + Zebra zebra = (Zebra) o; + return Objects.equals(this.type, zebra.type) && + Objects.equals(this.className, zebra.className) && super.equals(o); } @Override public int hashCode() { - return Objects.hash(kind, super.hashCode()); + return Objects.hash(type, className, super.hashCode()); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class BigCat {\n"); + sb.append("class Zebra {\n"); sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append(" kind: ").append(toIndentedString(kind)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" className: ").append(toIndentedString(className)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java index cf0b7b35f477..24df57d8d7eb 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java @@ -42,8 +42,8 @@ public class AnotherFakeApiTest { */ @Test public void call123testSpecialTagsTest() throws ApiException { - //Client body = null; - //Client response = api.call123testSpecialTags(body); + //Client client = null; + //Client response = api.call123testSpecialTags(client); // TODO: test validations } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/DefaultApiTest.java new file mode 100644 index 000000000000..3f6b4c2d7160 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/DefaultApiTest.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.api; + +import org.openapitools.client.*; +import org.openapitools.client.auth.*; +import org.openapitools.client.model.InlineResponseDefault; +import org.junit.Test; +import org.junit.Ignore; +import org.junit.Assert; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for DefaultApi + */ +public class DefaultApiTest { + + private final DefaultApi api = new DefaultApi(); + + /** + * + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void fooGetTest() throws ApiException { + //InlineResponseDefault response = api.fooGet(); + // TODO: test validations + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/FakeApiTest.java index c97e51ef6a3f..b46f1ae7b267 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/FakeApiTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -19,11 +19,11 @@ import org.openapitools.client.model.Client; import java.io.File; import org.openapitools.client.model.FileSchemaTestClass; +import org.openapitools.client.model.HealthCheckResult; import java.time.LocalDate; import java.time.OffsetDateTime; import org.openapitools.client.model.OuterComposite; import org.openapitools.client.model.User; -import org.openapitools.client.model.XmlItem; import org.junit.Test; import org.junit.Ignore; import org.junit.Assert; @@ -41,17 +41,16 @@ public class FakeApiTest { private final FakeApi api = new FakeApi(); /** - * creates an XmlItem + * Health check endpoint * - * this route creates an XmlItem + * * * @throws ApiException * if the Api call fails */ @Test - public void createXmlItemTest() throws ApiException { - //XmlItem xmlItem = null; - //api.createXmlItem(xmlItem); + public void fakeHealthGetTest() throws ApiException { + //HealthCheckResult response = api.fakeHealthGet(); // TODO: test validations } @@ -80,8 +79,8 @@ public void fakeOuterBooleanSerializeTest() throws ApiException { */ @Test public void fakeOuterCompositeSerializeTest() throws ApiException { - //OuterComposite body = null; - //OuterComposite response = api.fakeOuterCompositeSerialize(body); + //OuterComposite outerComposite = null; + //OuterComposite response = api.fakeOuterCompositeSerialize(outerComposite); // TODO: test validations } @@ -125,8 +124,8 @@ public void fakeOuterStringSerializeTest() throws ApiException { */ @Test public void testBodyWithFileSchemaTest() throws ApiException { - //FileSchemaTestClass body = null; - //api.testBodyWithFileSchema(body); + //FileSchemaTestClass fileSchemaTestClass = null; + //api.testBodyWithFileSchema(fileSchemaTestClass); // TODO: test validations } @@ -141,8 +140,8 @@ public void testBodyWithFileSchemaTest() throws ApiException { @Test public void testBodyWithQueryParamsTest() throws ApiException { //String query = null; - //User body = null; - //api.testBodyWithQueryParams(query, body); + //User user = null; + //api.testBodyWithQueryParams(query, user); // TODO: test validations } @@ -156,15 +155,15 @@ public void testBodyWithQueryParamsTest() throws ApiException { */ @Test public void testClientModelTest() throws ApiException { - //Client body = null; - //Client response = api.testClientModel(body); + //Client client = null; + //Client response = api.testClientModel(client); // TODO: test validations } /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * * @throws ApiException * if the Api call fails @@ -248,8 +247,8 @@ public void testGroupParametersTest() throws ApiException { */ @Test public void testInlineAdditionalPropertiesTest() throws ApiException { - //Map param = null; - //api.testInlineAdditionalProperties(param); + //Map requestBody = null; + //api.testInlineAdditionalProperties(requestBody); // TODO: test validations } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java index d5d0386500bd..2194d1682951 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java @@ -42,8 +42,8 @@ public class FakeClassnameTags123ApiTest { */ @Test public void testClassnameTest() throws ApiException { - //Client body = null; - //Client response = api.testClassname(body); + //Client client = null; + //Client response = api.testClassname(client); // TODO: test validations } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/PetApiTest.java index 7a918bea9662..866d46d816dc 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/PetApiTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -18,7 +18,6 @@ import java.io.File; import org.openapitools.client.model.ModelApiResponse; import org.openapitools.client.model.Pet; -import java.util.Set; import org.junit.Test; import org.junit.Ignore; import org.junit.Assert; @@ -45,8 +44,8 @@ public class PetApiTest { */ @Test public void addPetTest() throws ApiException { - //Pet body = null; - //api.addPet(body); + //Pet pet = null; + //api.addPet(pet); // TODO: test validations } @@ -91,8 +90,8 @@ public void findPetsByStatusTest() throws ApiException { */ @Test public void findPetsByTagsTest() throws ApiException { - //Set tags = null; - //Set response = api.findPetsByTags(tags); + //List tags = null; + //List response = api.findPetsByTags(tags); // TODO: test validations } @@ -121,8 +120,8 @@ public void getPetByIdTest() throws ApiException { */ @Test public void updatePetTest() throws ApiException { - //Pet body = null; - //api.updatePet(body); + //Pet pet = null; + //api.updatePet(pet); // TODO: test validations } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/StoreApiTest.java index 97bf695d6b25..20dcc8c1d6e5 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/StoreApiTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -86,8 +86,8 @@ public void getOrderByIdTest() throws ApiException { */ @Test public void placeOrderTest() throws ApiException { - //Order body = null; - //Order response = api.placeOrder(body); + //Order order = null; + //Order response = api.placeOrder(order); // TODO: test validations } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/UserApiTest.java index 8d11fad9de87..17c07ffe226f 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/UserApiTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -42,8 +42,8 @@ public class UserApiTest { */ @Test public void createUserTest() throws ApiException { - //User body = null; - //api.createUser(body); + //User user = null; + //api.createUser(user); // TODO: test validations } @@ -57,8 +57,8 @@ public void createUserTest() throws ApiException { */ @Test public void createUsersWithArrayInputTest() throws ApiException { - //List body = null; - //api.createUsersWithArrayInput(body); + //List user = null; + //api.createUsersWithArrayInput(user); // TODO: test validations } @@ -72,8 +72,8 @@ public void createUsersWithArrayInputTest() throws ApiException { */ @Test public void createUsersWithListInputTest() throws ApiException { - //List body = null; - //api.createUsersWithListInput(body); + //List user = null; + //api.createUsersWithListInput(user); // TODO: test validations } @@ -148,8 +148,8 @@ public void logoutUserTest() throws ApiException { @Test public void updateUserTest() throws ApiException { //String username = null; - //User body = null; - //api.updateUser(username, body); + //User user = null; + //api.updateUser(username, user); // TODO: test validations } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java index 2e3844ba9756..88ee16219b0a 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesClassTest.java @@ -19,10 +19,12 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; @@ -43,91 +45,67 @@ public void testAdditionalPropertiesClass() { } /** - * Test the property 'mapString' + * Test the property 'mapProperty' */ @Test - public void mapStringTest() { - // TODO: test mapString + public void mapPropertyTest() { + // TODO: test mapProperty } /** - * Test the property 'mapNumber' + * Test the property 'mapOfMapProperty' */ @Test - public void mapNumberTest() { - // TODO: test mapNumber + public void mapOfMapPropertyTest() { + // TODO: test mapOfMapProperty } /** - * Test the property 'mapInteger' - */ - @Test - public void mapIntegerTest() { - // TODO: test mapInteger - } - - /** - * Test the property 'mapBoolean' - */ - @Test - public void mapBooleanTest() { - // TODO: test mapBoolean - } - - /** - * Test the property 'mapArrayInteger' - */ - @Test - public void mapArrayIntegerTest() { - // TODO: test mapArrayInteger - } - - /** - * Test the property 'mapArrayAnytype' + * Test the property 'anytype1' */ @Test - public void mapArrayAnytypeTest() { - // TODO: test mapArrayAnytype + public void anytype1Test() { + // TODO: test anytype1 } /** - * Test the property 'mapMapString' + * Test the property 'mapWithUndeclaredPropertiesAnytype1' */ @Test - public void mapMapStringTest() { - // TODO: test mapMapString + public void mapWithUndeclaredPropertiesAnytype1Test() { + // TODO: test mapWithUndeclaredPropertiesAnytype1 } /** - * Test the property 'mapMapAnytype' + * Test the property 'mapWithUndeclaredPropertiesAnytype2' */ @Test - public void mapMapAnytypeTest() { - // TODO: test mapMapAnytype + public void mapWithUndeclaredPropertiesAnytype2Test() { + // TODO: test mapWithUndeclaredPropertiesAnytype2 } /** - * Test the property 'anytype1' + * Test the property 'mapWithUndeclaredPropertiesAnytype3' */ @Test - public void anytype1Test() { - // TODO: test anytype1 + public void mapWithUndeclaredPropertiesAnytype3Test() { + // TODO: test mapWithUndeclaredPropertiesAnytype3 } /** - * Test the property 'anytype2' + * Test the property 'emptyMap' */ @Test - public void anytype2Test() { - // TODO: test anytype2 + public void emptyMapTest() { + // TODO: test emptyMap } /** - * Test the property 'anytype3' + * Test the property 'mapWithUndeclaredPropertiesString' */ @Test - public void anytype3Test() { - // TODO: test anytype3 + public void mapWithUndeclaredPropertiesStringTest() { + // TODO: test mapWithUndeclaredPropertiesString } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AnimalTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AnimalTest.java index 7e79e5ca7b3f..558153c5578a 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AnimalTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AnimalTest.java @@ -21,7 +21,6 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.openapitools.client.model.BigCat; import org.openapitools.client.model.Cat; import org.openapitools.client.model.Dog; import org.junit.Assert; diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AppleReqTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AppleReqTest.java new file mode 100644 index 000000000000..0f39f3ad75cf --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AppleReqTest.java @@ -0,0 +1,57 @@ +/* + * 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 AppleReq + */ +public class AppleReqTest { + private final AppleReq model = new AppleReq(); + + /** + * Model tests for AppleReq + */ + @Test + public void testAppleReq() { + // TODO: test AppleReq + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'mealy' + */ + @Test + public void mealyTest() { + // TODO: test mealy + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AppleTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AppleTest.java new file mode 100644 index 000000000000..d983478a130b --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AppleTest.java @@ -0,0 +1,57 @@ +/* + * 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 Apple + */ +public class AppleTest { + private final Apple model = new Apple(); + + /** + * Model tests for Apple + */ + @Test + public void testApple() { + // TODO: test Apple + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BananaReqTest.java similarity index 66% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BananaReqTest.java index 4e03485a4484..a6d9b0c6123d 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesNumberTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BananaReqTest.java @@ -20,33 +20,39 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; -import java.util.HashMap; -import java.util.Map; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; /** - * Model tests for AdditionalPropertiesNumber + * Model tests for BananaReq */ -public class AdditionalPropertiesNumberTest { - private final AdditionalPropertiesNumber model = new AdditionalPropertiesNumber(); +public class BananaReqTest { + private final BananaReq model = new BananaReq(); /** - * Model tests for AdditionalPropertiesNumber + * Model tests for BananaReq */ @Test - public void testAdditionalPropertiesNumber() { - // TODO: test AdditionalPropertiesNumber + public void testBananaReq() { + // TODO: test BananaReq } /** - * Test the property 'name' + * Test the property 'lengthCm' */ @Test - public void nameTest() { - // TODO: test name + public void lengthCmTest() { + // TODO: test lengthCm + } + + /** + * Test the property 'sweet' + */ + @Test + public void sweetTest() { + // TODO: test sweet } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BananaTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BananaTest.java new file mode 100644 index 000000000000..ce5b24ce27f9 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BananaTest.java @@ -0,0 +1,50 @@ +/* + * 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 java.math.BigDecimal; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Banana + */ +public class BananaTest { + private final Banana model = new Banana(); + + /** + * Model tests for Banana + */ + @Test + public void testBanana() { + // TODO: test Banana + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BasquePigTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BasquePigTest.java new file mode 100644 index 000000000000..c89b20084dfa --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BasquePigTest.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 BasquePig + */ +public class BasquePigTest { + private final BasquePig model = new BasquePig(); + + /** + * Model tests for BasquePig + */ + @Test + public void testBasquePig() { + // TODO: test BasquePig + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/CatTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/CatTest.java index d0952b501004..1792dc3cc76a 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/CatTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/CatTest.java @@ -22,7 +22,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.client.model.Animal; -import org.openapitools.client.model.BigCat; import org.openapitools.client.model.CatAllOf; import org.junit.Assert; import org.junit.Ignore; diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ChildCatAllOfTest.java similarity index 72% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ChildCatAllOfTest.java index c84d987e7640..23ba3a5e47cd 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesStringTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ChildCatAllOfTest.java @@ -19,25 +19,23 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.HashMap; -import java.util.Map; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; /** - * Model tests for AdditionalPropertiesString + * Model tests for ChildCatAllOf */ -public class AdditionalPropertiesStringTest { - private final AdditionalPropertiesString model = new AdditionalPropertiesString(); +public class ChildCatAllOfTest { + private final ChildCatAllOf model = new ChildCatAllOf(); /** - * Model tests for AdditionalPropertiesString + * Model tests for ChildCatAllOf */ @Test - public void testAdditionalPropertiesString() { - // TODO: test AdditionalPropertiesString + public void testChildCatAllOf() { + // TODO: test ChildCatAllOf } /** diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ChildCatTest.java similarity index 64% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ChildCatTest.java index ceb024c5620b..4e71ac70188f 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesArrayTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ChildCatTest.java @@ -16,29 +16,38 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import org.openapitools.client.model.ChildCatAllOf; +import org.openapitools.client.model.ParentPet; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; /** - * Model tests for AdditionalPropertiesArray + * Model tests for ChildCat */ -public class AdditionalPropertiesArrayTest { - private final AdditionalPropertiesArray model = new AdditionalPropertiesArray(); +public class ChildCatTest { + private final ChildCat model = new ChildCat(); /** - * Model tests for AdditionalPropertiesArray + * Model tests for ChildCat */ @Test - public void testAdditionalPropertiesArray() { - // TODO: test AdditionalPropertiesArray + public void testChildCat() { + // TODO: test ChildCat + } + + /** + * Test the property 'petType' + */ + @Test + public void petTypeTest() { + // TODO: test petType } /** diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java new file mode 100644 index 000000000000..6237f87cb9b6 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ComplexQuadrilateralTest.java @@ -0,0 +1,59 @@ +/* + * 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.QuadrilateralInterface; +import org.openapitools.client.model.ShapeInterface; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for ComplexQuadrilateral + */ +public class ComplexQuadrilateralTest { + private final ComplexQuadrilateral model = new ComplexQuadrilateral(); + + /** + * Model tests for ComplexQuadrilateral + */ + @Test + public void testComplexQuadrilateral() { + // TODO: test ComplexQuadrilateral + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/DanishPigTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/DanishPigTest.java new file mode 100644 index 000000000000..9d2b8aeaa0bf --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/DanishPigTest.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 DanishPig + */ +public class DanishPigTest { + private final DanishPig model = new DanishPig(); + + /** + * Model tests for DanishPig + */ + @Test + public void testDanishPig() { + // TODO: test DanishPig + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/DrawingTest.java similarity index 51% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/DrawingTest.java index 56641d163a50..406cad75e14f 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/TypeHolderExampleTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/DrawingTest.java @@ -19,74 +19,66 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.math.BigDecimal; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import org.openapitools.client.model.Fruit; +import org.openapitools.client.model.NullableShape; +import org.openapitools.client.model.Shape; +import org.openapitools.client.model.ShapeOrNull; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; /** - * Model tests for TypeHolderExample + * Model tests for Drawing */ -public class TypeHolderExampleTest { - private final TypeHolderExample model = new TypeHolderExample(); +public class DrawingTest { + private final Drawing model = new Drawing(); /** - * Model tests for TypeHolderExample + * Model tests for Drawing */ @Test - public void testTypeHolderExample() { - // TODO: test TypeHolderExample + public void testDrawing() { + // TODO: test Drawing } /** - * Test the property 'stringItem' + * Test the property 'mainShape' */ @Test - public void stringItemTest() { - // TODO: test stringItem + public void mainShapeTest() { + // TODO: test mainShape } /** - * Test the property 'numberItem' + * Test the property 'shapeOrNull' */ @Test - public void numberItemTest() { - // TODO: test numberItem + public void shapeOrNullTest() { + // TODO: test shapeOrNull } /** - * Test the property 'floatItem' + * Test the property 'nullableShape' */ @Test - public void floatItemTest() { - // TODO: test floatItem + public void nullableShapeTest() { + // TODO: test nullableShape } /** - * Test the property 'integerItem' + * Test the property 'shapes' */ @Test - public void integerItemTest() { - // TODO: test integerItem - } - - /** - * Test the property 'boolItem' - */ - @Test - public void boolItemTest() { - // TODO: test boolItem - } - - /** - * Test the property 'arrayItem' - */ - @Test - public void arrayItemTest() { - // TODO: test arrayItem + public void shapesTest() { + // TODO: test shapes } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/EnumTestTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/EnumTestTest.java index 04e7afb19784..936fbe191c01 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/EnumTestTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/EnumTestTest.java @@ -20,6 +20,12 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.client.model.OuterEnum; +import org.openapitools.client.model.OuterEnumDefaultValue; +import org.openapitools.client.model.OuterEnumInteger; +import org.openapitools.client.model.OuterEnumIntegerDefaultValue; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; @@ -79,4 +85,28 @@ public void outerEnumTest() { // TODO: test outerEnum } + /** + * Test the property 'outerEnumInteger' + */ + @Test + public void outerEnumIntegerTest() { + // TODO: test outerEnumInteger + } + + /** + * Test the property 'outerEnumDefaultValue' + */ + @Test + public void outerEnumDefaultValueTest() { + // TODO: test outerEnumDefaultValue + } + + /** + * Test the property 'outerEnumIntegerDefaultValue' + */ + @Test + public void outerEnumIntegerDefaultValueTest() { + // TODO: test outerEnumIntegerDefaultValue + } + } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java new file mode 100644 index 000000000000..66a6d32e76f7 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/EquilateralTriangleTest.java @@ -0,0 +1,59 @@ +/* + * 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.ShapeInterface; +import org.openapitools.client.model.TriangleInterface; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for EquilateralTriangle + */ +public class EquilateralTriangleTest { + private final EquilateralTriangle model = new EquilateralTriangle(); + + /** + * Model tests for EquilateralTriangle + */ + @Test + public void testEquilateralTriangle() { + // TODO: test EquilateralTriangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/FooTest.java similarity index 74% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/FooTest.java index a9b13011f001..e315d9e3b155 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BigCatAllOfTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/FooTest.java @@ -25,25 +25,25 @@ /** - * Model tests for BigCatAllOf + * Model tests for Foo */ -public class BigCatAllOfTest { - private final BigCatAllOf model = new BigCatAllOf(); +public class FooTest { + private final Foo model = new Foo(); /** - * Model tests for BigCatAllOf + * Model tests for Foo */ @Test - public void testBigCatAllOf() { - // TODO: test BigCatAllOf + public void testFoo() { + // TODO: test Foo } /** - * Test the property 'kind' + * Test the property 'bar' */ @Test - public void kindTest() { - // TODO: test kind + public void barTest() { + // TODO: test bar } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/FormatTestTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/FormatTestTest.java index 73a1f737503f..d282af3ac23b 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/FormatTestTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/FormatTestTest.java @@ -148,11 +148,19 @@ public void passwordTest() { } /** - * Test the property 'bigDecimal' + * Test the property 'patternWithDigits' */ @Test - public void bigDecimalTest() { - // TODO: test bigDecimal + public void patternWithDigitsTest() { + // TODO: test patternWithDigits + } + + /** + * Test the property 'patternWithDigitsAndDelimiter' + */ + @Test + public void patternWithDigitsAndDelimiterTest() { + // TODO: test patternWithDigitsAndDelimiter } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/FruitReqTest.java similarity index 54% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/FruitReqTest.java index e96ac744439d..dc614b817d83 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/TypeHolderDefaultTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/FruitReqTest.java @@ -20,65 +20,57 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; +import org.openapitools.client.model.AppleReq; +import org.openapitools.client.model.BananaReq; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; /** - * Model tests for TypeHolderDefault + * Model tests for FruitReq */ -public class TypeHolderDefaultTest { - private final TypeHolderDefault model = new TypeHolderDefault(); +public class FruitReqTest { + private final FruitReq model = new FruitReq(); /** - * Model tests for TypeHolderDefault + * Model tests for FruitReq */ @Test - public void testTypeHolderDefault() { - // TODO: test TypeHolderDefault + public void testFruitReq() { + // TODO: test FruitReq } /** - * Test the property 'stringItem' + * Test the property 'cultivar' */ @Test - public void stringItemTest() { - // TODO: test stringItem + public void cultivarTest() { + // TODO: test cultivar } /** - * Test the property 'numberItem' + * Test the property 'mealy' */ @Test - public void numberItemTest() { - // TODO: test numberItem + public void mealyTest() { + // TODO: test mealy } /** - * Test the property 'integerItem' + * Test the property 'lengthCm' */ @Test - public void integerItemTest() { - // TODO: test integerItem + public void lengthCmTest() { + // TODO: test lengthCm } /** - * Test the property 'boolItem' + * Test the property 'sweet' */ @Test - public void boolItemTest() { - // TODO: test boolItem - } - - /** - * Test the property 'arrayItem' - */ - @Test - public void arrayItemTest() { - // TODO: test arrayItem + public void sweetTest() { + // TODO: test sweet } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/FruitTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/FruitTest.java new file mode 100644 index 000000000000..36dee4f05ba7 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/FruitTest.java @@ -0,0 +1,68 @@ +/* + * 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 java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Fruit + */ +public class FruitTest { + private final Fruit model = new Fruit(); + + /** + * Model tests for Fruit + */ + @Test + public void testFruit() { + // TODO: test Fruit + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/GmFruitTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/GmFruitTest.java new file mode 100644 index 000000000000..ed3965cd8a06 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/GmFruitTest.java @@ -0,0 +1,68 @@ +/* + * 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 java.math.BigDecimal; +import org.openapitools.client.model.Apple; +import org.openapitools.client.model.Banana; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for GmFruit + */ +public class GmFruitTest { + private final GmFruit model = new GmFruit(); + + /** + * Model tests for GmFruit + */ + @Test + public void testGmFruit() { + // TODO: test GmFruit + } + + /** + * Test the property 'cultivar' + */ + @Test + public void cultivarTest() { + // TODO: test cultivar + } + + /** + * Test the property 'origin' + */ + @Test + public void originTest() { + // TODO: test origin + } + + /** + * Test the property 'lengthCm' + */ + @Test + public void lengthCmTest() { + // TODO: test lengthCm + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java new file mode 100644 index 000000000000..59aba05da2db --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/GrandparentAnimalTest.java @@ -0,0 +1,53 @@ +/* + * 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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ChildCat; +import org.openapitools.client.model.ParentPet; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for GrandparentAnimal + */ +public class GrandparentAnimalTest { + private final GrandparentAnimal model = new GrandparentAnimal(); + + /** + * Model tests for GrandparentAnimal + */ + @Test + public void testGrandparentAnimal() { + // TODO: test GrandparentAnimal + } + + /** + * Test the property 'petType' + */ + @Test + public void petTypeTest() { + // TODO: test petType + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java new file mode 100644 index 000000000000..43806e73f933 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/HealthCheckResultTest.java @@ -0,0 +1,52 @@ +/* + * 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 com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for HealthCheckResult + */ +public class HealthCheckResultTest { + private final HealthCheckResult model = new HealthCheckResult(); + + /** + * Model tests for HealthCheckResult + */ + @Test + public void testHealthCheckResult() { + // TODO: test HealthCheckResult + } + + /** + * Test the property 'nullableMessage' + */ + @Test + public void nullableMessageTest() { + // TODO: test nullableMessage + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineObject1Test.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineObject1Test.java new file mode 100644 index 000000000000..f7e7347374d3 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineObject1Test.java @@ -0,0 +1,58 @@ +/* + * 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 java.io.File; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for InlineObject1 + */ +public class InlineObject1Test { + private final InlineObject1 model = new InlineObject1(); + + /** + * Model tests for InlineObject1 + */ + @Test + public void testInlineObject1() { + // TODO: test InlineObject1 + } + + /** + * Test the property 'additionalMetadata' + */ + @Test + public void additionalMetadataTest() { + // TODO: test additionalMetadata + } + + /** + * Test the property 'file' + */ + @Test + public void fileTest() { + // TODO: test file + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineObject2Test.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineObject2Test.java new file mode 100644 index 000000000000..a25872427e3d --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineObject2Test.java @@ -0,0 +1,59 @@ +/* + * 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 java.util.ArrayList; +import java.util.List; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for InlineObject2 + */ +public class InlineObject2Test { + private final InlineObject2 model = new InlineObject2(); + + /** + * Model tests for InlineObject2 + */ + @Test + public void testInlineObject2() { + // TODO: test InlineObject2 + } + + /** + * Test the property 'enumFormStringArray' + */ + @Test + public void enumFormStringArrayTest() { + // TODO: test enumFormStringArray + } + + /** + * Test the property 'enumFormString' + */ + @Test + public void enumFormStringTest() { + // TODO: test enumFormString + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineObject3Test.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineObject3Test.java new file mode 100644 index 000000000000..66d973213517 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineObject3Test.java @@ -0,0 +1,157 @@ +/* + * 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 java.io.File; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for InlineObject3 + */ +public class InlineObject3Test { + private final InlineObject3 model = new InlineObject3(); + + /** + * Model tests for InlineObject3 + */ + @Test + public void testInlineObject3() { + // TODO: test InlineObject3 + } + + /** + * Test the property 'integer' + */ + @Test + public void integerTest() { + // TODO: test integer + } + + /** + * Test the property 'int32' + */ + @Test + public void int32Test() { + // TODO: test int32 + } + + /** + * Test the property 'int64' + */ + @Test + public void int64Test() { + // TODO: test int64 + } + + /** + * Test the property 'number' + */ + @Test + public void numberTest() { + // TODO: test number + } + + /** + * Test the property '_float' + */ + @Test + public void _floatTest() { + // TODO: test _float + } + + /** + * Test the property '_double' + */ + @Test + public void _doubleTest() { + // TODO: test _double + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + + /** + * Test the property 'patternWithoutDelimiter' + */ + @Test + public void patternWithoutDelimiterTest() { + // TODO: test patternWithoutDelimiter + } + + /** + * Test the property '_byte' + */ + @Test + public void _byteTest() { + // TODO: test _byte + } + + /** + * Test the property 'binary' + */ + @Test + public void binaryTest() { + // TODO: test binary + } + + /** + * Test the property 'date' + */ + @Test + public void dateTest() { + // TODO: test date + } + + /** + * Test the property 'dateTime' + */ + @Test + public void dateTimeTest() { + // TODO: test dateTime + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'callback' + */ + @Test + public void callbackTest() { + // TODO: test callback + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineObject4Test.java similarity index 65% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineObject4Test.java index 66a7b85623e3..dee98299577f 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesIntegerTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineObject4Test.java @@ -19,33 +19,39 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.HashMap; -import java.util.Map; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; /** - * Model tests for AdditionalPropertiesInteger + * Model tests for InlineObject4 */ -public class AdditionalPropertiesIntegerTest { - private final AdditionalPropertiesInteger model = new AdditionalPropertiesInteger(); +public class InlineObject4Test { + private final InlineObject4 model = new InlineObject4(); /** - * Model tests for AdditionalPropertiesInteger + * Model tests for InlineObject4 */ @Test - public void testAdditionalPropertiesInteger() { - // TODO: test AdditionalPropertiesInteger + public void testInlineObject4() { + // TODO: test InlineObject4 } /** - * Test the property 'name' + * Test the property 'param' */ @Test - public void nameTest() { - // TODO: test name + public void paramTest() { + // TODO: test param + } + + /** + * Test the property 'param2' + */ + @Test + public void param2Test() { + // TODO: test param2 } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineObject5Test.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineObject5Test.java new file mode 100644 index 000000000000..bca9d9d5532f --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineObject5Test.java @@ -0,0 +1,58 @@ +/* + * 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 java.io.File; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for InlineObject5 + */ +public class InlineObject5Test { + private final InlineObject5 model = new InlineObject5(); + + /** + * Model tests for InlineObject5 + */ + @Test + public void testInlineObject5() { + // TODO: test InlineObject5 + } + + /** + * Test the property 'additionalMetadata' + */ + @Test + public void additionalMetadataTest() { + // TODO: test additionalMetadata + } + + /** + * Test the property 'requiredFile' + */ + @Test + public void requiredFileTest() { + // TODO: test requiredFile + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineObjectTest.java similarity index 72% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineObjectTest.java index e0c72c586347..eac0e1987dce 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesObjectTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineObjectTest.java @@ -19,25 +19,23 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.HashMap; -import java.util.Map; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; /** - * Model tests for AdditionalPropertiesObject + * Model tests for InlineObject */ -public class AdditionalPropertiesObjectTest { - private final AdditionalPropertiesObject model = new AdditionalPropertiesObject(); +public class InlineObjectTest { + private final InlineObject model = new InlineObject(); /** - * Model tests for AdditionalPropertiesObject + * Model tests for InlineObject */ @Test - public void testAdditionalPropertiesObject() { - // TODO: test AdditionalPropertiesObject + public void testInlineObject() { + // TODO: test InlineObject } /** @@ -48,4 +46,12 @@ public void nameTest() { // TODO: test name } + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineResponseDefaultTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineResponseDefaultTest.java new file mode 100644 index 000000000000..dc7262e10b10 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/InlineResponseDefaultTest.java @@ -0,0 +1,50 @@ +/* + * 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.Foo; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for InlineResponseDefault + */ +public class InlineResponseDefaultTest { + private final InlineResponseDefault model = new InlineResponseDefault(); + + /** + * Model tests for InlineResponseDefault + */ + @Test + public void testInlineResponseDefault() { + // TODO: test InlineResponseDefault + } + + /** + * Test the property 'string' + */ + @Test + public void stringTest() { + // TODO: test string + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java new file mode 100644 index 000000000000..b51db78af295 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/IsoscelesTriangleTest.java @@ -0,0 +1,59 @@ +/* + * 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.ShapeInterface; +import org.openapitools.client.model.TriangleInterface; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for IsoscelesTriangle + */ +public class IsoscelesTriangleTest { + private final IsoscelesTriangle model = new IsoscelesTriangle(); + + /** + * Model tests for IsoscelesTriangle + */ + @Test + public void testIsoscelesTriangle() { + // TODO: test IsoscelesTriangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BigCatTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/MammalTest.java similarity index 66% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BigCatTest.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/MammalTest.java index b3afa31d2894..58c9e49194e8 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/BigCatTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/MammalTest.java @@ -21,57 +21,58 @@ 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.openapitools.client.model.Pig; +import org.openapitools.client.model.Whale; +import org.openapitools.client.model.Zebra; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; /** - * Model tests for BigCat + * Model tests for Mammal */ -public class BigCatTest { - private final BigCat model = new BigCat(); +public class MammalTest { + private final Mammal model = new Mammal(); /** - * Model tests for BigCat + * Model tests for Mammal */ @Test - public void testBigCat() { - // TODO: test BigCat + public void testMammal() { + // TODO: test Mammal } /** - * Test the property 'className' + * Test the property 'hasBaleen' */ @Test - public void classNameTest() { - // TODO: test className + public void hasBaleenTest() { + // TODO: test hasBaleen } /** - * Test the property 'color' + * Test the property 'hasTeeth' */ @Test - public void colorTest() { - // TODO: test color + public void hasTeethTest() { + // TODO: test hasTeeth } /** - * Test the property 'declawed' + * Test the property 'className' */ @Test - public void declawedTest() { - // TODO: test declawed + public void classNameTest() { + // TODO: test className } /** - * Test the property 'kind' + * Test the property 'type' */ @Test - public void kindTest() { - // TODO: test kind + public void typeTest() { + // TODO: test type } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/NullableClassTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/NullableClassTest.java new file mode 100644 index 000000000000..380cb9f5c540 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/NullableClassTest.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 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 java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for NullableClass + */ +public class NullableClassTest { + private final NullableClass model = new NullableClass(); + + /** + * Model tests for NullableClass + */ + @Test + public void testNullableClass() { + // TODO: test NullableClass + } + + /** + * Test the property 'integerProp' + */ + @Test + public void integerPropTest() { + // TODO: test integerProp + } + + /** + * Test the property 'numberProp' + */ + @Test + public void numberPropTest() { + // TODO: test numberProp + } + + /** + * Test the property 'booleanProp' + */ + @Test + public void booleanPropTest() { + // TODO: test booleanProp + } + + /** + * Test the property 'stringProp' + */ + @Test + public void stringPropTest() { + // TODO: test stringProp + } + + /** + * Test the property 'dateProp' + */ + @Test + public void datePropTest() { + // TODO: test dateProp + } + + /** + * Test the property 'datetimeProp' + */ + @Test + public void datetimePropTest() { + // TODO: test datetimeProp + } + + /** + * Test the property 'arrayNullableProp' + */ + @Test + public void arrayNullablePropTest() { + // TODO: test arrayNullableProp + } + + /** + * Test the property 'arrayAndItemsNullableProp' + */ + @Test + public void arrayAndItemsNullablePropTest() { + // TODO: test arrayAndItemsNullableProp + } + + /** + * Test the property 'arrayItemsNullable' + */ + @Test + public void arrayItemsNullableTest() { + // TODO: test arrayItemsNullable + } + + /** + * Test the property 'objectNullableProp' + */ + @Test + public void objectNullablePropTest() { + // TODO: test objectNullableProp + } + + /** + * Test the property 'objectAndItemsNullableProp' + */ + @Test + public void objectAndItemsNullablePropTest() { + // TODO: test objectAndItemsNullableProp + } + + /** + * Test the property 'objectItemsNullable' + */ + @Test + public void objectItemsNullableTest() { + // TODO: test objectItemsNullable + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/NullableShapeTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/NullableShapeTest.java new file mode 100644 index 000000000000..9ce46c36f5ea --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/NullableShapeTest.java @@ -0,0 +1,69 @@ +/* + * 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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for NullableShape + */ +public class NullableShapeTest { + private final NullableShape model = new NullableShape(); + + /** + * Model tests for NullableShape + */ + @Test + public void testNullableShape() { + // TODO: test NullableShape + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java new file mode 100644 index 000000000000..59c4eebd2f0f --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/OuterEnumDefaultValueTest.java @@ -0,0 +1,33 @@ +/* + * 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.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for OuterEnumDefaultValue + */ +public class OuterEnumDefaultValueTest { + /** + * Model tests for OuterEnumDefaultValue + */ + @Test + public void testOuterEnumDefaultValue() { + // TODO: test OuterEnumDefaultValue + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java new file mode 100644 index 000000000000..fa981c709357 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/OuterEnumIntegerDefaultValueTest.java @@ -0,0 +1,33 @@ +/* + * 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.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for OuterEnumIntegerDefaultValue + */ +public class OuterEnumIntegerDefaultValueTest { + /** + * Model tests for OuterEnumIntegerDefaultValue + */ + @Test + public void testOuterEnumIntegerDefaultValue() { + // TODO: test OuterEnumIntegerDefaultValue + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java new file mode 100644 index 000000000000..1b98d326bb13 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/OuterEnumIntegerTest.java @@ -0,0 +1,33 @@ +/* + * 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.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for OuterEnumInteger + */ +public class OuterEnumIntegerTest { + /** + * Model tests for OuterEnumInteger + */ + @Test + public void testOuterEnumInteger() { + // TODO: test OuterEnumInteger + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ParentPetTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ParentPetTest.java new file mode 100644 index 000000000000..9e1393c03c40 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ParentPetTest.java @@ -0,0 +1,53 @@ +/* + * 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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ChildCat; +import org.openapitools.client.model.GrandparentAnimal; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for ParentPet + */ +public class ParentPetTest { + private final ParentPet model = new ParentPet(); + + /** + * Model tests for ParentPet + */ + @Test + public void testParentPet() { + // TODO: test ParentPet + } + + /** + * Test the property 'petType' + */ + @Test + public void petTypeTest() { + // TODO: test petType + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/PetTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/PetTest.java index 4065f7ca1a46..c3c0d4cc35dd 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/PetTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/PetTest.java @@ -20,9 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; -import java.util.LinkedHashSet; import java.util.List; -import java.util.Set; import org.openapitools.client.model.Category; import org.openapitools.client.model.Tag; import org.junit.Assert; diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/PigTest.java similarity index 65% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/PigTest.java index 517e5a10ae43..4fc8bfae7dcb 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesBooleanTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/PigTest.java @@ -16,36 +16,38 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.HashMap; -import java.util.Map; +import org.openapitools.client.model.BasquePig; +import org.openapitools.client.model.DanishPig; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; /** - * Model tests for AdditionalPropertiesBoolean + * Model tests for Pig */ -public class AdditionalPropertiesBooleanTest { - private final AdditionalPropertiesBoolean model = new AdditionalPropertiesBoolean(); +public class PigTest { + private final Pig model = new Pig(); /** - * Model tests for AdditionalPropertiesBoolean + * Model tests for Pig */ @Test - public void testAdditionalPropertiesBoolean() { - // TODO: test AdditionalPropertiesBoolean + public void testPig() { + // TODO: test Pig } /** - * Test the property 'name' + * Test the property 'className' */ @Test - public void nameTest() { - // TODO: test name + public void classNameTest() { + // TODO: test className } } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.java new file mode 100644 index 000000000000..718ab0efe92c --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/QuadrilateralInterfaceTest.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 QuadrilateralInterface + */ +public class QuadrilateralInterfaceTest { + private final QuadrilateralInterface model = new QuadrilateralInterface(); + + /** + * Model tests for QuadrilateralInterface + */ + @Test + public void testQuadrilateralInterface() { + // TODO: test QuadrilateralInterface + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/QuadrilateralTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/QuadrilateralTest.java new file mode 100644 index 000000000000..75a2d3c42f45 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/QuadrilateralTest.java @@ -0,0 +1,61 @@ +/* + * 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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.ComplexQuadrilateral; +import org.openapitools.client.model.SimpleQuadrilateral; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Quadrilateral + */ +public class QuadrilateralTest { + private final Quadrilateral model = new Quadrilateral(); + + /** + * Model tests for Quadrilateral + */ + @Test + public void testQuadrilateral() { + // TODO: test Quadrilateral + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java new file mode 100644 index 000000000000..6f5fb0093e45 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ScaleneTriangleTest.java @@ -0,0 +1,59 @@ +/* + * 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.ShapeInterface; +import org.openapitools.client.model.TriangleInterface; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for ScaleneTriangle + */ +public class ScaleneTriangleTest { + private final ScaleneTriangle model = new ScaleneTriangle(); + + /** + * Model tests for ScaleneTriangle + */ + @Test + public void testScaleneTriangle() { + // TODO: test ScaleneTriangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.java new file mode 100644 index 000000000000..9c22ccba6d37 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ShapeInterfaceTest.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 ShapeInterface + */ +public class ShapeInterfaceTest { + private final ShapeInterface model = new ShapeInterface(); + + /** + * Model tests for ShapeInterface + */ + @Test + public void testShapeInterface() { + // TODO: test ShapeInterface + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java new file mode 100644 index 000000000000..65468232ee58 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ShapeOrNullTest.java @@ -0,0 +1,69 @@ +/* + * 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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for ShapeOrNull + */ +public class ShapeOrNullTest { + private final ShapeOrNull model = new ShapeOrNull(); + + /** + * Model tests for ShapeOrNull + */ + @Test + public void testShapeOrNull() { + // TODO: test ShapeOrNull + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ShapeTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ShapeTest.java new file mode 100644 index 000000000000..b882ac315568 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ShapeTest.java @@ -0,0 +1,69 @@ +/* + * 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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Quadrilateral; +import org.openapitools.client.model.Triangle; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Shape + */ +public class ShapeTest { + private final Shape model = new Shape(); + + /** + * Model tests for Shape + */ + @Test + public void testShape() { + // TODO: test Shape + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java new file mode 100644 index 000000000000..b1dda86fe7f2 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/SimpleQuadrilateralTest.java @@ -0,0 +1,59 @@ +/* + * 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.QuadrilateralInterface; +import org.openapitools.client.model.ShapeInterface; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for SimpleQuadrilateral + */ +public class SimpleQuadrilateralTest { + private final SimpleQuadrilateral model = new SimpleQuadrilateral(); + + /** + * Model tests for SimpleQuadrilateral + */ + @Test + public void testSimpleQuadrilateral() { + // TODO: test SimpleQuadrilateral + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'quadrilateralType' + */ + @Test + public void quadrilateralTypeTest() { + // TODO: test quadrilateralType + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.java new file mode 100644 index 000000000000..d07b83711447 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/TriangleInterfaceTest.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 TriangleInterface + */ +public class TriangleInterfaceTest { + private final TriangleInterface model = new TriangleInterface(); + + /** + * Model tests for TriangleInterface + */ + @Test + public void testTriangleInterface() { + // TODO: test TriangleInterface + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/TriangleTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/TriangleTest.java new file mode 100644 index 000000000000..2c9070813847 --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/TriangleTest.java @@ -0,0 +1,62 @@ +/* + * 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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.EquilateralTriangle; +import org.openapitools.client.model.IsoscelesTriangle; +import org.openapitools.client.model.ScaleneTriangle; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * Model tests for Triangle + */ +public class TriangleTest { + private final Triangle model = new Triangle(); + + /** + * Model tests for Triangle + */ + @Test + public void testTriangle() { + // TODO: test Triangle + } + + /** + * Test the property 'shapeType' + */ + @Test + public void shapeTypeTest() { + // TODO: test shapeType + } + + /** + * Test the property 'triangleType' + */ + @Test + public void triangleTypeTest() { + // TODO: test triangleType + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/UserTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/UserTest.java index ce40d3a2a637..f5a8e85cb65c 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/UserTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/UserTest.java @@ -19,6 +19,9 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openapitools.jackson.nullable.JsonNullable; +import java.util.NoSuchElementException; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; @@ -102,4 +105,36 @@ public void userStatusTest() { // TODO: test userStatus } + /** + * Test the property 'objectWithNoDeclaredProps' + */ + @Test + public void objectWithNoDeclaredPropsTest() { + // TODO: test objectWithNoDeclaredProps + } + + /** + * Test the property 'objectWithNoDeclaredPropsNullable' + */ + @Test + public void objectWithNoDeclaredPropsNullableTest() { + // TODO: test objectWithNoDeclaredPropsNullable + } + + /** + * Test the property 'anyTypeProp' + */ + @Test + public void anyTypePropTest() { + // TODO: test anyTypeProp + } + + /** + * Test the property 'anyTypePropNullable' + */ + @Test + public void anyTypePropNullableTest() { + // TODO: test anyTypePropNullable + } + } diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/WhaleTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/WhaleTest.java new file mode 100644 index 000000000000..26810e2c280e --- /dev/null +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/WhaleTest.java @@ -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. + */ + + +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 Whale + */ +public class WhaleTest { + private final Whale model = new Whale(); + + /** + * Model tests for Whale + */ + @Test + public void testWhale() { + // TODO: test Whale + } + + /** + * Test the property 'hasBaleen' + */ + @Test + public void hasBaleenTest() { + // TODO: test hasBaleen + } + + /** + * Test the property 'hasTeeth' + */ + @Test + public void hasTeethTest() { + // TODO: test hasTeeth + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className + } + +} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/XmlItemTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/XmlItemTest.java deleted file mode 100644 index 501c414555f4..000000000000 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/XmlItemTest.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * 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 java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - - -/** - * Model tests for XmlItem - */ -public class XmlItemTest { - private final XmlItem model = new XmlItem(); - - /** - * Model tests for XmlItem - */ - @Test - public void testXmlItem() { - // TODO: test XmlItem - } - - /** - * Test the property 'attributeString' - */ - @Test - public void attributeStringTest() { - // TODO: test attributeString - } - - /** - * Test the property 'attributeNumber' - */ - @Test - public void attributeNumberTest() { - // TODO: test attributeNumber - } - - /** - * Test the property 'attributeInteger' - */ - @Test - public void attributeIntegerTest() { - // TODO: test attributeInteger - } - - /** - * Test the property 'attributeBoolean' - */ - @Test - public void attributeBooleanTest() { - // TODO: test attributeBoolean - } - - /** - * Test the property 'wrappedArray' - */ - @Test - public void wrappedArrayTest() { - // TODO: test wrappedArray - } - - /** - * Test the property 'nameString' - */ - @Test - public void nameStringTest() { - // TODO: test nameString - } - - /** - * Test the property 'nameNumber' - */ - @Test - public void nameNumberTest() { - // TODO: test nameNumber - } - - /** - * Test the property 'nameInteger' - */ - @Test - public void nameIntegerTest() { - // TODO: test nameInteger - } - - /** - * Test the property 'nameBoolean' - */ - @Test - public void nameBooleanTest() { - // TODO: test nameBoolean - } - - /** - * Test the property 'nameArray' - */ - @Test - public void nameArrayTest() { - // TODO: test nameArray - } - - /** - * Test the property 'nameWrappedArray' - */ - @Test - public void nameWrappedArrayTest() { - // TODO: test nameWrappedArray - } - - /** - * Test the property 'prefixString' - */ - @Test - public void prefixStringTest() { - // TODO: test prefixString - } - - /** - * Test the property 'prefixNumber' - */ - @Test - public void prefixNumberTest() { - // TODO: test prefixNumber - } - - /** - * Test the property 'prefixInteger' - */ - @Test - public void prefixIntegerTest() { - // TODO: test prefixInteger - } - - /** - * Test the property 'prefixBoolean' - */ - @Test - public void prefixBooleanTest() { - // TODO: test prefixBoolean - } - - /** - * Test the property 'prefixArray' - */ - @Test - public void prefixArrayTest() { - // TODO: test prefixArray - } - - /** - * Test the property 'prefixWrappedArray' - */ - @Test - public void prefixWrappedArrayTest() { - // TODO: test prefixWrappedArray - } - - /** - * Test the property 'namespaceString' - */ - @Test - public void namespaceStringTest() { - // TODO: test namespaceString - } - - /** - * Test the property 'namespaceNumber' - */ - @Test - public void namespaceNumberTest() { - // TODO: test namespaceNumber - } - - /** - * Test the property 'namespaceInteger' - */ - @Test - public void namespaceIntegerTest() { - // TODO: test namespaceInteger - } - - /** - * Test the property 'namespaceBoolean' - */ - @Test - public void namespaceBooleanTest() { - // TODO: test namespaceBoolean - } - - /** - * Test the property 'namespaceArray' - */ - @Test - public void namespaceArrayTest() { - // TODO: test namespaceArray - } - - /** - * Test the property 'namespaceWrappedArray' - */ - @Test - public void namespaceWrappedArrayTest() { - // TODO: test namespaceWrappedArray - } - - /** - * Test the property 'prefixNsString' - */ - @Test - public void prefixNsStringTest() { - // TODO: test prefixNsString - } - - /** - * Test the property 'prefixNsNumber' - */ - @Test - public void prefixNsNumberTest() { - // TODO: test prefixNsNumber - } - - /** - * Test the property 'prefixNsInteger' - */ - @Test - public void prefixNsIntegerTest() { - // TODO: test prefixNsInteger - } - - /** - * Test the property 'prefixNsBoolean' - */ - @Test - public void prefixNsBooleanTest() { - // TODO: test prefixNsBoolean - } - - /** - * Test the property 'prefixNsArray' - */ - @Test - public void prefixNsArrayTest() { - // TODO: test prefixNsArray - } - - /** - * Test the property 'prefixNsWrappedArray' - */ - @Test - public void prefixNsWrappedArrayTest() { - // TODO: test prefixNsWrappedArray - } - -} diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ZebraTest.java similarity index 69% rename from samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java rename to samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ZebraTest.java index ec44af783873..28ce0c1d7f88 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/AdditionalPropertiesAnyTypeTest.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/test/java/org/openapitools/client/model/ZebraTest.java @@ -27,25 +27,33 @@ /** - * Model tests for AdditionalPropertiesAnyType + * Model tests for Zebra */ -public class AdditionalPropertiesAnyTypeTest { - private final AdditionalPropertiesAnyType model = new AdditionalPropertiesAnyType(); +public class ZebraTest { + private final Zebra model = new Zebra(); /** - * Model tests for AdditionalPropertiesAnyType + * Model tests for Zebra */ @Test - public void testAdditionalPropertiesAnyType() { - // TODO: test AdditionalPropertiesAnyType + public void testZebra() { + // TODO: test Zebra } /** - * Test the property 'name' + * Test the property 'type' */ @Test - public void nameTest() { - // TODO: test name + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'className' + */ + @Test + public void classNameTest() { + // TODO: test className } } diff --git a/samples/openapi3/client/petstore/python-experimental/.openapi-generator/FILES b/samples/openapi3/client/petstore/python-experimental/.openapi-generator/FILES index 378e6965acc8..ffc326a12f08 100644 --- a/samples/openapi3/client/petstore/python-experimental/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python-experimental/.openapi-generator/FILES @@ -102,92 +102,94 @@ petstore_api/api/pet_api.py petstore_api/api/store_api.py petstore_api/api/user_api.py petstore_api/api_client.py +petstore_api/apis/__init__.py petstore_api/configuration.py petstore_api/exceptions.py +petstore_api/model/__init__.py +petstore_api/model/additional_properties_class.py +petstore_api/model/address.py +petstore_api/model/animal.py +petstore_api/model/api_response.py +petstore_api/model/apple.py +petstore_api/model/apple_req.py +petstore_api/model/array_of_array_of_number_only.py +petstore_api/model/array_of_number_only.py +petstore_api/model/array_test.py +petstore_api/model/banana.py +petstore_api/model/banana_req.py +petstore_api/model/basque_pig.py +petstore_api/model/capitalization.py +petstore_api/model/cat.py +petstore_api/model/cat_all_of.py +petstore_api/model/category.py +petstore_api/model/child_cat.py +petstore_api/model/child_cat_all_of.py +petstore_api/model/class_model.py +petstore_api/model/client.py +petstore_api/model/complex_quadrilateral.py +petstore_api/model/danish_pig.py +petstore_api/model/dog.py +petstore_api/model/dog_all_of.py +petstore_api/model/drawing.py +petstore_api/model/enum_arrays.py +petstore_api/model/enum_class.py +petstore_api/model/enum_test.py +petstore_api/model/equilateral_triangle.py +petstore_api/model/file.py +petstore_api/model/file_schema_test_class.py +petstore_api/model/foo.py +petstore_api/model/format_test.py +petstore_api/model/fruit.py +petstore_api/model/fruit_req.py +petstore_api/model/gm_fruit.py +petstore_api/model/grandparent_animal.py +petstore_api/model/has_only_read_only.py +petstore_api/model/health_check_result.py +petstore_api/model/inline_object.py +petstore_api/model/inline_object1.py +petstore_api/model/inline_object2.py +petstore_api/model/inline_object3.py +petstore_api/model/inline_object4.py +petstore_api/model/inline_object5.py +petstore_api/model/inline_response_default.py +petstore_api/model/isosceles_triangle.py +petstore_api/model/list.py +petstore_api/model/mammal.py +petstore_api/model/map_test.py +petstore_api/model/mixed_properties_and_additional_properties_class.py +petstore_api/model/model200_response.py +petstore_api/model/model_return.py +petstore_api/model/name.py +petstore_api/model/nullable_class.py +petstore_api/model/nullable_shape.py +petstore_api/model/number_only.py +petstore_api/model/order.py +petstore_api/model/outer_composite.py +petstore_api/model/outer_enum.py +petstore_api/model/outer_enum_default_value.py +petstore_api/model/outer_enum_integer.py +petstore_api/model/outer_enum_integer_default_value.py +petstore_api/model/parent_pet.py +petstore_api/model/pet.py +petstore_api/model/pig.py +petstore_api/model/quadrilateral.py +petstore_api/model/quadrilateral_interface.py +petstore_api/model/read_only_first.py +petstore_api/model/scalene_triangle.py +petstore_api/model/shape.py +petstore_api/model/shape_interface.py +petstore_api/model/shape_or_null.py +petstore_api/model/simple_quadrilateral.py +petstore_api/model/special_model_name.py +petstore_api/model/string_boolean_map.py +petstore_api/model/tag.py +petstore_api/model/triangle.py +petstore_api/model/triangle_interface.py +petstore_api/model/user.py +petstore_api/model/whale.py +petstore_api/model/zebra.py petstore_api/model_utils.py petstore_api/models/__init__.py -petstore_api/models/additional_properties_class.py -petstore_api/models/address.py -petstore_api/models/animal.py -petstore_api/models/api_response.py -petstore_api/models/apple.py -petstore_api/models/apple_req.py -petstore_api/models/array_of_array_of_number_only.py -petstore_api/models/array_of_number_only.py -petstore_api/models/array_test.py -petstore_api/models/banana.py -petstore_api/models/banana_req.py -petstore_api/models/basque_pig.py -petstore_api/models/capitalization.py -petstore_api/models/cat.py -petstore_api/models/cat_all_of.py -petstore_api/models/category.py -petstore_api/models/child_cat.py -petstore_api/models/child_cat_all_of.py -petstore_api/models/class_model.py -petstore_api/models/client.py -petstore_api/models/complex_quadrilateral.py -petstore_api/models/danish_pig.py -petstore_api/models/dog.py -petstore_api/models/dog_all_of.py -petstore_api/models/drawing.py -petstore_api/models/enum_arrays.py -petstore_api/models/enum_class.py -petstore_api/models/enum_test.py -petstore_api/models/equilateral_triangle.py -petstore_api/models/file.py -petstore_api/models/file_schema_test_class.py -petstore_api/models/foo.py -petstore_api/models/format_test.py -petstore_api/models/fruit.py -petstore_api/models/fruit_req.py -petstore_api/models/gm_fruit.py -petstore_api/models/grandparent_animal.py -petstore_api/models/has_only_read_only.py -petstore_api/models/health_check_result.py -petstore_api/models/inline_object.py -petstore_api/models/inline_object1.py -petstore_api/models/inline_object2.py -petstore_api/models/inline_object3.py -petstore_api/models/inline_object4.py -petstore_api/models/inline_object5.py -petstore_api/models/inline_response_default.py -petstore_api/models/isosceles_triangle.py -petstore_api/models/list.py -petstore_api/models/mammal.py -petstore_api/models/map_test.py -petstore_api/models/mixed_properties_and_additional_properties_class.py -petstore_api/models/model200_response.py -petstore_api/models/model_return.py -petstore_api/models/name.py -petstore_api/models/nullable_class.py -petstore_api/models/nullable_shape.py -petstore_api/models/number_only.py -petstore_api/models/order.py -petstore_api/models/outer_composite.py -petstore_api/models/outer_enum.py -petstore_api/models/outer_enum_default_value.py -petstore_api/models/outer_enum_integer.py -petstore_api/models/outer_enum_integer_default_value.py -petstore_api/models/parent_pet.py -petstore_api/models/pet.py -petstore_api/models/pig.py -petstore_api/models/quadrilateral.py -petstore_api/models/quadrilateral_interface.py -petstore_api/models/read_only_first.py -petstore_api/models/scalene_triangle.py -petstore_api/models/shape.py -petstore_api/models/shape_interface.py -petstore_api/models/shape_or_null.py -petstore_api/models/simple_quadrilateral.py -petstore_api/models/special_model_name.py -petstore_api/models/string_boolean_map.py -petstore_api/models/tag.py -petstore_api/models/triangle.py -petstore_api/models/triangle_interface.py -petstore_api/models/user.py -petstore_api/models/whale.py -petstore_api/models/zebra.py petstore_api/rest.py petstore_api/signing.py requirements.txt diff --git a/samples/openapi3/client/petstore/python-experimental/README.md b/samples/openapi3/client/petstore/python-experimental/README.md index 9827e98d2a13..a542d727b93d 100644 --- a/samples/openapi3/client/petstore/python-experimental/README.md +++ b/samples/openapi3/client/petstore/python-experimental/README.md @@ -50,7 +50,8 @@ import datetime import time import petstore_api from pprint import pprint - +from petstore_api.api import another_fake_api +from petstore_api.model import client # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. configuration = petstore_api.Configuration( @@ -62,8 +63,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.AnotherFakeApi(api_client) - client_client = petstore_api.Client() # client.Client | client model + api_instance = another_fake_api.AnotherFakeApi(api_client) + client_client = client.Client() # client.Client | client model try: # To test special tags @@ -71,7 +72,6 @@ with petstore_api.ApiClient(configuration) as api_client: pprint(api_response) except petstore_api.ApiException as e: print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e) - ``` ## Documentation for API Endpoints @@ -253,3 +253,22 @@ Class | Method | HTTP request | Description +## Notes for Large OpenAPI documents +If the OpenAPI document is large, imports in petstore_api.apis and petstore_api.models may fail with a +RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions: + +Solution 1: +Use specific imports for apis and models like: +- `from petstore_api.api.default_api import DefaultApi` +- `from petstore_api.model.pet import Pet` + +Solution 1: +Before importing the package, adjust the maximum recursion limit as shown below: +``` +import sys +sys.setrecursionlimit(1500) +import petstore_api +from petstore_api.apis import * +from petstore_api.models import * +``` + diff --git a/samples/openapi3/client/petstore/python-experimental/docs/AnotherFakeApi.md b/samples/openapi3/client/petstore/python-experimental/docs/AnotherFakeApi.md index 7b8b3d6796d0..4290afb9ab04 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/AnotherFakeApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/AnotherFakeApi.md @@ -20,6 +20,8 @@ To test special tags and operation ID starting with number from __future__ import print_function import time import petstore_api +from petstore_api.api import another_fake_api +from petstore_api.model import client from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -31,8 +33,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.AnotherFakeApi(api_client) - client_client = petstore_api.Client() # client.Client | client model + api_instance = another_fake_api.AnotherFakeApi(api_client) + client_client = client.Client() # client.Client | client model # example passing only required values which don't have defaults set try: diff --git a/samples/openapi3/client/petstore/python-experimental/docs/DefaultApi.md b/samples/openapi3/client/petstore/python-experimental/docs/DefaultApi.md index 91623f7a45ae..d5e28c8bc429 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/DefaultApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/DefaultApi.md @@ -18,6 +18,8 @@ Method | HTTP request | Description from __future__ import print_function import time import petstore_api +from petstore_api.api import default_api +from petstore_api.model import inline_response_default from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -29,7 +31,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.DefaultApi(api_client) + api_instance = default_api.DefaultApi(api_client) # example, this endpoint has no required or optional parameters try: diff --git a/samples/openapi3/client/petstore/python-experimental/docs/FakeApi.md b/samples/openapi3/client/petstore/python-experimental/docs/FakeApi.md index a31649db9aaf..6bd8936f1b5b 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/FakeApi.md @@ -31,6 +31,8 @@ Health check endpoint from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import health_check_result from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -42,7 +44,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) # example, this endpoint has no required or optional parameters try: @@ -89,6 +91,7 @@ Test serialization of outer boolean types from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -100,7 +103,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) body = True # bool | Input boolean as post body (optional) # example passing only required values which don't have defaults set @@ -151,6 +154,8 @@ Test serialization of object with outer number type from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import outer_composite from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -162,8 +167,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - outer_composite_outer_composite = petstore_api.OuterComposite() # outer_composite.OuterComposite | Input composite as post body (optional) + api_instance = fake_api.FakeApi(api_client) + outer_composite_outer_composite = outer_composite.OuterComposite() # outer_composite.OuterComposite | Input composite as post body (optional) # example passing only required values which don't have defaults set # and optional values @@ -213,6 +218,7 @@ Test serialization of outer number types from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -224,7 +230,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) body = 3.4 # float | Input number as post body (optional) # example passing only required values which don't have defaults set @@ -275,6 +281,7 @@ Test serialization of outer string types from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -286,7 +293,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) body = 'body_example' # str | Input string as post body (optional) # example passing only required values which don't have defaults set @@ -337,6 +344,8 @@ For this test, the body for this request much reference a schema named `File`. from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import file_schema_test_class from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -348,8 +357,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - file_schema_test_class_file_schema_test_class = petstore_api.FileSchemaTestClass() # file_schema_test_class.FileSchemaTestClass | + api_instance = fake_api.FakeApi(api_client) + file_schema_test_class_file_schema_test_class = file_schema_test_class.FileSchemaTestClass() # file_schema_test_class.FileSchemaTestClass | # example passing only required values which don't have defaults set try: @@ -395,6 +404,8 @@ No authorization required from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -406,9 +417,9 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) query = 'query_example' # str | - user_user = petstore_api.User() # user.User | + user_user = user.User() # user.User | # example passing only required values which don't have defaults set try: @@ -457,6 +468,8 @@ To test \"client\" model from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api +from petstore_api.model import client from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -468,8 +481,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) - client_client = petstore_api.Client() # client.Client | client model + api_instance = fake_api.FakeApi(api_client) + client_client = client.Client() # client.Client | client model # example passing only required values which don't have defaults set try: @@ -520,6 +533,7 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -541,7 +555,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) number = 3.4 # float | None double = 3.4 # float | None pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None @@ -626,6 +640,7 @@ To test enum parameters from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -637,7 +652,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) enum_header_string_array = ['enum_header_string_array_example'] # [str] | Header parameter enum test (string array) (optional) enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) if omitted the server will use the default value of '-efg' enum_query_string_array = ['enum_query_string_array_example'] # [str] | Query parameter enum test (string array) (optional) @@ -704,6 +719,7 @@ Fake endpoint to test group parameters (optional) from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -724,7 +740,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) required_string_group = 56 # int | Required String in group parameters required_boolean_group = True # bool | Required Boolean in group parameters required_int64_group = 56 # int | Required Integer in group parameters @@ -790,6 +806,7 @@ test inline additionalProperties from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -801,7 +818,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) request_body = {'key': 'request_body_example'} # {str: (str,)} | request body # example passing only required values which don't have defaults set @@ -849,6 +866,7 @@ test json serialization of form data from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -860,7 +878,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) param = 'param_example' # str | field1 param2 = 'param2_example' # str | field2 @@ -912,6 +930,7 @@ To test the collection format in query parameters from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -923,7 +942,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeApi(api_client) + api_instance = fake_api.FakeApi(api_client) pipe = ['pipe_example'] # [str] | ioutil = ['ioutil_example'] # [str] | http = ['http_example'] # [str] | diff --git a/samples/openapi3/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md index ab1eb4d62ca8..3568b3be2399 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/FakeClassnameTags123Api.md @@ -21,6 +21,8 @@ To test class name in snake case from __future__ import print_function import time import petstore_api +from petstore_api.api import fake_classname_tags_123_api +from petstore_api.model import client from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -46,8 +48,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.FakeClassnameTags123Api(api_client) - client_client = petstore_api.Client() # client.Client | client model + api_instance = fake_classname_tags_123_api.FakeClassnameTags123Api(api_client) + client_client = client.Client() # client.Client | client model # example passing only required values which don't have defaults set try: diff --git a/samples/openapi3/client/petstore/python-experimental/docs/PetApi.md b/samples/openapi3/client/petstore/python-experimental/docs/PetApi.md index 62bcfdd1bdd1..a5344a30f168 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/PetApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/PetApi.md @@ -27,6 +27,8 @@ Add a new pet to the store from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -108,8 +110,8 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - pet_pet = petstore_api.Pet() # pet.Pet | Pet object that needs to be added to the store + api_instance = pet_api.PetApi(api_client) + pet_pet = pet.Pet() # pet.Pet | Pet object that needs to be added to the store # example passing only required values which don't have defaults set try: @@ -157,6 +159,7 @@ Deletes a pet from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -178,7 +181,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | Pet id to delete api_key = 'api_key_example' # str | (optional) @@ -239,6 +242,8 @@ Multiple status values can be provided with comma separated strings from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -320,7 +325,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) status = ['status_example'] # [str] | Status values that need to be considered for filter # example passing only required values which don't have defaults set @@ -373,6 +378,8 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -454,7 +461,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) tags = ['tags_example'] # [str] | Tags to filter by # example passing only required values which don't have defaults set @@ -507,6 +514,8 @@ Returns a single pet from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -532,7 +541,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | ID of pet to return # example passing only required values which don't have defaults set @@ -584,6 +593,8 @@ Update an existing pet from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import pet from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -665,8 +676,8 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) - pet_pet = petstore_api.Pet() # pet.Pet | Pet object that needs to be added to the store + api_instance = pet_api.PetApi(api_client) + pet_pet = pet.Pet() # pet.Pet | Pet object that needs to be added to the store # example passing only required values which don't have defaults set try: @@ -716,6 +727,7 @@ Updates a pet in the store with form data from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -737,7 +749,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | ID of pet that needs to be updated name = 'name_example' # str | Updated name of the pet (optional) status = 'status_example' # str | Updated status of the pet (optional) @@ -798,6 +810,8 @@ uploads an image from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import api_response from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -819,7 +833,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | ID of pet to update additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) file = open('/path/to/file', 'rb') # file_type | file to upload (optional) @@ -882,6 +896,8 @@ uploads an image (required) from __future__ import print_function import time import petstore_api +from petstore_api.api import pet_api +from petstore_api.model import api_response from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -903,7 +919,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN' # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.PetApi(api_client) + api_instance = pet_api.PetApi(api_client) pet_id = 56 # int | ID of pet to update required_file = open('/path/to/file', 'rb') # file_type | file to upload additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) diff --git a/samples/openapi3/client/petstore/python-experimental/docs/StoreApi.md b/samples/openapi3/client/petstore/python-experimental/docs/StoreApi.md index 4a7b890a1cc1..2cebd103e1f8 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/StoreApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/StoreApi.md @@ -23,6 +23,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non from __future__ import print_function import time import petstore_api +from petstore_api.api import store_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -34,7 +35,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) + api_instance = store_api.StoreApi(api_client) order_id = 'order_id_example' # str | ID of the order that needs to be deleted # example passing only required values which don't have defaults set @@ -86,6 +87,7 @@ Returns a map of status codes to quantities from __future__ import print_function import time import petstore_api +from petstore_api.api import store_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -111,7 +113,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient(configuration) as api_client: # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) + api_instance = store_api.StoreApi(api_client) # example, this endpoint has no required or optional parameters try: @@ -158,6 +160,8 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge from __future__ import print_function import time import petstore_api +from petstore_api.api import store_api +from petstore_api.model import order from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -169,7 +173,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) + api_instance = store_api.StoreApi(api_client) order_id = 56 # int | ID of pet that needs to be fetched # example passing only required values which don't have defaults set @@ -220,6 +224,8 @@ Place an order for a pet from __future__ import print_function import time import petstore_api +from petstore_api.api import store_api +from petstore_api.model import order from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -231,8 +237,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.StoreApi(api_client) - order_order = petstore_api.Order() # order.Order | order placed for purchasing the pet + api_instance = store_api.StoreApi(api_client) + order_order = order.Order() # order.Order | order placed for purchasing the pet # example passing only required values which don't have defaults set try: diff --git a/samples/openapi3/client/petstore/python-experimental/docs/UserApi.md b/samples/openapi3/client/petstore/python-experimental/docs/UserApi.md index 4aa31e100bb0..ffcdef6d343c 100644 --- a/samples/openapi3/client/petstore/python-experimental/docs/UserApi.md +++ b/samples/openapi3/client/petstore/python-experimental/docs/UserApi.md @@ -27,6 +27,8 @@ This can only be done by the logged in user. from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -38,8 +40,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - user_user = petstore_api.User() # user.User | Created user object + api_instance = user_api.UserApi(api_client) + user_user = user.User() # user.User | Created user object # example passing only required values which don't have defaults set try: @@ -86,6 +88,8 @@ Creates list of users with given input array from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -97,8 +101,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - user_user = [petstore_api.User()] # [user.User] | List of user object + api_instance = user_api.UserApi(api_client) + user_user = [user.User()] # [user.User] | List of user object # example passing only required values which don't have defaults set try: @@ -145,6 +149,8 @@ Creates list of users with given input array from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -156,8 +162,8 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) - user_user = [petstore_api.User()] # [user.User] | List of user object + api_instance = user_api.UserApi(api_client) + user_user = [user.User()] # [user.User] | List of user object # example passing only required values which don't have defaults set try: @@ -206,6 +212,7 @@ This can only be done by the logged in user. from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -217,7 +224,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) username = 'username_example' # str | The name that needs to be deleted # example passing only required values which don't have defaults set @@ -266,6 +273,8 @@ Get user by user name from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -277,7 +286,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing. # example passing only required values which don't have defaults set @@ -328,6 +337,7 @@ Logs user into the system from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -339,7 +349,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) username = 'username_example' # str | The user name for login password = 'password_example' # str | The password for login in clear text @@ -391,6 +401,7 @@ Logs out current logged in user session from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -402,7 +413,7 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) # example, this endpoint has no required or optional parameters try: @@ -448,6 +459,8 @@ This can only be done by the logged in user. from __future__ import print_function import time import petstore_api +from petstore_api.api import user_api +from petstore_api.model import user from pprint import pprint # Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 # See configuration.py for a list of all supported configuration parameters. @@ -459,9 +472,9 @@ configuration = petstore_api.Configuration( # Enter a context with an instance of the API client with petstore_api.ApiClient() as api_client: # Create an instance of the API class - api_instance = petstore_api.UserApi(api_client) + api_instance = user_api.UserApi(api_client) username = 'username_example' # str | name that need to be deleted - user_user = petstore_api.User() # user.User | Updated user object + user_user = user.User() # user.User | Updated user object # example passing only required values which don't have defaults set try: diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/__init__.py index 8b945d032fbe..fb7630e30d59 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/__init__.py @@ -16,15 +16,6 @@ __version__ = "1.0.0" -# import apis into sdk package -from petstore_api.api.another_fake_api import AnotherFakeApi -from petstore_api.api.default_api import DefaultApi -from petstore_api.api.fake_api import FakeApi -from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api -from petstore_api.api.pet_api import PetApi -from petstore_api.api.store_api import StoreApi -from petstore_api.api.user_api import UserApi - # import ApiClient from petstore_api.api_client import ApiClient @@ -34,91 +25,8 @@ # import exceptions from petstore_api.exceptions import OpenApiException +from petstore_api.exceptions import ApiAttributeError from petstore_api.exceptions import ApiTypeError from petstore_api.exceptions import ApiValueError from petstore_api.exceptions import ApiKeyError -from petstore_api.exceptions import ApiException - -# import models into sdk package -from petstore_api.models.additional_properties_class import AdditionalPropertiesClass -from petstore_api.models.address import Address -from petstore_api.models.animal import Animal -from petstore_api.models.api_response import ApiResponse -from petstore_api.models.apple import Apple -from petstore_api.models.apple_req import AppleReq -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.banana import Banana -from petstore_api.models.banana_req import BananaReq -from petstore_api.models.basque_pig import BasquePig -from petstore_api.models.capitalization import Capitalization -from petstore_api.models.cat import Cat -from petstore_api.models.cat_all_of import CatAllOf -from petstore_api.models.category import Category -from petstore_api.models.child_cat import ChildCat -from petstore_api.models.child_cat_all_of import ChildCatAllOf -from petstore_api.models.class_model import ClassModel -from petstore_api.models.client import Client -from petstore_api.models.complex_quadrilateral import ComplexQuadrilateral -from petstore_api.models.danish_pig import DanishPig -from petstore_api.models.dog import Dog -from petstore_api.models.dog_all_of import DogAllOf -from petstore_api.models.drawing import Drawing -from petstore_api.models.enum_arrays import EnumArrays -from petstore_api.models.enum_class import EnumClass -from petstore_api.models.enum_test import EnumTest -from petstore_api.models.equilateral_triangle import EquilateralTriangle -from petstore_api.models.file import File -from petstore_api.models.file_schema_test_class import FileSchemaTestClass -from petstore_api.models.foo import Foo -from petstore_api.models.format_test import FormatTest -from petstore_api.models.fruit import Fruit -from petstore_api.models.fruit_req import FruitReq -from petstore_api.models.gm_fruit import GmFruit -from petstore_api.models.grandparent_animal import GrandparentAnimal -from petstore_api.models.has_only_read_only import HasOnlyReadOnly -from petstore_api.models.health_check_result import HealthCheckResult -from petstore_api.models.inline_object import InlineObject -from petstore_api.models.inline_object1 import InlineObject1 -from petstore_api.models.inline_object2 import InlineObject2 -from petstore_api.models.inline_object3 import InlineObject3 -from petstore_api.models.inline_object4 import InlineObject4 -from petstore_api.models.inline_object5 import InlineObject5 -from petstore_api.models.inline_response_default import InlineResponseDefault -from petstore_api.models.isosceles_triangle import IsoscelesTriangle -from petstore_api.models.list import List -from petstore_api.models.mammal import Mammal -from petstore_api.models.map_test import MapTest -from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass -from petstore_api.models.model200_response import Model200Response -from petstore_api.models.model_return import ModelReturn -from petstore_api.models.name import Name -from petstore_api.models.nullable_class import NullableClass -from petstore_api.models.nullable_shape import NullableShape -from petstore_api.models.number_only import NumberOnly -from petstore_api.models.order import Order -from petstore_api.models.outer_composite import OuterComposite -from petstore_api.models.outer_enum import OuterEnum -from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue -from petstore_api.models.outer_enum_integer import OuterEnumInteger -from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue -from petstore_api.models.parent_pet import ParentPet -from petstore_api.models.pet import Pet -from petstore_api.models.pig import Pig -from petstore_api.models.quadrilateral import Quadrilateral -from petstore_api.models.quadrilateral_interface import QuadrilateralInterface -from petstore_api.models.read_only_first import ReadOnlyFirst -from petstore_api.models.scalene_triangle import ScaleneTriangle -from petstore_api.models.shape import Shape -from petstore_api.models.shape_interface import ShapeInterface -from petstore_api.models.shape_or_null import ShapeOrNull -from petstore_api.models.simple_quadrilateral import SimpleQuadrilateral -from petstore_api.models.special_model_name import SpecialModelName -from petstore_api.models.string_boolean_map import StringBooleanMap -from petstore_api.models.tag import Tag -from petstore_api.models.triangle import Triangle -from petstore_api.models.triangle_interface import TriangleInterface -from petstore_api.models.user import User -from petstore_api.models.whale import Whale -from petstore_api.models.zebra import Zebra +from petstore_api.exceptions import ApiException \ No newline at end of file diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/another_fake_api.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/another_fake_api.py index 6c7e40c24825..cb2881b7ae8c 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/another_fake_api.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/another_fake_api.py @@ -34,7 +34,7 @@ str, validate_and_convert_types ) -from petstore_api.models import client +from petstore_api.model import client class AnotherFakeApi(object): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/default_api.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/default_api.py index 3e46d7928cb5..25c8e40e5252 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/default_api.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/default_api.py @@ -34,7 +34,7 @@ str, validate_and_convert_types ) -from petstore_api.models import inline_response_default +from petstore_api.model import inline_response_default class DefaultApi(object): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_api.py index fd5096ba6de1..69531b0525fa 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_api.py @@ -34,11 +34,11 @@ str, validate_and_convert_types ) -from petstore_api.models import health_check_result -from petstore_api.models import outer_composite -from petstore_api.models import file_schema_test_class -from petstore_api.models import user -from petstore_api.models import client +from petstore_api.model import health_check_result +from petstore_api.model import outer_composite +from petstore_api.model import file_schema_test_class +from petstore_api.model import user +from petstore_api.model import client class FakeApi(object): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api.py index f2a13a0b92fd..2ed92b4d0f33 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/fake_classname_tags_123_api.py @@ -34,7 +34,7 @@ str, validate_and_convert_types ) -from petstore_api.models import client +from petstore_api.model import client class FakeClassnameTags123Api(object): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/pet_api.py index 1a0fdb48bf4c..9ccaf11c268d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/pet_api.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/pet_api.py @@ -34,8 +34,8 @@ str, validate_and_convert_types ) -from petstore_api.models import pet -from petstore_api.models import api_response +from petstore_api.model import pet +from petstore_api.model import api_response class PetApi(object): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/store_api.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/store_api.py index 46fce50d29d3..67648f5ee722 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/store_api.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/store_api.py @@ -34,7 +34,7 @@ str, validate_and_convert_types ) -from petstore_api.models import order +from petstore_api.model import order class StoreApi(object): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/user_api.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/user_api.py index e354babbfe5c..e5f5ffe886c9 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/api/user_api.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/api/user_api.py @@ -34,7 +34,7 @@ str, validate_and_convert_types ) -from petstore_api.models import user +from petstore_api.model import user class UserApi(object): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/apis/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/apis/__init__.py new file mode 100644 index 000000000000..41cbd0aa055e --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/apis/__init__.py @@ -0,0 +1,21 @@ +# coding: utf-8 + +# flake8: noqa + +# import all apis into this package +# if you have many ampis here with many many models used in each api this may +# raise a RecursionError +# to avoid this, import only the api that you directly need like: +# from .api.pet_api import PetApi +# or import this package, but before doing it, use: +# import sys +# sys.setrecursionlimit(n) + +# import apis into api package +from petstore_api.api.another_fake_api import AnotherFakeApi +from petstore_api.api.default_api import DefaultApi +from petstore_api.api.fake_api import FakeApi +from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api +from petstore_api.api.pet_api import PetApi +from petstore_api.api.store_api import StoreApi +from petstore_api.api.user_api import UserApi diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/model/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/__init__.py new file mode 100644 index 000000000000..cfe32b784926 --- /dev/null +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/__init__.py @@ -0,0 +1,5 @@ +# we can not import model classes here because that would create a circular +# reference which would not work in python2 +# do not import all models into this module because that uses a lot of memory and stack frames +# if you need the ability to import all models from one package, import them with +# from {{packageName}.models import ModelA, ModelB diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/additional_properties_class.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/additional_properties_class.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/address.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/address.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/address.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/address.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.py index 641c9c16e279..7ba62dad1622 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/animal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/animal.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import cat + from petstore_api.model import cat except ImportError: cat = sys.modules[ - 'petstore_api.models.cat'] + 'petstore_api.model.cat'] try: - from petstore_api.models import dog + from petstore_api.model import dog except ImportError: dog = sys.modules[ - 'petstore_api.models.dog'] + 'petstore_api.model.dog'] class Animal(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/api_response.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/api_response.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/api_response.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/apple_req.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/apple_req.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_array_of_number_only.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_array_of_number_only.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/array_of_number_only.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_of_number_only.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/array_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.py similarity index 98% rename from samples/client/petstore/python-experimental/petstore_api/models/array_test.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.py index 0eed8d054611..e2bc76832b27 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/array_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/array_test.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import read_only_first + from petstore_api.model import read_only_first except ImportError: read_only_first = sys.modules[ - 'petstore_api.models.read_only_first'] + 'petstore_api.model.read_only_first'] class ArrayTest(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/banana_req.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/banana_req.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/basque_pig.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/basque_pig.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/basque_pig.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/capitalization.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/capitalization.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/capitalization.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.py index b80672252538..ab01b1f0a9c5 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat.py @@ -34,20 +34,20 @@ validate_get_composed_info, ) try: - from petstore_api.models import address + from petstore_api.model import address except ImportError: address = sys.modules[ - 'petstore_api.models.address'] + 'petstore_api.model.address'] try: - from petstore_api.models import animal + from petstore_api.model import animal except ImportError: animal = sys.modules[ - 'petstore_api.models.animal'] + 'petstore_api.model.animal'] try: - from petstore_api.models import cat_all_of + from petstore_api.model import cat_all_of except ImportError: cat_all_of = sys.modules[ - 'petstore_api.models.cat_all_of'] + 'petstore_api.model.cat_all_of'] class Cat(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat_all_of.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat_all_of.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/cat_all_of.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/cat_all_of.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/category.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/category.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/category.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/child_cat.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/child_cat.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.py index f838e61b4014..996f3e0098e2 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/child_cat.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import child_cat_all_of + from petstore_api.model import child_cat_all_of except ImportError: child_cat_all_of = sys.modules[ - 'petstore_api.models.child_cat_all_of'] + 'petstore_api.model.child_cat_all_of'] try: - from petstore_api.models import parent_pet + from petstore_api.model import parent_pet except ImportError: parent_pet = sys.modules[ - 'petstore_api.models.parent_pet'] + 'petstore_api.model.parent_pet'] class ChildCat(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/child_cat_all_of.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat_all_of.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/child_cat_all_of.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/child_cat_all_of.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/class_model.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/class_model.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/class_model.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/client.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/client.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/client.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.py index 03497b55fb45..7cc5a70032a0 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/complex_quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/complex_quadrilateral.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import quadrilateral_interface + from petstore_api.model import quadrilateral_interface except ImportError: quadrilateral_interface = sys.modules[ - 'petstore_api.models.quadrilateral_interface'] + 'petstore_api.model.quadrilateral_interface'] try: - from petstore_api.models import shape_interface + from petstore_api.model import shape_interface except ImportError: shape_interface = sys.modules[ - 'petstore_api.models.shape_interface'] + 'petstore_api.model.shape_interface'] class ComplexQuadrilateral(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/danish_pig.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/danish_pig.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/danish_pig.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.py index e35c52bd69d0..a100eb3c70ef 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import animal + from petstore_api.model import animal except ImportError: animal = sys.modules[ - 'petstore_api.models.animal'] + 'petstore_api.model.animal'] try: - from petstore_api.models import dog_all_of + from petstore_api.model import dog_all_of except ImportError: dog_all_of = sys.modules[ - 'petstore_api.models.dog_all_of'] + 'petstore_api.model.dog_all_of'] class Dog(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog_all_of.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog_all_of.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/dog_all_of.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/dog_all_of.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/drawing.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.py similarity index 95% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/drawing.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.py index a9cf39773d6b..8d61b20887d1 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/drawing.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/drawing.py @@ -34,25 +34,25 @@ validate_get_composed_info, ) try: - from petstore_api.models import fruit + from petstore_api.model import fruit except ImportError: fruit = sys.modules[ - 'petstore_api.models.fruit'] + 'petstore_api.model.fruit'] try: - from petstore_api.models import nullable_shape + from petstore_api.model import nullable_shape except ImportError: nullable_shape = sys.modules[ - 'petstore_api.models.nullable_shape'] + 'petstore_api.model.nullable_shape'] try: - from petstore_api.models import shape + from petstore_api.model import shape except ImportError: shape = sys.modules[ - 'petstore_api.models.shape'] + 'petstore_api.model.shape'] try: - from petstore_api.models import shape_or_null + from petstore_api.model import shape_or_null except ImportError: shape_or_null = sys.modules[ - 'petstore_api.models.shape_or_null'] + 'petstore_api.model.shape_or_null'] class Drawing(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_arrays.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_arrays.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_class.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_class.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_class.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.py similarity index 95% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_test.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.py index ba6118114b07..1320cc416e7d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/enum_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/enum_test.py @@ -34,25 +34,25 @@ validate_get_composed_info, ) try: - from petstore_api.models import outer_enum + from petstore_api.model import outer_enum except ImportError: outer_enum = sys.modules[ - 'petstore_api.models.outer_enum'] + 'petstore_api.model.outer_enum'] try: - from petstore_api.models import outer_enum_default_value + from petstore_api.model import outer_enum_default_value except ImportError: outer_enum_default_value = sys.modules[ - 'petstore_api.models.outer_enum_default_value'] + 'petstore_api.model.outer_enum_default_value'] try: - from petstore_api.models import outer_enum_integer + from petstore_api.model import outer_enum_integer except ImportError: outer_enum_integer = sys.modules[ - 'petstore_api.models.outer_enum_integer'] + 'petstore_api.model.outer_enum_integer'] try: - from petstore_api.models import outer_enum_integer_default_value + from petstore_api.model import outer_enum_integer_default_value except ImportError: outer_enum_integer_default_value = sys.modules[ - 'petstore_api.models.outer_enum_integer_default_value'] + 'petstore_api.model.outer_enum_integer_default_value'] class EnumTest(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.py index c601d01dde7f..44f69a5dced7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/equilateral_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/equilateral_triangle.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import shape_interface + from petstore_api.model import shape_interface except ImportError: shape_interface = sys.modules[ - 'petstore_api.models.shape_interface'] + 'petstore_api.model.shape_interface'] try: - from petstore_api.models import triangle_interface + from petstore_api.model import triangle_interface except ImportError: triangle_interface = sys.modules[ - 'petstore_api.models.triangle_interface'] + 'petstore_api.model.triangle_interface'] class EquilateralTriangle(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/file.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/file.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/file.py diff --git a/samples/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py similarity index 98% rename from samples/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py index 79e5638ccc94..0a9471e9e420 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/file_schema_test_class.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import file + from petstore_api.model import file except ImportError: file = sys.modules[ - 'petstore_api.models.file'] + 'petstore_api.model.file'] class FileSchemaTestClass(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/foo.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/foo.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/foo.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/format_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/format_test.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/format_test.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.py index 1058c953ee60..244497b64a10 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import apple + from petstore_api.model import apple except ImportError: apple = sys.modules[ - 'petstore_api.models.apple'] + 'petstore_api.model.apple'] try: - from petstore_api.models import banana + from petstore_api.model import banana except ImportError: banana = sys.modules[ - 'petstore_api.models.banana'] + 'petstore_api.model.banana'] class Fruit(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit_req.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit_req.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit_req.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit_req.py index b8af0f35f432..11a7615749cc 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/fruit_req.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/fruit_req.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import apple_req + from petstore_api.model import apple_req except ImportError: apple_req = sys.modules[ - 'petstore_api.models.apple_req'] + 'petstore_api.model.apple_req'] try: - from petstore_api.models import banana_req + from petstore_api.model import banana_req except ImportError: banana_req = sys.modules[ - 'petstore_api.models.banana_req'] + 'petstore_api.model.banana_req'] class FruitReq(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_fruit.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_fruit.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.py index 9857b08c36c6..e2ebe6fd9d17 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/gm_fruit.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import apple + from petstore_api.model import apple except ImportError: apple = sys.modules[ - 'petstore_api.models.apple'] + 'petstore_api.model.apple'] try: - from petstore_api.models import banana + from petstore_api.model import banana except ImportError: banana = sys.modules[ - 'petstore_api.models.banana'] + 'petstore_api.model.banana'] class GmFruit(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py index ab2ba56caf37..b5af666f7530 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/grandparent_animal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/grandparent_animal.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import child_cat + from petstore_api.model import child_cat except ImportError: child_cat = sys.modules[ - 'petstore_api.models.child_cat'] + 'petstore_api.model.child_cat'] try: - from petstore_api.models import parent_pet + from petstore_api.model import parent_pet except ImportError: parent_pet = sys.modules[ - 'petstore_api.models.parent_pet'] + 'petstore_api.model.parent_pet'] class GrandparentAnimal(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/has_only_read_only.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/has_only_read_only.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/health_check_result.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/health_check_result.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/health_check_result.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object1.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object1.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object1.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object1.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object2.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object2.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object2.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object2.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object3.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object3.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object3.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object3.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object4.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object4.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object4.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object4.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object5.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object5.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_object5.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_object5.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_response_default.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_response_default.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_response_default.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_response_default.py index 577dbfeb8517..f3abf4a7a193 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/inline_response_default.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/inline_response_default.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import foo + from petstore_api.model import foo except ImportError: foo = sys.modules[ - 'petstore_api.models.foo'] + 'petstore_api.model.foo'] class InlineResponseDefault(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.py index ea5607fdfd9b..40c8878bb003 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/isosceles_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/isosceles_triangle.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import shape_interface + from petstore_api.model import shape_interface except ImportError: shape_interface = sys.modules[ - 'petstore_api.models.shape_interface'] + 'petstore_api.model.shape_interface'] try: - from petstore_api.models import triangle_interface + from petstore_api.model import triangle_interface except ImportError: triangle_interface = sys.modules[ - 'petstore_api.models.triangle_interface'] + 'petstore_api.model.triangle_interface'] class IsoscelesTriangle(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/list.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/list.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/list.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/list.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mammal.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/mammal.py index 44f3e402c981..e0b9f314080d 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/mammal.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mammal.py @@ -34,20 +34,20 @@ validate_get_composed_info, ) try: - from petstore_api.models import pig + from petstore_api.model import pig except ImportError: pig = sys.modules[ - 'petstore_api.models.pig'] + 'petstore_api.model.pig'] try: - from petstore_api.models import whale + from petstore_api.model import whale except ImportError: whale = sys.modules[ - 'petstore_api.models.whale'] + 'petstore_api.model.whale'] try: - from petstore_api.models import zebra + from petstore_api.model import zebra except ImportError: zebra = sys.modules[ - 'petstore_api.models.zebra'] + 'petstore_api.model.zebra'] class Mammal(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/map_test.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/map_test.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.py index 45be8a1fecfd..a22af06ce4fd 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/map_test.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/map_test.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import string_boolean_map + from petstore_api.model import string_boolean_map except ImportError: string_boolean_map = sys.modules[ - 'petstore_api.models.string_boolean_map'] + 'petstore_api.model.string_boolean_map'] class MapTest(ModelNormal): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py similarity index 98% rename from samples/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py index 0e584ebd43e9..a0fcac2eb019 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/mixed_properties_and_additional_properties_class.py @@ -34,10 +34,10 @@ validate_get_composed_info, ) try: - from petstore_api.models import animal + from petstore_api.model import animal except ImportError: animal = sys.modules[ - 'petstore_api.models.animal'] + 'petstore_api.model.animal'] class MixedPropertiesAndAdditionalPropertiesClass(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model200_response.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/model200_response.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/model200_response.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/model_return.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/model_return.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/model_return.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/name.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/name.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/name.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_class.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_class.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_class.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_shape.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_shape.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_shape.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_shape.py index e62a3881c520..77778126a6f7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/nullable_shape.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/nullable_shape.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import quadrilateral + from petstore_api.model import quadrilateral except ImportError: quadrilateral = sys.modules[ - 'petstore_api.models.quadrilateral'] + 'petstore_api.model.quadrilateral'] try: - from petstore_api.models import triangle + from petstore_api.model import triangle except ImportError: triangle = sys.modules[ - 'petstore_api.models.triangle'] + 'petstore_api.model.triangle'] class NullableShape(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/number_only.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/number_only.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/number_only.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/order.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/order.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/order.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_composite.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_composite.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_composite.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_composite.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_enum.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_enum.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_default_value.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_enum_default_value.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_default_value.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_enum_default_value.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_enum_integer.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_enum_integer.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_enum_integer_default_value.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/outer_enum_integer_default_value.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/outer_enum_integer_default_value.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/parent_pet.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/parent_pet.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/parent_pet.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/parent_pet.py index 89633120977e..26a44926fa3e 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/parent_pet.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/parent_pet.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import child_cat + from petstore_api.model import child_cat except ImportError: child_cat = sys.modules[ - 'petstore_api.models.child_cat'] + 'petstore_api.model.child_cat'] try: - from petstore_api.models import grandparent_animal + from petstore_api.model import grandparent_animal except ImportError: grandparent_animal = sys.modules[ - 'petstore_api.models.grandparent_animal'] + 'petstore_api.model.grandparent_animal'] class ParentPet(ModelComposed): diff --git a/samples/client/petstore/python-experimental/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.py similarity index 97% rename from samples/client/petstore/python-experimental/petstore_api/models/pet.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.py index c93acd53c96c..742d7cdf04a8 100644 --- a/samples/client/petstore/python-experimental/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pet.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import category + from petstore_api.model import category except ImportError: category = sys.modules[ - 'petstore_api.models.category'] + 'petstore_api.model.category'] try: - from petstore_api.models import tag + from petstore_api.model import tag except ImportError: tag = sys.modules[ - 'petstore_api.models.tag'] + 'petstore_api.model.tag'] class Pet(ModelNormal): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pig.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pig.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/pig.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/pig.py index 5dd3fdb64ec1..2e02e4e88c98 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/pig.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/pig.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import basque_pig + from petstore_api.model import basque_pig except ImportError: basque_pig = sys.modules[ - 'petstore_api.models.basque_pig'] + 'petstore_api.model.basque_pig'] try: - from petstore_api.models import danish_pig + from petstore_api.model import danish_pig except ImportError: danish_pig = sys.modules[ - 'petstore_api.models.danish_pig'] + 'petstore_api.model.danish_pig'] class Pig(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral.py index 0f4994064571..b0766c987164 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import complex_quadrilateral + from petstore_api.model import complex_quadrilateral except ImportError: complex_quadrilateral = sys.modules[ - 'petstore_api.models.complex_quadrilateral'] + 'petstore_api.model.complex_quadrilateral'] try: - from petstore_api.models import simple_quadrilateral + from petstore_api.model import simple_quadrilateral except ImportError: simple_quadrilateral = sys.modules[ - 'petstore_api.models.simple_quadrilateral'] + 'petstore_api.model.simple_quadrilateral'] class Quadrilateral(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/quadrilateral_interface.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/quadrilateral_interface.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/read_only_first.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/read_only_first.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/read_only_first.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.py index 6350bdea3bc5..2c58f1bb99ae 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/scalene_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/scalene_triangle.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import shape_interface + from petstore_api.model import shape_interface except ImportError: shape_interface = sys.modules[ - 'petstore_api.models.shape_interface'] + 'petstore_api.model.shape_interface'] try: - from petstore_api.models import triangle_interface + from petstore_api.model import triangle_interface except ImportError: triangle_interface = sys.modules[ - 'petstore_api.models.triangle_interface'] + 'petstore_api.model.triangle_interface'] class ScaleneTriangle(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape.py index ef83ed3a31b7..9eec4b7705ed 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import quadrilateral + from petstore_api.model import quadrilateral except ImportError: quadrilateral = sys.modules[ - 'petstore_api.models.quadrilateral'] + 'petstore_api.model.quadrilateral'] try: - from petstore_api.models import triangle + from petstore_api.model import triangle except ImportError: triangle = sys.modules[ - 'petstore_api.models.triangle'] + 'petstore_api.model.triangle'] class Shape(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape_interface.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_interface.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape_interface.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_or_null.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape_or_null.py similarity index 98% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_or_null.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape_or_null.py index 53043fdd60c4..8c00f44dfaac 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/shape_or_null.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/shape_or_null.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import quadrilateral + from petstore_api.model import quadrilateral except ImportError: quadrilateral = sys.modules[ - 'petstore_api.models.quadrilateral'] + 'petstore_api.model.quadrilateral'] try: - from petstore_api.models import triangle + from petstore_api.model import triangle except ImportError: triangle = sys.modules[ - 'petstore_api.models.triangle'] + 'petstore_api.model.triangle'] class ShapeOrNull(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.py similarity index 97% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.py index 8d8cf85fca1e..dd27bd66fea7 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/simple_quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/simple_quadrilateral.py @@ -34,15 +34,15 @@ validate_get_composed_info, ) try: - from petstore_api.models import quadrilateral_interface + from petstore_api.model import quadrilateral_interface except ImportError: quadrilateral_interface = sys.modules[ - 'petstore_api.models.quadrilateral_interface'] + 'petstore_api.model.quadrilateral_interface'] try: - from petstore_api.models import shape_interface + from petstore_api.model import shape_interface except ImportError: shape_interface = sys.modules[ - 'petstore_api.models.shape_interface'] + 'petstore_api.model.shape_interface'] class SimpleQuadrilateral(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/special_model_name.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/special_model_name.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/special_model_name.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_boolean_map.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/string_boolean_map.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/string_boolean_map.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/tag.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/tag.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/tag.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle.py similarity index 96% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle.py index 27b8ae122733..52c3218db1e3 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle.py @@ -34,20 +34,20 @@ validate_get_composed_info, ) try: - from petstore_api.models import equilateral_triangle + from petstore_api.model import equilateral_triangle except ImportError: equilateral_triangle = sys.modules[ - 'petstore_api.models.equilateral_triangle'] + 'petstore_api.model.equilateral_triangle'] try: - from petstore_api.models import isosceles_triangle + from petstore_api.model import isosceles_triangle except ImportError: isosceles_triangle = sys.modules[ - 'petstore_api.models.isosceles_triangle'] + 'petstore_api.model.isosceles_triangle'] try: - from petstore_api.models import scalene_triangle + from petstore_api.model import scalene_triangle except ImportError: scalene_triangle = sys.modules[ - 'petstore_api.models.scalene_triangle'] + 'petstore_api.model.scalene_triangle'] class Triangle(ModelComposed): diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/triangle_interface.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/triangle_interface.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/user.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/user.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/user.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/whale.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/whale.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/whale.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/zebra.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.py similarity index 100% rename from samples/openapi3/client/petstore/python-experimental/petstore_api/models/zebra.py rename to samples/openapi3/client/petstore/python-experimental/petstore_api/model/zebra.py diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/__init__.py index e02c66519259..7c58ced9f86a 100644 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/__init__.py @@ -1,15 +1,95 @@ # coding: utf-8 # flake8: noqa -""" - 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 +# import all models into this package +# if you have many models here with many references from one model to another this may +# raise a RecursionError +# to avoid this, import only the models that you directly need like: +# from from petstore_api.model.pet import Pet +# or import this package, but before doing it, use: +# import sys +# sys.setrecursionlimit(n) - The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -# we can not import model classes here because that would create a circular -# reference which would not work in python2 +from petstore_api.model.additional_properties_class import AdditionalPropertiesClass +from petstore_api.model.address import Address +from petstore_api.model.animal import Animal +from petstore_api.model.api_response import ApiResponse +from petstore_api.model.apple import Apple +from petstore_api.model.apple_req import AppleReq +from petstore_api.model.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly +from petstore_api.model.array_of_number_only import ArrayOfNumberOnly +from petstore_api.model.array_test import ArrayTest +from petstore_api.model.banana import Banana +from petstore_api.model.banana_req import BananaReq +from petstore_api.model.basque_pig import BasquePig +from petstore_api.model.capitalization import Capitalization +from petstore_api.model.cat import Cat +from petstore_api.model.cat_all_of import CatAllOf +from petstore_api.model.category import Category +from petstore_api.model.child_cat import ChildCat +from petstore_api.model.child_cat_all_of import ChildCatAllOf +from petstore_api.model.class_model import ClassModel +from petstore_api.model.client import Client +from petstore_api.model.complex_quadrilateral import ComplexQuadrilateral +from petstore_api.model.danish_pig import DanishPig +from petstore_api.model.dog import Dog +from petstore_api.model.dog_all_of import DogAllOf +from petstore_api.model.drawing import Drawing +from petstore_api.model.enum_arrays import EnumArrays +from petstore_api.model.enum_class import EnumClass +from petstore_api.model.enum_test import EnumTest +from petstore_api.model.equilateral_triangle import EquilateralTriangle +from petstore_api.model.file import File +from petstore_api.model.file_schema_test_class import FileSchemaTestClass +from petstore_api.model.foo import Foo +from petstore_api.model.format_test import FormatTest +from petstore_api.model.fruit import Fruit +from petstore_api.model.fruit_req import FruitReq +from petstore_api.model.gm_fruit import GmFruit +from petstore_api.model.grandparent_animal import GrandparentAnimal +from petstore_api.model.has_only_read_only import HasOnlyReadOnly +from petstore_api.model.health_check_result import HealthCheckResult +from petstore_api.model.inline_object import InlineObject +from petstore_api.model.inline_object1 import InlineObject1 +from petstore_api.model.inline_object2 import InlineObject2 +from petstore_api.model.inline_object3 import InlineObject3 +from petstore_api.model.inline_object4 import InlineObject4 +from petstore_api.model.inline_object5 import InlineObject5 +from petstore_api.model.inline_response_default import InlineResponseDefault +from petstore_api.model.isosceles_triangle import IsoscelesTriangle +from petstore_api.model.list import List +from petstore_api.model.mammal import Mammal +from petstore_api.model.map_test import MapTest +from petstore_api.model.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass +from petstore_api.model.model200_response import Model200Response +from petstore_api.model.model_return import ModelReturn +from petstore_api.model.name import Name +from petstore_api.model.nullable_class import NullableClass +from petstore_api.model.nullable_shape import NullableShape +from petstore_api.model.number_only import NumberOnly +from petstore_api.model.order import Order +from petstore_api.model.outer_composite import OuterComposite +from petstore_api.model.outer_enum import OuterEnum +from petstore_api.model.outer_enum_default_value import OuterEnumDefaultValue +from petstore_api.model.outer_enum_integer import OuterEnumInteger +from petstore_api.model.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue +from petstore_api.model.parent_pet import ParentPet +from petstore_api.model.pet import Pet +from petstore_api.model.pig import Pig +from petstore_api.model.quadrilateral import Quadrilateral +from petstore_api.model.quadrilateral_interface import QuadrilateralInterface +from petstore_api.model.read_only_first import ReadOnlyFirst +from petstore_api.model.scalene_triangle import ScaleneTriangle +from petstore_api.model.shape import Shape +from petstore_api.model.shape_interface import ShapeInterface +from petstore_api.model.shape_or_null import ShapeOrNull +from petstore_api.model.simple_quadrilateral import SimpleQuadrilateral +from petstore_api.model.special_model_name import SpecialModelName +from petstore_api.model.string_boolean_map import StringBooleanMap +from petstore_api.model.tag import Tag +from petstore_api.model.triangle import Triangle +from petstore_api.model.triangle_interface import TriangleInterface +from petstore_api.model.user import User +from petstore_api.model.whale import Whale +from petstore_api.model.zebra import Zebra diff --git a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_mammal.py b/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_mammal.py deleted file mode 100644 index 40d056a494ec..000000000000 --- a/samples/openapi3/client/petstore/python-experimental/petstore_api/models/gm_mammal.py +++ /dev/null @@ -1,212 +0,0 @@ -# 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 re # noqa: F401 -import sys # noqa: F401 - -import six # noqa: F401 - -from petstore_api.model_utils import ( # noqa: F401 - ModelComposed, - ModelNormal, - ModelSimple, - date, - datetime, - file_type, - int, - none_type, - str, - validate_get_composed_info, -) -try: - from petstore_api.models import whale -except ImportError: - whale = sys.modules[ - 'petstore_api.models.whale'] -try: - from petstore_api.models import zebra -except ImportError: - zebra = sys.modules[ - 'petstore_api.models.zebra'] - - -class GmMammal(ModelComposed): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('lungs',): { - '2': 2, - }, - ('type',): { - 'PLAINS': "plains", - 'MOUNTAIN': "mountain", - 'GREVYS': "grevys", - }, - } - - validations = { - } - - additional_properties_type = None - - @staticmethod - def openapi_types(): - """ - This must be a class method so a model may have properties that are - of type self, this ensures that we don't create a cyclic import - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'class_name': (str,), # noqa: E501 - 'lungs': (int,), # noqa: E501 - 'has_baleen': (bool,), # noqa: E501 - 'has_teeth': (bool,), # noqa: E501 - 'type': (str,), # noqa: E501 - } - - @staticmethod - def discriminator(): - return { - 'class_name': { - 'whale': whale.Whale, - 'zebra': zebra.Zebra, - }, - } - - attribute_map = { - 'class_name': 'className', # noqa: E501 - 'lungs': 'lungs', # noqa: E501 - 'has_baleen': 'hasBaleen', # noqa: E501 - 'has_teeth': 'hasTeeth', # noqa: E501 - 'type': 'type', # noqa: E501 - } - - required_properties = set([ - '_data_store', - '_check_type', - '_json_variable_naming', - '_path_to_item', - '_configuration', - '_composed_instances', - '_var_name_to_model_instances', - '_additional_properties_model_instances', - ]) - - def __init__(self, class_name, _check_type=True, _json_variable_naming=False, _path_to_item=(), _configuration=None, **kwargs): # noqa: E501 - """gm_mammal.GmMammal - a model defined in OpenAPI - - Args: - class_name (str): - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _json_variable_naming (bool): True if the data is from the server - False if the data is from the client (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - lungs (int): [optional] if omitted the server will use the default value of 2 # noqa: E501 - has_baleen (bool): [optional] # noqa: E501 - has_teeth (bool): [optional] # noqa: E501 - type (str): [optional] # noqa: E501 - """ - - self._data_store = {} - self._check_type = _check_type - self._json_variable_naming = _json_variable_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - - constant_args = { - '_check_type': _check_type, - '_path_to_item': _path_to_item, - '_json_variable_naming': _json_variable_naming, - '_configuration': _configuration, - } - model_args = { - 'class_name': class_name, - } - model_args.update(kwargs) - composed_info = validate_get_composed_info( - constant_args, model_args, self) - self._composed_instances = composed_info[0] - self._var_name_to_model_instances = composed_info[1] - self._additional_properties_model_instances = composed_info[2] - - self.class_name = class_name - for var_name, var_value in six.iteritems(kwargs): - setattr(self, var_name, var_value) - - @staticmethod - def _composed_schemas(): - # we need this here to make our import statements work - # we must store _composed_schemas in here so the code is only run - # when we invoke this method. If we kept this at the class - # level we would get an error beause the class level - # code would be run when this module is imported, and these composed - # classes don't exist yet because their module has not finished - # loading - return { - 'anyOf': [ - whale.Whale, - zebra.Zebra, - ], - 'allOf': [ - ], - 'oneOf': [ - ], - } - - @classmethod - def get_discriminator_class(cls, json_variable_naming, data): - """Returns the child class specified by the discriminator""" - discriminator = cls.discriminator() - discr_propertyname_py = list(discriminator.keys())[0] - discr_propertyname_js = cls.attribute_map[discr_propertyname_py] - if json_variable_naming: - class_name = data[discr_propertyname_js] - else: - class_name = data[discr_propertyname_py] - class_name_to_discr_class = discriminator[discr_propertyname_py] - return class_name_to_discr_class.get(class_name) diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/test/test_additional_properties_class.py index 279baa3a454f..befc14455da2 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_additional_properties_class.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.additional_properties_class import AdditionalPropertiesClass class TestAdditionalPropertiesClass(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testAdditionalPropertiesClass(self): """Test AdditionalPropertiesClass""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.AdditionalPropertiesClass() # noqa: E501 + # model = AdditionalPropertiesClass() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_address.py b/samples/openapi3/client/petstore/python-experimental/test/test_address.py index 7aa36d745cf5..dcc33c22dbb3 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_address.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_address.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.address import Address class TestAddress(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testAddress(self): """Test Address""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Address() # noqa: E501 + # model = Address() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_animal.py b/samples/openapi3/client/petstore/python-experimental/test/test_animal.py index 66f94c5eef4e..958f303f13e3 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_animal.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_animal.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import cat +except ImportError: + cat = sys.modules[ + 'petstore_api.model.cat'] +try: + from petstore_api.model import dog +except ImportError: + dog = sys.modules[ + 'petstore_api.model.dog'] +from petstore_api.model.animal import Animal class TestAnimal(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testAnimal(self): """Test Animal""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Animal() # noqa: E501 + # model = Animal() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_another_fake_api.py b/samples/openapi3/client/petstore/python-experimental/test/test_another_fake_api.py index d95798cfc5a4..f79966a26961 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_another_fake_api.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_another_fake_api.py @@ -16,14 +16,13 @@ import petstore_api from petstore_api.api.another_fake_api import AnotherFakeApi # noqa: E501 -from petstore_api.rest import ApiException class TestAnotherFakeApi(unittest.TestCase): """AnotherFakeApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.another_fake_api.AnotherFakeApi() # noqa: E501 + self.api = AnotherFakeApi() # noqa: E501 def tearDown(self): pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_api_response.py b/samples/openapi3/client/petstore/python-experimental/test/test_api_response.py index a253e6f364cd..9db92633f626 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_api_response.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_api_response.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.api_response import ApiResponse class TestApiResponse(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testApiResponse(self): """Test ApiResponse""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ApiResponse() # noqa: E501 + # model = ApiResponse() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_apple.py b/samples/openapi3/client/petstore/python-experimental/test/test_apple.py index 100866918919..9aedfc0b01d5 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_apple.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_apple.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.apple import Apple class TestApple(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testApple(self): """Test Apple""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Apple() # noqa: E501 + # model = Apple() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_apple_req.py b/samples/openapi3/client/petstore/python-experimental/test/test_apple_req.py index 4cb5abcdede4..79650cd1c747 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_apple_req.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_apple_req.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.apple_req import AppleReq class TestAppleReq(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testAppleReq(self): """Test AppleReq""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.AppleReq() # noqa: E501 + # model = AppleReq() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-experimental/test/test_array_of_array_of_number_only.py index e47430f6861a..4980ad17afb5 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_array_of_array_of_number_only.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly class TestArrayOfArrayOfNumberOnly(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testArrayOfArrayOfNumberOnly(self): """Test ArrayOfArrayOfNumberOnly""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ArrayOfArrayOfNumberOnly() # noqa: E501 + # model = ArrayOfArrayOfNumberOnly() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_array_of_number_only.py b/samples/openapi3/client/petstore/python-experimental/test/test_array_of_number_only.py index 1a65f69b9268..479c537cada7 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_array_of_number_only.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.array_of_number_only import ArrayOfNumberOnly class TestArrayOfNumberOnly(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testArrayOfNumberOnly(self): """Test ArrayOfNumberOnly""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ArrayOfNumberOnly() # noqa: E501 + # model = ArrayOfNumberOnly() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_array_test.py b/samples/openapi3/client/petstore/python-experimental/test/test_array_test.py index ac1b486bb74e..2426b27b7e46 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_array_test.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_array_test.py @@ -11,10 +11,16 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import read_only_first +except ImportError: + read_only_first = sys.modules[ + 'petstore_api.model.read_only_first'] +from petstore_api.model.array_test import ArrayTest class TestArrayTest(unittest.TestCase): @@ -29,7 +35,7 @@ def tearDown(self): def testArrayTest(self): """Test ArrayTest""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ArrayTest() # noqa: E501 + # model = ArrayTest() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_banana.py b/samples/openapi3/client/petstore/python-experimental/test/test_banana.py index 6efdcd07da1c..a989386b018c 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_banana.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_banana.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.banana import Banana class TestBanana(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testBanana(self): """Test Banana""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Banana() # noqa: E501 + # model = Banana() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_banana_req.py b/samples/openapi3/client/petstore/python-experimental/test/test_banana_req.py index 5eeb0bc57c21..39d125e4a15e 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_banana_req.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_banana_req.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.banana_req import BananaReq class TestBananaReq(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testBananaReq(self): """Test BananaReq""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.BananaReq() # noqa: E501 + # model = BananaReq() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_basque_pig.py b/samples/openapi3/client/petstore/python-experimental/test/test_basque_pig.py index 46e9ff215dc8..b00c5f8a6aa5 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_basque_pig.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_basque_pig.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.basque_pig import BasquePig class TestBasquePig(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testBasquePig(self): """Test BasquePig""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.BasquePig() # noqa: E501 + # model = BasquePig() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_capitalization.py b/samples/openapi3/client/petstore/python-experimental/test/test_capitalization.py index 1cb91380a768..20d2649c01eb 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_capitalization.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_capitalization.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.capitalization import Capitalization class TestCapitalization(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testCapitalization(self): """Test Capitalization""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Capitalization() # noqa: E501 + # model = Capitalization() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_cat.py b/samples/openapi3/client/petstore/python-experimental/test/test_cat.py index bd616261861d..1cb6b58cbd09 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_cat.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_cat.py @@ -11,10 +11,26 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import address +except ImportError: + address = sys.modules[ + 'petstore_api.model.address'] +try: + from petstore_api.model import animal +except ImportError: + animal = sys.modules[ + 'petstore_api.model.animal'] +try: + from petstore_api.model import cat_all_of +except ImportError: + cat_all_of = sys.modules[ + 'petstore_api.model.cat_all_of'] +from petstore_api.model.cat import Cat class TestCat(unittest.TestCase): @@ -29,7 +45,7 @@ def tearDown(self): def testCat(self): """Test Cat""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Cat() # noqa: E501 + # model = Cat() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_cat_all_of.py b/samples/openapi3/client/petstore/python-experimental/test/test_cat_all_of.py index 136ed8da050a..a5bb91ac864e 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_cat_all_of.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_cat_all_of.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.cat_all_of import CatAllOf class TestCatAllOf(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testCatAllOf(self): """Test CatAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.CatAllOf() # noqa: E501 + # model = CatAllOf() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_category.py b/samples/openapi3/client/petstore/python-experimental/test/test_category.py index c2ab96f823b6..59b64e5924a8 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_category.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_category.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.category import Category class TestCategory(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testCategory(self): """Test Category""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Category() # noqa: E501 + # model = Category() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_child_cat.py b/samples/openapi3/client/petstore/python-experimental/test/test_child_cat.py index c42c3b583aae..34c085515a80 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_child_cat.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_child_cat.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import child_cat_all_of +except ImportError: + child_cat_all_of = sys.modules[ + 'petstore_api.model.child_cat_all_of'] +try: + from petstore_api.model import parent_pet +except ImportError: + parent_pet = sys.modules[ + 'petstore_api.model.parent_pet'] +from petstore_api.model.child_cat import ChildCat class TestChildCat(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testChildCat(self): """Test ChildCat""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ChildCat() # noqa: E501 + # model = ChildCat() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_child_cat_all_of.py b/samples/openapi3/client/petstore/python-experimental/test/test_child_cat_all_of.py index 3304a81a2321..2a7aab100fbf 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_child_cat_all_of.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_child_cat_all_of.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.child_cat_all_of import ChildCatAllOf class TestChildCatAllOf(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testChildCatAllOf(self): """Test ChildCatAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ChildCatAllOf() # noqa: E501 + # model = ChildCatAllOf() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_class_model.py b/samples/openapi3/client/petstore/python-experimental/test/test_class_model.py index 3ac7e553042e..060df39e4b5e 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_class_model.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_class_model.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.class_model import ClassModel class TestClassModel(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testClassModel(self): """Test ClassModel""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ClassModel() # noqa: E501 + # model = ClassModel() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_client.py b/samples/openapi3/client/petstore/python-experimental/test/test_client.py index 683190363445..ab5e3a80d377 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_client.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_client.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.client import Client class TestClient(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testClient(self): """Test Client""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Client() # noqa: E501 + # model = Client() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_complex_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/test/test_complex_quadrilateral.py index b1d4fc9079bd..0c0887509c8b 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_complex_quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_complex_quadrilateral.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import quadrilateral_interface +except ImportError: + quadrilateral_interface = sys.modules[ + 'petstore_api.model.quadrilateral_interface'] +try: + from petstore_api.model import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.model.shape_interface'] +from petstore_api.model.complex_quadrilateral import ComplexQuadrilateral class TestComplexQuadrilateral(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testComplexQuadrilateral(self): """Test ComplexQuadrilateral""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ComplexQuadrilateral() # noqa: E501 + # model = ComplexQuadrilateral() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_danish_pig.py b/samples/openapi3/client/petstore/python-experimental/test/test_danish_pig.py index 0cbe8f8c102a..a82c352e84c1 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_danish_pig.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_danish_pig.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.danish_pig import DanishPig class TestDanishPig(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testDanishPig(self): """Test DanishPig""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.DanishPig() # noqa: E501 + # model = DanishPig() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_default_api.py b/samples/openapi3/client/petstore/python-experimental/test/test_default_api.py index 50e7c57bd0bf..5f4fb5230ac4 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_default_api.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_default_api.py @@ -16,14 +16,13 @@ import petstore_api from petstore_api.api.default_api import DefaultApi # noqa: E501 -from petstore_api.rest import ApiException class TestDefaultApi(unittest.TestCase): """DefaultApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.default_api.DefaultApi() # noqa: E501 + self.api = DefaultApi() # noqa: E501 def tearDown(self): pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_dog.py b/samples/openapi3/client/petstore/python-experimental/test/test_dog.py index 37e9dd56d4ff..4a6fc61ad761 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_dog.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_dog.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import animal +except ImportError: + animal = sys.modules[ + 'petstore_api.model.animal'] +try: + from petstore_api.model import dog_all_of +except ImportError: + dog_all_of = sys.modules[ + 'petstore_api.model.dog_all_of'] +from petstore_api.model.dog import Dog class TestDog(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testDog(self): """Test Dog""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Dog() # noqa: E501 + # model = Dog() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_dog_all_of.py b/samples/openapi3/client/petstore/python-experimental/test/test_dog_all_of.py index 7f443eb9b60c..7ab4e8ae79d8 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_dog_all_of.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_dog_all_of.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.dog_all_of import DogAllOf class TestDogAllOf(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testDogAllOf(self): """Test DogAllOf""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.DogAllOf() # noqa: E501 + # model = DogAllOf() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_drawing.py b/samples/openapi3/client/petstore/python-experimental/test/test_drawing.py index 6897ce82676d..dbfba3ea700f 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_drawing.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_drawing.py @@ -11,17 +11,33 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import nullable_shape +except ImportError: + nullable_shape = sys.modules[ + 'petstore_api.model.nullable_shape'] +try: + from petstore_api.model import shape +except ImportError: + shape = sys.modules[ + 'petstore_api.model.shape'] +try: + from petstore_api.model import shape_or_null +except ImportError: + shape_or_null = sys.modules[ + 'petstore_api.model.shape_or_null'] +from petstore_api.model.drawing import Drawing class TestDrawing(unittest.TestCase): """Drawing unit test stubs""" def setUp(self): - self.api_client = petstore_api.ApiClient() + pass def tearDown(self): pass @@ -32,73 +48,79 @@ def test_create_instances(self): """ # Validate object can be created using pythonic names. - inst = petstore_api.Shape( + inst = shape.Shape( shape_type="Triangle", triangle_type="IsoscelesTriangle" ) - assert isinstance(inst, petstore_api.IsoscelesTriangle) + from petstore_api.model.isosceles_triangle import IsoscelesTriangle + assert isinstance(inst, IsoscelesTriangle) # Validate object can be created using OAS names. # For example, this can be used to construct objects on the client # when the input data is available as JSON documents. data = { - 'shapeType': "Triangle", - 'triangleType': "IsoscelesTriangle" + 'shapeType': "Triangle", + 'triangleType': "IsoscelesTriangle" } - inst = petstore_api.Shape(_spec_property_naming=True, **data) - assert isinstance(inst, petstore_api.IsoscelesTriangle) + inst = shape.Shape(_spec_property_naming=True, **data) + assert isinstance(inst, IsoscelesTriangle) def test_deserialize_oneof_reference(self): """ Validate the scenario when the type of a OAS property is 'oneOf', and the 'oneOf' schema is specified as a reference ($ref), not an inline 'oneOf' schema. """ - isosceles_triangle = petstore_api.Shape( + isosceles_triangle = shape.Shape( shape_type="Triangle", triangle_type="IsoscelesTriangle" ) - assert isinstance(isosceles_triangle, petstore_api.IsoscelesTriangle) - inst = petstore_api.Drawing( + from petstore_api.model.isosceles_triangle import IsoscelesTriangle + from petstore_api.model.triangle import Triangle + from petstore_api.model.equilateral_triangle import EquilateralTriangle + + assert isinstance(isosceles_triangle, IsoscelesTriangle) + inst = Drawing( # 'main_shape' has type 'Shape', which is a oneOf [triangle, quadrilateral] # composed schema. So we should be able to assign a petstore_api.Triangle # to a 'main_shape'. main_shape=isosceles_triangle, shapes=[ - petstore_api.Shape( + shape.Shape( shape_type="Triangle", triangle_type="EquilateralTriangle" ), - petstore_api.Triangle( + Triangle( shape_type="Triangle", triangle_type="IsoscelesTriangle" ), - petstore_api.EquilateralTriangle( + EquilateralTriangle( shape_type="Triangle", triangle_type="EquilateralTriangle" ), - petstore_api.Shape( + shape.Shape( shape_type="Quadrilateral", quadrilateral_type="ComplexQuadrilateral" ), ], ) - assert isinstance(inst, petstore_api.Drawing) - assert isinstance(inst.main_shape, petstore_api.IsoscelesTriangle) + from petstore_api.model.complex_quadrilateral import ComplexQuadrilateral + assert isinstance(inst, Drawing) + assert isinstance(inst.main_shape, IsoscelesTriangle) self.assertEqual(len(inst.shapes), 4) - assert isinstance(inst.shapes[0], petstore_api.EquilateralTriangle) - assert isinstance(inst.shapes[1], petstore_api.IsoscelesTriangle) - assert isinstance(inst.shapes[2], petstore_api.EquilateralTriangle) - assert isinstance(inst.shapes[3], petstore_api.ComplexQuadrilateral) + assert isinstance(inst.shapes[0], EquilateralTriangle) + assert isinstance(inst.shapes[1], IsoscelesTriangle) + assert isinstance(inst.shapes[2], EquilateralTriangle) + assert isinstance(inst.shapes[3], ComplexQuadrilateral) # Validate we cannot assign the None value to main_shape because the 'null' type # is not one of the allowed types in the 'Shape' schema. err_msg = ("Invalid type for variable '{}'. " - "Required value type is {} and passed type was {} at {}") + "Required value type is {} and passed type was {} at {}") with self.assertRaisesRegexp( - petstore_api.ApiTypeError, - err_msg.format("main_shape", "Shape", "NoneType", "\['main_shape'\]") + petstore_api.ApiTypeError, + err_msg.format("main_shape", "Shape", "NoneType", "\['main_shape'\]") ): - inst = petstore_api.Drawing( + inst = Drawing( # 'main_shape' has type 'Shape', which is a oneOf [triangle, quadrilateral] # So the None value should not be allowed and an exception should be raised. main_shape=None, @@ -115,11 +137,11 @@ def test_deserialize_oneof_reference_with_null_type(self): # Validate we can assign the None value to shape_or_null, because the 'null' type # is one of the allowed types in the 'ShapeOrNull' schema. - inst = petstore_api.Drawing( + inst = Drawing( # 'shape_or_null' has type 'ShapeOrNull', which is a oneOf [null, triangle, quadrilateral] shape_or_null=None, ) - assert isinstance(inst, petstore_api.Drawing) + assert isinstance(inst, Drawing) self.assertFalse(hasattr(inst, 'main_shape')) self.assertTrue(hasattr(inst, 'shape_or_null')) self.assertIsNone(inst.shape_or_null) @@ -135,16 +157,15 @@ def test_deserialize_oneof_reference_with_nullable_type(self): # Validate we can assign the None value to nullable_shape, because the NullableShape # has the 'nullable: true' attribute. - inst = petstore_api.Drawing( + inst = Drawing( # 'nullable_shape' has type 'NullableShape', which is a oneOf [triangle, quadrilateral] - # and the 'nullable: true' attribute. + # and the 'nullable: true' attribute. nullable_shape=None, ) - assert isinstance(inst, petstore_api.Drawing) + assert isinstance(inst, Drawing) self.assertFalse(hasattr(inst, 'main_shape')) self.assertTrue(hasattr(inst, 'nullable_shape')) self.assertIsNone(inst.nullable_shape) - if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_enum_arrays.py b/samples/openapi3/client/petstore/python-experimental/test/test_enum_arrays.py index 5f789287332a..143a23fe0d45 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_enum_arrays.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_enum_arrays.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.enum_arrays import EnumArrays class TestEnumArrays(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testEnumArrays(self): """Test EnumArrays""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.EnumArrays() # noqa: E501 + # model = EnumArrays() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_enum_class.py b/samples/openapi3/client/petstore/python-experimental/test/test_enum_class.py index f25e772ff26a..f910231c9d02 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_enum_class.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_enum_class.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.enum_class import EnumClass class TestEnumClass(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testEnumClass(self): """Test EnumClass""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.EnumClass() # noqa: E501 + # model = EnumClass() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_enum_test.py b/samples/openapi3/client/petstore/python-experimental/test/test_enum_test.py index 8238fb7a3ab9..6a98e49b9689 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_enum_test.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_enum_test.py @@ -11,10 +11,31 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import outer_enum +except ImportError: + outer_enum = sys.modules[ + 'petstore_api.model.outer_enum'] +try: + from petstore_api.model import outer_enum_default_value +except ImportError: + outer_enum_default_value = sys.modules[ + 'petstore_api.model.outer_enum_default_value'] +try: + from petstore_api.model import outer_enum_integer +except ImportError: + outer_enum_integer = sys.modules[ + 'petstore_api.model.outer_enum_integer'] +try: + from petstore_api.model import outer_enum_integer_default_value +except ImportError: + outer_enum_integer_default_value = sys.modules[ + 'petstore_api.model.outer_enum_integer_default_value'] +from petstore_api.model.enum_test import EnumTest class TestEnumTest(unittest.TestCase): @@ -29,7 +50,7 @@ def tearDown(self): def testEnumTest(self): """Test EnumTest""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.EnumTest() # noqa: E501 + # model = EnumTest() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_equilateral_triangle.py b/samples/openapi3/client/petstore/python-experimental/test/test_equilateral_triangle.py index cdef216105eb..8f286edfdcba 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_equilateral_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_equilateral_triangle.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.model.shape_interface'] +try: + from petstore_api.model import triangle_interface +except ImportError: + triangle_interface = sys.modules[ + 'petstore_api.model.triangle_interface'] +from petstore_api.model.equilateral_triangle import EquilateralTriangle class TestEquilateralTriangle(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testEquilateralTriangle(self): """Test EquilateralTriangle""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.EquilateralTriangle() # noqa: E501 + # model = EquilateralTriangle() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_fake_api.py b/samples/openapi3/client/petstore/python-experimental/test/test_fake_api.py index 581d1499eedf..f6678a59b240 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_fake_api.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_fake_api.py @@ -16,14 +16,13 @@ import petstore_api from petstore_api.api.fake_api import FakeApi # noqa: E501 -from petstore_api.rest import ApiException class TestFakeApi(unittest.TestCase): """FakeApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.fake_api.FakeApi() # noqa: E501 + self.api = FakeApi() # noqa: E501 def tearDown(self): pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py b/samples/openapi3/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py index f54e0d06644f..c12e35eb5dea 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_fake_classname_tags_123_api.py @@ -16,14 +16,13 @@ import petstore_api from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api # noqa: E501 -from petstore_api.rest import ApiException class TestFakeClassnameTags123Api(unittest.TestCase): """FakeClassnameTags123Api unit test stubs""" def setUp(self): - self.api = petstore_api.api.fake_classname_tags_123_api.FakeClassnameTags123Api() # noqa: E501 + self.api = FakeClassnameTags123Api() # noqa: E501 def tearDown(self): pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_file.py b/samples/openapi3/client/petstore/python-experimental/test/test_file.py index af185e32e6e8..8d60f64e01cc 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_file.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_file.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.file import File class TestFile(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testFile(self): """Test File""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.File() # noqa: E501 + # model = File() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_file_schema_test_class.py b/samples/openapi3/client/petstore/python-experimental/test/test_file_schema_test_class.py index c2de4e866cda..9a4f6d38dfef 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_file_schema_test_class.py @@ -11,10 +11,16 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import file +except ImportError: + file = sys.modules[ + 'petstore_api.model.file'] +from petstore_api.model.file_schema_test_class import FileSchemaTestClass class TestFileSchemaTestClass(unittest.TestCase): @@ -29,7 +35,7 @@ def tearDown(self): def testFileSchemaTestClass(self): """Test FileSchemaTestClass""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.FileSchemaTestClass() # noqa: E501 + # model = FileSchemaTestClass() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_foo.py b/samples/openapi3/client/petstore/python-experimental/test/test_foo.py index c54feb98c25a..8125de84ada3 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_foo.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_foo.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.foo import Foo class TestFoo(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testFoo(self): """Test Foo""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Foo() # noqa: E501 + # model = Foo() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_format_test.py b/samples/openapi3/client/petstore/python-experimental/test/test_format_test.py index a9d39521e934..07f4f5e4c1f7 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_format_test.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_format_test.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.format_test import FormatTest class TestFormatTest(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testFormatTest(self): """Test FormatTest""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.FormatTest() # noqa: E501 + # model = FormatTest() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_fruit.py b/samples/openapi3/client/petstore/python-experimental/test/test_fruit.py index 1172373b9e1d..1eb9d09d5061 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_fruit.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import apple +except ImportError: + apple = sys.modules[ + 'petstore_api.model.apple'] +try: + from petstore_api.model import banana +except ImportError: + banana = sys.modules[ + 'petstore_api.model.banana'] +from petstore_api.model.fruit import Fruit class TestFruit(unittest.TestCase): @@ -33,7 +44,7 @@ def testFruit(self): # banana test length_cm = 20.3 color = 'yellow' - fruit = petstore_api.Fruit(length_cm=length_cm, color=color) + fruit = Fruit(length_cm=length_cm, color=color) # check its properties self.assertEqual(fruit.length_cm, length_cm) self.assertEqual(fruit['length_cm'], length_cm) @@ -79,7 +90,7 @@ def testFruit(self): # Per Python doc, if the named attribute does not exist, # default is returned if provided, otherwise AttributeError is raised. with self.assertRaises(AttributeError): - getattr(fruit, 'cultivar') + getattr(fruit, 'cultivar') # make sure that the ModelComposed class properties are correct # model._composed_schemas stores the anyOf/allOf/oneOf info @@ -89,15 +100,15 @@ def testFruit(self): 'anyOf': [], 'allOf': [], 'oneOf': [ - petstore_api.Apple, - petstore_api.Banana, + apple.Apple, + banana.Banana, ], } ) # model._composed_instances is a list of the instances that were # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: - if composed_instance.__class__ == petstore_api.Banana: + if composed_instance.__class__ == banana.Banana: banana_instance = composed_instance self.assertEqual( fruit._composed_instances, @@ -129,7 +140,7 @@ def testFruit(self): # including extra parameters raises an exception with self.assertRaises(petstore_api.ApiValueError): - fruit = petstore_api.Fruit( + fruit = Fruit( color=color, length_cm=length_cm, unknown_property='some value' @@ -137,7 +148,7 @@ def testFruit(self): # including input parameters for two oneOf instances raise an exception with self.assertRaises(petstore_api.ApiValueError): - fruit = petstore_api.Fruit( + fruit = Fruit( length_cm=length_cm, cultivar='granny smith' ) @@ -146,7 +157,7 @@ def testFruit(self): # apple test color = 'red' cultivar = 'golden delicious' - fruit = petstore_api.Fruit(color=color, cultivar=cultivar) + fruit = Fruit(color=color, cultivar=cultivar) # check its properties self.assertEqual(fruit.color, color) self.assertEqual(fruit['color'], color) @@ -166,7 +177,7 @@ def testFruit(self): # model._composed_instances is a list of the instances that were # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: - if composed_instance.__class__ == petstore_api.Apple: + if composed_instance.__class__ == apple.Apple: apple_instance = composed_instance self.assertEqual( fruit._composed_instances, @@ -191,20 +202,20 @@ def testFruit(self): def testFruitNullValue(self): # Since 'apple' is nullable, validate we can create an apple with the 'null' value. - apple = petstore_api.Apple(None) - self.assertIsNone(apple) + fruit = apple.Apple(None) + self.assertIsNone(fruit) # 'banana' is not nullable. with self.assertRaises(petstore_api.ApiTypeError): - banana = petstore_api.Banana(None) + banana.Banana(None) # Since 'fruit' has oneOf 'apple', 'banana' and 'apple' is nullable, # validate we can create a fruit with the 'null' value. - fruit = petstore_api.Fruit(None) + fruit = Fruit(None) self.assertIsNone(fruit) # Redo the same thing, this time passing a null Apple to the Fruit constructor. - fruit = petstore_api.Fruit(petstore_api.Apple(None)) + fruit = Fruit(apple.Apple(None)) self.assertIsNone(fruit) if __name__ == '__main__': diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_fruit_req.py b/samples/openapi3/client/petstore/python-experimental/test/test_fruit_req.py index f3e03faf271c..3a1aa8fc283b 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_fruit_req.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_fruit_req.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import apple_req +except ImportError: + apple_req = sys.modules[ + 'petstore_api.model.apple_req'] +try: + from petstore_api.model import banana_req +except ImportError: + banana_req = sys.modules[ + 'petstore_api.model.banana_req'] +from petstore_api.model.fruit_req import FruitReq class TestFruitReq(unittest.TestCase): @@ -32,7 +43,7 @@ def testFruitReq(self): # make an instance of Fruit, a composed schema oneOf model # banana test length_cm = 20.3 - fruit = petstore_api.FruitReq(length_cm=length_cm) + fruit = FruitReq(length_cm=length_cm) # check its properties self.assertEqual(fruit.length_cm, length_cm) self.assertEqual(fruit['length_cm'], length_cm) @@ -70,8 +81,8 @@ def testFruitReq(self): 'anyOf': [], 'allOf': [], 'oneOf': [ - petstore_api.AppleReq, - petstore_api.BananaReq, + apple_req.AppleReq, + banana_req.BananaReq, type(None), ], } @@ -79,7 +90,7 @@ def testFruitReq(self): # model._composed_instances is a list of the instances that were # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: - if composed_instance.__class__ == petstore_api.BananaReq: + if composed_instance.__class__ == banana_req.BananaReq: banana_instance = composed_instance self.assertEqual( fruit._composed_instances, @@ -111,14 +122,14 @@ def testFruitReq(self): # including extra parameters raises an exception with self.assertRaises(petstore_api.ApiValueError): - fruit = petstore_api.FruitReq( + fruit = FruitReq( length_cm=length_cm, unknown_property='some value' ) # including input parameters for two oneOf instances raise an exception with self.assertRaises(petstore_api.ApiValueError): - fruit = petstore_api.FruitReq( + fruit = FruitReq( length_cm=length_cm, cultivar='granny smith' ) @@ -126,7 +137,7 @@ def testFruitReq(self): # make an instance of Fruit, a composed schema oneOf model # apple test cultivar = 'golden delicious' - fruit = petstore_api.FruitReq(cultivar=cultivar) + fruit = FruitReq(cultivar=cultivar) # check its properties self.assertEqual(fruit.cultivar, cultivar) self.assertEqual(fruit['cultivar'], cultivar) @@ -142,7 +153,7 @@ def testFruitReq(self): # model._composed_instances is a list of the instances that were # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: - if composed_instance.__class__ == petstore_api.AppleReq: + if composed_instance.__class__ == apple_req.AppleReq: apple_instance = composed_instance self.assertEqual( fruit._composed_instances, diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_gm_fruit.py b/samples/openapi3/client/petstore/python-experimental/test/test_gm_fruit.py index c68121f1fd8f..9d13e90659d0 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_gm_fruit.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_gm_fruit.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import apple +except ImportError: + apple = sys.modules[ + 'petstore_api.model.apple'] +try: + from petstore_api.model import banana +except ImportError: + banana = sys.modules[ + 'petstore_api.model.banana'] +from petstore_api.model.gm_fruit import GmFruit class TestGmFruit(unittest.TestCase): @@ -33,7 +44,7 @@ def testGmFruit(self): # banana test length_cm = 20.3 color = 'yellow' - fruit = petstore_api.GmFruit(length_cm=length_cm, color=color) + fruit = GmFruit(length_cm=length_cm, color=color) # check its properties self.assertEqual(fruit.length_cm, length_cm) self.assertEqual(fruit['length_cm'], length_cm) @@ -73,8 +84,8 @@ def testGmFruit(self): fruit._composed_schemas, { 'anyOf': [ - petstore_api.Apple, - petstore_api.Banana, + apple.Apple, + banana.Banana, ], 'allOf': [], 'oneOf': [], @@ -83,7 +94,7 @@ def testGmFruit(self): # model._composed_instances is a list of the instances that were # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: - if composed_instance.__class__ == petstore_api.Banana: + if composed_instance.__class__ == banana.Banana: banana_instance = composed_instance self.assertEqual( fruit._composed_instances, @@ -115,7 +126,7 @@ def testGmFruit(self): # including extra parameters raises an exception with self.assertRaises(petstore_api.ApiValueError): - fruit = petstore_api.GmFruit( + fruit = GmFruit( color=color, length_cm=length_cm, unknown_property='some value' @@ -124,7 +135,7 @@ def testGmFruit(self): # including input parameters for both anyOf instances works cultivar = 'banaple' color = 'orange' - fruit = petstore_api.GmFruit( + fruit = GmFruit( color=color, cultivar=cultivar, length_cm=length_cm @@ -142,9 +153,9 @@ def testGmFruit(self): # model._composed_instances is a list of the instances that were # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: - if composed_instance.__class__ == petstore_api.Apple: + if composed_instance.__class__ == apple.Apple: apple_instance = composed_instance - elif composed_instance.__class__ == petstore_api.Banana: + elif composed_instance.__class__ == banana.Banana: banana_instance = composed_instance self.assertEqual( fruit._composed_instances, @@ -167,7 +178,7 @@ def testGmFruit(self): color = 'red' cultivar = 'golden delicious' origin = 'California' - fruit = petstore_api.GmFruit(color=color, cultivar=cultivar, origin=origin) + fruit = GmFruit(color=color, cultivar=cultivar, origin=origin) # check its properties self.assertEqual(fruit.color, color) self.assertEqual(fruit['color'], color) @@ -193,7 +204,7 @@ def testGmFruit(self): # model._composed_instances is a list of the instances that were # made from the anyOf/allOf/OneOf classes in model._composed_schemas for composed_instance in fruit._composed_instances: - if composed_instance.__class__ == petstore_api.Apple: + if composed_instance.__class__ == apple.Apple: apple_instance = composed_instance self.assertEqual( fruit._composed_instances, diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_grandparent_animal.py b/samples/openapi3/client/petstore/python-experimental/test/test_grandparent_animal.py index dc0d300cdaea..286ef176575b 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_grandparent_animal.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_grandparent_animal.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import child_cat +except ImportError: + child_cat = sys.modules[ + 'petstore_api.model.child_cat'] +try: + from petstore_api.model import parent_pet +except ImportError: + parent_pet = sys.modules[ + 'petstore_api.model.parent_pet'] +from petstore_api.model.grandparent_animal import GrandparentAnimal class TestGrandparentAnimal(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testGrandparentAnimal(self): """Test GrandparentAnimal""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.GrandparentAnimal() # noqa: E501 + # model = GrandparentAnimal() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_has_only_read_only.py b/samples/openapi3/client/petstore/python-experimental/test/test_has_only_read_only.py index e042faf7c94c..9ebd7683b398 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_has_only_read_only.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_has_only_read_only.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.has_only_read_only import HasOnlyReadOnly class TestHasOnlyReadOnly(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testHasOnlyReadOnly(self): """Test HasOnlyReadOnly""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.HasOnlyReadOnly() # noqa: E501 + # model = HasOnlyReadOnly() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_health_check_result.py b/samples/openapi3/client/petstore/python-experimental/test/test_health_check_result.py index ebcc32f43964..11ff5f5cf636 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_health_check_result.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_health_check_result.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.health_check_result import HealthCheckResult class TestHealthCheckResult(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testHealthCheckResult(self): """Test HealthCheckResult""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.HealthCheckResult() # noqa: E501 + # model = HealthCheckResult() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object.py b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object.py index fc2e177006a2..3b3eee80807c 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.inline_object import InlineObject class TestInlineObject(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testInlineObject(self): """Test InlineObject""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.InlineObject() # noqa: E501 + # model = InlineObject() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object1.py b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object1.py index 12a62225defd..77d4b46553dd 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object1.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object1.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.inline_object1 import InlineObject1 class TestInlineObject1(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testInlineObject1(self): """Test InlineObject1""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.InlineObject1() # noqa: E501 + # model = InlineObject1() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object2.py b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object2.py index 1651197f964b..b2310f152179 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object2.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object2.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.inline_object2 import InlineObject2 class TestInlineObject2(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testInlineObject2(self): """Test InlineObject2""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.InlineObject2() # noqa: E501 + # model = InlineObject2() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object3.py b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object3.py index 2efbae377dde..afe7ca434286 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object3.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object3.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.inline_object3 import InlineObject3 class TestInlineObject3(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testInlineObject3(self): """Test InlineObject3""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.InlineObject3() # noqa: E501 + # model = InlineObject3() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object4.py b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object4.py index 4f74d9cacacf..1b9bea4716dc 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object4.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object4.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.inline_object4 import InlineObject4 class TestInlineObject4(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testInlineObject4(self): """Test InlineObject4""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.InlineObject4() # noqa: E501 + # model = InlineObject4() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object5.py b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object5.py index 895cc44ea290..ac72c53c1e3c 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_inline_object5.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_inline_object5.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.inline_object5 import InlineObject5 class TestInlineObject5(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testInlineObject5(self): """Test InlineObject5""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.InlineObject5() # noqa: E501 + # model = InlineObject5() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_inline_response_default.py b/samples/openapi3/client/petstore/python-experimental/test/test_inline_response_default.py index ecdd05f72fa4..b52167aea166 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_inline_response_default.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_inline_response_default.py @@ -11,10 +11,16 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import foo +except ImportError: + foo = sys.modules[ + 'petstore_api.model.foo'] +from petstore_api.model.inline_response_default import InlineResponseDefault class TestInlineResponseDefault(unittest.TestCase): @@ -29,7 +35,7 @@ def tearDown(self): def testInlineResponseDefault(self): """Test InlineResponseDefault""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.InlineResponseDefault() # noqa: E501 + # model = InlineResponseDefault() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_isosceles_triangle.py b/samples/openapi3/client/petstore/python-experimental/test/test_isosceles_triangle.py index 1f27f751d061..d89ae6ab78dd 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_isosceles_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_isosceles_triangle.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.model.shape_interface'] +try: + from petstore_api.model import triangle_interface +except ImportError: + triangle_interface = sys.modules[ + 'petstore_api.model.triangle_interface'] +from petstore_api.model.isosceles_triangle import IsoscelesTriangle class TestIsoscelesTriangle(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testIsoscelesTriangle(self): """Test IsoscelesTriangle""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.IsoscelesTriangle() # noqa: E501 + # model = IsoscelesTriangle() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_list.py b/samples/openapi3/client/petstore/python-experimental/test/test_list.py index 29979911a8e9..52156adfed2e 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_list.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_list.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.list import List class TestList(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testList(self): """Test List""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.List() # noqa: E501 + # model = List() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_mammal.py b/samples/openapi3/client/petstore/python-experimental/test/test_mammal.py index cc783f53ed64..2a8893d02fb3 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_mammal.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_mammal.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import whale +except ImportError: + whale = sys.modules[ + 'petstore_api.model.whale'] +try: + from petstore_api.model import zebra +except ImportError: + zebra = sys.modules[ + 'petstore_api.model.zebra'] +from petstore_api.model.mammal import Mammal class TestMammal(unittest.TestCase): @@ -30,8 +41,9 @@ def testMammal(self): """Test Mammal""" # tests that we can make a BasquePig by traveling through descendant discriminator in Pig - model = petstore_api.Mammal(class_name="BasquePig") - assert isinstance(model, petstore_api.BasquePig) + model = Mammal(class_name="BasquePig") + from petstore_api.model import basque_pig + assert isinstance(model, basque_pig.BasquePig) if __name__ == '__main__': diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_map_test.py b/samples/openapi3/client/petstore/python-experimental/test/test_map_test.py index 8592f21949bd..88b28ff93dac 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_map_test.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_map_test.py @@ -11,10 +11,16 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import string_boolean_map +except ImportError: + string_boolean_map = sys.modules[ + 'petstore_api.model.string_boolean_map'] +from petstore_api.model.map_test import MapTest class TestMapTest(unittest.TestCase): @@ -29,7 +35,7 @@ def tearDown(self): def testMapTest(self): """Test MapTest""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.MapTest() # noqa: E501 + # model = MapTest() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-experimental/test/test_mixed_properties_and_additional_properties_class.py index a4e89d3e8c07..4dcb5ad4268c 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_mixed_properties_and_additional_properties_class.py @@ -11,10 +11,16 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import animal +except ImportError: + animal = sys.modules[ + 'petstore_api.model.animal'] +from petstore_api.model.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass class TestMixedPropertiesAndAdditionalPropertiesClass(unittest.TestCase): @@ -29,7 +35,7 @@ def tearDown(self): def testMixedPropertiesAndAdditionalPropertiesClass(self): """Test MixedPropertiesAndAdditionalPropertiesClass""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.MixedPropertiesAndAdditionalPropertiesClass() # noqa: E501 + # model = MixedPropertiesAndAdditionalPropertiesClass() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_model200_response.py b/samples/openapi3/client/petstore/python-experimental/test/test_model200_response.py index 149629fe1e8e..4012eaae3362 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_model200_response.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_model200_response.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.model200_response import Model200Response class TestModel200Response(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testModel200Response(self): """Test Model200Response""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Model200Response() # noqa: E501 + # model = Model200Response() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_model_return.py b/samples/openapi3/client/petstore/python-experimental/test/test_model_return.py index e48b2c479839..54c98b33cd66 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_model_return.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_model_return.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.model_return import ModelReturn class TestModelReturn(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testModelReturn(self): """Test ModelReturn""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ModelReturn() # noqa: E501 + # model = ModelReturn() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_name.py b/samples/openapi3/client/petstore/python-experimental/test/test_name.py index 1f6407683b29..6a9be99d1a57 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_name.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_name.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.name import Name class TestName(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testName(self): """Test Name""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Name() # noqa: E501 + # model = Name() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_nullable_class.py b/samples/openapi3/client/petstore/python-experimental/test/test_nullable_class.py index 8af2cb8447ee..f73dc3d98bbb 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_nullable_class.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_nullable_class.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.nullable_class import NullableClass class TestNullableClass(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testNullableClass(self): """Test NullableClass""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.NullableClass() # noqa: E501 + # model = NullableClass() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_nullable_shape.py b/samples/openapi3/client/petstore/python-experimental/test/test_nullable_shape.py index 1e22479d4db4..d6bf001743bf 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_nullable_shape.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_nullable_shape.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import quadrilateral +except ImportError: + quadrilateral = sys.modules[ + 'petstore_api.model.quadrilateral'] +try: + from petstore_api.model import triangle +except ImportError: + triangle = sys.modules[ + 'petstore_api.model.triangle'] +from petstore_api.model.nullable_shape import NullableShape class TestNullableShape(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testNullableShape(self): """Test NullableShape""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.NullableShape() # noqa: E501 + # model = NullableShape() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_number_only.py b/samples/openapi3/client/petstore/python-experimental/test/test_number_only.py index 732baf4b84ed..07aab1d78af7 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_number_only.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_number_only.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.number_only import NumberOnly class TestNumberOnly(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testNumberOnly(self): """Test NumberOnly""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.NumberOnly() # noqa: E501 + # model = NumberOnly() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_order.py b/samples/openapi3/client/petstore/python-experimental/test/test_order.py index 10ce38e954ea..604c67042c34 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_order.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_order.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.order import Order class TestOrder(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testOrder(self): """Test Order""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Order() # noqa: E501 + # model = Order() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_outer_composite.py b/samples/openapi3/client/petstore/python-experimental/test/test_outer_composite.py index c191d04ec6b2..7da5c1f09b59 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_outer_composite.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_outer_composite.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.outer_composite import OuterComposite class TestOuterComposite(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testOuterComposite(self): """Test OuterComposite""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.OuterComposite() # noqa: E501 + # model = OuterComposite() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum.py b/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum.py index fbb8cb7ad5cf..ab9dac9d612b 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.outer_enum import OuterEnum class TestOuterEnum(unittest.TestCase): @@ -30,15 +31,14 @@ def testOuterEnum(self): """Test OuterEnum""" # Since 'OuterEnum' is nullable, validate the null value can be assigned # to OuterEnum. - inst = petstore_api.OuterEnum(None) + inst = OuterEnum(None) self.assertIsNone(inst) - inst = petstore_api.OuterEnum('approved') - assert isinstance(inst, petstore_api.OuterEnum) + inst = OuterEnum('approved') + assert isinstance(inst, OuterEnum) with self.assertRaises(petstore_api.ApiValueError): - inst = petstore_api.OuterEnum('garbage') - assert isinstance(inst, petstore_api.OuterEnum) + OuterEnum('garbage') if __name__ == '__main__': diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_default_value.py b/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_default_value.py index 80c9534a88e2..a0f6fb3cef51 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_default_value.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_default_value.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.outer_enum_default_value import OuterEnumDefaultValue class TestOuterEnumDefaultValue(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testOuterEnumDefaultValue(self): """Test OuterEnumDefaultValue""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.OuterEnumDefaultValue() # noqa: E501 + # model = OuterEnumDefaultValue() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_integer.py b/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_integer.py index 60724eefd711..9e0fa2975b4b 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_integer.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_integer.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.outer_enum_integer import OuterEnumInteger class TestOuterEnumInteger(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testOuterEnumInteger(self): """Test OuterEnumInteger""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.OuterEnumInteger() # noqa: E501 + # model = OuterEnumInteger() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_integer_default_value.py index 8eca8fa69ac1..6eb78f95b0cf 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_integer_default_value.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_outer_enum_integer_default_value.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue class TestOuterEnumIntegerDefaultValue(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testOuterEnumIntegerDefaultValue(self): """Test OuterEnumIntegerDefaultValue""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.OuterEnumIntegerDefaultValue() # noqa: E501 + # model = OuterEnumIntegerDefaultValue() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_parent_pet.py b/samples/openapi3/client/petstore/python-experimental/test/test_parent_pet.py index 8db04124d66e..15262872e195 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_parent_pet.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_parent_pet.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import child_cat +except ImportError: + child_cat = sys.modules[ + 'petstore_api.model.child_cat'] +try: + from petstore_api.model import grandparent_animal +except ImportError: + grandparent_animal = sys.modules[ + 'petstore_api.model.grandparent_animal'] +from petstore_api.model.parent_pet import ParentPet class TestParentPet(unittest.TestCase): @@ -32,8 +43,9 @@ def testParentPet(self): # test that we can make a ParentPet from a ParentPet # which requires that we travel back through ParentPet's allOf descendant # GrandparentAnimal, and we use the descendant's discriminator to make ParentPet - model = petstore_api.ParentPet(pet_type="ParentPet") - assert isinstance(model, petstore_api.ParentPet) + model = ParentPet(pet_type="ParentPet") + assert isinstance(model, ParentPet) + if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_pet.py b/samples/openapi3/client/petstore/python-experimental/test/test_pet.py index db9e3729f505..fb8586e4090c 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_pet.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_pet.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import category +except ImportError: + category = sys.modules[ + 'petstore_api.model.category'] +try: + from petstore_api.model import tag +except ImportError: + tag = sys.modules[ + 'petstore_api.model.tag'] +from petstore_api.model.pet import Pet class TestPet(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testPet(self): """Test Pet""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Pet() # noqa: E501 + # model = Pet() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_pet_api.py b/samples/openapi3/client/petstore/python-experimental/test/test_pet_api.py index 77665df879f1..3f2d3a8847ca 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_pet_api.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_pet_api.py @@ -16,14 +16,13 @@ import petstore_api from petstore_api.api.pet_api import PetApi # noqa: E501 -from petstore_api.rest import ApiException class TestPetApi(unittest.TestCase): """PetApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.pet_api.PetApi() # noqa: E501 + self.api = PetApi() # noqa: E501 def tearDown(self): pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_pig.py b/samples/openapi3/client/petstore/python-experimental/test/test_pig.py index afdd210da7d9..f98bed3f1910 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_pig.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_pig.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import basque_pig +except ImportError: + basque_pig = sys.modules[ + 'petstore_api.model.basque_pig'] +try: + from petstore_api.model import danish_pig +except ImportError: + danish_pig = sys.modules[ + 'petstore_api.model.danish_pig'] +from petstore_api.model.pig import Pig class TestPig(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testPig(self): """Test Pig""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Pig() # noqa: E501 + # model = Pig() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral.py index 9bb838811892..149b9a0070b6 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import complex_quadrilateral +except ImportError: + complex_quadrilateral = sys.modules[ + 'petstore_api.model.complex_quadrilateral'] +try: + from petstore_api.model import simple_quadrilateral +except ImportError: + simple_quadrilateral = sys.modules[ + 'petstore_api.model.simple_quadrilateral'] +from petstore_api.model.quadrilateral import Quadrilateral class TestQuadrilateral(unittest.TestCase): @@ -28,10 +39,10 @@ def tearDown(self): def testQuadrilateral(self): """Test Quadrilateral""" - complex_quadrilateral = petstore_api.Quadrilateral(shape_type="Quadrilateral", quadrilateral_type="ComplexQuadrilateral") - assert isinstance(complex_quadrilateral, petstore_api.ComplexQuadrilateral) - simple_quadrilateral = petstore_api.Quadrilateral(shape_type="Quadrilateral", quadrilateral_type="SimpleQuadrilateral") - assert isinstance(simple_quadrilateral, petstore_api.SimpleQuadrilateral) + instance = Quadrilateral(shape_type="Quadrilateral", quadrilateral_type="ComplexQuadrilateral") + assert isinstance(instance, complex_quadrilateral.ComplexQuadrilateral) + instance = Quadrilateral(shape_type="Quadrilateral", quadrilateral_type="SimpleQuadrilateral") + assert isinstance(instance, simple_quadrilateral.SimpleQuadrilateral) if __name__ == '__main__': diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral_interface.py b/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral_interface.py index 7a48ce64a9df..0b2e32dc37af 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral_interface.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_quadrilateral_interface.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.quadrilateral_interface import QuadrilateralInterface class TestQuadrilateralInterface(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testQuadrilateralInterface(self): """Test QuadrilateralInterface""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.QuadrilateralInterface() # noqa: E501 + # model = QuadrilateralInterface() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_read_only_first.py b/samples/openapi3/client/petstore/python-experimental/test/test_read_only_first.py index 553768f3303a..c2dcde240e77 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_read_only_first.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_read_only_first.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.read_only_first import ReadOnlyFirst class TestReadOnlyFirst(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testReadOnlyFirst(self): """Test ReadOnlyFirst""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ReadOnlyFirst() # noqa: E501 + # model = ReadOnlyFirst() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_scalene_triangle.py b/samples/openapi3/client/petstore/python-experimental/test/test_scalene_triangle.py index 8452fc183137..f5f1ccb3efa0 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_scalene_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_scalene_triangle.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.model.shape_interface'] +try: + from petstore_api.model import triangle_interface +except ImportError: + triangle_interface = sys.modules[ + 'petstore_api.model.triangle_interface'] +from petstore_api.model.scalene_triangle import ScaleneTriangle class TestScaleneTriangle(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testScaleneTriangle(self): """Test ScaleneTriangle""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ScaleneTriangle() # noqa: E501 + # model = ScaleneTriangle() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_shape.py b/samples/openapi3/client/petstore/python-experimental/test/test_shape.py index e06fd0cb6faf..4424679aeccb 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_shape.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_shape.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import quadrilateral +except ImportError: + quadrilateral = sys.modules[ + 'petstore_api.model.quadrilateral'] +try: + from petstore_api.model import triangle +except ImportError: + triangle = sys.modules[ + 'petstore_api.model.triangle'] +from petstore_api.model.shape import Shape class TestShape(unittest.TestCase): @@ -28,67 +39,71 @@ def tearDown(self): def testShape(self): """Test Shape""" - equilateral_triangle = petstore_api.Triangle( + from petstore_api.model import complex_quadrilateral + from petstore_api.model import simple_quadrilateral + from petstore_api.model import equilateral_triangle + from petstore_api.model import isosceles_triangle + from petstore_api.model import scalene_triangle + tri = triangle.Triangle( shape_type="Triangle", triangle_type="EquilateralTriangle" ) - assert isinstance(equilateral_triangle, petstore_api.EquilateralTriangle) + assert isinstance(tri, equilateral_triangle.EquilateralTriangle) - isosceles_triangle = petstore_api.Triangle( + tri = triangle.Triangle( shape_type="Triangle", triangle_type="IsoscelesTriangle" ) - assert isinstance(isosceles_triangle, petstore_api.IsoscelesTriangle) + assert isinstance(tri, isosceles_triangle.IsoscelesTriangle) - scalene_triangle = petstore_api.Triangle( + tri = triangle.Triangle( shape_type="Triangle", triangle_type="ScaleneTriangle" ) - assert isinstance(scalene_triangle, petstore_api.ScaleneTriangle) + assert isinstance(tri, scalene_triangle.ScaleneTriangle) - complex_quadrilateral = petstore_api.Shape( + quad = Shape( shape_type="Quadrilateral", quadrilateral_type="ComplexQuadrilateral" ) - assert isinstance(complex_quadrilateral, petstore_api.ComplexQuadrilateral) + assert isinstance(quad, complex_quadrilateral.ComplexQuadrilateral) - simple_quadrilateral = petstore_api.Shape( + quad = Shape( shape_type="Quadrilateral", quadrilateral_type="SimpleQuadrilateral" ) - assert isinstance(simple_quadrilateral, petstore_api.SimpleQuadrilateral) + assert isinstance(quad, simple_quadrilateral.SimpleQuadrilateral) # No discriminator provided. err_msg = ("Cannot deserialize input data due to missing discriminator. " - "The discriminator property '{}' is missing at path: ()" - ) + "The discriminator property '{}' is missing at path: ()" + ) with self.assertRaisesRegexp( - petstore_api.ApiValueError, - err_msg.format("shapeType") + petstore_api.ApiValueError, + err_msg.format("shapeType") ): - petstore_api.Shape() + Shape() # invalid shape_type (first discriminator). 'Circle' does not exist in the model. err_msg = ("Cannot deserialize input data due to invalid discriminator " - "value. The OpenAPI document has no mapping for discriminator " - "property '{}'='{}' at path: ()" - ) + "value. The OpenAPI document has no mapping for discriminator " + "property '{}'='{}' at path: ()" + ) with self.assertRaisesRegexp( - petstore_api.ApiValueError, - err_msg.format("shapeType", "Circle") + petstore_api.ApiValueError, + err_msg.format("shapeType", "Circle") ): - petstore_api.Shape(shape_type="Circle") + Shape(shape_type="Circle") # invalid quadrilateral_type (second discriminator) with self.assertRaisesRegexp( - petstore_api.ApiValueError, - err_msg.format("quadrilateralType", "Triangle") + petstore_api.ApiValueError, + err_msg.format("quadrilateralType", "Triangle") ): - petstore_api.Shape( + Shape( shape_type="Quadrilateral", quadrilateral_type="Triangle" ) - if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_shape_interface.py b/samples/openapi3/client/petstore/python-experimental/test/test_shape_interface.py index a768951489a0..c8b0270f9fc5 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_shape_interface.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_shape_interface.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.shape_interface import ShapeInterface class TestShapeInterface(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testShapeInterface(self): """Test ShapeInterface""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ShapeInterface() # noqa: E501 + # model = ShapeInterface() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_shape_or_null.py b/samples/openapi3/client/petstore/python-experimental/test/test_shape_or_null.py index b04d847204bc..e3bfa41e7e84 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_shape_or_null.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_shape_or_null.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import quadrilateral +except ImportError: + quadrilateral = sys.modules[ + 'petstore_api.model.quadrilateral'] +try: + from petstore_api.model import triangle +except ImportError: + triangle = sys.modules[ + 'petstore_api.model.triangle'] +from petstore_api.model.shape_or_null import ShapeOrNull class TestShapeOrNull(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testShapeOrNull(self): """Test ShapeOrNull""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.ShapeOrNull() # noqa: E501 + # model = ShapeOrNull() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_simple_quadrilateral.py b/samples/openapi3/client/petstore/python-experimental/test/test_simple_quadrilateral.py index f51722093445..b08ddf1c6781 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_simple_quadrilateral.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_simple_quadrilateral.py @@ -11,10 +11,21 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import quadrilateral_interface +except ImportError: + quadrilateral_interface = sys.modules[ + 'petstore_api.model.quadrilateral_interface'] +try: + from petstore_api.model import shape_interface +except ImportError: + shape_interface = sys.modules[ + 'petstore_api.model.shape_interface'] +from petstore_api.model.simple_quadrilateral import SimpleQuadrilateral class TestSimpleQuadrilateral(unittest.TestCase): @@ -29,7 +40,7 @@ def tearDown(self): def testSimpleQuadrilateral(self): """Test SimpleQuadrilateral""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.SimpleQuadrilateral() # noqa: E501 + # model = SimpleQuadrilateral() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_special_model_name.py b/samples/openapi3/client/petstore/python-experimental/test/test_special_model_name.py index 7de520d9cefe..6124525f5170 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_special_model_name.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_special_model_name.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.special_model_name import SpecialModelName class TestSpecialModelName(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testSpecialModelName(self): """Test SpecialModelName""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.SpecialModelName() # noqa: E501 + # model = SpecialModelName() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_store_api.py b/samples/openapi3/client/petstore/python-experimental/test/test_store_api.py index 81848d24a67e..0d9cc3dd36ea 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_store_api.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_store_api.py @@ -16,14 +16,13 @@ import petstore_api from petstore_api.api.store_api import StoreApi # noqa: E501 -from petstore_api.rest import ApiException class TestStoreApi(unittest.TestCase): """StoreApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.store_api.StoreApi() # noqa: E501 + self.api = StoreApi() # noqa: E501 def tearDown(self): pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_string_boolean_map.py b/samples/openapi3/client/petstore/python-experimental/test/test_string_boolean_map.py index af071721eba3..e2e9d8b420b8 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_string_boolean_map.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_string_boolean_map.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.string_boolean_map import StringBooleanMap class TestStringBooleanMap(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testStringBooleanMap(self): """Test StringBooleanMap""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.StringBooleanMap() # noqa: E501 + # model = StringBooleanMap() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_tag.py b/samples/openapi3/client/petstore/python-experimental/test/test_tag.py index 27c2be5391ab..b0a09d94a785 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_tag.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_tag.py @@ -15,6 +15,7 @@ import unittest import petstore_api +from petstore_api.model.tag import Tag class TestTag(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testTag(self): """Test Tag""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Tag() # noqa: E501 + # model = Tag() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_triangle.py b/samples/openapi3/client/petstore/python-experimental/test/test_triangle.py index 42037a1ec79b..65ae20743e14 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_triangle.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_triangle.py @@ -11,10 +11,26 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +try: + from petstore_api.model import equilateral_triangle +except ImportError: + equilateral_triangle = sys.modules[ + 'petstore_api.model.equilateral_triangle'] +try: + from petstore_api.model import isosceles_triangle +except ImportError: + isosceles_triangle = sys.modules[ + 'petstore_api.model.isosceles_triangle'] +try: + from petstore_api.model import scalene_triangle +except ImportError: + scalene_triangle = sys.modules[ + 'petstore_api.model.scalene_triangle'] +from petstore_api.model.triangle import Triangle class TestTriangle(unittest.TestCase): @@ -28,12 +44,12 @@ def tearDown(self): def testTriangle(self): """Test Triangle""" - equilateral_triangle = petstore_api.Triangle(shape_type="Triangle", triangle_type="EquilateralTriangle") - assert isinstance(equilateral_triangle, petstore_api.EquilateralTriangle) - isosceles_triangle = petstore_api.Triangle(shape_type="Triangle", triangle_type="IsoscelesTriangle") - assert isinstance(isosceles_triangle, petstore_api.IsoscelesTriangle) - scalene_triangle = petstore_api.Triangle(shape_type="Triangle", triangle_type="ScaleneTriangle") - assert isinstance(scalene_triangle, petstore_api.ScaleneTriangle) + tri = Triangle(shape_type="Triangle", triangle_type="EquilateralTriangle") + assert isinstance(tri, equilateral_triangle.EquilateralTriangle) + tri = Triangle(shape_type="Triangle", triangle_type="IsoscelesTriangle") + assert isinstance(tri, isosceles_triangle.IsoscelesTriangle) + tri = Triangle(shape_type="Triangle", triangle_type="ScaleneTriangle") + assert isinstance(tri, scalene_triangle.ScaleneTriangle) if __name__ == '__main__': diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_triangle_interface.py b/samples/openapi3/client/petstore/python-experimental/test/test_triangle_interface.py index 4d87e647e61e..e087651a7d55 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_triangle_interface.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_triangle_interface.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.triangle_interface import TriangleInterface class TestTriangleInterface(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testTriangleInterface(self): """Test TriangleInterface""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.TriangleInterface() # noqa: E501 + # model = TriangleInterface() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_user.py b/samples/openapi3/client/petstore/python-experimental/test/test_user.py index 3df641e29b6a..7241bb589c52 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_user.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_user.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.user import User class TestUser(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testUser(self): """Test User""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.User() # noqa: E501 + # model = User() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_user_api.py b/samples/openapi3/client/petstore/python-experimental/test/test_user_api.py index 6df730fba2b1..df306da07761 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_user_api.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_user_api.py @@ -16,14 +16,13 @@ import petstore_api from petstore_api.api.user_api import UserApi # noqa: E501 -from petstore_api.rest import ApiException class TestUserApi(unittest.TestCase): """UserApi unit test stubs""" def setUp(self): - self.api = petstore_api.api.user_api.UserApi() # noqa: E501 + self.api = UserApi() # noqa: E501 def tearDown(self): pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_whale.py b/samples/openapi3/client/petstore/python-experimental/test/test_whale.py index 35d68f0cda02..3ad793af3e43 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_whale.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_whale.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.whale import Whale class TestWhale(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testWhale(self): """Test Whale""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Whale() # noqa: E501 + # model = Whale() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/test/test_zebra.py b/samples/openapi3/client/petstore/python-experimental/test/test_zebra.py index 6013bd9a9a20..fe3245cced48 100644 --- a/samples/openapi3/client/petstore/python-experimental/test/test_zebra.py +++ b/samples/openapi3/client/petstore/python-experimental/test/test_zebra.py @@ -11,10 +11,11 @@ from __future__ import absolute_import - +import sys import unittest import petstore_api +from petstore_api.model.zebra import Zebra class TestZebra(unittest.TestCase): @@ -29,7 +30,7 @@ def tearDown(self): def testZebra(self): """Test Zebra""" # FIXME: construct object with mandatory attributes with example values - # model = petstore_api.Zebra() # noqa: E501 + # model = Zebra() # noqa: E501 pass diff --git a/samples/openapi3/client/petstore/python-experimental/tests/test_api_validation.py b/samples/openapi3/client/petstore/python-experimental/tests/test_api_validation.py index a8a7276142bc..edf48ad0160b 100644 --- a/samples/openapi3/client/petstore/python-experimental/tests/test_api_validation.py +++ b/samples/openapi3/client/petstore/python-experimental/tests/test_api_validation.py @@ -21,6 +21,7 @@ from collections import namedtuple import petstore_api +from petstore_api.model import format_test import petstore_api.configuration HOST = 'http://petstore.swagger.io/v2' @@ -50,7 +51,7 @@ def checkRaiseRegex(self, expected_exception, expected_regex): def test_multiple_of(self): - inst = petstore_api.FormatTest( + inst = format_test.FormatTest( byte='3', date=datetime.date(2000, 1, 1), password="abcdefghijkl", @@ -58,10 +59,10 @@ def test_multiple_of(self): number=65.0, float=62.4 ) - assert isinstance(inst, petstore_api.FormatTest) + assert isinstance(inst, format_test.FormatTest) with self.checkRaiseRegex(petstore_api.exceptions.ApiValueError, "Invalid value for `integer`, value must be a multiple of `2`"): - inst = petstore_api.FormatTest( + inst = format_test.FormatTest( byte='3', date=datetime.date(2000, 1, 1), password="abcdefghijkl", @@ -80,8 +81,8 @@ def test_multiple_of_deserialization(self): 'float': 62.4, } response = MockResponse(data=json.dumps(data)) - deserialized = self.api_client.deserialize(response, (petstore_api.FormatTest,), True) - self.assertTrue(isinstance(deserialized, petstore_api.FormatTest)) + deserialized = self.api_client.deserialize(response, (format_test.FormatTest,), True) + self.assertTrue(isinstance(deserialized, format_test.FormatTest)) with self.checkRaiseRegex(petstore_api.exceptions.ApiValueError, "Invalid value for `integer`, value must be a multiple of `2`"): data = { @@ -93,7 +94,7 @@ def test_multiple_of_deserialization(self): 'float': 62.4, } response = MockResponse(data=json.dumps(data)) - deserialized = self.api_client.deserialize(response, (petstore_api.FormatTest,), True) + deserialized = self.api_client.deserialize(response, (format_test.FormatTest,), True) # Disable JSON schema validation. No error should be raised during deserialization. config = petstore_api.Configuration() @@ -109,8 +110,8 @@ def test_multiple_of_deserialization(self): 'float': 62.4, } response = MockResponse(data=json.dumps(data)) - deserialized = api_client.deserialize(response, (petstore_api.FormatTest,), True) - self.assertTrue(isinstance(deserialized, petstore_api.FormatTest)) + deserialized = api_client.deserialize(response, (format_test.FormatTest,), True) + self.assertTrue(isinstance(deserialized, format_test.FormatTest)) # Disable JSON schema validation but for a different keyword. # An error should be raised during deserialization. @@ -128,4 +129,4 @@ def test_multiple_of_deserialization(self): 'float': 62.4, } response = MockResponse(data=json.dumps(data)) - deserialized = api_client.deserialize(response, (petstore_api.FormatTest,), True) + deserialized = api_client.deserialize(response, (format_test.FormatTest,), True) diff --git a/samples/openapi3/client/petstore/python-experimental/tests/test_deserialization.py b/samples/openapi3/client/petstore/python-experimental/tests/test_deserialization.py index a34df3425672..23e597d9bf54 100644 --- a/samples/openapi3/client/petstore/python-experimental/tests/test_deserialization.py +++ b/samples/openapi3/client/petstore/python-experimental/tests/test_deserialization.py @@ -16,6 +16,20 @@ import datetime import petstore_api +from petstore_api.model import ( + shape, + equilateral_triangle, + animal, + dog, + apple, + mammal, + whale, + zebra, + banana, + fruit_req, + drawing, + banana_req, +) MockResponse = namedtuple('MockResponse', 'data') @@ -46,8 +60,8 @@ def test_deserialize_shape(self): } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Shape,), True) - self.assertTrue(isinstance(deserialized, petstore_api.EquilateralTriangle)) + deserialized = self.deserialize(response, (shape.Shape,), True) + self.assertTrue(isinstance(deserialized, equilateral_triangle.EquilateralTriangle)) self.assertEqual(deserialized.shape_type, shape_type) self.assertEqual(deserialized.triangle_type, triangle_type) @@ -67,7 +81,7 @@ def test_deserialize_shape(self): petstore_api.ApiValueError, err_msg.format("quadrilateralType", "Triangle") ): - self.deserialize(response, (petstore_api.Shape,), True) + self.deserialize(response, (shape.Shape,), True) def test_deserialize_animal(self): """ @@ -86,8 +100,8 @@ def test_deserialize_animal(self): } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Animal,), True) - self.assertTrue(isinstance(deserialized, petstore_api.Dog)) + deserialized = self.deserialize(response, (animal.Animal,), True) + self.assertTrue(isinstance(deserialized, dog.Dog)) self.assertEqual(deserialized.class_name, class_name) self.assertEqual(deserialized.color, color) self.assertEqual(deserialized.breed, breed) @@ -98,15 +112,15 @@ def test_regex_constraint(self): """ # Test with valid regex pattern. - inst = petstore_api.Apple( + inst = apple.Apple( cultivar="Akane" ) - assert isinstance(inst, petstore_api.Apple) + assert isinstance(inst, apple.Apple) - inst = petstore_api.Apple( + inst = apple.Apple( origin="cHiLe" ) - assert isinstance(inst, petstore_api.Apple) + assert isinstance(inst, apple.Apple) # Test with invalid regex pattern. err_msg = ("Invalid value for `{}`, must match regular expression `{}`$") @@ -114,7 +128,7 @@ def test_regex_constraint(self): petstore_api.ApiValueError, err_msg.format("cultivar", "[^`]*") ): - inst = petstore_api.Apple( + inst = apple.Apple( cultivar="!@#%@$#Akane" ) @@ -123,7 +137,7 @@ def test_regex_constraint(self): petstore_api.ApiValueError, err_msg.format("origin", "[^`]*") ): - inst = petstore_api.Apple( + inst = apple.Apple( origin="!@#%@$#Chile" ) @@ -143,8 +157,8 @@ def test_deserialize_mammal(self): 'className': class_name } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Mammal,), True) - self.assertTrue(isinstance(deserialized, petstore_api.Whale)) + deserialized = self.deserialize(response, (mammal.Mammal,), True) + self.assertTrue(isinstance(deserialized, whale.Whale)) self.assertEqual(deserialized.has_baleen, has_baleen) self.assertEqual(deserialized.has_teeth, has_teeth) self.assertEqual(deserialized.class_name, class_name) @@ -157,8 +171,8 @@ def test_deserialize_mammal(self): 'className': class_name } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Mammal,), True) - self.assertTrue(isinstance(deserialized, petstore_api.Zebra)) + deserialized = self.deserialize(response, (mammal.Mammal,), True) + self.assertTrue(isinstance(deserialized, zebra.Zebra)) self.assertEqual(deserialized.type, zebra_type) self.assertEqual(deserialized.class_name, class_name) @@ -170,8 +184,8 @@ def test_deserialize_float_value(self): 'lengthCm': 3.1415 } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Banana,), True) - self.assertTrue(isinstance(deserialized, petstore_api.Banana)) + deserialized = self.deserialize(response, (banana.Banana,), True) + self.assertTrue(isinstance(deserialized, banana.Banana)) self.assertEqual(deserialized.length_cm, 3.1415) # Float value is serialized without decimal point @@ -179,8 +193,8 @@ def test_deserialize_float_value(self): 'lengthCm': 3 } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Banana,), True) - self.assertTrue(isinstance(deserialized, petstore_api.Banana)) + deserialized = self.deserialize(response, (banana.Banana,), True) + self.assertTrue(isinstance(deserialized, banana.Banana)) self.assertEqual(deserialized.length_cm, 3.0) def test_deserialize_fruit_null_value(self): @@ -192,10 +206,10 @@ def test_deserialize_fruit_null_value(self): # Unmarshal 'null' value data = None response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.FruitReq, type(None)), True) + deserialized = self.deserialize(response, (fruit_req.FruitReq, type(None)), True) self.assertEqual(type(deserialized), type(None)) - inst = petstore_api.FruitReq(None) + inst = fruit_req.FruitReq(None) self.assertIsNone(inst) def test_deserialize_with_additional_properties(self): @@ -220,8 +234,8 @@ def test_deserialize_with_additional_properties(self): 'size': 'medium', } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Dog,), True) - self.assertEqual(type(deserialized), petstore_api.Dog) + deserialized = self.deserialize(response, (dog.Dog,), True) + self.assertEqual(type(deserialized), dog.Dog) self.assertEqual(deserialized.class_name, 'Dog') self.assertEqual(deserialized.breed, 'golden retriever') @@ -238,8 +252,8 @@ def test_deserialize_with_additional_properties(self): 'p2': [ 'a', 'b', 123], } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Mammal,), True) - self.assertEqual(type(deserialized), petstore_api.Zebra) + deserialized = self.deserialize(response, (mammal.Mammal,), True) + self.assertEqual(type(deserialized), zebra.Zebra) self.assertEqual(deserialized.class_name, 'zebra') self.assertEqual(deserialized.type, 'plains') self.assertEqual(deserialized.p1, True) @@ -259,8 +273,8 @@ def test_deserialize_with_additional_properties(self): 'unknown-group': 'abc', } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.BananaReq,), True) - self.assertEqual(type(deserialized), petstore_api.BananaReq) + deserialized = self.deserialize(response, (banana_req.BananaReq,), True) + self.assertEqual(type(deserialized), banana_req.BananaReq) self.assertEqual(deserialized.lengthCm, 21) self.assertEqual(deserialized.p1, True) @@ -286,4 +300,4 @@ def test_deserialize_with_additional_properties_and_reference(self): ], } response = MockResponse(data=json.dumps(data)) - deserialized = self.deserialize(response, (petstore_api.Drawing,), True) + deserialized = self.deserialize(response, (drawing.Drawing,), True) diff --git a/samples/openapi3/client/petstore/python-experimental/tests/test_discard_unknown_properties.py b/samples/openapi3/client/petstore/python-experimental/tests/test_discard_unknown_properties.py index a85ae29c46e2..976a3da2df4f 100644 --- a/samples/openapi3/client/petstore/python-experimental/tests/test_discard_unknown_properties.py +++ b/samples/openapi3/client/petstore/python-experimental/tests/test_discard_unknown_properties.py @@ -12,18 +12,12 @@ """ from collections import namedtuple import json -import os import re -import shutil import unittest -from six.moves.urllib.parse import urlencode, urlparse import petstore_api +from petstore_api.model import cat, dog, isosceles_triangle, banana_req from petstore_api import Configuration, signing -from petstore_api.rest import ( - RESTClientObject, - RESTResponse -) from petstore_api.model_utils import ( file_type, @@ -57,7 +51,7 @@ def test_deserialize_banana_req_do_not_discard_unknown_properties(self): # Deserializing with strict validation raises an exception because the 'unknown_property' # is undeclared. with self.assertRaises(petstore_api.exceptions.ApiAttributeError) as cm: - deserialized = api_client.deserialize(response, ((petstore_api.BananaReq),), True) + deserialized = api_client.deserialize(response, ((banana_req.BananaReq),), True) self.assertTrue(re.match("BananaReq has no attribute 'unknown_property' at.*", str(cm.exception)), 'Exception message: {0}'.format(str(cm.exception))) @@ -83,7 +77,7 @@ def test_deserialize_isosceles_triangle_do_not_discard_unknown_properties(self): # Deserializing with strict validation raises an exception because the 'unknown_property' # is undeclared. with self.assertRaises(petstore_api.ApiValueError) as cm: - deserialized = api_client.deserialize(response, ((petstore_api.IsoscelesTriangle),), True) + deserialized = api_client.deserialize(response, ((isosceles_triangle.IsoscelesTriangle),), True) self.assertTrue(re.match('.*Not all inputs were used.*unknown_property.*', str(cm.exception)), 'Exception message: {0}'.format(str(cm.exception))) @@ -107,8 +101,8 @@ def test_deserialize_banana_req_discard_unknown_properties(self): # The 'unknown_property' is undeclared, which would normally raise an exception, but # when discard_unknown_keys is set to True, the unknown properties are discarded. response = MockResponse(data=json.dumps(data)) - deserialized = api_client.deserialize(response, ((petstore_api.BananaReq),), True) - self.assertTrue(isinstance(deserialized, petstore_api.BananaReq)) + deserialized = api_client.deserialize(response, ((banana_req.BananaReq),), True) + self.assertTrue(isinstance(deserialized, banana_req.BananaReq)) # Check the 'unknown_property' and 'more-unknown' properties are not present in the # output. self.assertIn("length_cm", deserialized.to_dict().keys()) @@ -133,8 +127,8 @@ def test_deserialize_cat_do_not_discard_unknown_properties(self): # Deserializing with strict validation does not raise an exception because the even though # the 'dynamic-property' is undeclared, the 'Cat' schema defines the additionalProperties # attribute. - deserialized = api_client.deserialize(response, ((petstore_api.Cat),), True) - self.assertTrue(isinstance(deserialized, petstore_api.Cat)) + deserialized = api_client.deserialize(response, ((cat.Cat),), True) + self.assertTrue(isinstance(deserialized, cat.Cat)) self.assertIn('color', deserialized.to_dict()) self.assertEqual(deserialized['color'], 'black') @@ -156,8 +150,8 @@ def test_deserialize_cat_discard_unknown_properties(self): # The 'my_additional_property' is undeclared, but 'Cat' has a 'Address' type through # the allOf: [ $ref: '#/components/schemas/Address' ]. response = MockResponse(data=json.dumps(data)) - deserialized = api_client.deserialize(response, ((petstore_api.Cat),), True) - self.assertTrue(isinstance(deserialized, petstore_api.Cat)) + deserialized = api_client.deserialize(response, ((cat.Cat),), True) + self.assertTrue(isinstance(deserialized, cat.Cat)) # Check the 'unknown_property' and 'more-unknown' properties are not present in the # output. self.assertIn("declawed", deserialized.to_dict().keys()) diff --git a/samples/openapi3/client/petstore/python-experimental/tests/test_http_signature.py b/samples/openapi3/client/petstore/python-experimental/tests/test_http_signature.py index 9864cf1a2139..e8f0dd186a98 100644 --- a/samples/openapi3/client/petstore/python-experimental/tests/test_http_signature.py +++ b/samples/openapi3/client/petstore/python-experimental/tests/test_http_signature.py @@ -25,6 +25,8 @@ from six.moves.urllib.parse import urlencode, urlparse import petstore_api +from petstore_api.model import category, tag, pet +from petstore_api.api.pet_api import PetApi from petstore_api import Configuration, signing from petstore_api.rest import ( RESTClientObject, @@ -211,13 +213,13 @@ def tearDownClass(cls): @classmethod def setUpModels(cls): - cls.category = petstore_api.Category() + cls.category = category.Category() cls.category.id = id_gen() cls.category.name = "dog" - cls.tag = petstore_api.Tag() + cls.tag = tag.Tag() cls.tag.id = id_gen() cls.tag.name = "python-pet-tag" - cls.pet = petstore_api.Pet( + cls.pet = pet.Pet( name="hello kity", photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"] ) @@ -286,7 +288,7 @@ def test_valid_http_signature(self): config.access_token = None api_client = petstore_api.ApiClient(config) - pet_api = petstore_api.PetApi(api_client) + pet_api = PetApi(api_client) mock_pool = MockPoolManager(self) api_client.rest_client.pool_manager = mock_pool @@ -317,7 +319,7 @@ def test_valid_http_signature_with_defaults(self): config.access_token = None api_client = petstore_api.ApiClient(config) - pet_api = petstore_api.PetApi(api_client) + pet_api = PetApi(api_client) mock_pool = MockPoolManager(self) api_client.rest_client.pool_manager = mock_pool @@ -353,7 +355,7 @@ def test_valid_http_signature_rsassa_pkcs1v15(self): config.access_token = None api_client = petstore_api.ApiClient(config) - pet_api = petstore_api.PetApi(api_client) + pet_api = PetApi(api_client) mock_pool = MockPoolManager(self) api_client.rest_client.pool_manager = mock_pool @@ -389,7 +391,7 @@ def test_valid_http_signature_rsassa_pss(self): config.access_token = None api_client = petstore_api.ApiClient(config) - pet_api = petstore_api.PetApi(api_client) + pet_api = PetApi(api_client) mock_pool = MockPoolManager(self) api_client.rest_client.pool_manager = mock_pool @@ -425,7 +427,7 @@ def test_valid_http_signature_ec_p521(self): config.access_token = None api_client = petstore_api.ApiClient(config) - pet_api = petstore_api.PetApi(api_client) + pet_api = PetApi(api_client) mock_pool = MockPoolManager(self) api_client.rest_client.pool_manager = mock_pool diff --git a/samples/server/petstore/haskell-servant/.openapi-generator/VERSION b/samples/server/petstore/haskell-servant/.openapi-generator/VERSION index c3a2c7076fa8..d99e7162d01f 100644 --- a/samples/server/petstore/haskell-servant/.openapi-generator/VERSION +++ b/samples/server/petstore/haskell-servant/.openapi-generator/VERSION @@ -1 +1 @@ -4.2.0-SNAPSHOT \ No newline at end of file +5.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/php-laravel/lib/README.md b/samples/server/petstore/php-laravel/lib/README.md index 76ceb65d21f6..607a00a0ad2a 100644 --- a/samples/server/petstore/php-laravel/lib/README.md +++ b/samples/server/petstore/php-laravel/lib/README.md @@ -1,5 +1,8 @@ # OpenAPI generated server +## Requirements +* PHP 7.1.3 or newer + ## Overview This server was generated by the [openapi-generator](https://github.com/openapitools/openapi-generator) project. By using the [OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/AnotherFakeController.php b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/AnotherFakeController.php index 700d13d11e45..5c0f1920227c 100644 --- a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/AnotherFakeController.php +++ b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/AnotherFakeController.php @@ -3,6 +3,7 @@ /** * 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: \" \\ + * PHP version 7.1.3 * * The version of the OpenAPI document: 1.0.0 * diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeClassnameTags123Controller.php b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeClassnameTags123Controller.php index 46ccd6e5fd6e..b7d0cda25324 100644 --- a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeClassnameTags123Controller.php +++ b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeClassnameTags123Controller.php @@ -3,6 +3,7 @@ /** * 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: \" \\ + * PHP version 7.1.3 * * The version of the OpenAPI document: 1.0.0 * diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php index d883a0108d79..d308d6d15730 100644 --- a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php +++ b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php @@ -3,6 +3,7 @@ /** * 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: \" \\ + * PHP version 7.1.3 * * The version of the OpenAPI document: 1.0.0 * diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/PetController.php b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/PetController.php index 5fc490b27cc1..6ce841dc2faa 100644 --- a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/PetController.php +++ b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/PetController.php @@ -3,6 +3,7 @@ /** * 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: \" \\ + * PHP version 7.1.3 * * The version of the OpenAPI document: 1.0.0 * diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/StoreController.php b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/StoreController.php index 6c7013f5b635..4a6f2e18a8d5 100644 --- a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/StoreController.php +++ b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/StoreController.php @@ -3,6 +3,7 @@ /** * 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: \" \\ + * PHP version 7.1.3 * * The version of the OpenAPI document: 1.0.0 * diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/UserController.php b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/UserController.php index 365502a3beec..3477a0b5255b 100644 --- a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/UserController.php +++ b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/UserController.php @@ -3,6 +3,7 @@ /** * 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: \" \\ + * PHP version 7.1.3 * * The version of the OpenAPI document: 1.0.0 * diff --git a/samples/server/petstore/php-laravel/lib/routes/api.php b/samples/server/petstore/php-laravel/lib/routes/api.php index 0fd1c22d3efa..b67eb068a078 100644 --- a/samples/server/petstore/php-laravel/lib/routes/api.php +++ b/samples/server/petstore/php-laravel/lib/routes/api.php @@ -3,6 +3,7 @@ /** * 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: \" \\ + * PHP version 7.1.3 * * The version of the OpenAPI document: 1.0.0 * diff --git a/samples/server/petstore/php-laravel/lib/routes/channels.php b/samples/server/petstore/php-laravel/lib/routes/channels.php index ce848a9a1b03..a149aa63f030 100644 --- a/samples/server/petstore/php-laravel/lib/routes/channels.php +++ b/samples/server/petstore/php-laravel/lib/routes/channels.php @@ -3,6 +3,7 @@ /** * 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: \" \\ + * PHP version 7.1.3 * * The version of the OpenAPI document: 1.0.0 * diff --git a/samples/server/petstore/php-laravel/lib/routes/console.php b/samples/server/petstore/php-laravel/lib/routes/console.php index 0ed63f6741a7..12e2fa86f31f 100644 --- a/samples/server/petstore/php-laravel/lib/routes/console.php +++ b/samples/server/petstore/php-laravel/lib/routes/console.php @@ -3,6 +3,7 @@ /** * 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: \" \\ + * PHP version 7.1.3 * * The version of the OpenAPI document: 1.0.0 * diff --git a/samples/server/petstore/php-laravel/lib/routes/web.php b/samples/server/petstore/php-laravel/lib/routes/web.php index 325aca0792e7..0fbf681e45bf 100644 --- a/samples/server/petstore/php-laravel/lib/routes/web.php +++ b/samples/server/petstore/php-laravel/lib/routes/web.php @@ -3,6 +3,7 @@ /** * 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: \" \\ + * PHP version 7.1.3 * * The version of the OpenAPI document: 1.0.0 * diff --git a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/AnotherFakeApi.php b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/AnotherFakeApi.php index 322f09736fa5..135cd3b23236 100644 --- a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/AnotherFakeApi.php +++ b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/AnotherFakeApi.php @@ -3,6 +3,7 @@ /** * 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: \" \\ + * PHP version 7.1.3 * * The version of the OpenAPI document: 1.0.0 * diff --git a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeApi.php b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeApi.php index cbc65e59a4d6..e01b2014f75c 100644 --- a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeApi.php +++ b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeApi.php @@ -3,6 +3,7 @@ /** * 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: \" \\ + * PHP version 7.1.3 * * The version of the OpenAPI document: 1.0.0 * diff --git a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeClassnameTags123Api.php b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeClassnameTags123Api.php index 1b60b7d6361c..2c9d145a10bc 100644 --- a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeClassnameTags123Api.php +++ b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeClassnameTags123Api.php @@ -3,6 +3,7 @@ /** * 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: \" \\ + * PHP version 7.1.3 * * The version of the OpenAPI document: 1.0.0 * diff --git a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/PetApi.php b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/PetApi.php index 5667a6f98523..679719dda0d4 100644 --- a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/PetApi.php +++ b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/PetApi.php @@ -3,6 +3,7 @@ /** * 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: \" \\ + * PHP version 7.1.3 * * The version of the OpenAPI document: 1.0.0 * diff --git a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/StoreApi.php b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/StoreApi.php index 76caa0054843..55efa5680dcd 100644 --- a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/StoreApi.php +++ b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/StoreApi.php @@ -3,6 +3,7 @@ /** * 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: \" \\ + * PHP version 7.1.3 * * The version of the OpenAPI document: 1.0.0 * diff --git a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/UserApi.php b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/UserApi.php index e6667053a095..d878c1e85057 100644 --- a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/UserApi.php +++ b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/UserApi.php @@ -3,6 +3,7 @@ /** * 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: \" \\ + * PHP version 7.1.3 * * The version of the OpenAPI document: 1.0.0 * diff --git a/samples/server/petstore/php-lumen/lib/readme.md b/samples/server/petstore/php-lumen/lib/readme.md index e0dba8a2f5ca..77316595b804 100644 --- a/samples/server/petstore/php-lumen/lib/readme.md +++ b/samples/server/petstore/php-lumen/lib/readme.md @@ -1,5 +1,8 @@ # OpenAPITools generated server +## Requirements +* PHP 7.1.3 or newer + ## Overview This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification/) from a remote server, you can easily generate a server stub. This diff --git a/samples/server/petstore/php-lumen/lib/routes/web.php b/samples/server/petstore/php-lumen/lib/routes/web.php index 9ffff0e0c73a..14bd40610b22 100644 --- a/samples/server/petstore/php-lumen/lib/routes/web.php +++ b/samples/server/petstore/php-lumen/lib/routes/web.php @@ -3,6 +3,7 @@ /** * 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: \" \\ + * PHP version 7.1.3 * * The version of the OpenAPI document: 1.0.0 * diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index c37c1641f024..defb23afd922 100755 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -46,7 +46,7 @@ const docusaurusConfig = { }, links: [ - {to: 'docs/installation', label: 'Install'}, + {to: 'docs/installation', label: 'Getting Started'}, {to: 'docs/generators', label: 'Generators'}, {to: 'docs/roadmap', label: 'Roadmap'}, {to: "docs/faq", label: "FAQ" }, diff --git a/website/sidebars.js b/website/sidebars.js index 3c715231a70f..0880123d523c 100755 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -5,7 +5,8 @@ module.exports = { 'installation', 'plugins', 'online', - 'usage' + 'usage', + 'globals' ], 'Extending': [ 'templating', diff --git a/website/src/pages/index.js b/website/src/pages/index.js index 21393e443f6a..cf40dfbafa03 100755 --- a/website/src/pages/index.js +++ b/website/src/pages/index.js @@ -127,11 +127,11 @@ const callouts = [ { id: 'try', imageUrl: 'img/tools/npm.svg', - title: <>Try via NPM, + title: <>Try via npm, content: ( <>

- The NPM package + The npm package wrapper is cross-platform wrapper around the .jar artifact.