diff --git a/.circleci/config.yml b/.circleci/config.yml index c3611c57351a..c5b0d3dc6f10 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -82,6 +82,7 @@ jobs: - ~/.bundle - ~/.go_workspace - ~/.gradle + - ~/.pub-cache - ~/.cache/bower - ".git" - ~/.stack diff --git a/CI/circle_parallel.sh b/CI/circle_parallel.sh index 25705a08528d..25bea6eb41eb 100755 --- a/CI/circle_parallel.sh +++ b/CI/circle_parallel.sh @@ -14,6 +14,18 @@ function cleanup { trap cleanup EXIT +function installDart { + # install dart2 + sudo apt-get update + sudo apt-get install apt-transport-https + sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -' + sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list' + sudo apt-get update + sudo apt-get install dart + export PATH="$PATH:/usr/lib/dart/bin" + export DART_POST_PROCESS="dart format" +} + if [ "$NODE_INDEX" = "1" ]; then echo "Running node $NODE_INDEX to test 'samples.circleci' defined in pom.xml ..." java -version @@ -24,6 +36,8 @@ if [ "$NODE_INDEX" = "1" ]; then ls -l /home/circleci/.ivy2/cache elif [ "$NODE_INDEX" = "2" ]; then + installDart + # run ensure-up-to-date sample script on SNAPSHOT version only project_version=`mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout` if [[ $project_version == *"-SNAPSHOT" ]]; then @@ -67,14 +81,7 @@ else export PATH="/usr/local/go1.14/go/bin:$PATH" go version - # install dart2 - sudo apt-get update - sudo apt-get install apt-transport-https - sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -' - sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list' - sudo apt-get update - sudo apt-get install dart - export PATH="$PATH:/usr/lib/dart/bin" + installDart mvn --no-snapshot-updates --quiet verify -Psamples.circleci.others -Dorg.slf4j.simpleLogger.defaultLogLevel=error mvn --no-snapshot-updates --quiet javadoc:javadoc -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error diff --git a/bin/configs/dart-dio-next-petstore-client-lib-fake.yaml b/bin/configs/dart-dio-next-petstore-client-lib-fake.yaml new file mode 100644 index 000000000000..d6a85861a8a2 --- /dev/null +++ b/bin/configs/dart-dio-next-petstore-client-lib-fake.yaml @@ -0,0 +1,7 @@ +generatorName: dart-dio-next +outputDir: samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml +templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio +enablePostProcessFile: "true" +additionalProperties: + hideGenerationTimestamp: "true" diff --git a/docs/file-post-processing.md b/docs/file-post-processing.md index a23845adae2e..b0c66e28f8db 100644 --- a/docs/file-post-processing.md +++ b/docs/file-post-processing.md @@ -22,6 +22,7 @@ The following environment variables are supported by their respective generators * `CPP_POST_PROCESS_FILE` * `CSHARP_POST_PROCESS_FILE` * `C_POST_PROCESS_FILE` +* `DART_POST_PROCESS` * `DART_POST_PROCESS_FILE` * `FSHARP_POST_PROCESS_FILE` * `GO_POST_PROCESS_FILE` diff --git a/docs/generators.md b/docs/generators.md index 6b4406e43ac3..e581cc54fb1a 100644 --- a/docs/generators.md +++ b/docs/generators.md @@ -22,6 +22,7 @@ The following generators are available: * [csharp-netcore](generators/csharp-netcore.md) * [dart](generators/dart.md) * [dart-dio](generators/dart-dio.md) +* [dart-dio-next (experimental)](generators/dart-dio-next.md) * [dart-jaguar](generators/dart-jaguar.md) * [eiffel](generators/eiffel.md) * [elixir](generators/elixir.md) diff --git a/docs/generators/dart-dio-next.md b/docs/generators/dart-dio-next.md new file mode 100644 index 000000000000..da4fbe4f9a81 --- /dev/null +++ b/docs/generators/dart-dio-next.md @@ -0,0 +1,233 @@ +--- +title: Config Options for dart-dio-next +sidebar_label: dart-dio-next +--- + +These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. + +| Option | Description | Values | Default | +| ------ | ----------- | ------ | ------- | +|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| +|dateLibrary|Specify Date library|
**core**
[DEFAULT] Dart core library (DateTime)
**timemachine**
Time Machine is date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.
|core| +|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| +|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C#have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| +|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| +|pubAuthor|Author name in generated pubspec| |null| +|pubAuthorEmail|Email address of the author in generated pubspec| |null| +|pubDescription|Description in generated pubspec| |null| +|pubHomepage|Homepage in generated pubspec| |null| +|pubLibrary|Library name in generated code| |null| +|pubName|Name in generated pubspec| |null| +|pubVersion|Version in generated pubspec| |null| +|serializationLibrary|Specify serialization library|
**built_value**
[DEFAULT] built_value
|built_value| +|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| +|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| +|sourceFolder|Source folder for generated code| |null| +|useEnumExtension|Allow the 'x-enum-values' extension for enums| |null| + +## IMPORT MAPPING + +| Type/Alias | Imports | +| ---------- | ------- | + + +## INSTANTIATION TYPES + +| Type/Alias | Instantiated By | +| ---------- | --------------- | + + +## LANGUAGE PRIMITIVES + + + +## RESERVED WORDS + + + +## FEATURE SET + + +### Client Modification Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasePath|✗|ToolingExtension +|Authorizations|✗|ToolingExtension +|UserAgent|✗|ToolingExtension +|MockServer|✗|ToolingExtension + +### Data Type Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Custom|✗|OAS2,OAS3 +|Int32|✗|OAS2,OAS3 +|Int64|✗|OAS2,OAS3 +|Float|✗|OAS2,OAS3 +|Double|✗|OAS2,OAS3 +|Decimal|✗|ToolingExtension +|String|✗|OAS2,OAS3 +|Byte|✗|OAS2,OAS3 +|Binary|✗|OAS2,OAS3 +|Boolean|✗|OAS2,OAS3 +|Date|✗|OAS2,OAS3 +|DateTime|✗|OAS2,OAS3 +|Password|✗|OAS2,OAS3 +|File|✗|OAS2 +|Array|✗|OAS2,OAS3 +|Maps|✗|ToolingExtension +|CollectionFormat|✗|OAS2 +|CollectionFormatMulti|✗|OAS2 +|Enum|✗|OAS2,OAS3 +|ArrayOfEnum|✗|ToolingExtension +|ArrayOfModel|✗|ToolingExtension +|ArrayOfCollectionOfPrimitives|✗|ToolingExtension +|ArrayOfCollectionOfModel|✗|ToolingExtension +|ArrayOfCollectionOfEnum|✗|ToolingExtension +|MapOfEnum|✗|ToolingExtension +|MapOfModel|✗|ToolingExtension +|MapOfCollectionOfPrimitives|✗|ToolingExtension +|MapOfCollectionOfModel|✗|ToolingExtension +|MapOfCollectionOfEnum|✗|ToolingExtension + +### Documentation Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Readme|✗|ToolingExtension +|Model|✗|ToolingExtension +|Api|✗|ToolingExtension + +### Global Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Host|✗|OAS2,OAS3 +|BasePath|✗|OAS2,OAS3 +|Info|✗|OAS2,OAS3 +|Schemes|✗|OAS2,OAS3 +|PartialSchemes|✗|OAS2,OAS3 +|Consumes|✗|OAS2 +|Produces|✗|OAS2 +|ExternalDocumentation|✗|OAS2,OAS3 +|Examples|✗|OAS2,OAS3 +|XMLStructureDefinitions|✗|OAS2,OAS3 +|MultiServer|✗|OAS3 +|ParameterizedServer|✗|OAS3 +|ParameterStyling|✗|OAS3 +|Callbacks|✗|OAS3 +|LinkObjects|✗|OAS3 + +### Parameter Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Path|✗|OAS2,OAS3 +|Query|✗|OAS2,OAS3 +|Header|✗|OAS2,OAS3 +|Body|✗|OAS2 +|FormUnencoded|✗|OAS2 +|FormMultipart|✗|OAS2 +|Cookie|✗|OAS3 + +### Schema Support Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Simple|✗|OAS2,OAS3 +|Composite|✗|OAS2,OAS3 +|Polymorphism|✗|OAS2,OAS3 +|Union|✗|OAS3 + +### Security Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasicAuth|✗|OAS2,OAS3 +|ApiKey|✗|OAS2,OAS3 +|OpenIDConnect|✗|OAS3 +|BearerToken|✗|OAS3 +|OAuth2_Implicit|✗|OAS2,OAS3 +|OAuth2_Password|✗|OAS2,OAS3 +|OAuth2_ClientCredentials|✗|OAS2,OAS3 +|OAuth2_AuthorizationCode|✗|OAS2,OAS3 + +### Wire Format Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|JSON|✗|OAS2,OAS3 +|XML|✗|OAS2,OAS3 +|PROTOBUF|✗|ToolingExtension +|Custom|✗|OAS2,OAS3 diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java index 082c634fed14..db41efefd584 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java @@ -114,6 +114,15 @@ public boolean getHasFormParams() { return nonempty(formParams); } + /** + * Check if there's at least one body parameter or at least one form parameter + * + * @return true if body or form parameter exists, false otherwise + */ + public boolean getHasBodyOrFormParams() { + return getHasBodyParam() || getHasFormParams(); + } + /** * Check if there's at least one form parameter * diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java index a4e4111aa344..ca4921ce1b0a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java @@ -12,17 +12,16 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.*; import org.openapitools.codegen.utils.ModelUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.BufferedReader; import java.io.File; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import static org.openapitools.codegen.utils.StringUtils.*; -import static org.openapitools.codegen.utils.StringUtils.camelize; public abstract class AbstractDartCodegen extends DefaultCodegen { @@ -663,6 +662,7 @@ public String escapeUnsafeCharacters(String input) { @Override public void postProcessFile(File file, String fileType) { + super.postProcessFile(file, fileType); if (file == null) { return; } @@ -674,7 +674,7 @@ public void postProcessFile(File file, String fileType) { // process all files with dart extension if ("dart".equals(FilenameUtils.getExtension(file.toString()))) { - // currently only support "dartfmt -w yourcode.dart" + // currently supported is "dartfmt -w" and "dart format" String command = dartPostProcessFile + " " + file.toString(); try { Process p = Runtime.getRuntime().exec(command); @@ -689,4 +689,31 @@ public void postProcessFile(File file, String fileType) { } } } + + @Override + public void postProcess() { + if (isEnablePostProcessFile()) { + // Using the condition here to have way to still disable this + // for older Dart generators in CI by default. + + // Post processing the whole dart output is much faster then individual files. + // Setting this variable to "dart format" is the suggested way of doing this. + final String dartPostProcess = System.getenv("DART_POST_PROCESS"); + if (!StringUtils.isEmpty(dartPostProcess)) { + final String command = dartPostProcess + " " + getOutputDir(); + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: {}", command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } + super.postProcess(); + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java index 94bf7ac7a20c..59578099cce8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java @@ -51,10 +51,9 @@ public DartClientCodegen() { ) ); - final CliOption serializationLibrary = new CliOption(CodegenConstants.SERIALIZATION_LIBRARY, + final CliOption serializationLibrary = CliOption.newString(CodegenConstants.SERIALIZATION_LIBRARY, "Specify serialization library"); serializationLibrary.setDefault(SERIALIZATION_LIBRARY_NATIVE); - serializationLibrary.setType("String"); final Map serializationOptions = new HashMap<>(); serializationOptions.put(SERIALIZATION_LIBRARY_NATIVE, "Use native serializer, backwards compatible"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioNextClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioNextClientCodegen.java new file mode 100644 index 000000000000..7034bc4bece7 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioNextClientCodegen.java @@ -0,0 +1,402 @@ +/* + * Copyright 2021 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.languages; + +import com.google.common.collect.Sets; +import io.swagger.v3.oas.models.media.Schema; +import org.apache.commons.lang3.StringUtils; +import org.openapitools.codegen.*; +import org.openapitools.codegen.meta.GeneratorMetadata; +import org.openapitools.codegen.meta.Stability; +import org.openapitools.codegen.meta.features.ClientModificationFeature; +import org.openapitools.codegen.utils.ModelUtils; +import org.openapitools.codegen.utils.ProcessUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.util.*; + +import static org.openapitools.codegen.utils.StringUtils.underscore; + +public class DartDioNextClientCodegen extends AbstractDartCodegen { + + private static final Logger LOGGER = LoggerFactory.getLogger(DartDioNextClientCodegen.class); + + public static final String DATE_LIBRARY = "dateLibrary"; + public static final String DATE_LIBRARY_CORE = "core"; + public static final String DATE_LIBRARY_TIME_MACHINE = "timemachine"; + public static final String DATE_LIBRARY_DEFAULT = DATE_LIBRARY_CORE; + + public static final String SERIALIZATION_LIBRARY_BUILT_VALUE = "built_value"; + public static final String SERIALIZATION_LIBRARY_DEFAULT = SERIALIZATION_LIBRARY_BUILT_VALUE; + + private static final String CLIENT_NAME = "clientName"; + + private String dateLibrary; + + private String clientName; + + public DartDioNextClientCodegen() { + super(); + + modifyFeatureSet(features -> features + .includeClientModificationFeatures( + ClientModificationFeature.Authorizations, + ClientModificationFeature.UserAgent + ) + ); + generatorMetadata = GeneratorMetadata.newBuilder() + .stability(Stability.EXPERIMENTAL) + .build(); + + outputFolder = "generated-code/dart-dio-next"; + embeddedTemplateDir = "dart/libraries/dio"; + this.setTemplateDir(embeddedTemplateDir); + + apiPackage = "lib.src.api"; + modelPackage = "lib.src.model"; + + supportedLibraries.put(SERIALIZATION_LIBRARY_BUILT_VALUE, "[DEFAULT] built_value"); + final CliOption serializationLibrary = CliOption.newString(CodegenConstants.SERIALIZATION_LIBRARY, "Specify serialization library"); + serializationLibrary.setEnum(supportedLibraries); + serializationLibrary.setDefault(SERIALIZATION_LIBRARY_DEFAULT); + cliOptions.add(serializationLibrary); + + final CliOption dateOption = CliOption.newString(DATE_LIBRARY, "Specify Date library"); + dateOption.setDefault(DATE_LIBRARY_DEFAULT); + + final Map dateOptions = new HashMap<>(); + dateOptions.put(DATE_LIBRARY_CORE, "[DEFAULT] Dart core library (DateTime)"); + dateOptions.put(DATE_LIBRARY_TIME_MACHINE, "Time Machine is date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing."); + dateOption.setEnum(dateOptions); + cliOptions.add(dateOption); + } + + public String getDateLibrary() { + return dateLibrary; + } + + public void setDateLibrary(String library) { + this.dateLibrary = library; + } + + public String getClientName() { + return clientName; + } + + public void setClientName(String clientName) { + this.clientName = clientName; + } + + @Override + public String getName() { + return "dart-dio-next"; + } + + @Override + public String getHelp() { + return "Generates a Dart Dio client library with null-safety."; + } + + @Override + public void processOpts() { + super.processOpts(); + + if (StringUtils.isEmpty(System.getenv("DART_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable DART_POST_PROCESS_FILE not defined so the Dart code may not be properly formatted. To define it, try `export DART_POST_PROCESS_FILE=\"/usr/local/bin/dartfmt -w\"` (Linux/Mac)"); + LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI)."); + } + + if (!additionalProperties.containsKey(CodegenConstants.SERIALIZATION_LIBRARY)) { + additionalProperties.put(CodegenConstants.SERIALIZATION_LIBRARY, SERIALIZATION_LIBRARY_DEFAULT); + LOGGER.debug("Serialization library not set, using default {}", SERIALIZATION_LIBRARY_DEFAULT); + } + setLibrary(additionalProperties.get(CodegenConstants.SERIALIZATION_LIBRARY).toString()); + + if (!additionalProperties.containsKey(DATE_LIBRARY)) { + additionalProperties.put(DATE_LIBRARY, DATE_LIBRARY_DEFAULT); + LOGGER.debug("Date library not set, using default {}", DATE_LIBRARY_DEFAULT); + } + setDateLibrary(additionalProperties.get(DATE_LIBRARY).toString()); + + if (!additionalProperties.containsKey(CLIENT_NAME)) { + final String name = org.openapitools.codegen.utils.StringUtils.camelize(pubName); + additionalProperties.put(CLIENT_NAME, name); + LOGGER.debug("Client name not set, using default {}", DATE_LIBRARY_DEFAULT); + } + setClientName(additionalProperties.get(CLIENT_NAME).toString()); + + supportingFiles.add(new SupportingFile("pubspec.mustache", "", "pubspec.yaml")); + supportingFiles.add(new SupportingFile("analysis_options.mustache", "", "analysis_options.yaml")); + supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); + + final String libFolder = sourceFolder + File.separator + "lib"; + supportingFiles.add(new SupportingFile("lib.mustache", libFolder, pubName + ".dart")); + + final String srcFolder = libFolder + File.separator + "src"; + supportingFiles.add(new SupportingFile("api_client.mustache", srcFolder, "api.dart")); + supportingFiles.add(new SupportingFile("api_util.mustache", srcFolder, "api_util.dart")); + + final String authFolder = srcFolder + File.separator + "auth"; + supportingFiles.add(new SupportingFile("auth/api_key_auth.mustache", authFolder, "api_key_auth.dart")); + supportingFiles.add(new SupportingFile("auth/basic_auth.mustache", authFolder, "basic_auth.dart")); + supportingFiles.add(new SupportingFile("auth/oauth.mustache", authFolder, "oauth.dart")); + supportingFiles.add(new SupportingFile("auth/auth.mustache", authFolder, "auth.dart")); + + configureSerializationLibrary(srcFolder); + configureDateLibrary(srcFolder); + } + + private void configureSerializationLibrary(String srcFolder) { + switch (library) { + default: + case SERIALIZATION_LIBRARY_BUILT_VALUE: + additionalProperties.put("useBuiltValue", "true"); + configureSerializationLibraryBuiltValue(srcFolder); + break; + } + } + + private void configureSerializationLibraryBuiltValue(String srcFolder) { + supportingFiles.add(new SupportingFile("serialization/built_value/serializers.mustache", srcFolder, "serializers.dart")); + + typeMapping.put("Array", "BuiltList"); + typeMapping.put("array", "BuiltList"); + typeMapping.put("List", "BuiltList"); + typeMapping.put("set", "BuiltSet"); + typeMapping.put("map", "BuiltMap"); + typeMapping.put("file", "Uint8List"); + typeMapping.put("binary", "Uint8List"); + typeMapping.put("object", "JsonObject"); + typeMapping.put("AnyType", "JsonObject"); + + additionalReservedWords.addAll(Sets.newHashSet( + "EnumClass", + // The following are reserved dataTypes but can not be added to defaultIncludes + // as this would prevent them from being added to the imports. + "BuiltList", + "BuiltSet", + "BuiltMap", + "Uint8List", + "JsonObject" + )); + + importMapping.put("BuiltList", "package:built_collection/built_collection.dart"); + importMapping.put("BuiltSet", "package:built_collection/built_collection.dart"); + importMapping.put("BuiltMap", "package:built_collection/built_collection.dart"); + importMapping.put("JsonObject", "package:built_value/json_object.dart"); + importMapping.put("Uint8List", "dart:typed_data"); + } + + private void configureDateLibrary(String srcFolder) { + switch (dateLibrary) { + case DATE_LIBRARY_TIME_MACHINE: + additionalProperties.put("useDateLibTimeMachine", "true"); + typeMapping.put("date", "OffsetDate"); + typeMapping.put("Date", "OffsetDate"); + typeMapping.put("DateTime", "OffsetDateTime"); + typeMapping.put("datetime", "OffsetDateTime"); + additionalReservedWords.addAll(Sets.newHashSet("OffsetDate", "OffsetDateTime")); + importMapping.put("OffsetDate", "package:time_machine/time_machine.dart"); + importMapping.put("OffsetDateTime", "package:time_machine/time_machine.dart"); + if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(library)) { + supportingFiles.add(new SupportingFile("serialization/built_value/local_date_serializer.mustache", srcFolder, "local_date_serializer.dart")); + } + break; + default: + case DATE_LIBRARY_CORE: + // this option uses the dart core classes + additionalProperties.put("useDateLibCore", "true"); + break; + } + } + + @Override + public String toDefaultValue(Schema schema) { + if (schema.getDefault() != null) { + if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(library)) { + if (ModelUtils.isArraySchema(schema)) { + if (ModelUtils.isSet(schema)) { + return "SetBuilder()"; + } + return "ListBuilder()"; + } + if (ModelUtils.isMapSchema(schema)) { + return "MapBuilder()"; + } + } + if (ModelUtils.isDateSchema(schema) || ModelUtils.isDateTimeSchema(schema)) { + // this is currently not supported and would create compile errors + return null; + } + if (ModelUtils.isStringSchema(schema)) { + return "'" + schema.getDefault().toString().replaceAll("'", "\\'") + "'"; + } + return schema.getDefault().toString(); + } + return null; + } + + @Override + public Map postProcessModels(Map objs) { + objs = super.postProcessModels(objs); + List models = (List) objs.get("models"); + ProcessUtils.addIndexToProperties(models, 1); + + for (Object _mo : models) { + Map mo = (Map) _mo; + Set modelImports = new HashSet<>(); + CodegenModel cm = (CodegenModel) mo.get("model"); + for (String modelImport : cm.imports) { + if (needToImport(modelImport)) { + if (importMapping().containsKey(modelImport)) { + modelImports.add(importMapping().get(modelImport)); + } else { + modelImports.add("package:" + pubName + "/src/model/" + underscore(modelImport) + ".dart"); + } + } + } + + cm.imports = modelImports; + boolean hasVars = cm.vars.size() > 0; + cm.vendorExtensions.put("x-has-vars", hasVars); + } + return objs; + } + + @Override + public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { + super.postProcessModelProperty(model, property); + if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(library)) { + if (property.isEnum) { + // enums are generated with built_value and make use of BuiltSet + model.imports.add("BuiltSet"); + } + + property.getVendorExtensions().put("x-built-value-serializer-type", createBuiltValueSerializerType(property)); + } + } + + private String createBuiltValueSerializerType(CodegenProperty property) { + final StringBuilder sb = new StringBuilder("const FullType("); + if (property.isContainer) { + appendBuiltValueCollection(sb, property); + } else { + sb.append(property.datatypeWithEnum); + } + sb.append(")"); + return sb.toString(); + } + + private void appendBuiltValueCollection(StringBuilder sb, CodegenProperty property) { + sb.append(property.baseType); + sb.append(", [FullType("); + if (property.isMap) { + // a map always has string keys + sb.append("String), FullType("); + } + if (property.items.isContainer) { + appendBuiltValueCollection(sb, property.items); + } else { + sb.append(property.items.datatypeWithEnum); + } + sb.append(")]"); + } + + @Override + public Map postProcessOperationsWithModels(Map objs, List allModels) { + objs = super.postProcessOperationsWithModels(objs, allModels); + Map operations = (Map) objs.get("operations"); + List operationList = (List) operations.get("operation"); + + Set> serializers = new HashSet<>(); + Set modelImports = new HashSet<>(); + Set fullImports = new HashSet<>(); + + for (CodegenOperation op : operationList) { + op.httpMethod = op.httpMethod.toLowerCase(Locale.ROOT); + boolean isJson = true; //default to JSON + boolean isForm = false; + boolean isMultipart = false; + if (op.consumes != null) { + for (Map consume : op.consumes) { + if (consume.containsKey("mediaType")) { + String type = consume.get("mediaType"); + isJson = type.equalsIgnoreCase("application/json"); + isForm = type.equalsIgnoreCase("application/x-www-form-urlencoded"); + isMultipart = type.equalsIgnoreCase("multipart/form-data"); + break; + } + } + } + + for (CodegenParameter param : op.bodyParams) { + if (param.baseType != null && param.baseType.equalsIgnoreCase("Uint8List") && isMultipart) { + param.baseType = "MultipartFile"; + param.dataType = "MultipartFile"; + } + if (param.isContainer) { + final Map serializer = new HashMap<>(); + serializer.put("isArray", param.isArray); + serializer.put("uniqueItems", param.uniqueItems); + serializer.put("isMap", param.isMap); + serializer.put("baseType", param.baseType); + serializers.add(serializer); + } + } + + op.vendorExtensions.put("x-is-json", isJson); + op.vendorExtensions.put("x-is-form", isForm); + op.vendorExtensions.put("x-is-multipart", isMultipart); + + if (op.getHasFormParams()) { + fullImports.add("package:" + pubName + "/src/api_util.dart"); + } + + Set imports = new HashSet<>(); + for (String item : op.imports) { + if (needToImport(item)) { + if (importMapping().containsKey(item)) { + fullImports.add(importMapping().get(item)); + } else { + imports.add(underscore(item)); + } + } + } + modelImports.addAll(imports); + op.imports = imports; + + if (op.returnContainer != null) { + final Map serializer = new HashMap<>(); + serializer.put("isArray", Objects.equals("array", op.returnContainer) || Objects.equals("set", op.returnContainer)); + serializer.put("uniqueItems", op.uniqueItems); + serializer.put("isMap", Objects.equals("map", op.returnContainer)); + serializer.put("baseType", op.returnBaseType); + serializers.add(serializer); + } + } + + objs.put("modelImports", modelImports); + objs.put("fullImports", fullImports); + objs.put("serializers", serializers); + + return objs; + } + +} diff --git a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig index 18bfd3dc5566..886c41c7f4e2 100644 --- a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig +++ b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig @@ -24,6 +24,7 @@ org.openapitools.codegen.languages.CSharpDotNet2ClientCodegen org.openapitools.codegen.languages.CSharpNancyFXServerCodegen org.openapitools.codegen.languages.DartClientCodegen org.openapitools.codegen.languages.DartDioClientCodegen +org.openapitools.codegen.languages.DartDioNextClientCodegen org.openapitools.codegen.languages.DartJaguarClientCodegen org.openapitools.codegen.languages.EiffelClientCodegen org.openapitools.codegen.languages.ElixirClientCodegen diff --git a/modules/openapi-generator/src/main/resources/dart-dio/README.mustache b/modules/openapi-generator/src/main/resources/dart-dio/README.mustache index 332b31f4ae9b..0b375af727d9 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/README.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/README.mustache @@ -51,15 +51,15 @@ Please follow the [installation procedure](#installation--usage) and then run th import 'package:{{pubName}}/api.dart'; {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} -var api_instance = new {{classname}}(); +final api = {{classname}}(); {{#allParams}} -var {{paramName}} = {{#isArray}}[{{/isArray}}{{#isBodyParam}}new {{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isArray}}]{{/isArray}}; // {{{dataType}}} | {{{description}}} +final {{paramName}} = {{#isArray}}[{{/isArray}}{{#isBodyParam}}{{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isArray}}]{{/isArray}}; // {{{dataType}}} | {{{description}}} {{/allParams}} try { - {{#returnType}}var result = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + {{#returnType}}final response = await {{/returnType}}api.{{{operationId}}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); {{#returnType}} - print(result); + print(response); {{/returnType}} } catch (e) { print("Exception when calling {{classname}}->{{operationId}}: $e\n"); @@ -73,12 +73,12 @@ All URIs are relative to *{{basePath}}* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} ## Documentation For Models -{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md) +{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) {{/model}}{{/models}} ## Documentation For Authorization diff --git a/modules/openapi-generator/src/main/resources/dart-dio/api_doc.mustache b/modules/openapi-generator/src/main/resources/dart-dio/api_doc.mustache index cbaa61b75dd3..1e28b16012e4 100644 --- a/modules/openapi-generator/src/main/resources/dart-dio/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/dart-dio/api_doc.mustache @@ -10,7 +10,7 @@ All URIs are relative to *{{basePath}}* Method | HTTP request | Description ------------- | ------------- | ------------- -{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} {{/operation}}{{/operations}} {{#operations}} diff --git a/modules/openapi-generator/src/main/resources/dart/analysis_options.mustache b/modules/openapi-generator/src/main/resources/dart/analysis_options.mustache deleted file mode 100644 index 518eb901a6ff..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/analysis_options.mustache +++ /dev/null @@ -1,2 +0,0 @@ -analyzer: - strong-mode: true \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/api.mustache b/modules/openapi-generator/src/main/resources/dart/api.mustache deleted file mode 100644 index 443dd53fc903..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/api.mustache +++ /dev/null @@ -1,117 +0,0 @@ -part of {{pubName}}.api; - -{{#operations}} - - -class {{classname}} { - final ApiClient apiClient; - - {{classname}}([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; - - {{#operation}} - /// {{summary}} - /// - /// {{notes}} - {{#returnType}}Future<{{{returnType}}}> {{/returnType}}{{^returnType}}Future {{/returnType}}{{nickname}}({{#allParams}}{{#required}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async { - Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; - - // verify required params are set - {{#allParams}} - {{#required}} - if({{paramName}} == null) { - throw new ApiException(400, "Missing required param: {{paramName}}"); - } - {{/required}} - {{/allParams}} - - // create path and map variables - String path = "{{{path}}}".replaceAll("{format}","json"){{#pathParams}}.replaceAll("{" + "{{baseName}}" + "}", {{{paramName}}}.toString()){{/pathParams}}; - - // query params - List queryParams = []; - Map headerParams = {}; - Map formParams = {}; - {{#queryParams}} - {{^required}} - if({{paramName}} != null) { - {{/required}} - queryParams.addAll(_convertParametersForCollectionFormat("{{collectionFormat}}", "{{baseName}}", {{paramName}})); - {{^required}} - } - {{/required}} - {{/queryParams}} - {{#headerParams}} - headerParams["{{baseName}}"] = {{paramName}}; - {{/headerParams}} - - List contentTypes = [{{#consumes}}"{{{mediaType}}}"{{^-last}},{{/-last}}{{/consumes}}]; - - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; - List authNames = [{{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}}]; - - if(contentType.startsWith("multipart/form-data")) { - bool hasFields = false; - MultipartRequest mp = new MultipartRequest(null, null); - {{#formParams}} - {{^isFile}} - if ({{paramName}} != null) { - hasFields = true; - mp.fields['{{baseName}}'] = parameterToString({{paramName}}); - } - {{/isFile}} - {{#isFile}} - if ({{paramName}} != null) { - hasFields = true; - mp.fields['{{baseName}}'] = {{paramName}}.field; - mp.files.add({{paramName}}); - } - {{/isFile}} - {{/formParams}} - if(hasFields) - postBody = mp; - } - else { - {{#formParams}} - {{^isFile}} - if ({{paramName}} != null) - formParams['{{baseName}}'] = parameterToString({{paramName}}); - {{/isFile}} - {{/formParams}} - } - - var response = await apiClient.invokeAPI(path, - '{{httpMethod}}', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); - - if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, _decodeBodyBytes(response)); - } else if(response.body != null) { - {{#isArray}} - {{#returnType}} - return (apiClient.deserialize(_decodeBodyBytes(response), '{{{returnType}}}') as List).map((item) => item as {{returnBaseType}}).toList(); - {{/returnType}} - {{/isArray}} - {{^isArray}} - {{#isMap}} - {{#returnType}} - return new {{{returnType}}}.from(apiClient.deserialize(_decodeBodyBytes(response), '{{{returnType}}}')); - {{/returnType}}; - {{/isMap}} - {{^isMap}} - {{#returnType}} - return apiClient.deserialize(_decodeBodyBytes(response), '{{{returnType}}}') as {{{returnType}}}; - {{/returnType}} - {{/isMap}} - {{/isArray}} - } else { - return{{#returnType}} null{{/returnType}}; - } - } - {{/operation}} -} -{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/dart/api_client.mustache b/modules/openapi-generator/src/main/resources/dart/api_client.mustache deleted file mode 100644 index 9bb3d59bc52f..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/api_client.mustache +++ /dev/null @@ -1,170 +0,0 @@ -part of {{pubName}}.api; - -class QueryParam { - String name; - String value; - - QueryParam(this.name, this.value); -} - -class ApiClient { - - String basePath; - var client = new Client(); - - Map _defaultHeaderMap = {}; - Map _authentications = {}; - - final _RegList = new RegExp(r'^List<(.*)>$'); - final _RegMap = new RegExp(r'^Map$'); - - ApiClient({this.basePath: "{{{basePath}}}"}) { - // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}} - _authentications['{{name}}'] = new HttpBasicAuth();{{/isBasic}}{{#isApiKey}} - _authentications['{{name}}'] = new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");{{/isApiKey}}{{#isOAuth}} - _authentications['{{name}}'] = new OAuth();{{/isOAuth}}{{/authMethods}} - {{#httpUserAgent}}addDefaultHeader('User-Agent', '{{{.}}}');{{/httpUserAgent}} - } - - void addDefaultHeader(String key, String value) { - _defaultHeaderMap[key] = value; - } - - dynamic _deserialize(dynamic value, String targetType) { - try { - switch (targetType) { - case 'String': - return '$value'; - case 'int': - return value is int ? value : int.parse('$value'); - case 'bool': - return value is bool ? value : '$value'.toLowerCase() == 'true'; - case 'double': - return value is double ? value : double.parse('$value'); - {{#models}} - {{#model}} - case '{{classname}}': - {{#isEnum}} - // Enclose the value in a list so that Dartson can use a transformer - // to decode it. - final listValue = [value]; - final List listResult = dson.map(listValue, []); - return listResult[0]; - {{/isEnum}} - {{^isEnum}} - return new {{classname}}.fromJson(value); - {{/isEnum}} - {{/model}} - {{/models}} - default: - { - Match match; - if (value is List && - (match = _RegList.firstMatch(targetType)) != null) { - var newTargetType = match[1]; - return value.map((v) => _deserialize(v, newTargetType)).toList(); - } else if (value is Map && - (match = _RegMap.firstMatch(targetType)) != null) { - var newTargetType = match[1]; - return new Map.fromIterables(value.keys, - value.values.map((v) => _deserialize(v, newTargetType))); - } - } - } - } catch (e, stack) { - throw new ApiException.withInner(500, 'Exception during deserialization.', e, stack); - } - throw new ApiException(500, 'Could not find a suitable class for deserialization'); - } - - dynamic deserialize(String json, String targetType) { - // Remove all spaces. Necessary for reg expressions as well. - targetType = targetType.replaceAll(' ', ''); - - if (targetType == 'String') return json; - - var decodedJson = JSON.decode(json); - return _deserialize(decodedJson, targetType); - } - - String serialize(Object obj) { - String serialized = ''; - if (obj == null) { - serialized = ''; - } else { - serialized = JSON.encode(obj); - } - return serialized; - } - - // We don't use a Map for queryParams. - // If collectionFormat is 'multi' a key might appear multiple times. - Future invokeAPI(String path, - String method, - Iterable queryParams, - Object body, - Map headerParams, - Map formParams, - String contentType, - List authNames) async { - - _updateParamsForAuth(authNames, queryParams, headerParams); - - var ps = queryParams - .where((p) => p.value != null) - .map((p) => '${p.name}=${Uri.encodeQueryComponent(p.value)}'); - - String queryString = ps.isNotEmpty ? - '?' + ps.join('&') : - ''; - - String url = basePath + path + queryString; - - headerParams.addAll(_defaultHeaderMap); - headerParams['Content-Type'] = contentType; - - if(body is MultipartRequest) { - var request = new MultipartRequest(method, Uri.parse(url)); - request.fields.addAll(body.fields); - request.files.addAll(body.files); - request.headers.addAll(body.headers); - request.headers.addAll(headerParams); - var response = await client.send(request); - return Response.fromStream(response); - } else { - var msgBody = contentType == "application/x-www-form-urlencoded" ? formParams : serialize(body); - switch(method) { - case "POST": - return client.post(url, headers: headerParams, body: msgBody); - case "PUT": - return client.put(url, headers: headerParams, body: msgBody); - case "DELETE": - return client.delete(url, headers: headerParams); - case "PATCH": - return client.patch(url, headers: headerParams, body: msgBody); - case "HEAD": - return client.head(url, headers: headerParams); - default: - return client.get(url, headers: headerParams); - } - } - } - - /// Update query and header parameters based on authentication settings. - /// @param authNames The authentications to apply - void _updateParamsForAuth(List authNames, List queryParams, Map headerParams) { - authNames.forEach((authName) { - Authentication auth = _authentications[authName]; - if (auth == null) throw new ArgumentError("Authentication undefined: " + authName); - auth.applyToParams(queryParams, headerParams); - }); - } - - void setAccessToken(String accessToken) { - _authentications.forEach((key, auth) { - if (auth is OAuth) { - auth.setAccessToken(accessToken); - } - }); - } -} diff --git a/modules/openapi-generator/src/main/resources/dart/api_exception.mustache b/modules/openapi-generator/src/main/resources/dart/api_exception.mustache deleted file mode 100644 index b86af8d954c5..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/api_exception.mustache +++ /dev/null @@ -1,23 +0,0 @@ -part of {{pubName}}.api; - -class ApiException implements Exception { - int code = 0; - String message = null; - Exception innerException = null; - StackTrace stackTrace = null; - - ApiException(this.code, this.message); - - ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); - - String toString() { - if (message == null) return "ApiException"; - - if (innerException == null) { - return "ApiException $code: $message"; - } - - return "ApiException $code: $message (Inner exception: ${innerException})\n\n" + - stackTrace.toString(); - } -} diff --git a/modules/openapi-generator/src/main/resources/dart/api_helper.mustache b/modules/openapi-generator/src/main/resources/dart/api_helper.mustache deleted file mode 100644 index 73b2585b1b45..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/api_helper.mustache +++ /dev/null @@ -1,64 +0,0 @@ -part of {{pubName}}.api; - -const _delimiters = const {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; - -// port from Java version -Iterable _convertParametersForCollectionFormat( - String collectionFormat, String name, dynamic value) { - var params = []; - - // preconditions - if (name == null || name.isEmpty || value == null) return params; - - if (value is! List) { - params.add(new QueryParam(name, parameterToString(value))); - return params; - } - - List values = value as List; - - // get the collection format - collectionFormat = (collectionFormat == null || collectionFormat.isEmpty) - ? "csv" - : collectionFormat; // default: csv - - if (collectionFormat == "multi") { - return values.map((v) => new QueryParam(name, parameterToString(v))); - } - - String delimiter = _delimiters[collectionFormat] ?? ","; - - params.add(new QueryParam(name, values.map((v) => parameterToString(v)).join(delimiter))); - return params; -} - -/// Format the given parameter object into string. -String parameterToString(dynamic value) { - if (value == null) { - return ''; - } else if (value is DateTime) { - return value.toUtc().toIso8601String(); - {{#models}} - {{#model}} - {{#isEnum}} - } else if (value is {{classname}}) { - return new {{classname}}TypeTransformer().encode(value).toString(); - {{/isEnum}} - {{/model}} - {{/models}} - } else { - return value.toString(); - } -} - -/// Returns the decoded body by utf-8 if application/json with the given headers. -/// Else, returns the decoded body by default algorithm of dart:http. -/// Because avoid to text garbling when header only contains "application/json" without "; charset=utf-8". -String _decodeBodyBytes(Response response) { - var contentType = response.headers['content-type']; - if (contentType != null && contentType.contains("application/json")) { - return utf8.decode(response.bodyBytes); - } else { - return response.body; - } -} diff --git a/modules/openapi-generator/src/main/resources/dart/api_test.mustache b/modules/openapi-generator/src/main/resources/dart/api_test.mustache deleted file mode 100644 index f5211efaff22..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/api_test.mustache +++ /dev/null @@ -1,28 +0,0 @@ -import 'package:{{pubName}}/api.dart'; -import 'package:test/test.dart'; - -{{#operations}} - -/// tests for {{classname}} -void main() { - var instance = new {{classname}}(); - - group('tests for {{classname}}', () { - {{#operation}} - {{#summary}} - // {{{.}}} - // - {{/summary}} - {{#notes}} - // {{{.}}} - // - {{/notes}} - //{{#returnType}}Future<{{{returnType}}}> {{/returnType}}{{^returnType}}Future {{/returnType}}{{operationId}}({{#allParams}}{{#required}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async - test('test {{operationId}}', () async { - // TODO - }); - - {{/operation}} - }); -} -{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/dart/apilib.mustache b/modules/openapi-generator/src/main/resources/dart/apilib.mustache deleted file mode 100644 index 4d210cee600e..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/apilib.mustache +++ /dev/null @@ -1,20 +0,0 @@ -library {{pubName}}.api; - -import 'dart:async'; -import 'dart:convert'; -import 'package:http/http.dart'; - -part 'api_client.dart'; -part 'api_helper.dart'; -part 'api_exception.dart'; -part 'auth/authentication.dart'; -part 'auth/api_key_auth.dart'; -part 'auth/oauth.dart'; -part 'auth/http_basic_auth.dart'; - -{{#apiInfo}}{{#apis}}part 'api/{{classFilename}}.dart'; -{{/apis}}{{/apiInfo}} -{{#models}}{{#model}}part 'model/{{classFilename}}.dart'; -{{/model}}{{/models}} - -ApiClient defaultApiClient = new ApiClient(); diff --git a/modules/openapi-generator/src/main/resources/dart/auth/api_key_auth.mustache b/modules/openapi-generator/src/main/resources/dart/auth/api_key_auth.mustache deleted file mode 100644 index 86bde8a90f54..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/auth/api_key_auth.mustache +++ /dev/null @@ -1,27 +0,0 @@ -part of {{pubName}}.api; - -class ApiKeyAuth implements Authentication { - - final String location; - final String paramName; - String apiKey; - String apiKeyPrefix; - - ApiKeyAuth(this.location, this.paramName); - - @override - void applyToParams(List queryParams, Map headerParams) { - String value; - if (apiKeyPrefix != null) { - value = '$apiKeyPrefix $apiKey'; - } else { - value = apiKey; - } - - if (location == 'query' && value != null) { - queryParams.add(new QueryParam(paramName, value)); - } else if (location == 'header' && value != null) { - headerParams[paramName] = value; - } - } -} diff --git a/modules/openapi-generator/src/main/resources/dart/auth/authentication.mustache b/modules/openapi-generator/src/main/resources/dart/auth/authentication.mustache deleted file mode 100644 index 40540bac5301..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/auth/authentication.mustache +++ /dev/null @@ -1,7 +0,0 @@ -part of {{pubName}}.api; - -abstract class Authentication { - - /// Apply authentication settings to header and query params. - void applyToParams(List queryParams, Map headerParams); -} diff --git a/modules/openapi-generator/src/main/resources/dart/auth/http_basic_auth.mustache b/modules/openapi-generator/src/main/resources/dart/auth/http_basic_auth.mustache deleted file mode 100644 index 4fbcb2321b66..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/auth/http_basic_auth.mustache +++ /dev/null @@ -1,14 +0,0 @@ -part of {{pubName}}.api; - -class HttpBasicAuth implements Authentication { - - String username; - String password; - - @override - void applyToParams(List queryParams, Map headerParams) { - String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); - headerParams["Authorization"] = "Basic " + BASE64.encode(UTF8.encode(str)); - } - -} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/auth/oauth.mustache b/modules/openapi-generator/src/main/resources/dart/auth/oauth.mustache deleted file mode 100644 index 5b96ecc9d7a9..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/auth/oauth.mustache +++ /dev/null @@ -1,19 +0,0 @@ -part of {{pubName}}.api; - -class OAuth implements Authentication { - String accessToken; - - OAuth({this.accessToken}) { - } - - @override - void applyToParams(List queryParams, Map headerParams) { - if (accessToken != null) { - headerParams["Authorization"] = "Bearer " + accessToken; - } - } - - void setAccessToken(String accessToken) { - this.accessToken = accessToken; - } -} diff --git a/modules/openapi-generator/src/main/resources/dart/class.mustache b/modules/openapi-generator/src/main/resources/dart/class.mustache deleted file mode 100644 index e2a99a92a5c0..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/class.mustache +++ /dev/null @@ -1,96 +0,0 @@ -class {{classname}} { - {{#vars}} - {{#description}}/* {{{description}}} */{{/description}} - {{^defaultValue}}{{{dataType}}} {{name}} = null;{{/defaultValue}}{{#defaultValue}}{{{dataType}}} {{name}} = {{defaultValue}};{{/defaultValue}} - {{#allowableValues}} - {{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{ - {{/allowableValues}} - {{/vars}} - {{classname}}(); - - @override - String toString() { - return '{{classname}}[{{#vars}}{{name}}=${{name}}, {{/vars}}]'; - } - - {{classname}}.fromJson(Map json) { - if (json == null) return; - {{#vars}} - if (json['{{baseName}}'] == null) { - {{name}} = null; - } else { - {{#isDateTime}} - {{name}} = DateTime.parse(json['{{baseName}}']); - {{/isDateTime}} - {{#isDate}} - {{name}} = DateTime.parse(json['{{baseName}}']); - {{/isDate}} - {{^isDateTime}} - {{^isDate}} - {{#complexType}} - {{#isArray}} - {{name}} = {{complexType}}.listFromJson(json['{{baseName}}']); - {{/isArray}} - {{^isArray}} - {{#isMap}} - {{name}} = {{complexType}}.mapFromJson(json['{{baseName}}']); - {{/isMap}} - {{^isMap}} - {{name}} = new {{complexType}}.fromJson(json['{{baseName}}']); - {{/isMap}} - {{/isArray}} - {{/complexType}} - {{^complexType}} - {{#isArray}} - {{name}} = (json['{{baseName}}'] as List).map((item) => item as {{items.datatype}}).toList(); - {{/isArray}} - {{^isArray}} - {{name}} = json['{{baseName}}']; - {{/isArray}} - {{/complexType}} - {{/isDate}} - {{/isDateTime}} - } - {{/vars}} - } - - Map toJson() { - return { - {{#vars}} - {{#isDateTime}} - '{{baseName}}': {{name}} == null ? '' : {{name}}.toUtc().toIso8601String(){{^-last}},{{/-last}} - {{/isDateTime}} - {{#isDate}} - '{{baseName}}': {{name}} == null ? '' : {{name}}.toUtc().toIso8601String(){{^-last}},{{/-last}} - {{/isDate}} - {{^isDateTime}} - {{^isDate}} - {{#complexType}} - {{#isArray}} - '{{baseName}}': {{name}} == null ? null : {{name}}.map((item) => item.toJson()).toList(){{^-last}},{{/-last}} - {{/isArray}} - {{^isArray}} - '{{baseName}}': {{name}} == null ? null : {{name}}.toJson(){{^-last}},{{/-last}} - {{/isArray}} - {{/complexType}} - {{^complexType}} - '{{baseName}}': {{name}}{{^-last}},{{/-last}} - {{/complexType}} - {{/isDate}} - {{/isDateTime}} - {{/vars}} - }; - } - - static List<{{classname}}> listFromJson(List json) { - return json == null ? new List<{{classname}}>() : json.map((value) => new {{classname}}.fromJson(value)).toList(); - } - - static Map mapFromJson(Map> json) { - var map = new Map(); - if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new {{classname}}.fromJson(value)); - } - return map; - } -} diff --git a/modules/openapi-generator/src/main/resources/dart/enum.mustache b/modules/openapi-generator/src/main/resources/dart/enum.mustache deleted file mode 100644 index d4a4d2b8d111..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/enum.mustache +++ /dev/null @@ -1,36 +0,0 @@ -@Entity() -class {{classname}} { - /// The underlying value of this enum member. - final {{dataType}} value; - - const {{classname}}._internal(this.value); - - {{#allowableValues}} - {{#enumVars}} - {{#description}} - /// {{description}} - {{/description}} - static const {{classname}} {{{name}}} = const {{classname}}._internal({{{value}}}); - {{/enumVars}} - {{/allowableValues}} -} - -class {{classname}}TypeTransformer extends TypeTransformer<{{classname}}> { - - @override - dynamic encode({{classname}} data) { - return data.value; - } - - @override - {{classname}} decode(dynamic data) { - switch (data) { - {{#allowableValues}} - {{#enumVars}} - case {{{value}}}: return {{classname}}.{{{name}}}; - {{/enumVars}} - {{/allowableValues}} - default: throw('Unknown enum value to decode: $data'); - } - } -} diff --git a/modules/openapi-generator/src/main/resources/dart/git_push.sh.mustache b/modules/openapi-generator/src/main/resources/dart/git_push.sh.mustache deleted file mode 100755 index 8b3f689c9121..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/git_push.sh.mustache +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="{{{gitHost}}}" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="{{{gitUserId}}}" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="{{{gitRepoId}}}" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="{{{releaseNote}}}" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=`git remote` -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' - diff --git a/modules/openapi-generator/src/main/resources/dart/README.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/README.mustache similarity index 62% rename from modules/openapi-generator/src/main/resources/dart/README.mustache rename to modules/openapi-generator/src/main/resources/dart/libraries/dio/README.mustache index 18a674839135..454bd6ccdb97 100644 --- a/modules/openapi-generator/src/main/resources/dart/README.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/README.mustache @@ -1,4 +1,4 @@ -# {{pubName}} +# {{pubName}} (EXPERIMENTAL) {{#appDescriptionWithNewLines}} {{{appDescriptionWithNewLines}}} {{/appDescriptionWithNewLines}} @@ -19,7 +19,9 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) ## Requirements -Dart 1.20.0 or later OR Flutter 0.0.20 or later +* Dart 2.12.0 or later OR Flutter 1.26.0 or later +* Dio 4.0.0+ +* timemachine option currently **DOES NOT** support sound null-safety and may not work ## Installation & Usage @@ -31,7 +33,7 @@ version: {{pubVersion}} description: {{pubDescription}} dependencies: {{pubName}}: - git: https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}.git + git: https://github.com/{{gitUserId}}/{{gitRepoId}}.git version: 'any' ``` @@ -43,48 +45,25 @@ dependencies: path: /path/to/{{pubName}} ``` -## Tests - -TODO - ## Getting Started Please follow the [installation procedure](#installation--usage) and then run the following: ```dart -import 'package:{{pubName}}/api.dart'; +import 'package:{{pubName}}/{{pubName}}.dart'; {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} -{{#hasAuthMethods}} -{{#authMethods}} -{{#isBasic}} -// TODO Configure HTTP basic authorization: {{{name}}} -//{{pubName}}.api.Configuration.username = 'YOUR_USERNAME'; -//{{pubName}}.api.Configuration.password = 'YOUR_PASSWORD'; -{{/isBasic}} -{{#isApiKey}} -// TODO Configure API key authorization: {{{name}}} -//{{pubName}}.api.Configuration.apiKey{'{{{keyParamName}}}'} = 'YOUR_API_KEY'; -// uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//{{pubName}}.api.Configuration.apiKeyPrefix{'{{{keyParamName}}}'} = "Bearer"; -{{/isApiKey}} -{{#isOAuth}} -// TODO Configure OAuth2 access token for authorization: {{{name}}} -//{{pubName}}.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; -{{/isOAuth}} -{{/authMethods}} -{{/hasAuthMethods}} -var api_instance = new {{classname}}(); +final api = {{classname}}(); {{#allParams}} -var {{paramName}} = {{#isArray}}[{{/isArray}}{{#isBodyParam}}new {{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isArray}}]{{/isArray}}; // {{{dataType}}} | {{{description}}} +final {{paramName}} = {{#isArray}}[{{/isArray}}{{#isBodyParam}}{{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isArray}}]{{/isArray}}; // {{{dataType}}} | {{{description}}} {{/allParams}} try { - {{#returnType}}var result = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + {{#returnType}}final response = await {{/returnType}}api.{{{operationId}}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); {{#returnType}} - print(result); + print(response); {{/returnType}} -} catch (e) { +} catch on DioError (e) { print("Exception when calling {{classname}}->{{operationId}}: $e\n"); } {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} @@ -96,12 +75,12 @@ All URIs are relative to *{{basePath}}* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} ## Documentation For Models -{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md) +{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) {{/model}}{{/models}} ## Documentation For Authorization diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/analysis_options.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/analysis_options.mustache new file mode 100644 index 000000000000..a611887d3acf --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/analysis_options.mustache @@ -0,0 +1,9 @@ +analyzer: + language: + strict-inference: true + strict-raw-types: true + strong-mode: + implicit-dynamic: false + implicit-casts: false + exclude: + - test/*.dart diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/api.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api.mustache new file mode 100644 index 000000000000..8deca6ce0000 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api.mustache @@ -0,0 +1,136 @@ +{{>header}} +import 'dart:async'; + +{{#useBuiltValue}}import 'package:built_value/serializer.dart';{{/useBuiltValue}} +import 'package:dio/dio.dart'; + +{{#operations}} +{{#modelImports}}import 'package:{{pubName}}/src/model/{{.}}.dart'; +{{/modelImports}} +{{#fullImports}}import '{{.}}'; +{{/fullImports}} + +class {{classname}} { + + final Dio _dio; + {{#useBuiltValue}} + + final Serializers _serializers; + + {{/useBuiltValue}} + const {{classname}}(this._dio{{#useBuiltValue}}, this._serializers{{/useBuiltValue}}); + + {{#operation}} + /// {{{summary}}} + /// + /// {{{notes}}} + Future> {{nickname}}({ {{#allParams}}{{#isPathParam}} + required {{{dataType}}} {{paramName}},{{/isPathParam}}{{#isQueryParam}} + {{#required}}required {{/required}}{{{dataType}}}{{^required}}?{{/required}} {{paramName}},{{/isQueryParam}}{{#isHeaderParam}} + {{#required}}required {{/required}}{{{dataType}}}{{^required}}?{{/required}} {{paramName}},{{/isHeaderParam}}{{#isBodyParam}} + {{#required}}required {{/required}}{{{dataType}}}{{^required}}?{{/required}} {{paramName}},{{/isBodyParam}}{{#isFormParam}} + {{#required}}required {{/required}}{{{dataType}}}{{^required}}?{{/required}} {{paramName}},{{/isFormParam}}{{/allParams}} + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'{{{path}}}'{{#pathParams}}.replaceAll('{' r'{{{baseName}}}' '}', {{{paramName}}}.toString()){{/pathParams}}; + final _options = Options( + method: r'{{#lambda.uppercase}}{{httpMethod}}{{/lambda.uppercase}}', + {{#isResponseFile}} + responseType: ResponseType.bytes, + {{/isResponseFile}} + headers: { + {{#httpUserAgent}} + r'User-Agent': r'{{{.}}}', + {{/httpUserAgent}} + {{#headerParams}} + {{^required}}{{^isNullable}}if ({{{paramName}}} != null) {{/isNullable}}{{/required}}r'{{baseName}}': {{paramName}}, + {{/headerParams}} + ...?headers, + }, + extra: { + 'secure': >[{{^hasAuthMethods}}],{{/hasAuthMethods}}{{#hasAuthMethods}} + {{#authMethods}}{ + 'type': '{{type}}', + 'name': '{{name}}',{{#isApiKey}} + 'keyName': '{{keyParamName}}', + 'where': '{{#isKeyInQuery}}query{{/isKeyInQuery}}{{#isKeyInHeader}}header{{/isKeyInHeader}}',{{/isApiKey}} + },{{/authMethods}} + ],{{/hasAuthMethods}} + ...?extra, + }, + contentType: [{{^hasConsumes}} + 'application/json',{{/hasConsumes}}{{#hasConsumes}}{{#consumes}} + '{{{mediaType}}}',{{/consumes}}{{/hasConsumes}} + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = { + {{#queryParams}} + {{^required}}{{^isNullable}}if ({{{paramName}}} != null) {{/isNullable}}{{/required}}r'{{baseName}}': {{paramName}}, + {{/queryParams}} + }; + {{#hasBodyOrFormParams}} + + dynamic _bodyData; + + try { +{{#useBuiltValue}}{{>serialization/built_value/serialize}}{{/useBuiltValue}} + } catch(error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + {{/hasBodyOrFormParams}} + + final _response = await _dio.request( + _path,{{#hasBodyOrFormParams}} + data: _bodyData,{{/hasBodyOrFormParams}} + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + {{#returnType}} + + {{{returnType}}} _responseData; + + try { +{{#useBuiltValue}}{{>serialization/built_value/deserialize}}{{/useBuiltValue}} + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response<{{{returnType}}}>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + );{{/returnType}}{{^returnType}} + return _response;{{/returnType}} + } + + {{/operation}} +} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_client.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_client.mustache new file mode 100644 index 000000000000..2c2fd45de880 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_client.mustache @@ -0,0 +1,64 @@ +{{>header}} +import 'package:dio/dio.dart';{{#useBuiltValue}} +import 'package:built_value/serializer.dart'; +import 'package:{{pubName}}/src/serializers.dart';{{/useBuiltValue}} +import 'package:{{pubName}}/src/auth/api_key_auth.dart'; +import 'package:{{pubName}}/src/auth/basic_auth.dart'; +import 'package:{{pubName}}/src/auth/oauth.dart'; +{{#apiInfo}}{{#apis}}import 'package:{{pubName}}/src/api/{{classFilename}}.dart'; +{{/apis}}{{/apiInfo}} +class {{clientName}} { + static const String basePath = r'{{{basePath}}}'; + + final Dio dio; +{{#useBuiltValue}} + final Serializers serializers; + +{{/useBuiltValue}} + {{clientName}}({ + Dio? dio,{{#useBuiltValue}} + Serializers? serializers,{{/useBuiltValue}} + String? basePathOverride, + List? interceptors, + }) : {{#useBuiltValue}}this.serializers = serializers ?? standardSerializers,{{/useBuiltValue}} + this.dio = dio ?? + Dio(BaseOptions( + baseUrl: basePathOverride ?? basePath, + connectTimeout: 5000, + receiveTimeout: 3000, + )) { + if (interceptors == null) { + this.dio.interceptors.addAll([ + OAuthInterceptor(), + BasicAuthInterceptor(), + ApiKeyAuthInterceptor(), + ]); + } else { + this.dio.interceptors.addAll(interceptors); + } + } + + void setOAuthToken(String name, String token) { + if (this.dio.interceptors.any((i) => i is OAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is OAuthInterceptor) as OAuthInterceptor).tokens[name] = token; + } + } + + void setBasicAuth(String name, String username, String password) { + if (this.dio.interceptors.any((i) => i is BasicAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is BasicAuthInterceptor) as BasicAuthInterceptor).authInfo[name] = BasicAuthInfo(username, password); + } + } + + void setApiKey(String name, String apiKey) { + if (this.dio.interceptors.any((i) => i is ApiKeyAuthInterceptor)) { + (this.dio.interceptors.firstWhere((element) => element is ApiKeyAuthInterceptor) as ApiKeyAuthInterceptor).apiKeys[name] = apiKey; + } + }{{#apiInfo}}{{#apis}} + + /// Get {{classname}} instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + {{classname}} get{{classname}}() { + return {{classname}}(dio{{#useBuiltValue}}, serializers{{/useBuiltValue}}); + }{{/apis}}{{/apiInfo}} +} diff --git a/modules/openapi-generator/src/main/resources/dart/api_doc.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_doc.mustache similarity index 70% rename from modules/openapi-generator/src/main/resources/dart/api_doc.mustache rename to modules/openapi-generator/src/main/resources/dart/libraries/dio/api_doc.mustache index 0ebccc31c4f4..1e28b16012e4 100644 --- a/modules/openapi-generator/src/main/resources/dart/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_doc.mustache @@ -10,7 +10,7 @@ All URIs are relative to *{{basePath}}* Method | HTTP request | Description ------------- | ------------- | ------------- -{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} {{/operation}}{{/operations}} {{#operations}} @@ -29,25 +29,25 @@ import 'package:{{pubName}}/api.dart'; {{#authMethods}} {{#isBasic}} // TODO Configure HTTP basic authorization: {{{name}}} -//{{pubName}}.api.Configuration.username = 'YOUR_USERNAME'; -//{{pubName}}.api.Configuration.password = 'YOUR_PASSWORD'; +//defaultApiClient.getAuthentication('{{{name}}}').username = 'YOUR_USERNAME' +//defaultApiClient.getAuthentication('{{{name}}}').password = 'YOUR_PASSWORD'; {{/isBasic}} {{#isApiKey}} // TODO Configure API key authorization: {{{name}}} -//{{pubName}}.api.Configuration.apiKey{'{{{keyParamName}}}'} = 'YOUR_API_KEY'; +//defaultApiClient.getAuthentication('{{{name}}}').apiKey = 'YOUR_API_KEY'; // uncomment below to setup prefix (e.g. Bearer) for API key, if needed -//{{pubName}}.api.Configuration.apiKeyPrefix{'{{{keyParamName}}}'} = "Bearer"; +//defaultApiClient.getAuthentication('{{{name}}}').apiKeyPrefix = 'Bearer'; {{/isApiKey}} {{#isOAuth}} // TODO Configure OAuth2 access token for authorization: {{{name}}} -//{{pubName}}.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; +//defaultApiClient.getAuthentication('{{{name}}}').accessToken = 'YOUR_ACCESS_TOKEN'; {{/isOAuth}} {{/authMethods}} {{/hasAuthMethods}} var api_instance = new {{classname}}(); {{#allParams}} -var {{paramName}} = {{#isArray}}[{{/isArray}}{{#isBodyParam}}new {{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isArray}}]{{/isArray}}; // {{{dataType}}} | {{{description}}} +var {{paramName}} = {{#isArray}}[{{/isArray}}{{#isBodyParam}}new {{{dataType}}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isArray}}]{{/isArray}}; // {{{dataType}}} | {{{description}}} {{/allParams}} try { @@ -56,7 +56,7 @@ try { print(result); {{/returnType}} } catch (e) { - print("Exception when calling {{classname}}->{{operationId}}: $e\n"); + print('Exception when calling {{classname}}->{{operationId}}: $e\n'); } ``` @@ -64,7 +64,7 @@ try { {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} +{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{baseType}}.md){{/isPrimitiveType}}| {{{description}}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{{defaultValue}}}]{{/defaultValue}} {{/allParams}} ### Return type diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_test.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_test.mustache new file mode 100644 index 000000000000..056920d91aa1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_test.mustache @@ -0,0 +1,28 @@ +import 'package:test/test.dart'; +import 'package:{{pubName}}/{{pubName}}.dart'; + +{{#operations}} + +/// tests for {{{classname}}} +void main() { + final instance = {{{clientName}}}().get{{{classname}}}(); + + group({{{classname}}}, () { + {{#operation}} + {{#summary}} + // {{{.}}} + // + {{/summary}} + {{#notes}} + // {{{.}}} + // + {{/notes}} + //{{#returnType}}Future<{{{returnType}}}> {{/returnType}}{{^returnType}}Future {{/returnType}}{{{operationId}}}({{#allParams}}{{#required}}{{{dataType}}} {{{paramName}}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}} {{{paramName}}}{{^-last}}, {{/-last}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async + test('test {{{operationId}}}', () async { + // TODO + }); + + {{/operation}} + }); +} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_util.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_util.mustache new file mode 100644 index 000000000000..4cdc6bcea3c5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_util.mustache @@ -0,0 +1,28 @@ +{{>header}} +import 'dart:convert'; + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; + +/// Format the given form parameter object into something that Dio can handle. +/// Returns primitive or String. +/// Returns List/Map if the value is BuildList/BuiltMap. +dynamic encodeFormParameter(Serializers serializers, dynamic value, FullType type) { + if (value == null) { + return ''; + } + if (value is String || value is num || value is bool) { + return value; + } + final serialized = serializers.serialize( + value as Object, + specifiedType: type, + ); + if (serialized is String) { + return serialized; + } + if (value is BuiltList || value is BuiltMap) { + return serialized; + } + return json.encode(serialized); +} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/api_key_auth.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/api_key_auth.mustache new file mode 100644 index 000000000000..7e57fd9ac927 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/api_key_auth.mustache @@ -0,0 +1,27 @@ +{{>header}} + +import 'package:dio/dio.dart'; +import 'package:{{pubName}}/src/auth/auth.dart'; + +class ApiKeyAuthInterceptor extends AuthInterceptor { + final Map apiKeys = {}; + + @override + void onRequest(RequestOptions options, RequestInterceptorHandler handler) { + final authInfo = getAuthInfo(options, 'apiKey'); + for (final info in authInfo) { + final authName = info['name'] as String; + final authKeyName = info['keyName'] as String; + final authWhere = info['where'] as String; + final apiKey = apiKeys[authName]; + if (apiKey != null) { + if (authWhere == 'query') { + options.queryParameters[authKeyName] = apiKey; + } else { + options.headers[authKeyName] = apiKey; + } + } + } + super.onRequest(options, handler); + } +} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/auth.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/auth.mustache new file mode 100644 index 000000000000..7bce19a475ae --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/auth.mustache @@ -0,0 +1,21 @@ +{{>header}} +import 'package:dio/dio.dart'; + +abstract class AuthInterceptor extends Interceptor { + /// Get auth information on given route for the given type. + /// Can return an empty list if type is not present on auth data or + /// if route doesn't need authentication. + List> getAuthInfo(RequestOptions route, String type) { + if (route.extra.containsKey('secure')) { + final auth = route.extra['secure'] as List>; + final results = >[]; + for (final info in auth) { + if (info['type'] == type) { + results.add(info); + } + } + return results; + } + return []; + } +} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/basic_auth.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/basic_auth.mustache new file mode 100644 index 000000000000..f33e259647b7 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/basic_auth.mustache @@ -0,0 +1,34 @@ +{{>header}} +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:{{pubName}}/src/auth/auth.dart'; + +class BasicAuthInfo { + final String username; + final String password; + + const BasicAuthInfo(this.username, this.password); +} + +class BasicAuthInterceptor extends AuthInterceptor { + final Map authInfo = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final metadataAuthInfo = getAuthInfo(options, 'basic'); + for (final info in metadataAuthInfo) { + final authName = info['name'] as String; + final basicAuthInfo = authInfo[authName]; + if (basicAuthInfo != null) { + final basicAuth = 'Basic ${base64Encode(utf8.encode('${basicAuthInfo.username}:${basicAuthInfo.password}'))}'; + options.headers['Authorization'] = basicAuth; + break; + } + } + super.onRequest(options, handler); + } +} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/oauth.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/oauth.mustache new file mode 100644 index 000000000000..0f92cdba98cd --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/oauth.mustache @@ -0,0 +1,23 @@ +{{>header}} +import 'package:dio/dio.dart'; +import 'package:{{pubName}}/src/auth/auth.dart'; + +class OAuthInterceptor extends AuthInterceptor { + final Map tokens = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final authInfo = getAuthInfo(options, 'oauth'); + for (final info in authInfo) { + final token = tokens[info['name']]; + if (token != null) { + options.headers['Authorization'] = 'Bearer ${token}'; + break; + } + } + super.onRequest(options, handler); + } +} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/class.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/class.mustache new file mode 100644 index 000000000000..da5ecb735258 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/class.mustache @@ -0,0 +1 @@ +{{#useBuiltValue}}{{>serialization/built_value/class}}{{/useBuiltValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/enum.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/enum.mustache new file mode 100644 index 000000000000..6c20417e3563 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/enum.mustache @@ -0,0 +1 @@ +{{#useBuiltValue}}{{>serialization/built_value/enum}}{{/useBuiltValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/gitignore.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/gitignore.mustache similarity index 59% rename from modules/openapi-generator/src/main/resources/dart/gitignore.mustache rename to modules/openapi-generator/src/main/resources/dart/libraries/dio/gitignore.mustache index 7c2804416498..8092a49d5152 100644 --- a/modules/openapi-generator/src/main/resources/dart/gitignore.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/gitignore.mustache @@ -1,6 +1,7 @@ -# See https://www.dartlang.org/tools/private-files.html +# See https://dart.dev/guides/libraries/private-files # Files and directories created by pub +.dart_tool/ .buildlog .packages .project @@ -25,3 +26,12 @@ doc/api/ # Don't commit pubspec lock file # (Library packages only! Remove pattern if developing an application package) pubspec.lock + +# Don’t commit files and directories created by other development environments. +# For example, if your development environment creates any of the following files, +# consider putting them in a global ignore file: +*.iml // IntelliJ +*.ipr // IntelliJ +*.iws // IntelliJ +.idea/ // IntelliJ +.DS_Store // Mac diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/header.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/header.mustache new file mode 100644 index 000000000000..32c88287e5cf --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/header.mustache @@ -0,0 +1,3 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/lib.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/lib.mustache new file mode 100644 index 000000000000..ff5436626536 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/lib.mustache @@ -0,0 +1,11 @@ +{{>header}} +export 'package:{{pubName}}/src/api.dart'; +export 'package:{{pubName}}/src/auth/api_key_auth.dart'; +export 'package:{{pubName}}/src/auth/basic_auth.dart'; +export 'package:{{pubName}}/src/auth/oauth.dart'; +{{#useBuiltValue}}export 'package:{{pubName}}/src/serializers.dart';{{/useBuiltValue}} + +{{#apiInfo}}{{#apis}}export 'package:{{pubName}}/src/api/{{classFilename}}.dart'; +{{/apis}}{{/apiInfo}} +{{#models}}{{#model}}export 'package:{{pubName}}/src/model/{{classFilename}}.dart'; +{{/model}}{{/models}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/model.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/model.mustache new file mode 100644 index 000000000000..5fdbb1b77c8c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/model.mustache @@ -0,0 +1,9 @@ +{{>header}} +{{#models}} + {{#model}} + {{#imports}} +import '{{.}}'; + {{/imports}} +{{#isEnum}}{{>enum}}{{/isEnum}}{{^isEnum}}{{>class}}{{/isEnum}} + {{/model}} +{{/models}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/model_test.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/model_test.mustache new file mode 100644 index 000000000000..eaa57022a416 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/model_test.mustache @@ -0,0 +1,28 @@ +{{#models}} +{{#model}} +import 'package:test/test.dart'; +import 'package:{{pubName}}/{{pubName}}.dart'; + +// tests for {{{classname}}} +void main() { + {{^isEnum}} + {{! Due to required vars without default value we can not create a full instance here }} + final instance = {{{classname}}}Builder(); + // TODO add properties to the builder and call build() + {{/isEnum}} + + group({{{classname}}}, () { + {{#vars}} + {{#description}} + // {{{description}}} + {{/description}} + // {{{dataType}}} {{{name}}}{{#defaultValue}} (default value: {{{.}}}){{/defaultValue}} + test('to test the property `{{{name}}}`', () async { + // TODO + }); + + {{/vars}} + }); +} +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/dart/object_doc.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/object_doc.mustache similarity index 57% rename from modules/openapi-generator/src/main/resources/dart/object_doc.mustache rename to modules/openapi-generator/src/main/resources/dart/libraries/dio/object_doc.mustache index 742952fef632..f2a52db11a4b 100644 --- a/modules/openapi-generator/src/main/resources/dart/object_doc.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/object_doc.mustache @@ -8,7 +8,7 @@ import 'package:{{pubName}}/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} +{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{{description}}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{defaultValue}}}]{{/defaultValue}} {{/vars}} [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/pubspec.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/pubspec.mustache new file mode 100644 index 000000000000..55234533fd0d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/pubspec.mustache @@ -0,0 +1,23 @@ +name: {{pubName}} +version: {{pubVersion}} +description: {{pubDescription}} + +environment: + sdk: '>=2.12.0 <3.0.0' + +dependencies: + dio: '4.0.0-prev2' +{{#useBuiltValue}} + built_value: '>=8.0.3 <9.0.0' + built_collection: '>=5.0.0 <6.0.0' +{{/useBuiltValue}} +{{#useDateLibTimeMachine}} + time_machine: ^0.9.16 +{{/useDateLibTimeMachine}} + +dev_dependencies: +{{#useBuiltValue}} + built_value_generator: '>=8.0.3 <9.0.0' + build_runner: any +{{/useBuiltValue}} + test: '>=1.16.0 <1.17.0' diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/class.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/class.mustache new file mode 100644 index 000000000000..f359b8d5a91b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/class.mustache @@ -0,0 +1,127 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part '{{classFilename}}.g.dart'; + +{{! + Classes with polymorphism or composition may generate unused imports, + these need to be ignored for said classes so that there are no lint errors. +}} +{{#parentModel}}// ignore_for_file: unused_import{{/parentModel}} + +abstract class {{classname}} implements Built<{{classname}}, {{classname}}Builder> { +{{#vars}} + {{#description}} + /// {{{description}}} + {{/description}} + @BuiltValueField(wireName: r'{{baseName}}') + {{{datatypeWithEnum}}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^required}}?{{/required}}{{/isNullable}} get {{name}}; + {{#allowableValues}} + // {{#min}}range from {{{min}}} to {{{max}}}{{/min}}{{^min}}enum {{name}}Enum { {{#values}} {{{.}}}, {{/values}} };{{/min}} + {{/allowableValues}} + +{{/vars}} + {{classname}}._(); + + static void _initializeBuilder({{{classname}}}Builder b) => b{{#vars}}{{#defaultValue}} + ..{{{name}}} = {{#isEnum}}{{^isContainer}}const {{{enumName}}}._({{/isContainer}}{{/isEnum}}{{{defaultValue}}}{{#isEnum}}{{^isContainer}}){{/isContainer}}{{/isEnum}}{{/defaultValue}}{{/vars}}; + + factory {{classname}}([void updates({{classname}}Builder b)]) = _${{classname}}; + + @BuiltValueSerializer(custom: true) + static Serializer<{{classname}}> get serializer => _${{classname}}Serializer(); +} + +{{! + Generate a custom serializer in order to support combinations of required and nullable. + By default built_value does not serialize null fields. +}} +class _${{classname}}Serializer implements StructuredSerializer<{{classname}}> { + @override + final Iterable types = const [{{classname}}, _${{classname}}]; + + @override + final String wireName = r'{{classname}}'; + + @override + Iterable serialize(Serializers serializers, {{{classname}}} object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + {{#vars}} + {{#required}} + {{! + A required property need to always be part of the serialized output. + When it is nullable, null is serialized, otherwise it is an error if it is null. + }} + result + ..add(r'{{baseName}}') + ..add({{#isNullable}}object.{{{name}}} == null ? null : {{/isNullable}}serializers.serialize(object.{{{name}}}, + specifiedType: {{{vendorExtensions.x-built-value-serializer-type}}})); + {{/required}} + {{^required}} + if (object.{{{name}}} != null) { + {{! Non-required properties are only serialized if not null. }} + result + ..add(r'{{baseName}}') + ..add(serializers.serialize(object.{{{name}}}, + specifiedType: {{{vendorExtensions.x-built-value-serializer-type}}})); + } + {{/required}} + {{/vars}} + return result; + } + + @override + {{classname}} deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = {{classname}}Builder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + {{#vars}} + case r'{{baseName}}': + {{#isContainer}} + result.{{{name}}}.replace(serializers.deserialize(value, + specifiedType: {{{vendorExtensions.x-built-value-serializer-type}}}) as {{{datatypeWithEnum}}}); + {{/isContainer}} + {{#isModel}} + result.{{{name}}}.replace(serializers.deserialize(value, + specifiedType: {{{vendorExtensions.x-built-value-serializer-type}}}) as {{{datatypeWithEnum}}}); + {{/isModel}} + {{^isContainer}} + {{^isModel}} + result.{{{name}}} = serializers.deserialize(value, + specifiedType: {{{vendorExtensions.x-built-value-serializer-type}}}) as {{{datatypeWithEnum}}}; + {{/isModel}} + {{/isContainer}} + break; + {{/vars}} + } + } + return result.build(); + } +} +{{! + Generate an enum for any variables that are declared as inline enums + isEnum is only true for inline variables that are enums. + If an enum is declared as a definition, isEnum is false and the enum is generated from the + enum.mustache template. +}} +{{#vars}} + {{#isEnum}} + {{^isContainer}} + +{{>serialization/built_value/enum_inline}} + {{/isContainer}} + {{#isContainer}} + {{#mostInnerItems}} + +{{>serialization/built_value/enum_inline}} + {{/mostInnerItems}} + {{/isContainer}} + {{/isEnum}} +{{/vars}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/deserialize.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/deserialize.mustache new file mode 100644 index 000000000000..f2b33d868d27 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/deserialize.mustache @@ -0,0 +1,24 @@ + {{#isResponseFile}} + _responseData = _response.data as {{{returnType}}}; + {{/isResponseFile}} + {{^isResponseFile}} + {{#returnSimpleType}} + {{#returnTypeIsPrimitive}} + _responseData = _response.data as {{{returnType}}}; + {{/returnTypeIsPrimitive}} + {{^returnTypeIsPrimitive}} + const _responseType = FullType({{{returnType}}}); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as {{{returnType}}}; + {{/returnTypeIsPrimitive}} + {{/returnSimpleType}} + {{^returnSimpleType}} + const _responseType = FullType(Built{{#isArray}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}{{/isArray}}{{#isMap}}Map{{/isMap}}, [{{#isMap}}FullType(String), {{/isMap}}FullType({{{returnBaseType}}})]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as {{{returnType}}}; + {{/returnSimpleType}} + {{/isResponseFile}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/enum.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/enum.mustache new file mode 100644 index 000000000000..4e299b1faa3b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/enum.mustache @@ -0,0 +1,33 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part '{{classFilename}}.g.dart'; + +class {{classname}} extends EnumClass { + + {{#allowableValues}} + {{#enumVars}} + {{#description}} + /// {{{description}}} + {{/description}} + @BuiltValueEnumConst({{#isInteger}}wireNumber: {{{value}}}{{/isInteger}}{{^isInteger}}wireName: r{{{value}}}{{/isInteger}}) + static const {{classname}} {{name}} = _${{name}}; + {{/enumVars}} + {{/allowableValues}} + + static Serializer<{{classname}}> get serializer => _${{#lambda.camelcase}}{{{classname}}}{{/lambda.camelcase}}Serializer; + + const {{classname}}._(String name): super(name); + + static BuiltSet<{{classname}}> get values => _$values; + static {{classname}} valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class {{classname}}Mixin = Object with _${{classname}}Mixin; diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/enum_inline.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/enum_inline.mustache new file mode 100644 index 000000000000..2d0c898cd3c9 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/enum_inline.mustache @@ -0,0 +1,19 @@ +class {{{enumName}}} extends EnumClass { + + {{#allowableValues}} + {{#enumVars}} + {{#description}} + /// {{{description}}} + {{/description}} + @BuiltValueEnumConst({{#isInteger}}wireNumber: {{{value}}}{{/isInteger}}{{^isInteger}}wireName: r{{{value}}}{{/isInteger}}) + static const {{{enumName}}} {{name}} = _${{#lambda.camelcase}}{{{enumName}}}{{/lambda.camelcase}}_{{name}}; + {{/enumVars}} + {{/allowableValues}} + + static Serializer<{{{enumName}}}> get serializer => _${{#lambda.camelcase}}{{{enumName}}}{{/lambda.camelcase}}Serializer; + + const {{{enumName}}}._(String name): super(name); + + static BuiltSet<{{{enumName}}}> get values => _${{#lambda.camelcase}}{{{enumName}}}{{/lambda.camelcase}}Values; + static {{{enumName}}} valueOf(String name) => _${{#lambda.camelcase}}{{{enumName}}}{{/lambda.camelcase}}ValueOf(name); +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/local_date_serializer.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/local_date_serializer.mustache new file mode 100644 index 000000000000..68cfd5e31c68 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/local_date_serializer.mustache @@ -0,0 +1,52 @@ +{{>header}} +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; +import 'package:time_machine/time_machine.dart'; + +class OffsetDateSerializer implements PrimitiveSerializer { + + const OffsetDateSerializer(); + + @override + Iterable get types => BuiltList([OffsetDate]); + + @override + String get wireName => 'OffsetDate'; + + @override + OffsetDate deserialize(Serializers serializers, Object serialized, + {FullType specifiedType = FullType.unspecified}) { + final local = LocalDate.dateTime(DateTime.parse(serialized as String)); + return OffsetDate(local, Offset(0)); + } + + @override + Object serialize(Serializers serializers, OffsetDate offsetDate, + {FullType specifiedType = FullType.unspecified}) { + return offsetDate.toString('yyyy-MM-dd'); + } +} + +class OffsetDateTimeSerializer implements PrimitiveSerializer { + + const OffsetDateTimeSerializer(); + + @override + Iterable get types => BuiltList([OffsetDateTime]); + + @override + String get wireName => 'OffsetDateTime'; + + @override + OffsetDateTime deserialize(Serializers serializers, Object serialized, + {FullType specifiedType = FullType.unspecified}) { + final local = LocalDateTime.dateTime(DateTime.parse(serialized as String)); + return OffsetDateTime(local, Offset(0)); + } + + @override + Object serialize(Serializers serializers, OffsetDateTime offsetDateTime, + {FullType specifiedType = FullType.unspecified}) { + return offsetDateTime.toString(); + } +} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/serialize.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/serialize.mustache new file mode 100644 index 000000000000..5794f34ad1ad --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/serialize.mustache @@ -0,0 +1,21 @@ + {{#hasFormParams}} + _bodyData = {{#isMultipart}}FormData.fromMap({{/isMultipart}}{ + {{#formParams}} + {{^required}}{{^isNullable}}if ({{{paramName}}} != null) {{/isNullable}}{{/required}}r'{{{baseName}}}': {{#isFile}}MultipartFile.fromBytes({{{paramName}}}, filename: r'{{{baseName}}}'){{/isFile}}{{^isFile}}encodeFormParameter(_serializers, {{{paramName}}}, const FullType({{^isContainer}}{{{baseType}}}{{/isContainer}}{{#isContainer}}Built{{#isMap}}Map{{/isMap}}{{#isArray}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}{{/isArray}}, [{{#isMap}}FullType(String), {{/isMap}}FullType({{{baseType}}})]{{/isContainer}})){{/isFile}}, + {{/formParams}} + }{{#isMultipart}}){{/isMultipart}}; + {{/hasFormParams}} + {{#bodyParam}} + {{#isPrimitiveType}} + _bodyData = {{paramName}}; + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#isContainer}} + const _type = FullType(Built{{#isMap}}Map{{/isMap}}{{#isArray}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}{{/isArray}}, [{{#isMap}}FullType(String), {{/isMap}}FullType({{{baseType}}})]); + {{/isContainer}} + {{^isContainer}} + const _type = FullType({{{baseType}}}); + {{/isContainer}} + _bodyData = {{^required}}{{paramName}} == null ? null : {{/required}}_serializers.serialize({{paramName}}, specifiedType: _type); + {{/isPrimitiveType}} + {{/bodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/serializers.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/serializers.mustache new file mode 100644 index 000000000000..afca0bc138f9 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/serializers.mustache @@ -0,0 +1,33 @@ +{{>header}} +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/json_object.dart'; +import 'package:built_value/serializer.dart'; +import 'package:built_value/standard_json_plugin.dart'; +{{#useDateLibCore}}import 'package:built_value/iso_8601_date_time_serializer.dart';{{/useDateLibCore}} +{{#useDateLibTimeMachine}}import 'package:time_machine/time_machine.dart'; +import 'package:{{pubName}}/src/local_date_serializer.dart';{{/useDateLibTimeMachine}} +{{#models}}{{#model}}import 'package:{{pubName}}/src/model/{{classFilename}}.dart'; +{{/model}}{{/models}} +part 'serializers.g.dart'; + +@SerializersFor([{{#models}}{{#model}} + {{classname}},{{/model}}{{/models}} +]) +Serializers serializers = (_$serializers.toBuilder(){{#apiInfo}}{{#apis}}{{#serializers}} + ..addBuilderFactory( +{{#isArray}} + const FullType(Built{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}, [FullType({{baseType}})]), + () => {{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}Builder<{{baseType}}>(), +{{/isArray}} +{{#isMap}} + const FullType(BuiltMap, [FullType(String), FullType({{baseType}})]), + () => MapBuilder(), +{{/isMap}} + ){{/serializers}}{{/apis}}{{/apiInfo}}{{#useDateLibTimeMachine}} + ..add(const OffsetDateSerializer()) + ..add(const OffsetDateTimeSerializer()){{/useDateLibTimeMachine}} + ..add(Iso8601DateTimeSerializer())) + .build(); + +Serializers standardSerializers = + (serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build(); diff --git a/modules/openapi-generator/src/main/resources/dart/model.mustache b/modules/openapi-generator/src/main/resources/dart/model.mustache deleted file mode 100644 index 37b030ab0349..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/model.mustache +++ /dev/null @@ -1,12 +0,0 @@ -part of {{pubName}}.api; - -{{#models}} -{{#model}} -{{#isEnum}} -{{>enum}} -{{/isEnum}} -{{^isEnum}} -{{>class}} -{{/isEnum}} -{{/model}} -{{/models}} diff --git a/modules/openapi-generator/src/main/resources/dart/model_test.mustache b/modules/openapi-generator/src/main/resources/dart/model_test.mustache deleted file mode 100644 index b766bf143e78..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/model_test.mustache +++ /dev/null @@ -1,26 +0,0 @@ -{{#models}} -{{#model}} -import 'package:{{pubName}}/api.dart'; -import 'package:test/test.dart'; - -// tests for {{classname}} -void main() { - var instance = new {{classname}}(); - - group('test {{classname}}', () { - {{#vars}} - {{#description}} - // {{{description}}} - {{/description}} - // {{{dataType}}} {{name}}{{#defaultValue}} (default value: {{{.}}}){{/defaultValue}} - test('to test the property `{{name}}`', () async { - // TODO - }); - - {{/vars}} - - }); - -} -{{/model}} -{{/models}} diff --git a/modules/openapi-generator/src/main/resources/dart/pubspec.mustache b/modules/openapi-generator/src/main/resources/dart/pubspec.mustache deleted file mode 100644 index 997448a9bebe..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/pubspec.mustache +++ /dev/null @@ -1,7 +0,0 @@ -name: {{pubName}} -version: {{pubVersion}} -description: {{pubDescription}} -dependencies: - http: '>=0.11.1 <0.13.0' -dev_dependencies: - test: ^1.3.0 diff --git a/modules/openapi-generator/src/main/resources/dart/travis.mustache b/modules/openapi-generator/src/main/resources/dart/travis.mustache deleted file mode 100644 index 82b19541fa43..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/travis.mustache +++ /dev/null @@ -1,11 +0,0 @@ -# https://docs.travis-ci.com/user/languages/dart/ -# -language: dart -dart: -# Install a specific stable release -- "1.24.3" -install: -- pub get - -script: -- pub run test diff --git a/modules/openapi-generator/src/main/resources/dart2/api_doc.mustache b/modules/openapi-generator/src/main/resources/dart2/api_doc.mustache index ba4c43fc9728..b7e91eb72c85 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_doc.mustache @@ -10,7 +10,7 @@ All URIs are relative to *{{{basePath}}}* Method | HTTP request | Description ------------- | ------------- | ------------- -{{#operations}}{{#operation}}[**{{{operationId}}}**]({{{classname}}}.md#{{{operationId}}}) | **{{{httpMethod}}}** {{{path}}} | {{#summary}}{{{summary}}}{{/summary}} +{{#operations}}{{#operation}}[**{{{operationId}}}**]({{{classname}}}.md#{{{operationIdLowerCase}}}) | **{{{httpMethod}}}** {{{path}}} | {{#summary}}{{{summary}}}{{/summary}} {{/operation}}{{/operations}} {{#operations}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioClientCodegenTest.java similarity index 98% rename from modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioClientCodegenTest.java rename to modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioClientCodegenTest.java index 24eb454be8e0..0e57791ce2f2 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioClientCodegenTest.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.openapitools.codegen.dartdio; +package org.openapitools.codegen.dart.dio; import java.io.BufferedReader; import java.io.FileInputStream; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioClientOptionsTest.java similarity index 98% rename from modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioClientOptionsTest.java rename to modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioClientOptionsTest.java index 8f1a3abcd4b3..478d243580e4 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioClientOptionsTest.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.openapitools.codegen.dartdio; +package org.openapitools.codegen.dart.dio; import org.openapitools.codegen.AbstractOptionsTest; import org.openapitools.codegen.CodegenConfig; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioModelTest.java similarity index 99% rename from modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioModelTest.java rename to modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioModelTest.java index 7aac98353d60..adc15af51001 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dartdio/DartDioModelTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioModelTest.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.openapitools.codegen.dartdio; +package org.openapitools.codegen.dart.dio; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioNextClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioNextClientCodegenTest.java new file mode 100644 index 000000000000..61622224bfd3 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioNextClientCodegenTest.java @@ -0,0 +1,86 @@ +/* + * Copyright 2021 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.dart.dio; + +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.languages.DartDioClientCodegen; +import org.openapitools.codegen.languages.DartDioNextClientCodegen; +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +public class DartDioNextClientCodegenTest { + + @Test + public void testInitialConfigValues() throws Exception { + final DartDioNextClientCodegen codegen = new DartDioNextClientCodegen(); + codegen.processOpts(); + + Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE); + Assert.assertEquals(codegen.isHideGenerationTimestamp(), true); + } + + @Test + public void testSettersForConfigValues() throws Exception { + final DartDioClientCodegen codegen = new DartDioClientCodegen(); + codegen.setHideGenerationTimestamp(false); + codegen.processOpts(); + + Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE); + Assert.assertEquals(codegen.isHideGenerationTimestamp(), false); + } + + @Test + public void testAdditionalPropertiesPutForConfigValues() throws Exception { + final DartDioClientCodegen codegen = new DartDioClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, false); + codegen.processOpts(); + + Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE); + Assert.assertEquals(codegen.isHideGenerationTimestamp(), false); + } + + @Test + public void testKeywords() throws Exception { + final DartDioClientCodegen codegen = new DartDioClientCodegen(); + + List reservedWordsList = new ArrayList(); + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("src/main/resources/dart/dart-keywords.txt"), Charset.forName("UTF-8"))); + while(reader.ready()) { reservedWordsList.add(reader.readLine()); } + reader.close(); + } catch (Exception e) { + String errorString = String.format(Locale.ROOT, "Error reading dart keywords: %s", e); + Assert.fail(errorString, e); + } + + Assert.assertEquals(reservedWordsList.size() > 20, true); + Assert.assertEquals(codegen.reservedWords().size() == reservedWordsList.size(), true); + for(String keyword : reservedWordsList) { + // reserved words are stored in lowercase + Assert.assertEquals(codegen.reservedWords().contains(keyword.toLowerCase(Locale.ROOT)), true, String.format(Locale.ROOT, "%s, part of %s, was not found in %s", keyword, reservedWordsList, codegen.reservedWords().toString())); + } + } + +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioNextClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioNextClientOptionsTest.java new file mode 100644 index 000000000000..f2237e4fbaaa --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioNextClientOptionsTest.java @@ -0,0 +1,55 @@ +/* + * Copyright 2021 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.dart.dio; + +import org.openapitools.codegen.AbstractOptionsTest; +import org.openapitools.codegen.CodegenConfig; +import org.openapitools.codegen.languages.DartDioNextClientCodegen; +import org.openapitools.codegen.options.DartDioNextClientOptionsProvider; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +public class DartDioNextClientOptionsTest extends AbstractOptionsTest { + private DartDioNextClientCodegen clientCodegen = mock(DartDioNextClientCodegen.class, mockSettings); + + public DartDioNextClientOptionsTest() { + super(new DartDioNextClientOptionsProvider()); + } + + @Override + protected CodegenConfig getCodegenConfig() { + return clientCodegen; + } + + @SuppressWarnings("unused") + @Override + protected void verifyOptions() { + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(DartDioNextClientOptionsProvider.SORT_PARAMS_VALUE)); + verify(clientCodegen).setPubLibrary(DartDioNextClientOptionsProvider.PUB_LIBRARY_VALUE); + verify(clientCodegen).setPubName(DartDioNextClientOptionsProvider.PUB_NAME_VALUE); + verify(clientCodegen).setPubVersion(DartDioNextClientOptionsProvider.PUB_VERSION_VALUE); + verify(clientCodegen).setPubDescription(DartDioNextClientOptionsProvider.PUB_DESCRIPTION_VALUE); + verify(clientCodegen).setPubAuthor(DartDioNextClientOptionsProvider.PUB_AUTHOR_VALUE); + verify(clientCodegen).setPubAuthorEmail(DartDioNextClientOptionsProvider.PUB_AUTHOR_EMAIL_VALUE); + verify(clientCodegen).setPubHomepage(DartDioNextClientOptionsProvider.PUB_HOMEPAGE_VALUE); + verify(clientCodegen).setSourceFolder(DartDioNextClientOptionsProvider.SOURCE_FOLDER_VALUE); + verify(clientCodegen).setUseEnumExtension(Boolean.parseBoolean(DartDioNextClientOptionsProvider.USE_ENUM_EXTENSION)); + verify(clientCodegen).setDateLibrary(DartDioNextClientCodegen.DATE_LIBRARY_DEFAULT); + verify(clientCodegen).setLibrary(DartDioNextClientCodegen.SERIALIZATION_LIBRARY_DEFAULT); + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioNextModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioNextModelTest.java new file mode 100644 index 000000000000..928647ae681a --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioNextModelTest.java @@ -0,0 +1,494 @@ +/* + * Copyright 2021 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.dart.dio; + +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.media.*; +import org.openapitools.codegen.*; +import org.openapitools.codegen.languages.DartDioNextClientCodegen; +import org.openapitools.codegen.languages.DartDioNextClientCodegen; +import org.testng.Assert; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +@SuppressWarnings("static-method") +public class DartDioNextModelTest { + + @Test(description = "convert a simple model") + public void simpleModelTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("id", new IntegerSchema()) + .addProperties("name", new StringSchema()) + .addProperties("createdAt", new DateTimeSchema()) + .addRequiredItem("id") + .addRequiredItem("name"); + final DefaultCodegen codegen = new DartDioNextClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 3); + // {{imports}} is not used in template + //Assert.assertEquals(cm.imports.size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "id"); + Assert.assertEquals(property1.dataType, "int"); + Assert.assertEquals(property1.name, "id"); + Assert.assertNull(property1.defaultValue); + Assert.assertEquals(property1.baseType, "int"); + Assert.assertTrue(property1.required); + Assert.assertTrue(property1.isPrimitiveType); + Assert.assertFalse(property1.isContainer); + + final CodegenProperty property2 = cm.vars.get(1); + Assert.assertEquals(property2.baseName, "name"); + Assert.assertEquals(property2.dataType, "String"); + Assert.assertEquals(property2.name, "name"); + Assert.assertNull(property2.defaultValue); + Assert.assertEquals(property2.baseType, "String"); + Assert.assertTrue(property2.required); + Assert.assertTrue(property2.isPrimitiveType); + Assert.assertFalse(property2.isContainer); + + final CodegenProperty property3 = cm.vars.get(2); + Assert.assertEquals(property3.baseName, "createdAt"); + Assert.assertEquals(property3.complexType, "DateTime"); + Assert.assertEquals(property3.dataType, "DateTime"); + Assert.assertEquals(property3.name, "createdAt"); + Assert.assertNull(property3.defaultValue); + Assert.assertEquals(property3.baseType, "DateTime"); + Assert.assertFalse(property3.required); + Assert.assertFalse(property3.isContainer); + } + + @Test(description = "convert a simple dart-dit model with datelibrary") + public void simpleModelWithTimeMachineTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("id", new IntegerSchema()) + .addProperties("name", new StringSchema()) + .addProperties("createdAt", new DateTimeSchema()) + .addProperties("birthDate", new DateSchema()) + .addRequiredItem("id") + .addRequiredItem("name"); + + final DartDioNextClientCodegen codegen = new DartDioNextClientCodegen(); + codegen.additionalProperties().put(DartDioNextClientCodegen.DATE_LIBRARY, DartDioNextClientCodegen.DATE_LIBRARY_TIME_MACHINE); + codegen.processOpts(); + + codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model)); + + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 4); + // {{imports}} is not used in template + //Assert.assertEquals(cm.imports.size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "id"); + Assert.assertEquals(property1.dataType, "int"); + Assert.assertEquals(property1.name, "id"); + Assert.assertNull(property1.defaultValue); + Assert.assertEquals(property1.baseType, "int"); + Assert.assertTrue(property1.required); + Assert.assertTrue(property1.isPrimitiveType); + Assert.assertFalse(property1.isContainer); + + final CodegenProperty property2 = cm.vars.get(1); + Assert.assertEquals(property2.baseName, "name"); + Assert.assertEquals(property2.dataType, "String"); + Assert.assertEquals(property2.name, "name"); + Assert.assertNull(property2.defaultValue); + Assert.assertEquals(property2.baseType, "String"); + Assert.assertTrue(property2.required); + Assert.assertTrue(property2.isPrimitiveType); + Assert.assertFalse(property2.isContainer); + + final CodegenProperty property3 = cm.vars.get(2); + Assert.assertEquals(property3.baseName, "createdAt"); + Assert.assertEquals(property3.complexType, "OffsetDateTime"); + Assert.assertEquals(property3.dataType, "OffsetDateTime"); + Assert.assertEquals(property3.name, "createdAt"); + Assert.assertNull(property3.defaultValue); + Assert.assertEquals(property3.baseType, "OffsetDateTime"); + Assert.assertFalse(property3.required); + Assert.assertFalse(property3.isContainer); + + final CodegenProperty property4 = cm.vars.get(3); + Assert.assertEquals(property4.baseName, "birthDate"); + Assert.assertEquals(property4.complexType, "OffsetDate"); + Assert.assertEquals(property4.dataType, "OffsetDate"); + Assert.assertEquals(property4.name, "birthDate"); + Assert.assertNull(property4.defaultValue); + Assert.assertEquals(property4.baseType, "OffsetDate"); + Assert.assertFalse(property4.required); + Assert.assertFalse(property4.isContainer); + } + + @Test(description = "convert a model with list property") + public void listPropertyTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("id", new IntegerSchema()) + .addProperties("urls", new ArraySchema() + .items(new StringSchema())) + .addRequiredItem("id"); + + final DefaultCodegen codegen = new DartDioNextClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE); + codegen.processOpts(); + + codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model)); + + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 2); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "id"); + Assert.assertEquals(property1.dataType, "int"); + Assert.assertEquals(property1.name, "id"); + Assert.assertNull(property1.defaultValue); + Assert.assertEquals(property1.baseType, "int"); + Assert.assertTrue(property1.required); + Assert.assertTrue(property1.isPrimitiveType); + Assert.assertFalse(property1.isContainer); + + final CodegenProperty property2 = cm.vars.get(1); + Assert.assertEquals(property2.baseName, "urls"); + Assert.assertEquals(property2.dataType, "BuiltList"); + Assert.assertEquals(property2.name, "urls"); + Assert.assertEquals(property2.baseType, "BuiltList"); + Assert.assertEquals(property2.containerType, "array"); + Assert.assertFalse(property2.required); + Assert.assertTrue(property2.isPrimitiveType); + Assert.assertTrue(property2.isContainer); + } + + @Test(description = "convert a model with set property") + public void setPropertyTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("id", new IntegerSchema()) + .addProperties("urls", new ArraySchema().items(new StringSchema()).uniqueItems(true)) + .addRequiredItem("id"); + + final DefaultCodegen codegen = new DartDioNextClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE); + codegen.processOpts(); + + codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model)); + + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 2); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "id"); + Assert.assertEquals(property1.dataType, "int"); + Assert.assertEquals(property1.name, "id"); + Assert.assertNull(property1.defaultValue); + Assert.assertEquals(property1.baseType, "int"); + Assert.assertTrue(property1.required); + Assert.assertTrue(property1.isPrimitiveType); + Assert.assertFalse(property1.isContainer); + + final CodegenProperty property2 = cm.vars.get(1); + Assert.assertEquals(property2.baseName, "urls"); + Assert.assertEquals(property2.dataType, "BuiltSet"); + Assert.assertEquals(property2.name, "urls"); + Assert.assertEquals(property2.baseType, "BuiltSet"); + Assert.assertEquals(property2.containerType, "set"); + Assert.assertFalse(property2.required); + Assert.assertTrue(property2.isPrimitiveType); + Assert.assertTrue(property2.isContainer); + } + + @Test(description = "convert a model with a map property") + public void mapPropertyTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("translations", new MapSchema() + .additionalProperties(new StringSchema())) + .addRequiredItem("id"); + + final DefaultCodegen codegen = new DartDioNextClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE); + codegen.processOpts(); + + codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model)); + + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "translations"); + Assert.assertEquals(property1.dataType, "BuiltMap"); + Assert.assertEquals(property1.name, "translations"); + Assert.assertEquals(property1.baseType, "BuiltMap"); + Assert.assertEquals(property1.containerType, "map"); + Assert.assertFalse(property1.required); + Assert.assertTrue(property1.isContainer); + Assert.assertTrue(property1.isPrimitiveType); + } + + @Test(description = "convert a model with complex property") + public void complexPropertyTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("children", new Schema().$ref("#/definitions/Children")); + + final DefaultCodegen codegen = new DartDioNextClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE); + codegen.processOpts(); + + codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model)); + + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "children"); + Assert.assertEquals(property1.dataType, "Children"); + Assert.assertEquals(property1.name, "children"); + Assert.assertEquals(property1.baseType, "Children"); + Assert.assertFalse(property1.required); + Assert.assertFalse(property1.isContainer); + } + + @Test(description = "convert a model with complex list property") + public void complexListProperty() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("children", new ArraySchema() + .items(new Schema().$ref("#/definitions/Children"))); + + final DefaultCodegen codegen = new DartDioNextClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE); + codegen.processOpts(); + + codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model)); + + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "children"); + Assert.assertEquals(property1.dataType, "BuiltList"); + Assert.assertEquals(property1.name, "children"); + Assert.assertEquals(property1.baseType, "BuiltList"); + Assert.assertEquals(property1.containerType, "array"); + Assert.assertFalse(property1.required); + Assert.assertTrue(property1.isContainer); + } + + @Test(description = "convert a model with complex map property") + public void complexMapSchema() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("children", new MapSchema() + .additionalProperties(new Schema().$ref("#/definitions/Children"))); + + final DefaultCodegen codegen = new DartDioNextClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE); + codegen.processOpts(); + + codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model)); + + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "children"); + Assert.assertEquals(property1.complexType, "Children"); + Assert.assertEquals(property1.dataType, "BuiltMap"); + Assert.assertEquals(property1.name, "children"); + Assert.assertEquals(property1.baseType, "BuiltMap"); + Assert.assertEquals(property1.containerType, "map"); + Assert.assertFalse(property1.required); + Assert.assertTrue(property1.isContainer); + } + + @Test(description = "convert an array model") + public void arrayModelTest() { + final Schema model = new ArraySchema() + .items(new Schema().$ref("#/definitions/Children")) + .description("an array model"); + final DefaultCodegen codegen = new DartDioNextClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(model.getDescription(), "an array model"); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertTrue(cm.isArray); + Assert.assertEquals(cm.description, "an array model"); + Assert.assertEquals(cm.vars.size(), 0); + } + + @Test(description = "convert a map model") + public void mapModelTest() { + final Schema model = new Schema() + .description("a map model") + .additionalProperties(new Schema().$ref("#/definitions/Children")); + final DefaultCodegen codegen = new DartDioNextClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a map model"); + Assert.assertEquals(cm.vars.size(), 0); + } + + @DataProvider(name = "modelNames") + public static Object[][] modelNames() { + return new Object[][] { + {"EnumClass", "ModelEnumClass"}, + {"JsonObject", "ModelJsonObject"}, + // OffsetDate is valid without timemachine date library + {"OffsetDate", "OffsetDate"}, + }; + } + + @Test(dataProvider = "modelNames", description = "correctly prefix reserved model names") + public void modelNameTest(String name, String expectedName) { + OpenAPI openAPI = TestUtils.createOpenAPI(); + final Schema model = new Schema(); + + final DefaultCodegen codegen = new DartDioNextClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE); + codegen.processOpts(); + + codegen.setOpenAPI(openAPI); + + final CodegenModel cm = codegen.fromModel(name, model); + + Assert.assertEquals(cm.name, name); + Assert.assertEquals(cm.classname, expectedName); + } + + @DataProvider(name = "modelNamesTimemachine") + public static Object[][] modelNamesTimemachine() { + return new Object[][] { + {"EnumClass", "ModelEnumClass"}, + {"JsonObject", "ModelJsonObject"}, + // OffsetDate is not valid with timemachine date library + {"OffsetDate", "ModelOffsetDate"}, + }; + } + + @Test(dataProvider = "modelNamesTimemachine", description = "correctly prefix reserved model names") + public void modelNameTestTimemachine(String name, String expectedName) { + OpenAPI openAPI = TestUtils.createOpenAPI(); + final Schema model = new Schema(); + final DartDioNextClientCodegen codegen = new DartDioNextClientCodegen(); + codegen.additionalProperties().put(DartDioNextClientCodegen.DATE_LIBRARY, DartDioNextClientCodegen.DATE_LIBRARY_TIME_MACHINE); + codegen.processOpts(); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel(name, model); + + Assert.assertEquals(cm.name, name); + Assert.assertEquals(cm.classname, expectedName); + } + + @Test(description = "correctly generate collection default values") + public void collectionDefaultValues() { + final ArraySchema array = new ArraySchema(); + array.setDefault("[]"); + final Schema model = new Schema() + .description("a sample model") + .addProperties("arrayNoDefault", new ArraySchema()) + .addProperties("arrayEmptyDefault", array) + .addProperties("mapNoDefault", new MapSchema()); + final DefaultCodegen codegen = new DartDioNextClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE); + codegen.setOpenAPI(TestUtils.createOpenAPIWithOneSchema("sample", model)); + codegen.processOpts(); + final CodegenModel cm = codegen.fromModel("sample", model); + + final CodegenProperty arrayNoDefault = cm.vars.get(0); + Assert.assertEquals(arrayNoDefault.name, "arrayNoDefault"); + Assert.assertNull(arrayNoDefault.defaultValue); + + final CodegenProperty arrayEmptyDefault = cm.vars.get(1); + Assert.assertEquals(arrayEmptyDefault.name, "arrayEmptyDefault"); + Assert.assertEquals(arrayEmptyDefault.defaultValue, "ListBuilder()"); + + final CodegenProperty mapNoDefault = cm.vars.get(2); + Assert.assertEquals(mapNoDefault.name, "mapNoDefault"); + Assert.assertNull(mapNoDefault.defaultValue); + } + + @Test(description = "correctly generate date/datetime default values, currently null") + public void dateDefaultValues() { + final DateSchema date = new DateSchema(); + date.setDefault("2021-01-01"); + final DateTimeSchema dateTime = new DateTimeSchema(); + dateTime.setDefault("2021-01-01T14:00:00Z"); + final Schema model = new Schema() + .description("a sample model") + .addProperties("date", date) + .addProperties("dateTime", dateTime) + .addProperties("mapNoDefault", new MapSchema()); + final DefaultCodegen codegen = new DartDioNextClientCodegen(); + OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model); + codegen.setOpenAPI(openAPI); + final CodegenModel cm = codegen.fromModel("sample", model); + + final CodegenProperty dateDefault = cm.vars.get(0); + Assert.assertEquals(dateDefault.name, "date"); + Assert.assertNull(dateDefault.defaultValue); + + final CodegenProperty dateTimeDefault = cm.vars.get(1); + Assert.assertEquals(dateTimeDefault.name, "dateTime"); + Assert.assertNull(dateTimeDefault.defaultValue); + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioClientOptionsProvider.java index 89186805c9c3..fa6bb3eeadb1 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioClientOptionsProvider.java @@ -31,7 +31,7 @@ public class DartDioClientOptionsProvider implements OptionsProvider { public static final String PUB_LIBRARY_VALUE = "openapi.api"; public static final String PUB_NAME_VALUE = "openapi"; public static final String PUB_VERSION_VALUE = "1.0.0-SNAPSHOT"; - public static final String PUB_DESCRIPTION_VALUE = "OpenAPI API client dart"; + public static final String PUB_DESCRIPTION_VALUE = "OpenAPI API client dart-dio"; public static final String SOURCE_FOLDER_VALUE = "src"; public static final String USE_ENUM_EXTENSION = "true"; public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false"; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioNextClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioNextClientOptionsProvider.java new file mode 100644 index 000000000000..b03f2a972142 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioNextClientOptionsProvider.java @@ -0,0 +1,74 @@ +/* + * Copyright 2021 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.options; + +import com.google.common.collect.ImmutableMap; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.languages.DartDioNextClientCodegen; + +import java.util.Map; + +public class DartDioNextClientOptionsProvider implements OptionsProvider { + public static final String SORT_PARAMS_VALUE = "true"; + public static final String SORT_MODEL_PROPERTIES_VALUE = "false"; + public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; + public static final String PUB_LIBRARY_VALUE = "openapi.api"; + public static final String PUB_NAME_VALUE = "openapi"; + public static final String PUB_VERSION_VALUE = "1.0.0-SNAPSHOT"; + public static final String PUB_DESCRIPTION_VALUE = "OpenAPI API client dart-dio"; + public static final String SOURCE_FOLDER_VALUE = "src"; + public static final String USE_ENUM_EXTENSION = "true"; + public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false"; + public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true"; + public static final String PUB_AUTHOR_VALUE = "Author"; + public static final String PUB_AUTHOR_EMAIL_VALUE = "author@homepage"; + public static final String PUB_HOMEPAGE_VALUE = "Homepage"; + + @Override + public String getLanguage() { + return "dart-dio-next"; + } + + @Override + public Map createOptions() { + ImmutableMap.Builder builder = new ImmutableMap.Builder(); + return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE) + .put(CodegenConstants.SORT_MODEL_PROPERTIES_BY_REQUIRED_FLAG, SORT_MODEL_PROPERTIES_VALUE) + .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) + .put(DartDioNextClientCodegen.PUB_LIBRARY, PUB_LIBRARY_VALUE) + .put(DartDioNextClientCodegen.PUB_NAME, PUB_NAME_VALUE) + .put(DartDioNextClientCodegen.PUB_VERSION, PUB_VERSION_VALUE) + .put(DartDioNextClientCodegen.PUB_DESCRIPTION, PUB_DESCRIPTION_VALUE) + .put(DartDioNextClientCodegen.PUB_AUTHOR, PUB_AUTHOR_VALUE) + .put(DartDioNextClientCodegen.PUB_AUTHOR_EMAIL, PUB_AUTHOR_EMAIL_VALUE) + .put(DartDioNextClientCodegen.PUB_HOMEPAGE, PUB_HOMEPAGE_VALUE) + .put(CodegenConstants.SERIALIZATION_LIBRARY, DartDioNextClientCodegen.SERIALIZATION_LIBRARY_DEFAULT) + .put(DartDioNextClientCodegen.DATE_LIBRARY, DartDioNextClientCodegen.DATE_LIBRARY_DEFAULT) + .put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE) + .put(DartDioNextClientCodegen.USE_ENUM_EXTENSION, USE_ENUM_EXTENSION) + .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) + .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE) + .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") + .put(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, "true") + .build(); + } + + @Override + public boolean isServer() { + return false; + } +} diff --git a/pom.xml b/pom.xml index 62231544063a..3edbb6452814 100644 --- a/pom.xml +++ b/pom.xml @@ -1360,6 +1360,7 @@ samples/client/petstore/dart-dio/petstore_client_lib samples/openapi3/client/petstore/dart-dio/petstore_client_lib samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake + samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake samples/client/petstore/dart-jaguar/openapi samples/client/petstore/dart-jaguar/flutter_petstore/openapi diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/README.md b/samples/client/petstore/dart-dio/petstore_client_lib/README.md index 88903d1f2fb8..5c483353f35f 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/README.md +++ b/samples/client/petstore/dart-dio/petstore_client_lib/README.md @@ -40,11 +40,11 @@ Please follow the [installation procedure](#installation--usage) and then run th import 'package:openapi/api.dart'; -var api_instance = new PetApi(); -var body = new Pet(); // Pet | Pet object that needs to be added to the store +final api = PetApi(); +final body = Pet(); // Pet | Pet object that needs to be added to the store try { - api_instance.addPet(body); + api.addPet(body); } catch (e) { print("Exception when calling PetApi->addPet: $e\n"); } @@ -57,36 +57,36 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*PetApi* | [**addPet**](doc//PetApi.md#addpet) | **post** /pet | Add a new pet to the store -*PetApi* | [**deletePet**](doc//PetApi.md#deletepet) | **delete** /pet/{petId} | Deletes a pet -*PetApi* | [**findPetsByStatus**](doc//PetApi.md#findpetsbystatus) | **get** /pet/findByStatus | Finds Pets by status -*PetApi* | [**findPetsByTags**](doc//PetApi.md#findpetsbytags) | **get** /pet/findByTags | Finds Pets by tags -*PetApi* | [**getPetById**](doc//PetApi.md#getpetbyid) | **get** /pet/{petId} | Find pet by ID -*PetApi* | [**updatePet**](doc//PetApi.md#updatepet) | **put** /pet | Update an existing pet -*PetApi* | [**updatePetWithForm**](doc//PetApi.md#updatepetwithform) | **post** /pet/{petId} | Updates a pet in the store with form data -*PetApi* | [**uploadFile**](doc//PetApi.md#uploadfile) | **post** /pet/{petId}/uploadImage | uploads an image -*StoreApi* | [**deleteOrder**](doc//StoreApi.md#deleteorder) | **delete** /store/order/{orderId} | Delete purchase order by ID -*StoreApi* | [**getInventory**](doc//StoreApi.md#getinventory) | **get** /store/inventory | Returns pet inventories by status -*StoreApi* | [**getOrderById**](doc//StoreApi.md#getorderbyid) | **get** /store/order/{orderId} | Find purchase order by ID -*StoreApi* | [**placeOrder**](doc//StoreApi.md#placeorder) | **post** /store/order | Place an order for a pet -*UserApi* | [**createUser**](doc//UserApi.md#createuser) | **post** /user | Create user -*UserApi* | [**createUsersWithArrayInput**](doc//UserApi.md#createuserswitharrayinput) | **post** /user/createWithArray | Creates list of users with given input array -*UserApi* | [**createUsersWithListInput**](doc//UserApi.md#createuserswithlistinput) | **post** /user/createWithList | Creates list of users with given input array -*UserApi* | [**deleteUser**](doc//UserApi.md#deleteuser) | **delete** /user/{username} | Delete user -*UserApi* | [**getUserByName**](doc//UserApi.md#getuserbyname) | **get** /user/{username} | Get user by user name -*UserApi* | [**loginUser**](doc//UserApi.md#loginuser) | **get** /user/login | Logs user into the system -*UserApi* | [**logoutUser**](doc//UserApi.md#logoutuser) | **get** /user/logout | Logs out current logged in user session -*UserApi* | [**updateUser**](doc//UserApi.md#updateuser) | **put** /user/{username} | Updated user +*PetApi* | [**addPet**](doc/PetApi.md#addpet) | **post** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](doc/PetApi.md#deletepet) | **delete** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](doc/PetApi.md#findpetsbystatus) | **get** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](doc/PetApi.md#findpetsbytags) | **get** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](doc/PetApi.md#getpetbyid) | **get** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](doc/PetApi.md#updatepet) | **put** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](doc/PetApi.md#updatepetwithform) | **post** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](doc/PetApi.md#uploadfile) | **post** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](doc/StoreApi.md#deleteorder) | **delete** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**getInventory**](doc/StoreApi.md#getinventory) | **get** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](doc/StoreApi.md#getorderbyid) | **get** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](doc/StoreApi.md#placeorder) | **post** /store/order | Place an order for a pet +*UserApi* | [**createUser**](doc/UserApi.md#createuser) | **post** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](doc/UserApi.md#createuserswitharrayinput) | **post** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](doc/UserApi.md#createuserswithlistinput) | **post** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](doc/UserApi.md#deleteuser) | **delete** /user/{username} | Delete user +*UserApi* | [**getUserByName**](doc/UserApi.md#getuserbyname) | **get** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](doc/UserApi.md#loginuser) | **get** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](doc/UserApi.md#logoutuser) | **get** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](doc/UserApi.md#updateuser) | **put** /user/{username} | Updated user ## Documentation For Models - - [ApiResponse](doc//ApiResponse.md) - - [Category](doc//Category.md) - - [Order](doc//Order.md) - - [Pet](doc//Pet.md) - - [Tag](doc//Tag.md) - - [User](doc//User.md) + - [ApiResponse](doc/ApiResponse.md) + - [Category](doc/Category.md) + - [Order](doc/Order.md) + - [Pet](doc/Pet.md) + - [Tag](doc/Tag.md) + - [User](doc/User.md) ## Documentation For Authorization diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md index 8957c2bbf079..215f67f8aef0 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md +++ b/samples/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md @@ -9,14 +9,14 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**addPet**](PetApi.md#addPet) | **post** /pet | Add a new pet to the store -[**deletePet**](PetApi.md#deletePet) | **delete** /pet/{petId} | Deletes a pet -[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **get** /pet/findByStatus | Finds Pets by status -[**findPetsByTags**](PetApi.md#findPetsByTags) | **get** /pet/findByTags | Finds Pets by tags -[**getPetById**](PetApi.md#getPetById) | **get** /pet/{petId} | Find pet by ID -[**updatePet**](PetApi.md#updatePet) | **put** /pet | Update an existing pet -[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **post** /pet/{petId} | Updates a pet in the store with form data -[**uploadFile**](PetApi.md#uploadFile) | **post** /pet/{petId}/uploadImage | uploads an image +[**addPet**](PetApi.md#addpet) | **post** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletepet) | **delete** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findpetsbystatus) | **get** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findpetsbytags) | **get** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getpetbyid) | **get** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatepet) | **put** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatepetwithform) | **post** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadfile) | **post** /pet/{petId}/uploadImage | uploads an image # **addPet** diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md index 011664d06e5a..89d99ff78b92 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md +++ b/samples/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md @@ -9,10 +9,10 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**deleteOrder**](StoreApi.md#deleteOrder) | **delete** /store/order/{orderId} | Delete purchase order by ID -[**getInventory**](StoreApi.md#getInventory) | **get** /store/inventory | Returns pet inventories by status -[**getOrderById**](StoreApi.md#getOrderById) | **get** /store/order/{orderId} | Find purchase order by ID -[**placeOrder**](StoreApi.md#placeOrder) | **post** /store/order | Place an order for a pet +[**deleteOrder**](StoreApi.md#deleteorder) | **delete** /store/order/{orderId} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getinventory) | **get** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getorderbyid) | **get** /store/order/{orderId} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeorder) | **post** /store/order | Place an order for a pet # **deleteOrder** diff --git a/samples/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md b/samples/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md index 9cdbae87963b..fa7bae08b773 100644 --- a/samples/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md +++ b/samples/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md @@ -9,14 +9,14 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**createUser**](UserApi.md#createUser) | **post** /user | Create user -[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **post** /user/createWithArray | Creates list of users with given input array -[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **post** /user/createWithList | Creates list of users with given input array -[**deleteUser**](UserApi.md#deleteUser) | **delete** /user/{username} | Delete user -[**getUserByName**](UserApi.md#getUserByName) | **get** /user/{username} | Get user by user name -[**loginUser**](UserApi.md#loginUser) | **get** /user/login | Logs user into the system -[**logoutUser**](UserApi.md#logoutUser) | **get** /user/logout | Logs out current logged in user session -[**updateUser**](UserApi.md#updateUser) | **put** /user/{username} | Updated user +[**createUser**](UserApi.md#createuser) | **post** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **post** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createuserswithlistinput) | **post** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteuser) | **delete** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getuserbyname) | **get** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginuser) | **get** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutuser) | **get** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateuser) | **put** /user/{username} | Updated user # **createUser** diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/PetApi.md b/samples/client/petstore/dart2/petstore_client_lib/doc/PetApi.md index 5342fcc3b7b2..04c78f1b4271 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/PetApi.md +++ b/samples/client/petstore/dart2/petstore_client_lib/doc/PetApi.md @@ -9,14 +9,14 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store -[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status -[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags -[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID -[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet -[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data -[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**addPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image # **addPet** diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md b/samples/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md index a3bec5de59f6..a8bd976dc5a3 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md +++ b/samples/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md @@ -9,10 +9,10 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status -[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID -[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +[**deleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet # **deleteOrder** diff --git a/samples/client/petstore/dart2/petstore_client_lib/doc/UserApi.md b/samples/client/petstore/dart2/petstore_client_lib/doc/UserApi.md index 711b6726a92e..e480f7e2aaec 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/doc/UserApi.md +++ b/samples/client/petstore/dart2/petstore_client_lib/doc/UserApi.md @@ -9,14 +9,14 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**createUser**](UserApi.md#createUser) | **POST** /user | Create user -[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array -[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array -[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user -[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name -[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system -[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session -[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user +[**createUser**](UserApi.md#createuser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user # **createUser** diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/.gitignore b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/.gitignore new file mode 100644 index 000000000000..8092a49d5152 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/.gitignore @@ -0,0 +1,37 @@ +# See https://dart.dev/guides/libraries/private-files + +# Files and directories created by pub +.dart_tool/ +.buildlog +.packages +.project +.pub/ +build/ +**/packages/ + +# Files created by dart2js +# (Most Dart developers will use pub build to compile Dart, use/modify these +# rules if you intend to use dart2js directly +# Convention is to use extension '.dart.js' for Dart compiled to Javascript to +# differentiate from explicit Javascript files) +*.dart.js +*.part.js +*.js.deps +*.js.map +*.info.json + +# Directory created by dartdoc +doc/api/ + +# Don't commit pubspec lock file +# (Library packages only! Remove pattern if developing an application package) +pubspec.lock + +# Don’t commit files and directories created by other development environments. +# For example, if your development environment creates any of the following files, +# consider putting them in a global ignore file: +*.iml // IntelliJ +*.ipr // IntelliJ +*.iws // IntelliJ +.idea/ // IntelliJ +.DS_Store // Mac diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/.openapi-generator-ignore b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/.openapi-generator/FILES new file mode 100644 index 000000000000..eb412a44146e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/.openapi-generator/FILES @@ -0,0 +1,114 @@ +.gitignore +README.md +analysis_options.yaml +doc/AdditionalPropertiesClass.md +doc/Animal.md +doc/AnotherFakeApi.md +doc/ApiResponse.md +doc/ArrayOfArrayOfNumberOnly.md +doc/ArrayOfNumberOnly.md +doc/ArrayTest.md +doc/Capitalization.md +doc/Cat.md +doc/CatAllOf.md +doc/Category.md +doc/ClassModel.md +doc/DefaultApi.md +doc/Dog.md +doc/DogAllOf.md +doc/EnumArrays.md +doc/EnumTest.md +doc/FakeApi.md +doc/FakeClassnameTags123Api.md +doc/FileSchemaTestClass.md +doc/Foo.md +doc/FormatTest.md +doc/HasOnlyReadOnly.md +doc/HealthCheckResult.md +doc/InlineResponseDefault.md +doc/MapTest.md +doc/MixedPropertiesAndAdditionalPropertiesClass.md +doc/Model200Response.md +doc/ModelClient.md +doc/ModelEnumClass.md +doc/ModelFile.md +doc/ModelList.md +doc/ModelReturn.md +doc/Name.md +doc/NullableClass.md +doc/NumberOnly.md +doc/Order.md +doc/OuterComposite.md +doc/OuterEnum.md +doc/OuterEnumDefaultValue.md +doc/OuterEnumInteger.md +doc/OuterEnumIntegerDefaultValue.md +doc/OuterObjectWithEnumProperty.md +doc/Pet.md +doc/PetApi.md +doc/ReadOnlyFirst.md +doc/SpecialModelName.md +doc/StoreApi.md +doc/Tag.md +doc/User.md +doc/UserApi.md +lib/openapi.dart +lib/src/api.dart +lib/src/api/another_fake_api.dart +lib/src/api/default_api.dart +lib/src/api/fake_api.dart +lib/src/api/fake_classname_tags123_api.dart +lib/src/api/pet_api.dart +lib/src/api/store_api.dart +lib/src/api/user_api.dart +lib/src/api_util.dart +lib/src/auth/api_key_auth.dart +lib/src/auth/auth.dart +lib/src/auth/basic_auth.dart +lib/src/auth/oauth.dart +lib/src/model/additional_properties_class.dart +lib/src/model/animal.dart +lib/src/model/api_response.dart +lib/src/model/array_of_array_of_number_only.dart +lib/src/model/array_of_number_only.dart +lib/src/model/array_test.dart +lib/src/model/capitalization.dart +lib/src/model/cat.dart +lib/src/model/cat_all_of.dart +lib/src/model/category.dart +lib/src/model/class_model.dart +lib/src/model/dog.dart +lib/src/model/dog_all_of.dart +lib/src/model/enum_arrays.dart +lib/src/model/enum_test.dart +lib/src/model/file_schema_test_class.dart +lib/src/model/foo.dart +lib/src/model/format_test.dart +lib/src/model/has_only_read_only.dart +lib/src/model/health_check_result.dart +lib/src/model/inline_response_default.dart +lib/src/model/map_test.dart +lib/src/model/mixed_properties_and_additional_properties_class.dart +lib/src/model/model200_response.dart +lib/src/model/model_client.dart +lib/src/model/model_enum_class.dart +lib/src/model/model_file.dart +lib/src/model/model_list.dart +lib/src/model/model_return.dart +lib/src/model/name.dart +lib/src/model/nullable_class.dart +lib/src/model/number_only.dart +lib/src/model/order.dart +lib/src/model/outer_composite.dart +lib/src/model/outer_enum.dart +lib/src/model/outer_enum_default_value.dart +lib/src/model/outer_enum_integer.dart +lib/src/model/outer_enum_integer_default_value.dart +lib/src/model/outer_object_with_enum_property.dart +lib/src/model/pet.dart +lib/src/model/read_only_first.dart +lib/src/model/special_model_name.dart +lib/src/model/tag.dart +lib/src/model/user.dart +lib/src/serializers.dart +pubspec.yaml diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/.openapi-generator/VERSION new file mode 100644 index 000000000000..c30f0ec2be7f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/README.md new file mode 100644 index 000000000000..8c94c359ed77 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/README.md @@ -0,0 +1,194 @@ +# openapi (EXPERIMENTAL) +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 +- Build package: org.openapitools.codegen.languages.DartDioNextClientCodegen + +## Requirements + +* Dart 2.12.0 or later OR Flutter 1.26.0 or later +* Dio 4.0.0+ +* timemachine option currently **DOES NOT** support sound null-safety and may not work + +## Installation & Usage + +### Github +If this Dart package is published to Github, please include the following in pubspec.yaml +``` +name: openapi +version: 1.0.0 +description: OpenAPI API client +dependencies: + openapi: + git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git + version: 'any' +``` + +### Local +To use the package in your local drive, please include the following in pubspec.yaml +``` +dependencies: + openapi: + path: /path/to/openapi +``` + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```dart +import 'package:openapi/openapi.dart'; + + +final api = AnotherFakeApi(); +final modelClient = ModelClient(); // ModelClient | client model + +try { + final response = await api.call123testSpecialTags(modelClient); + print(response); +} catch on DioError (e) { + print("Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n"); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**call123testSpecialTags**](doc/AnotherFakeApi.md#call123testspecialtags) | **patch** /another-fake/dummy | To test special tags +*DefaultApi* | [**fooGet**](doc/DefaultApi.md#fooget) | **get** /foo | +*FakeApi* | [**fakeHealthGet**](doc/FakeApi.md#fakehealthget) | **get** /fake/health | Health check endpoint +*FakeApi* | [**fakeHttpSignatureTest**](doc/FakeApi.md#fakehttpsignaturetest) | **get** /fake/http-signature-test | test http signature authentication +*FakeApi* | [**fakeOuterBooleanSerialize**](doc/FakeApi.md#fakeouterbooleanserialize) | **post** /fake/outer/boolean | +*FakeApi* | [**fakeOuterCompositeSerialize**](doc/FakeApi.md#fakeoutercompositeserialize) | **post** /fake/outer/composite | +*FakeApi* | [**fakeOuterNumberSerialize**](doc/FakeApi.md#fakeouternumberserialize) | **post** /fake/outer/number | +*FakeApi* | [**fakeOuterStringSerialize**](doc/FakeApi.md#fakeouterstringserialize) | **post** /fake/outer/string | +*FakeApi* | [**fakePropertyEnumIntegerSerialize**](doc/FakeApi.md#fakepropertyenumintegerserialize) | **post** /fake/property/enum-int | +*FakeApi* | [**testBodyWithFileSchema**](doc/FakeApi.md#testbodywithfileschema) | **put** /fake/body-with-file-schema | +*FakeApi* | [**testBodyWithQueryParams**](doc/FakeApi.md#testbodywithqueryparams) | **put** /fake/body-with-query-params | +*FakeApi* | [**testClientModel**](doc/FakeApi.md#testclientmodel) | **patch** /fake | To test \"client\" model +*FakeApi* | [**testEndpointParameters**](doc/FakeApi.md#testendpointparameters) | **post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**testEnumParameters**](doc/FakeApi.md#testenumparameters) | **get** /fake | To test enum parameters +*FakeApi* | [**testGroupParameters**](doc/FakeApi.md#testgroupparameters) | **delete** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**testInlineAdditionalProperties**](doc/FakeApi.md#testinlineadditionalproperties) | **post** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**testJsonFormData**](doc/FakeApi.md#testjsonformdata) | **get** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**testQueryParameterCollectionFormat**](doc/FakeApi.md#testqueryparametercollectionformat) | **put** /fake/test-query-paramters | +*FakeClassnameTags123Api* | [**testClassname**](doc/FakeClassnameTags123Api.md#testclassname) | **patch** /fake_classname_test | To test class name in snake case +*PetApi* | [**addPet**](doc/PetApi.md#addpet) | **post** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](doc/PetApi.md#deletepet) | **delete** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](doc/PetApi.md#findpetsbystatus) | **get** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](doc/PetApi.md#findpetsbytags) | **get** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](doc/PetApi.md#getpetbyid) | **get** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](doc/PetApi.md#updatepet) | **put** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](doc/PetApi.md#updatepetwithform) | **post** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](doc/PetApi.md#uploadfile) | **post** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithRequiredFile**](doc/PetApi.md#uploadfilewithrequiredfile) | **post** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**deleteOrder**](doc/StoreApi.md#deleteorder) | **delete** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**getInventory**](doc/StoreApi.md#getinventory) | **get** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](doc/StoreApi.md#getorderbyid) | **get** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**placeOrder**](doc/StoreApi.md#placeorder) | **post** /store/order | Place an order for a pet +*UserApi* | [**createUser**](doc/UserApi.md#createuser) | **post** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](doc/UserApi.md#createuserswitharrayinput) | **post** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](doc/UserApi.md#createuserswithlistinput) | **post** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](doc/UserApi.md#deleteuser) | **delete** /user/{username} | Delete user +*UserApi* | [**getUserByName**](doc/UserApi.md#getuserbyname) | **get** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](doc/UserApi.md#loginuser) | **get** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](doc/UserApi.md#logoutuser) | **get** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](doc/UserApi.md#updateuser) | **put** /user/{username} | Updated user + + +## Documentation For Models + + - [AdditionalPropertiesClass](doc/AdditionalPropertiesClass.md) + - [Animal](doc/Animal.md) + - [ApiResponse](doc/ApiResponse.md) + - [ArrayOfArrayOfNumberOnly](doc/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](doc/ArrayOfNumberOnly.md) + - [ArrayTest](doc/ArrayTest.md) + - [Capitalization](doc/Capitalization.md) + - [Cat](doc/Cat.md) + - [CatAllOf](doc/CatAllOf.md) + - [Category](doc/Category.md) + - [ClassModel](doc/ClassModel.md) + - [Dog](doc/Dog.md) + - [DogAllOf](doc/DogAllOf.md) + - [EnumArrays](doc/EnumArrays.md) + - [EnumTest](doc/EnumTest.md) + - [FileSchemaTestClass](doc/FileSchemaTestClass.md) + - [Foo](doc/Foo.md) + - [FormatTest](doc/FormatTest.md) + - [HasOnlyReadOnly](doc/HasOnlyReadOnly.md) + - [HealthCheckResult](doc/HealthCheckResult.md) + - [InlineResponseDefault](doc/InlineResponseDefault.md) + - [MapTest](doc/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](doc/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](doc/Model200Response.md) + - [ModelClient](doc/ModelClient.md) + - [ModelEnumClass](doc/ModelEnumClass.md) + - [ModelFile](doc/ModelFile.md) + - [ModelList](doc/ModelList.md) + - [ModelReturn](doc/ModelReturn.md) + - [Name](doc/Name.md) + - [NullableClass](doc/NullableClass.md) + - [NumberOnly](doc/NumberOnly.md) + - [Order](doc/Order.md) + - [OuterComposite](doc/OuterComposite.md) + - [OuterEnum](doc/OuterEnum.md) + - [OuterEnumDefaultValue](doc/OuterEnumDefaultValue.md) + - [OuterEnumInteger](doc/OuterEnumInteger.md) + - [OuterEnumIntegerDefaultValue](doc/OuterEnumIntegerDefaultValue.md) + - [OuterObjectWithEnumProperty](doc/OuterObjectWithEnumProperty.md) + - [Pet](doc/Pet.md) + - [ReadOnlyFirst](doc/ReadOnlyFirst.md) + - [SpecialModelName](doc/SpecialModelName.md) + - [Tag](doc/Tag.md) + - [User](doc/User.md) + + +## Documentation For Authorization + + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +## api_key_query + +- **Type**: API key +- **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 + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets + + +## Author + + + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/analysis_options.yaml b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/analysis_options.yaml new file mode 100644 index 000000000000..a611887d3acf --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/analysis_options.yaml @@ -0,0 +1,9 @@ +analyzer: + language: + strict-inference: true + strict-raw-types: true + strong-mode: + implicit-dynamic: false + implicit-casts: false + exclude: + - test/*.dart diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..5443d024fd25 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/AdditionalPropertiesClass.md @@ -0,0 +1,16 @@ +# openapi.model.AdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapProperty** | **BuiltMap** | | [optional] +**mapOfMapProperty** | [**BuiltMap>**](BuiltMap.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Animal.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Animal.md new file mode 100644 index 000000000000..415b56e9bc2e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Animal.md @@ -0,0 +1,16 @@ +# openapi.model.Animal + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to 'red'] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/AnotherFakeApi.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/AnotherFakeApi.md new file mode 100644 index 000000000000..d55663297c13 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/AnotherFakeApi.md @@ -0,0 +1,57 @@ +# openapi.api.AnotherFakeApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**call123testSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **patch** /another-fake/dummy | To test special tags + + +# **call123testSpecialTags** +> ModelClient call123testSpecialTags(modelClient) + +To test special tags + +To test special tags and operation ID starting with number + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new AnotherFakeApi(); +var modelClient = new ModelClient(); // ModelClient | client model + +try { + var result = api_instance.call123testSpecialTags(modelClient); + print(result); +} catch (e) { + print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **modelClient** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ApiResponse.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ApiResponse.md new file mode 100644 index 000000000000..7ad5da0f89e4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ApiResponse.md @@ -0,0 +1,17 @@ +# openapi.model.ApiResponse + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..0a9d69c7e3cb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayArrayNumber** | [**BuiltList>**](BuiltList.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ArrayOfNumberOnly.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..6ffe36730c25 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayNumber** | **BuiltList** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ArrayTest.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ArrayTest.md new file mode 100644 index 000000000000..fc38f8ae52d5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ArrayTest.md @@ -0,0 +1,17 @@ +# openapi.model.ArrayTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayOfString** | **BuiltList** | | [optional] +**arrayArrayOfInteger** | [**BuiltList>**](BuiltList.md) | | [optional] +**arrayArrayOfModel** | [**BuiltList>**](BuiltList.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Capitalization.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Capitalization.md new file mode 100644 index 000000000000..4a07b4eb820d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Capitalization.md @@ -0,0 +1,20 @@ +# openapi.model.Capitalization + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**smallCamel** | **String** | | [optional] +**capitalCamel** | **String** | | [optional] +**smallSnake** | **String** | | [optional] +**capitalSnake** | **String** | | [optional] +**sCAETHFlowPoints** | **String** | | [optional] +**ATT_NAME** | **String** | Name of the pet | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Cat.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Cat.md new file mode 100644 index 000000000000..6552eea4b435 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Cat.md @@ -0,0 +1,17 @@ +# openapi.model.Cat + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to 'red'] +**declawed** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/CatAllOf.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/CatAllOf.md new file mode 100644 index 000000000000..36b2ae0e8ab3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/CatAllOf.md @@ -0,0 +1,15 @@ +# openapi.model.CatAllOf + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Category.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Category.md new file mode 100644 index 000000000000..ae6bc52e89d8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Category.md @@ -0,0 +1,16 @@ +# openapi.model.Category + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **String** | | [default to 'default-name'] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ClassModel.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ClassModel.md new file mode 100644 index 000000000000..13ae5d3a4708 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ClassModel.md @@ -0,0 +1,15 @@ +# openapi.model.ClassModel + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/DefaultApi.md new file mode 100644 index 000000000000..be916c3037d5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/DefaultApi.md @@ -0,0 +1,51 @@ +# openapi.api.DefaultApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +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 +```dart +import 'package:openapi/api.dart'; + +var api_instance = new DefaultApi(); + +try { + var result = api_instance.fooGet(); + print(result); +} catch (e) { + print('Exception when calling DefaultApi->fooGet: $e\n'); +} +``` + +### 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 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Dog.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Dog.md new file mode 100644 index 000000000000..d36439b767bb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Dog.md @@ -0,0 +1,17 @@ +# openapi.model.Dog + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to 'red'] +**breed** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/DogAllOf.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/DogAllOf.md new file mode 100644 index 000000000000..97a7c8fba492 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/DogAllOf.md @@ -0,0 +1,15 @@ +# openapi.model.DogAllOf + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/EnumArrays.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/EnumArrays.md new file mode 100644 index 000000000000..9cc4d727b2a9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/EnumArrays.md @@ -0,0 +1,16 @@ +# openapi.model.EnumArrays + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justSymbol** | **String** | | [optional] +**arrayEnum** | **BuiltList** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/EnumTest.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/EnumTest.md new file mode 100644 index 000000000000..7c24fe2347b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/EnumTest.md @@ -0,0 +1,22 @@ +# openapi.model.EnumTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumString** | **String** | | [optional] +**enumStringRequired** | **String** | | +**enumInteger** | **int** | | [optional] +**enumNumber** | **double** | | [optional] +**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] +**outerEnumInteger** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] +**outerEnumDefaultValue** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] +**outerEnumIntegerDefaultValue** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/FakeApi.md new file mode 100644 index 000000000000..41ab4e4fc126 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/FakeApi.md @@ -0,0 +1,769 @@ +# openapi.api.FakeApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fakeHealthGet**](FakeApi.md#fakehealthget) | **get** /fake/health | Health check endpoint +[**fakeHttpSignatureTest**](FakeApi.md#fakehttpsignaturetest) | **get** /fake/http-signature-test | test http signature authentication +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **post** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **post** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **post** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **post** /fake/outer/string | +[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **post** /fake/property/enum-int | +[**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 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**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 +[**testJsonFormData**](FakeApi.md#testjsonformdata) | **get** /fake/jsonFormData | test json serialization of form data +[**testQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **put** /fake/test-query-paramters | + + +# **fakeHealthGet** +> HealthCheckResult fakeHealthGet() + +Health check endpoint + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); + +try { + var result = api_instance.fakeHealthGet(); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeHealthGet: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakeHttpSignatureTest** +> fakeHttpSignatureTest(pet, query1, header1) + +test http signature authentication + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure HTTP basic authorization: http_signature_test +//defaultApiClient.getAuthentication('http_signature_test').username = 'YOUR_USERNAME' +//defaultApiClient.getAuthentication('http_signature_test').password = 'YOUR_PASSWORD'; + +var api_instance = new FakeApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store +var query1 = query1_example; // String | query parameter +var header1 = header1_example; // String | header parameter + +try { + api_instance.fakeHttpSignatureTest(pet, query1, header1); +} catch (e) { + print('Exception when calling FakeApi->fakeHttpSignatureTest: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **query1** | **String**| query parameter | [optional] + **header1** | **String**| header parameter | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakeOuterBooleanSerialize** +> bool fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var body = new bool(); // bool | Input boolean as post body + +try { + var result = api_instance.fakeOuterBooleanSerialize(body); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeOuterBooleanSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **bool**| Input boolean as post body | [optional] + +### Return type + +**bool** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(outerComposite) + + + +Test serialization of object with outer number type + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var outerComposite = new OuterComposite(); // OuterComposite | Input composite as post body + +try { + var result = api_instance.fakeOuterCompositeSerialize(outerComposite); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeOuterCompositeSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakeOuterNumberSerialize** +> num fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var body = new num(); // num | Input number as post body + +try { + var result = api_instance.fakeOuterNumberSerialize(body); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeOuterNumberSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **num**| Input number as post body | [optional] + +### Return type + +**num** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var body = new String(); // String | Input string as post body + +try { + var result = api_instance.fakeOuterStringSerialize(body); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeOuterStringSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **String**| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakePropertyEnumIntegerSerialize** +> OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty) + + + +Test serialization of enum (int) properties with examples + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var outerObjectWithEnumProperty = new OuterObjectWithEnumProperty(); // OuterObjectWithEnumProperty | Input enum (int) as post body + +try { + var result = api_instance.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakePropertyEnumIntegerSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outerObjectWithEnumProperty** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | + +### Return type + +[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testBodyWithFileSchema** +> testBodyWithFileSchema(fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + +try { + api_instance.testBodyWithFileSchema(fileSchemaTestClass); +} catch (e) { + print('Exception when calling FakeApi->testBodyWithFileSchema: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(query, user) + + + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var query = query_example; // String | +var user = new User(); // User | + +try { + api_instance.testBodyWithQueryParams(query, user); +} catch (e) { + print('Exception when calling FakeApi->testBodyWithQueryParams: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | **String**| | + **user** | [**User**](User.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testClientModel** +> ModelClient testClientModel(modelClient) + +To test \"client\" model + +To test \"client\" model + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var modelClient = new ModelClient(); // ModelClient | client model + +try { + var result = api_instance.testClientModel(modelClient); + print(result); +} catch (e) { + print('Exception when calling FakeApi->testClientModel: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **modelClient** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testEndpointParameters** +> testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure HTTP basic authorization: http_basic_test +//defaultApiClient.getAuthentication('http_basic_test').username = 'YOUR_USERNAME' +//defaultApiClient.getAuthentication('http_basic_test').password = 'YOUR_PASSWORD'; + +var api_instance = new FakeApi(); +var number = 8.14; // num | None +var double_ = 1.2; // double | None +var patternWithoutDelimiter = patternWithoutDelimiter_example; // String | None +var byte = BYTE_ARRAY_DATA_HERE; // String | None +var integer = 56; // int | None +var int32 = 56; // int | None +var int64 = 789; // int | None +var float = 3.4; // double | None +var string = string_example; // String | None +var binary = BINARY_DATA_HERE; // Uint8List | None +var date = 2013-10-20; // DateTime | None +var dateTime = 2013-10-20T19:20:30+01:00; // DateTime | None +var password = password_example; // String | None +var callback = callback_example; // String | None + +try { + api_instance.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); +} catch (e) { + print('Exception when calling FakeApi->testEndpointParameters: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **num**| None | + **double_** | **double**| None | + **patternWithoutDelimiter** | **String**| None | + **byte** | **String**| None | + **integer** | **int**| None | [optional] + **int32** | **int**| None | [optional] + **int64** | **int**| None | [optional] + **float** | **double**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **Uint8List**| None | [optional] + **date** | **DateTime**| None | [optional] + **dateTime** | **DateTime**| None | [optional] + **password** | **String**| None | [optional] + **callback** | **String**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testEnumParameters** +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var enumHeaderStringArray = []; // BuiltList | Header parameter enum test (string array) +var enumHeaderString = enumHeaderString_example; // String | Header parameter enum test (string) +var enumQueryStringArray = []; // BuiltList | Query parameter enum test (string array) +var enumQueryString = enumQueryString_example; // String | Query parameter enum test (string) +var enumQueryInteger = 56; // int | Query parameter enum test (double) +var enumQueryDouble = 1.2; // double | Query parameter enum test (double) +var enumFormStringArray = [enumFormStringArray_example]; // BuiltList | Form parameter enum test (string array) +var enumFormString = enumFormString_example; // String | Form parameter enum test (string) + +try { + api_instance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); +} catch (e) { + print('Exception when calling FakeApi->testEnumParameters: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**BuiltList**](String.md)| Header parameter enum test (string array) | [optional] + **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to '-efg'] + **enumQueryStringArray** | [**BuiltList**](String.md)| Query parameter enum test (string array) | [optional] + **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to '-efg'] + **enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] + **enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] + **enumFormStringArray** | [**BuiltList**](String.md)| Form parameter enum test (string array) | [optional] [default to '$'] + **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to '-efg'] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testGroupParameters** +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure HTTP basic authorization: bearer_test +//defaultApiClient.getAuthentication('bearer_test').username = 'YOUR_USERNAME' +//defaultApiClient.getAuthentication('bearer_test').password = 'YOUR_PASSWORD'; + +var api_instance = new FakeApi(); +var requiredStringGroup = 56; // int | Required String in group parameters +var requiredBooleanGroup = true; // bool | Required Boolean in group parameters +var requiredInt64Group = 789; // int | Required Integer in group parameters +var stringGroup = 56; // int | String in group parameters +var booleanGroup = true; // bool | Boolean in group parameters +var int64Group = 789; // int | Integer in group parameters + +try { + api_instance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); +} catch (e) { + print('Exception when calling FakeApi->testGroupParameters: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requiredStringGroup** | **int**| Required String in group parameters | + **requiredBooleanGroup** | **bool**| Required Boolean in group parameters | + **requiredInt64Group** | **int**| Required Integer in group parameters | + **stringGroup** | **int**| String in group parameters | [optional] + **booleanGroup** | **bool**| Boolean in group parameters | [optional] + **int64Group** | **int**| Integer in group parameters | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[bearer_test](../README.md#bearer_test) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testInlineAdditionalProperties** +> testInlineAdditionalProperties(requestBody) + +test inline additionalProperties + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var requestBody = new BuiltMap(); // BuiltMap | request body + +try { + api_instance.testInlineAdditionalProperties(requestBody); +} catch (e) { + print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**BuiltMap**](String.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testJsonFormData** +> testJsonFormData(param, param2) + +test json serialization of form data + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var param = param_example; // String | field1 +var param2 = param2_example; // String | field2 + +try { + api_instance.testJsonFormData(param, param2); +} catch (e) { + print('Exception when calling FakeApi->testJsonFormData: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **String**| field1 | + **param2** | **String**| field2 | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testQueryParameterCollectionFormat** +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) + + + +To test the collection format in query parameters + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new FakeApi(); +var pipe = []; // BuiltList | +var ioutil = []; // BuiltList | +var http = []; // BuiltList | +var url = []; // BuiltList | +var context = []; // BuiltList | + +try { + api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); +} catch (e) { + print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pipe** | [**BuiltList**](String.md)| | + **ioutil** | [**BuiltList**](String.md)| | + **http** | [**BuiltList**](String.md)| | + **url** | [**BuiltList**](String.md)| | + **context** | [**BuiltList**](String.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..9745ca8e3ffe --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md @@ -0,0 +1,61 @@ +# openapi.api.FakeClassnameTags123Api + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testclassname) | **patch** /fake_classname_test | To test class name in snake case + + +# **testClassname** +> ModelClient testClassname(modelClient) + +To test class name in snake case + +To test class name in snake case + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key_query +//defaultApiClient.getAuthentication('api_key_query').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key_query').apiKeyPrefix = 'Bearer'; + +var api_instance = new FakeClassnameTags123Api(); +var modelClient = new ModelClient(); // ModelClient | client model + +try { + var result = api_instance.testClassname(modelClient); + print(result); +} catch (e) { + print('Exception when calling FakeClassnameTags123Api->testClassname: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **modelClient** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/FileSchemaTestClass.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/FileSchemaTestClass.md new file mode 100644 index 000000000000..9b7eebcb2bf1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/FileSchemaTestClass.md @@ -0,0 +1,16 @@ +# openapi.model.FileSchemaTestClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**ModelFile**](ModelFile.md) | | [optional] +**files** | [**BuiltList**](ModelFile.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Foo.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Foo.md new file mode 100644 index 000000000000..185b76e3f5b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Foo.md @@ -0,0 +1,15 @@ +# openapi.model.Foo + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [default to 'bar'] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/FormatTest.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/FormatTest.md new file mode 100644 index 000000000000..7cac4e3b6be1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/FormatTest.md @@ -0,0 +1,30 @@ +# openapi.model.FormatTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | | [optional] +**int32** | **int** | | [optional] +**int64** | **int** | | [optional] +**number** | **num** | | +**float** | **double** | | [optional] +**double_** | **double** | | [optional] +**decimal** | **double** | | [optional] +**string** | **String** | | [optional] +**byte** | **String** | | +**binary** | [**Uint8List**](Uint8List.md) | | [optional] +**date** | [**DateTime**](DateTime.md) | | +**dateTime** | [**DateTime**](DateTime.md) | | [optional] +**uuid** | **String** | | [optional] +**password** | **String** | | +**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] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/HasOnlyReadOnly.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/HasOnlyReadOnly.md new file mode 100644 index 000000000000..32cae937155d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/HasOnlyReadOnly.md @@ -0,0 +1,16 @@ +# openapi.model.HasOnlyReadOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] +**foo** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/HealthCheckResult.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/HealthCheckResult.md new file mode 100644 index 000000000000..4d6aeb75d965 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/HealthCheckResult.md @@ -0,0 +1,15 @@ +# openapi.model.HealthCheckResult + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nullableMessage** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/InlineResponseDefault.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/InlineResponseDefault.md new file mode 100644 index 000000000000..c5e61e1162bf --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/InlineResponseDefault.md @@ -0,0 +1,15 @@ +# openapi.model.InlineResponseDefault + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/MapTest.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/MapTest.md new file mode 100644 index 000000000000..2da739ba8b83 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/MapTest.md @@ -0,0 +1,18 @@ +# openapi.model.MapTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapMapOfString** | [**BuiltMap>**](BuiltMap.md) | | [optional] +**mapOfEnumString** | **BuiltMap** | | [optional] +**directMap** | **BuiltMap** | | [optional] +**indirectMap** | **BuiltMap** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..f50d97687517 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,17 @@ +# openapi.model.MixedPropertiesAndAdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **String** | | [optional] +**dateTime** | [**DateTime**](DateTime.md) | | [optional] +**map** | [**BuiltMap**](Animal.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Model200Response.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Model200Response.md new file mode 100644 index 000000000000..5aa3fb97c32e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Model200Response.md @@ -0,0 +1,16 @@ +# openapi.model.Model200Response + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | [optional] +**class_** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ModelClient.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ModelClient.md new file mode 100644 index 000000000000..f7b922f4a398 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ModelClient.md @@ -0,0 +1,15 @@ +# openapi.model.ModelClient + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ModelEnumClass.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ModelEnumClass.md new file mode 100644 index 000000000000..ebaafb44c7f7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ModelEnumClass.md @@ -0,0 +1,14 @@ +# openapi.model.ModelEnumClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ModelFile.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ModelFile.md new file mode 100644 index 000000000000..4be260e93f6e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ModelFile.md @@ -0,0 +1,15 @@ +# openapi.model.ModelFile + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sourceURI** | **String** | Test capitalization | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ModelList.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ModelList.md new file mode 100644 index 000000000000..283aa1f6b711 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ModelList.md @@ -0,0 +1,15 @@ +# openapi.model.ModelList + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**n123list** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ModelReturn.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ModelReturn.md new file mode 100644 index 000000000000..bc02df7a3692 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ModelReturn.md @@ -0,0 +1,15 @@ +# openapi.model.ModelReturn + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**return_** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Name.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Name.md new file mode 100644 index 000000000000..25f49ea946b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Name.md @@ -0,0 +1,18 @@ +# openapi.model.Name + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | +**snakeCase** | **int** | | [optional] +**property** | **String** | | [optional] +**n123number** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/NullableClass.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/NullableClass.md new file mode 100644 index 000000000000..a9694f846c55 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/NullableClass.md @@ -0,0 +1,26 @@ +# openapi.model.NullableClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integerProp** | **int** | | [optional] +**numberProp** | **num** | | [optional] +**booleanProp** | **bool** | | [optional] +**stringProp** | **String** | | [optional] +**dateProp** | [**DateTime**](DateTime.md) | | [optional] +**datetimeProp** | [**DateTime**](DateTime.md) | | [optional] +**arrayNullableProp** | [**BuiltList**](JsonObject.md) | | [optional] +**arrayAndItemsNullableProp** | [**BuiltList**](JsonObject.md) | | [optional] +**arrayItemsNullable** | [**BuiltList**](JsonObject.md) | | [optional] +**objectNullableProp** | [**BuiltMap**](JsonObject.md) | | [optional] +**objectAndItemsNullableProp** | [**BuiltMap**](JsonObject.md) | | [optional] +**objectItemsNullable** | [**BuiltMap**](JsonObject.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/NumberOnly.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/NumberOnly.md new file mode 100644 index 000000000000..d8096a3db37a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/NumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.NumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justNumber** | **num** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Order.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Order.md new file mode 100644 index 000000000000..bde5ffe51a2c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Order.md @@ -0,0 +1,20 @@ +# openapi.model.Order + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**petId** | **int** | | [optional] +**quantity** | **int** | | [optional] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] +**status** | **String** | Order Status | [optional] +**complete** | **bool** | | [optional] [default to false] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/OuterComposite.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/OuterComposite.md new file mode 100644 index 000000000000..04bab7eff5d1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/OuterComposite.md @@ -0,0 +1,17 @@ +# openapi.model.OuterComposite + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | **num** | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/OuterEnum.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/OuterEnum.md new file mode 100644 index 000000000000..af62ad87ab2e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/OuterEnum.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnum + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/OuterEnumDefaultValue.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..c1bf8b0dec44 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/OuterEnumDefaultValue.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumDefaultValue + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/OuterEnumInteger.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/OuterEnumInteger.md new file mode 100644 index 000000000000..8c80a9e5c85f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/OuterEnumInteger.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumInteger + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..eb8b55d70249 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumIntegerDefaultValue + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/OuterObjectWithEnumProperty.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/OuterObjectWithEnumProperty.md new file mode 100644 index 000000000000..eab2ae8f66b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/OuterObjectWithEnumProperty.md @@ -0,0 +1,15 @@ +# openapi.model.OuterObjectWithEnumProperty + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | [**OuterEnumInteger**](OuterEnumInteger.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Pet.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Pet.md new file mode 100644 index 000000000000..3640640df190 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Pet.md @@ -0,0 +1,20 @@ +# openapi.model.Pet + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **BuiltSet** | | +**tags** | [**BuiltList**](Tag.md) | | [optional] +**status** | **String** | pet status in the store | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/PetApi.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/PetApi.md new file mode 100644 index 000000000000..d5a07d5046e2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/PetApi.md @@ -0,0 +1,427 @@ +# openapi.api.PetApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addPet**](PetApi.md#addpet) | **post** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletepet) | **delete** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findpetsbystatus) | **get** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findpetsbytags) | **get** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getpetbyid) | **get** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatepet) | **put** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatepetwithform) | **post** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadfile) | **post** /pet/{petId}/uploadImage | uploads an image +[**uploadFileWithRequiredFile**](PetApi.md#uploadfilewithrequiredfile) | **post** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) + + +# **addPet** +> addPet(pet) + +Add a new pet to the store + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.addPet(pet); +} catch (e) { + print('Exception when calling PetApi->addPet: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | Pet id to delete +var apiKey = apiKey_example; // String | + +try { + api_instance.deletePet(petId, apiKey); +} catch (e) { + print('Exception when calling PetApi->deletePet: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| Pet id to delete | + **apiKey** | **String**| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **findPetsByStatus** +> BuiltList findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var status = []; // BuiltList | Status values that need to be considered for filter + +try { + var result = api_instance.findPetsByStatus(status); + print(result); +} catch (e) { + print('Exception when calling PetApi->findPetsByStatus: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**BuiltList**](String.md)| Status values that need to be considered for filter | + +### Return type + +[**BuiltList**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **findPetsByTags** +> BuiltSet findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var tags = []; // BuiltSet | Tags to filter by + +try { + var result = api_instance.findPetsByTags(tags); + print(result); +} catch (e) { + print('Exception when calling PetApi->findPetsByTags: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**BuiltSet**](String.md)| Tags to filter by | + +### Return type + +[**BuiltSet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet to return + +try { + var result = api_instance.getPetById(petId); + print(result); +} catch (e) { + print('Exception when calling PetApi->getPetById: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **updatePet** +> updatePet(pet) + +Update an existing pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.updatePet(pet); +} catch (e) { + print('Exception when calling PetApi->updatePet: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet that needs to be updated +var name = name_example; // String | Updated name of the pet +var status = status_example; // String | Updated status of the pet + +try { + api_instance.updatePetWithForm(petId, name, status); +} catch (e) { + print('Exception when calling PetApi->updatePetWithForm: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet that needs to be updated | + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **uploadFile** +> ApiResponse uploadFile(petId, additionalMetadata, file) + +uploads an image + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet to update +var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server +var file = BINARY_DATA_HERE; // Uint8List | file to upload + +try { + var result = api_instance.uploadFile(petId, additionalMetadata, file); + print(result); +} catch (e) { + print('Exception when calling PetApi->uploadFile: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **Uint8List**| file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **uploadFileWithRequiredFile** +> ApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + +uploads an image (required) + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet to update +var requiredFile = BINARY_DATA_HERE; // Uint8List | file to upload +var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server + +try { + var result = api_instance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + print(result); +} catch (e) { + print('Exception when calling PetApi->uploadFileWithRequiredFile: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | + **requiredFile** | **Uint8List**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ReadOnlyFirst.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ReadOnlyFirst.md new file mode 100644 index 000000000000..8f612e8ba19f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/ReadOnlyFirst.md @@ -0,0 +1,16 @@ +# openapi.model.ReadOnlyFirst + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] +**baz** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/SpecialModelName.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/SpecialModelName.md new file mode 100644 index 000000000000..5fcfa98e0b36 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/SpecialModelName.md @@ -0,0 +1,15 @@ +# openapi.model.SpecialModelName + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/StoreApi.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/StoreApi.md new file mode 100644 index 000000000000..1fcb8f71eea9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/StoreApi.md @@ -0,0 +1,186 @@ +# openapi.api.StoreApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteOrder**](StoreApi.md#deleteorder) | **delete** /store/order/{order_id} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getinventory) | **get** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getorderbyid) | **get** /store/order/{order_id} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeorder) | **post** /store/order | Place an order for a pet + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new StoreApi(); +var orderId = orderId_example; // String | ID of the order that needs to be deleted + +try { + api_instance.deleteOrder(orderId); +} catch (e) { + print('Exception when calling StoreApi->deleteOrder: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of the order that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getInventory** +> BuiltMap getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; + +var api_instance = new StoreApi(); + +try { + var result = api_instance.getInventory(); + print(result); +} catch (e) { + print('Exception when calling StoreApi->getInventory: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**BuiltMap** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new StoreApi(); +var orderId = 789; // int | ID of pet that needs to be fetched + +try { + var result = api_instance.getOrderById(orderId); + print(result); +} catch (e) { + print('Exception when calling StoreApi->getOrderById: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **int**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **placeOrder** +> Order placeOrder(order) + +Place an order for a pet + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new StoreApi(); +var order = new Order(); // Order | order placed for purchasing the pet + +try { + var result = api_instance.placeOrder(order); + print(result); +} catch (e) { + print('Exception when calling StoreApi->placeOrder: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Tag.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Tag.md new file mode 100644 index 000000000000..c219f987c19c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/Tag.md @@ -0,0 +1,16 @@ +# openapi.model.Tag + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/User.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/User.md new file mode 100644 index 000000000000..fa87e64d8595 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/User.md @@ -0,0 +1,22 @@ +# openapi.model.User + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**username** | **String** | | [optional] +**firstName** | **String** | | [optional] +**lastName** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**userStatus** | **int** | User Status | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/UserApi.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/UserApi.md new file mode 100644 index 000000000000..62e01652e800 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/doc/UserApi.md @@ -0,0 +1,349 @@ +# openapi.api.UserApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UserApi.md#createuser) | **post** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **post** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createuserswithlistinput) | **post** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteuser) | **delete** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getuserbyname) | **get** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginuser) | **get** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutuser) | **get** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateuser) | **put** /user/{username} | Updated user + + +# **createUser** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var user = new User(); // User | Created user object + +try { + api_instance.createUser(user); +} catch (e) { + print('Exception when calling UserApi->createUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**User**](User.md)| Created user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var user = [new BuiltList()]; // BuiltList | List of user object + +try { + api_instance.createUsersWithArrayInput(user); +} catch (e) { + print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**BuiltList**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **createUsersWithListInput** +> createUsersWithListInput(user) + +Creates list of users with given input array + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var user = [new BuiltList()]; // BuiltList | List of user object + +try { + api_instance.createUsersWithListInput(user); +} catch (e) { + print('Exception when calling UserApi->createUsersWithListInput: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**BuiltList**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | The name that needs to be deleted + +try { + api_instance.deleteUser(username); +} catch (e) { + print('Exception when calling UserApi->deleteUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | The name that needs to be fetched. Use user1 for testing. + +try { + var result = api_instance.getUserByName(username); + print(result); +} catch (e) { + print('Exception when calling UserApi->getUserByName: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | The user name for login +var password = password_example; // String | The password for login in clear text + +try { + var result = api_instance.loginUser(username, password); + print(result); +} catch (e) { + print('Exception when calling UserApi->loginUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); + +try { + api_instance.logoutUser(); +} catch (e) { + print('Exception when calling UserApi->logoutUser: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **updateUser** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | name that need to be deleted +var user = new User(); // User | Updated user object + +try { + api_instance.updateUser(username, user); +} catch (e) { + print('Exception when calling UserApi->updateUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | + **user** | [**User**](User.md)| Updated user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/openapi.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/openapi.dart new file mode 100644 index 000000000000..9234c943ab63 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/openapi.dart @@ -0,0 +1,62 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +export 'package:openapi/src/api.dart'; +export 'package:openapi/src/auth/api_key_auth.dart'; +export 'package:openapi/src/auth/basic_auth.dart'; +export 'package:openapi/src/auth/oauth.dart'; +export 'package:openapi/src/serializers.dart'; + +export 'package:openapi/src/api/another_fake_api.dart'; +export 'package:openapi/src/api/default_api.dart'; +export 'package:openapi/src/api/fake_api.dart'; +export 'package:openapi/src/api/fake_classname_tags123_api.dart'; +export 'package:openapi/src/api/pet_api.dart'; +export 'package:openapi/src/api/store_api.dart'; +export 'package:openapi/src/api/user_api.dart'; + +export 'package:openapi/src/model/additional_properties_class.dart'; +export 'package:openapi/src/model/animal.dart'; +export 'package:openapi/src/model/api_response.dart'; +export 'package:openapi/src/model/array_of_array_of_number_only.dart'; +export 'package:openapi/src/model/array_of_number_only.dart'; +export 'package:openapi/src/model/array_test.dart'; +export 'package:openapi/src/model/capitalization.dart'; +export 'package:openapi/src/model/cat.dart'; +export 'package:openapi/src/model/cat_all_of.dart'; +export 'package:openapi/src/model/category.dart'; +export 'package:openapi/src/model/class_model.dart'; +export 'package:openapi/src/model/dog.dart'; +export 'package:openapi/src/model/dog_all_of.dart'; +export 'package:openapi/src/model/enum_arrays.dart'; +export 'package:openapi/src/model/enum_test.dart'; +export 'package:openapi/src/model/file_schema_test_class.dart'; +export 'package:openapi/src/model/foo.dart'; +export 'package:openapi/src/model/format_test.dart'; +export 'package:openapi/src/model/has_only_read_only.dart'; +export 'package:openapi/src/model/health_check_result.dart'; +export 'package:openapi/src/model/inline_response_default.dart'; +export 'package:openapi/src/model/map_test.dart'; +export 'package:openapi/src/model/mixed_properties_and_additional_properties_class.dart'; +export 'package:openapi/src/model/model200_response.dart'; +export 'package:openapi/src/model/model_client.dart'; +export 'package:openapi/src/model/model_enum_class.dart'; +export 'package:openapi/src/model/model_file.dart'; +export 'package:openapi/src/model/model_list.dart'; +export 'package:openapi/src/model/model_return.dart'; +export 'package:openapi/src/model/name.dart'; +export 'package:openapi/src/model/nullable_class.dart'; +export 'package:openapi/src/model/number_only.dart'; +export 'package:openapi/src/model/order.dart'; +export 'package:openapi/src/model/outer_composite.dart'; +export 'package:openapi/src/model/outer_enum.dart'; +export 'package:openapi/src/model/outer_enum_default_value.dart'; +export 'package:openapi/src/model/outer_enum_integer.dart'; +export 'package:openapi/src/model/outer_enum_integer_default_value.dart'; +export 'package:openapi/src/model/outer_object_with_enum_property.dart'; +export 'package:openapi/src/model/pet.dart'; +export 'package:openapi/src/model/read_only_first.dart'; +export 'package:openapi/src/model/special_model_name.dart'; +export 'package:openapi/src/model/tag.dart'; +export 'package:openapi/src/model/user.dart'; diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api.dart new file mode 100644 index 000000000000..22eabf5d3be4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api.dart @@ -0,0 +1,116 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:built_value/serializer.dart'; +import 'package:openapi/src/serializers.dart'; +import 'package:openapi/src/auth/api_key_auth.dart'; +import 'package:openapi/src/auth/basic_auth.dart'; +import 'package:openapi/src/auth/oauth.dart'; +import 'package:openapi/src/api/another_fake_api.dart'; +import 'package:openapi/src/api/default_api.dart'; +import 'package:openapi/src/api/fake_api.dart'; +import 'package:openapi/src/api/fake_classname_tags123_api.dart'; +import 'package:openapi/src/api/pet_api.dart'; +import 'package:openapi/src/api/store_api.dart'; +import 'package:openapi/src/api/user_api.dart'; + +class Openapi { + static const String basePath = r'http://petstore.swagger.io:80/v2'; + + final Dio dio; + final Serializers serializers; + + Openapi({ + Dio? dio, + Serializers? serializers, + String? basePathOverride, + List? interceptors, + }) : this.serializers = serializers ?? standardSerializers, + this.dio = dio ?? + Dio(BaseOptions( + baseUrl: basePathOverride ?? basePath, + connectTimeout: 5000, + receiveTimeout: 3000, + )) { + if (interceptors == null) { + this.dio.interceptors.addAll([ + OAuthInterceptor(), + BasicAuthInterceptor(), + ApiKeyAuthInterceptor(), + ]); + } else { + this.dio.interceptors.addAll(interceptors); + } + } + + void setOAuthToken(String name, String token) { + if (this.dio.interceptors.any((i) => i is OAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is OAuthInterceptor) + as OAuthInterceptor) + .tokens[name] = token; + } + } + + void setBasicAuth(String name, String username, String password) { + if (this.dio.interceptors.any((i) => i is BasicAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is BasicAuthInterceptor) + as BasicAuthInterceptor) + .authInfo[name] = BasicAuthInfo(username, password); + } + } + + void setApiKey(String name, String apiKey) { + if (this.dio.interceptors.any((i) => i is ApiKeyAuthInterceptor)) { + (this + .dio + .interceptors + .firstWhere((element) => element is ApiKeyAuthInterceptor) + as ApiKeyAuthInterceptor) + .apiKeys[name] = apiKey; + } + } + + /// Get AnotherFakeApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + AnotherFakeApi getAnotherFakeApi() { + return AnotherFakeApi(dio, serializers); + } + + /// Get DefaultApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + DefaultApi getDefaultApi() { + return DefaultApi(dio, serializers); + } + + /// Get FakeApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + FakeApi getFakeApi() { + return FakeApi(dio, serializers); + } + + /// Get FakeClassnameTags123Api instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + FakeClassnameTags123Api getFakeClassnameTags123Api() { + return FakeClassnameTags123Api(dio, serializers); + } + + /// Get PetApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + PetApi getPetApi() { + return PetApi(dio, serializers); + } + + /// Get StoreApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + StoreApi getStoreApi() { + return StoreApi(dio, serializers); + } + + /// Get UserApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + UserApi getUserApi() { + return UserApi(dio, serializers); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/another_fake_api.dart new file mode 100644 index 000000000000..61e534aee7f0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/another_fake_api.dart @@ -0,0 +1,104 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; + +import 'package:openapi/src/model/model_client.dart'; + +class AnotherFakeApi { + final Dio _dio; + + final Serializers _serializers; + + const AnotherFakeApi(this._dio, this._serializers); + + /// To test special tags + /// + /// To test special tags and operation ID starting with number + Future> call123testSpecialTags({ + required ModelClient modelClient, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/another-fake/dummy'; + final _options = Options( + method: r'PATCH', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + const _type = FullType(ModelClient); + _bodyData = _serializers.serialize(modelClient, specifiedType: _type); + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ModelClient _responseData; + + try { + const _responseType = FullType(ModelClient); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as ModelClient; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/default_api.dart new file mode 100644 index 000000000000..b4d3e174e318 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/default_api.dart @@ -0,0 +1,85 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; + +import 'package:openapi/src/model/inline_response_default.dart'; + +class DefaultApi { + final Dio _dio; + + final Serializers _serializers; + + const DefaultApi(this._dio, this._serializers); + + /// + /// + /// + Future> fooGet({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/foo'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + InlineResponseDefault _responseData; + + try { + const _responseType = FullType(InlineResponseDefault); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as InlineResponseDefault; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/fake_api.dart new file mode 100644 index 000000000000..0f1702646e24 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/fake_api.dart @@ -0,0 +1,1229 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; + +import 'package:openapi/src/model/file_schema_test_class.dart'; +import 'package:openapi/src/model/outer_composite.dart'; +import 'package:openapi/src/model/outer_object_with_enum_property.dart'; +import 'package:openapi/src/model/user.dart'; +import 'package:openapi/src/model/health_check_result.dart'; +import 'package:openapi/src/model/pet.dart'; +import 'package:openapi/src/model/model_client.dart'; +import 'package:openapi/src/api_util.dart'; +import 'dart:typed_data'; +import 'package:built_collection/built_collection.dart'; + +class FakeApi { + final Dio _dio; + + final Serializers _serializers; + + const FakeApi(this._dio, this._serializers); + + /// Health check endpoint + /// + /// + Future> fakeHealthGet({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/health'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + HealthCheckResult _responseData; + + try { + const _responseType = FullType(HealthCheckResult); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as HealthCheckResult; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// test http signature authentication + /// + /// + Future> fakeHttpSignatureTest({ + required Pet pet, + String? query1, + String? header1, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/http-signature-test'; + final _options = Options( + method: r'GET', + headers: { + if (header1 != null) r'header_1': header1, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'name': 'http_signature_test', + }, + ], + ...?extra, + }, + contentType: [ + 'application/json', + 'application/xml', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (query1 != null) r'query_1': query1, + }; + + dynamic _bodyData; + + try { + const _type = FullType(Pet); + _bodyData = _serializers.serialize(pet, specifiedType: _type); + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// + /// + /// Test serialization of outer boolean types + Future> fakeOuterBooleanSerialize({ + bool? body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/outer/boolean'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + _bodyData = body; + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + bool _responseData; + + try { + _responseData = _response.data as bool; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// + /// + /// Test serialization of object with outer number type + Future> fakeOuterCompositeSerialize({ + OuterComposite? outerComposite, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/outer/composite'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + const _type = FullType(OuterComposite); + _bodyData = outerComposite == null + ? null + : _serializers.serialize(outerComposite, specifiedType: _type); + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + OuterComposite _responseData; + + try { + const _responseType = FullType(OuterComposite); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as OuterComposite; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// + /// + /// Test serialization of outer number types + Future> fakeOuterNumberSerialize({ + num? body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/outer/number'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + _bodyData = body; + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + num _responseData; + + try { + _responseData = _response.data as num; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// + /// + /// Test serialization of outer string types + Future> fakeOuterStringSerialize({ + String? body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/outer/string'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + _bodyData = body; + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + String _responseData; + + try { + _responseData = _response.data as String; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// + /// + /// Test serialization of enum (int) properties with examples + Future> + fakePropertyEnumIntegerSerialize({ + required OuterObjectWithEnumProperty outerObjectWithEnumProperty, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/property/enum-int'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + const _type = FullType(OuterObjectWithEnumProperty); + _bodyData = _serializers.serialize(outerObjectWithEnumProperty, + specifiedType: _type); + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + OuterObjectWithEnumProperty _responseData; + + try { + const _responseType = FullType(OuterObjectWithEnumProperty); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as OuterObjectWithEnumProperty; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + Future> testBodyWithFileSchema({ + required FileSchemaTestClass fileSchemaTestClass, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/body-with-file-schema'; + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + const _type = FullType(FileSchemaTestClass); + _bodyData = + _serializers.serialize(fileSchemaTestClass, specifiedType: _type); + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// + /// + /// + Future> testBodyWithQueryParams({ + required String query, + required User user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/body-with-query-params'; + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'query': query, + }; + + dynamic _bodyData; + + try { + const _type = FullType(User); + _bodyData = _serializers.serialize(user, specifiedType: _type); + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// To test \"client\" model + /// + /// To test \"client\" model + Future> testClientModel({ + required ModelClient modelClient, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'PATCH', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + const _type = FullType(ModelClient); + _bodyData = _serializers.serialize(modelClient, specifiedType: _type); + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ModelClient _responseData; + + try { + const _responseType = FullType(ModelClient); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as ModelClient; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + Future> testEndpointParameters({ + required num number, + required double double_, + required String patternWithoutDelimiter, + required String byte, + int? integer, + int? int32, + int? int64, + double? float, + String? string, + Uint8List? binary, + DateTime? date, + DateTime? dateTime, + String? password, + String? callback, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'name': 'http_basic_test', + }, + ], + ...?extra, + }, + contentType: [ + 'application/x-www-form-urlencoded', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + _bodyData = { + if (integer != null) + r'integer': + encodeFormParameter(_serializers, integer, const FullType(int)), + if (int32 != null) + r'int32': + encodeFormParameter(_serializers, int32, const FullType(int)), + if (int64 != null) + r'int64': + encodeFormParameter(_serializers, int64, const FullType(int)), + r'number': + encodeFormParameter(_serializers, number, const FullType(num)), + if (float != null) + r'float': + encodeFormParameter(_serializers, float, const FullType(double)), + r'double': + encodeFormParameter(_serializers, double_, const FullType(double)), + if (string != null) + r'string': + encodeFormParameter(_serializers, string, const FullType(String)), + r'pattern_without_delimiter': encodeFormParameter( + _serializers, patternWithoutDelimiter, const FullType(String)), + r'byte': + encodeFormParameter(_serializers, byte, const FullType(String)), + if (binary != null) + r'binary': MultipartFile.fromBytes(binary, filename: r'binary'), + if (date != null) + r'date': + encodeFormParameter(_serializers, date, const FullType(DateTime)), + if (dateTime != null) + r'dateTime': encodeFormParameter( + _serializers, dateTime, const FullType(DateTime)), + if (password != null) + r'password': encodeFormParameter( + _serializers, password, const FullType(String)), + if (callback != null) + r'callback': encodeFormParameter( + _serializers, callback, const FullType(String)), + }; + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// To test enum parameters + /// + /// To test enum parameters + Future> testEnumParameters({ + BuiltList? enumHeaderStringArray, + String? enumHeaderString, + BuiltList? enumQueryStringArray, + String? enumQueryString, + int? enumQueryInteger, + double? enumQueryDouble, + BuiltList? enumFormStringArray, + String? enumFormString, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'GET', + headers: { + if (enumHeaderStringArray != null) + r'enum_header_string_array': enumHeaderStringArray, + if (enumHeaderString != null) r'enum_header_string': enumHeaderString, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/x-www-form-urlencoded', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (enumQueryStringArray != null) + r'enum_query_string_array': enumQueryStringArray, + if (enumQueryString != null) r'enum_query_string': enumQueryString, + if (enumQueryInteger != null) r'enum_query_integer': enumQueryInteger, + if (enumQueryDouble != null) r'enum_query_double': enumQueryDouble, + }; + + dynamic _bodyData; + + try { + _bodyData = { + if (enumFormStringArray != null) + r'enum_form_string_array': encodeFormParameter( + _serializers, + enumFormStringArray, + const FullType(BuiltList, [FullType(String)])), + if (enumFormString != null) + r'enum_form_string': encodeFormParameter( + _serializers, enumFormString, const FullType(String)), + }; + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Fake endpoint to test group parameters (optional) + /// + /// Fake endpoint to test group parameters (optional) + Future> testGroupParameters({ + required int requiredStringGroup, + required bool requiredBooleanGroup, + required int requiredInt64Group, + int? stringGroup, + bool? booleanGroup, + int? int64Group, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'DELETE', + headers: { + r'required_boolean_group': requiredBooleanGroup, + if (booleanGroup != null) r'boolean_group': booleanGroup, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'name': 'bearer_test', + }, + ], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'required_string_group': requiredStringGroup, + r'required_int64_group': requiredInt64Group, + if (stringGroup != null) r'string_group': stringGroup, + if (int64Group != null) r'int64_group': int64Group, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test inline additionalProperties + /// + /// + Future> testInlineAdditionalProperties({ + required BuiltMap requestBody, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/inline-additionalProperties'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + const _type = FullType(BuiltMap, [FullType(String), FullType(String)]); + _bodyData = _serializers.serialize(requestBody, specifiedType: _type); + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test json serialization of form data + /// + /// + Future> testJsonFormData({ + required String param, + required String param2, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/jsonFormData'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/x-www-form-urlencoded', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + _bodyData = { + r'param': + encodeFormParameter(_serializers, param, const FullType(String)), + r'param2': + encodeFormParameter(_serializers, param2, const FullType(String)), + }; + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// + /// + /// To test the collection format in query parameters + Future> testQueryParameterCollectionFormat({ + required BuiltList pipe, + required BuiltList ioutil, + required BuiltList http, + required BuiltList url, + required BuiltList context, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/test-query-paramters'; + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'pipe': pipe, + r'ioutil': ioutil, + r'http': http, + r'url': url, + r'context': context, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/fake_classname_tags123_api.dart new file mode 100644 index 000000000000..ee5248f3a5f4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/fake_classname_tags123_api.dart @@ -0,0 +1,111 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; + +import 'package:openapi/src/model/model_client.dart'; + +class FakeClassnameTags123Api { + final Dio _dio; + + final Serializers _serializers; + + const FakeClassnameTags123Api(this._dio, this._serializers); + + /// To test class name in snake case + /// + /// To test class name in snake case + Future> testClassname({ + required ModelClient modelClient, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake_classname_test'; + final _options = Options( + method: r'PATCH', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'apiKey', + 'name': 'api_key_query', + 'keyName': 'api_key_query', + 'where': 'query', + }, + ], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + const _type = FullType(ModelClient); + _bodyData = _serializers.serialize(modelClient, specifiedType: _type); + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ModelClient _responseData; + + try { + const _responseType = FullType(ModelClient); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as ModelClient; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/pet_api.dart new file mode 100644 index 000000000000..be85fa07b044 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/pet_api.dart @@ -0,0 +1,702 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; + +import 'package:openapi/src/model/pet.dart'; +import 'package:openapi/src/model/api_response.dart'; +import 'package:openapi/src/api_util.dart'; +import 'dart:typed_data'; +import 'package:built_collection/built_collection.dart'; + +class PetApi { + final Dio _dio; + + final Serializers _serializers; + + const PetApi(this._dio, this._serializers); + + /// Add a new pet to the store + /// + /// + Future> addPet({ + required Pet pet, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: [ + 'application/json', + 'application/xml', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + const _type = FullType(Pet); + _bodyData = _serializers.serialize(pet, specifiedType: _type); + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Deletes a pet + /// + /// + Future> deletePet({ + required int petId, + String? apiKey, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = + r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); + final _options = Options( + method: r'DELETE', + headers: { + if (apiKey != null) r'api_key': apiKey, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Finds Pets by status + /// + /// Multiple status values can be provided with comma separated strings + Future>> findPetsByStatus({ + required BuiltList status, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/findByStatus'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'status': status, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + BuiltList _responseData; + + try { + const _responseType = FullType(BuiltList, [FullType(Pet)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as BuiltList; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Finds Pets by tags + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + Future>> findPetsByTags({ + required BuiltSet tags, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/findByTags'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'tags': tags, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + BuiltSet _responseData; + + try { + const _responseType = FullType(BuiltSet, [FullType(Pet)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as BuiltSet; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Find pet by ID + /// + /// Returns a single pet + Future> getPetById({ + required int petId, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = + r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'apiKey', + 'name': 'api_key', + 'keyName': 'api_key', + 'where': 'header', + }, + ], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Pet _responseData; + + try { + const _responseType = FullType(Pet); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Pet; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Update an existing pet + /// + /// + Future> updatePet({ + required Pet pet, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet'; + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: [ + 'application/json', + 'application/xml', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + const _type = FullType(Pet); + _bodyData = _serializers.serialize(pet, specifiedType: _type); + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Updates a pet in the store with form data + /// + /// + Future> updatePetWithForm({ + required int petId, + String? name, + String? status, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = + r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: [ + 'application/x-www-form-urlencoded', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + _bodyData = { + if (name != null) + r'name': + encodeFormParameter(_serializers, name, const FullType(String)), + if (status != null) + r'status': + encodeFormParameter(_serializers, status, const FullType(String)), + }; + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// uploads an image + /// + /// + Future> uploadFile({ + required int petId, + String? additionalMetadata, + Uint8List? file, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/{petId}/uploadImage' + .replaceAll('{' r'petId' '}', petId.toString()); + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: [ + 'multipart/form-data', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + _bodyData = FormData.fromMap({ + if (additionalMetadata != null) + r'additionalMetadata': encodeFormParameter( + _serializers, additionalMetadata, const FullType(String)), + if (file != null) + r'file': MultipartFile.fromBytes(file, filename: r'file'), + }); + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ApiResponse _responseData; + + try { + const _responseType = FullType(ApiResponse); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as ApiResponse; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// uploads an image (required) + /// + /// + Future> uploadFileWithRequiredFile({ + required int petId, + required Uint8List requiredFile, + String? additionalMetadata, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/{petId}/uploadImageWithRequiredFile' + .replaceAll('{' r'petId' '}', petId.toString()); + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: [ + 'multipart/form-data', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + _bodyData = FormData.fromMap({ + if (additionalMetadata != null) + r'additionalMetadata': encodeFormParameter( + _serializers, additionalMetadata, const FullType(String)), + r'requiredFile': + MultipartFile.fromBytes(requiredFile, filename: r'requiredFile'), + }); + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ApiResponse _responseData; + + try { + const _responseType = FullType(ApiResponse); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as ApiResponse; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/store_api.dart new file mode 100644 index 000000000000..b4e470b11330 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/store_api.dart @@ -0,0 +1,292 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; + +import 'package:openapi/src/model/order.dart'; +import 'package:built_collection/built_collection.dart'; + +class StoreApi { + final Dio _dio; + + final Serializers _serializers; + + const StoreApi(this._dio, this._serializers); + + /// Delete purchase order by ID + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + Future> deleteOrder({ + required String orderId, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/store/order/{order_id}' + .replaceAll('{' r'order_id' '}', orderId.toString()); + final _options = Options( + method: r'DELETE', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Returns pet inventories by status + /// + /// Returns a map of status codes to quantities + Future>> getInventory({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/store/inventory'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'apiKey', + 'name': 'api_key', + 'keyName': 'api_key', + 'where': 'header', + }, + ], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + BuiltMap _responseData; + + try { + const _responseType = + FullType(BuiltMap, [FullType(String), FullType(int)]); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as BuiltMap; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Find purchase order by ID + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + Future> getOrderById({ + required int orderId, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/store/order/{order_id}' + .replaceAll('{' r'order_id' '}', orderId.toString()); + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Order _responseData; + + try { + const _responseType = FullType(Order); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Order; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Place an order for a pet + /// + /// + Future> placeOrder({ + required Order order, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/store/order'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + const _type = FullType(Order); + _bodyData = _serializers.serialize(order, specifiedType: _type); + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Order _responseData; + + try { + const _responseType = FullType(Order); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Order; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/user_api.dart new file mode 100644 index 000000000000..91d22855862b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api/user_api.dart @@ -0,0 +1,482 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; + +import 'package:openapi/src/model/user.dart'; +import 'package:built_collection/built_collection.dart'; + +class UserApi { + final Dio _dio; + + final Serializers _serializers; + + const UserApi(this._dio, this._serializers); + + /// Create user + /// + /// This can only be done by the logged in user. + Future> createUser({ + required User user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + const _type = FullType(User); + _bodyData = _serializers.serialize(user, specifiedType: _type); + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Creates list of users with given input array + /// + /// + Future> createUsersWithArrayInput({ + required BuiltList user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/createWithArray'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + const _type = FullType(BuiltList, [FullType(User)]); + _bodyData = _serializers.serialize(user, specifiedType: _type); + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Creates list of users with given input array + /// + /// + Future> createUsersWithListInput({ + required BuiltList user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/createWithList'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + const _type = FullType(BuiltList, [FullType(User)]); + _bodyData = _serializers.serialize(user, specifiedType: _type); + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Delete user + /// + /// This can only be done by the logged in user. + Future> deleteUser({ + required String username, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/{username}' + .replaceAll('{' r'username' '}', username.toString()); + final _options = Options( + method: r'DELETE', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Get user by user name + /// + /// + Future> getUserByName({ + required String username, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/{username}' + .replaceAll('{' r'username' '}', username.toString()); + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + User _responseData; + + try { + const _responseType = FullType(User); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as User; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Logs user into the system + /// + /// + Future> loginUser({ + required String username, + required String password, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/login'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'username': username, + r'password': password, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + String _responseData; + + try { + _responseData = _response.data as String; + } catch (error) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Logs out current logged in user session + /// + /// + Future> logoutUser({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/logout'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Updated user + /// + /// This can only be done by the logged in user. + Future> updateUser({ + required String username, + required User user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/{username}' + .replaceAll('{' r'username' '}', username.toString()); + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: [ + 'application/json', + ].first, + validateStatus: validateStatus, + ); + + final _queryParameters = {}; + + dynamic _bodyData; + + try { + const _type = FullType(User); + _bodyData = _serializers.serialize(user, specifiedType: _type); + } catch (error) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioErrorType.other, + error: error, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api_util.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api_util.dart new file mode 100644 index 000000000000..538ec770ae8b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/api_util.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:convert'; + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; + +/// Format the given form parameter object into something that Dio can handle. +/// Returns primitive or String. +/// Returns List/Map if the value is BuildList/BuiltMap. +dynamic encodeFormParameter( + Serializers serializers, dynamic value, FullType type) { + if (value == null) { + return ''; + } + if (value is String || value is num || value is bool) { + return value; + } + final serialized = serializers.serialize( + value as Object, + specifiedType: type, + ); + if (serialized is String) { + return serialized; + } + if (value is BuiltList || value is BuiltMap) { + return serialized; + } + return json.encode(serialized); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/auth/api_key_auth.dart new file mode 100644 index 000000000000..da0f9f2fe18a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/auth/api_key_auth.dart @@ -0,0 +1,29 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/auth.dart'; + +class ApiKeyAuthInterceptor extends AuthInterceptor { + final Map apiKeys = {}; + + @override + void onRequest(RequestOptions options, RequestInterceptorHandler handler) { + final authInfo = getAuthInfo(options, 'apiKey'); + for (final info in authInfo) { + final authName = info['name'] as String; + final authKeyName = info['keyName'] as String; + final authWhere = info['where'] as String; + final apiKey = apiKeys[authName]; + if (apiKey != null) { + if (authWhere == 'query') { + options.queryParameters[authKeyName] = apiKey; + } else { + options.headers[authKeyName] = apiKey; + } + } + } + super.onRequest(options, handler); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/auth/auth.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/auth/auth.dart new file mode 100644 index 000000000000..95fdd61889fa --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/auth/auth.dart @@ -0,0 +1,24 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; + +abstract class AuthInterceptor extends Interceptor { + /// Get auth information on given route for the given type. + /// Can return an empty list if type is not present on auth data or + /// if route doesn't need authentication. + List> getAuthInfo(RequestOptions route, String type) { + if (route.extra.containsKey('secure')) { + final auth = route.extra['secure'] as List>; + final results = >[]; + for (final info in auth) { + if (info['type'] == type) { + results.add(info); + } + } + return results; + } + return []; + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/auth/basic_auth.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/auth/basic_auth.dart new file mode 100644 index 000000000000..fb3a768a8ace --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/auth/basic_auth.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/auth.dart'; + +class BasicAuthInfo { + final String username; + final String password; + + const BasicAuthInfo(this.username, this.password); +} + +class BasicAuthInterceptor extends AuthInterceptor { + final Map authInfo = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final metadataAuthInfo = getAuthInfo(options, 'basic'); + for (final info in metadataAuthInfo) { + final authName = info['name'] as String; + final basicAuthInfo = authInfo[authName]; + if (basicAuthInfo != null) { + final basicAuth = + 'Basic ${base64Encode(utf8.encode('${basicAuthInfo.username}:${basicAuthInfo.password}'))}'; + options.headers['Authorization'] = basicAuth; + break; + } + } + super.onRequest(options, handler); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/auth/oauth.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/auth/oauth.dart new file mode 100644 index 000000000000..714f929486e0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/auth/oauth.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/auth.dart'; + +class OAuthInterceptor extends AuthInterceptor { + final Map tokens = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final authInfo = getAuthInfo(options, 'oauth'); + for (final info in authInfo) { + final token = tokens[info['name']]; + if (token != null) { + options.headers['Authorization'] = 'Bearer ${token}'; + break; + } + } + super.onRequest(options, handler); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/additional_properties_class.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/additional_properties_class.dart new file mode 100644 index 000000000000..3010d03524dd --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/additional_properties_class.dart @@ -0,0 +1,97 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'additional_properties_class.g.dart'; + +abstract class AdditionalPropertiesClass + implements + Built { + @BuiltValueField(wireName: r'map_property') + BuiltMap? get mapProperty; + + @BuiltValueField(wireName: r'map_of_map_property') + BuiltMap>? get mapOfMapProperty; + + AdditionalPropertiesClass._(); + + static void _initializeBuilder(AdditionalPropertiesClassBuilder b) => b; + + factory AdditionalPropertiesClass( + [void updates(AdditionalPropertiesClassBuilder b)]) = + _$AdditionalPropertiesClass; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$AdditionalPropertiesClassSerializer(); +} + +class _$AdditionalPropertiesClassSerializer + implements StructuredSerializer { + @override + final Iterable types = const [ + AdditionalPropertiesClass, + _$AdditionalPropertiesClass + ]; + + @override + final String wireName = r'AdditionalPropertiesClass'; + + @override + Iterable serialize( + Serializers serializers, AdditionalPropertiesClass object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.mapProperty != null) { + result + ..add(r'map_property') + ..add(serializers.serialize(object.mapProperty, + specifiedType: const FullType( + BuiltMap, [FullType(String), FullType(String)]))); + } + if (object.mapOfMapProperty != null) { + result + ..add(r'map_of_map_property') + ..add(serializers.serialize(object.mapOfMapProperty, + specifiedType: const FullType(BuiltMap, [ + FullType(String), + FullType(BuiltMap, [FullType(String), FullType(String)]) + ]))); + } + return result; + } + + @override + AdditionalPropertiesClass deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = AdditionalPropertiesClassBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'map_property': + result.mapProperty.replace(serializers.deserialize(value, + specifiedType: const FullType( + BuiltMap, [FullType(String), FullType(String)])) + as BuiltMap); + break; + case r'map_of_map_property': + result.mapOfMapProperty.replace(serializers.deserialize(value, + specifiedType: const FullType(BuiltMap, [ + FullType(String), + FullType(BuiltMap, [FullType(String), FullType(String)]) + ])) as BuiltMap>); + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/animal.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/animal.dart new file mode 100644 index 000000000000..5100660356d6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/animal.dart @@ -0,0 +1,74 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'animal.g.dart'; + +abstract class Animal implements Built { + @BuiltValueField(wireName: r'className') + String get className; + + @BuiltValueField(wireName: r'color') + String? get color; + + Animal._(); + + static void _initializeBuilder(AnimalBuilder b) => b..color = 'red'; + + factory Animal([void updates(AnimalBuilder b)]) = _$Animal; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$AnimalSerializer(); +} + +class _$AnimalSerializer implements StructuredSerializer { + @override + final Iterable types = const [Animal, _$Animal]; + + @override + final String wireName = r'Animal'; + + @override + Iterable serialize(Serializers serializers, Animal object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + result + ..add(r'className') + ..add(serializers.serialize(object.className, + specifiedType: const FullType(String))); + if (object.color != null) { + result + ..add(r'color') + ..add(serializers.serialize(object.color, + specifiedType: const FullType(String))); + } + return result; + } + + @override + Animal deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = AnimalBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'className': + result.className = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'color': + result.color = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/api_response.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/api_response.dart new file mode 100644 index 000000000000..b5745122ab7a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/api_response.dart @@ -0,0 +1,89 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'api_response.g.dart'; + +abstract class ApiResponse implements Built { + @BuiltValueField(wireName: r'code') + int? get code; + + @BuiltValueField(wireName: r'type') + String? get type; + + @BuiltValueField(wireName: r'message') + String? get message; + + ApiResponse._(); + + static void _initializeBuilder(ApiResponseBuilder b) => b; + + factory ApiResponse([void updates(ApiResponseBuilder b)]) = _$ApiResponse; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ApiResponseSerializer(); +} + +class _$ApiResponseSerializer implements StructuredSerializer { + @override + final Iterable types = const [ApiResponse, _$ApiResponse]; + + @override + final String wireName = r'ApiResponse'; + + @override + Iterable serialize(Serializers serializers, ApiResponse object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.code != null) { + result + ..add(r'code') + ..add(serializers.serialize(object.code, + specifiedType: const FullType(int))); + } + if (object.type != null) { + result + ..add(r'type') + ..add(serializers.serialize(object.type, + specifiedType: const FullType(String))); + } + if (object.message != null) { + result + ..add(r'message') + ..add(serializers.serialize(object.message, + specifiedType: const FullType(String))); + } + return result; + } + + @override + ApiResponse deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = ApiResponseBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'code': + result.code = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + break; + case r'type': + result.type = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'message': + result.message = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/array_of_array_of_number_only.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/array_of_array_of_number_only.dart new file mode 100644 index 000000000000..7984e48b5891 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/array_of_array_of_number_only.dart @@ -0,0 +1,79 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'array_of_array_of_number_only.g.dart'; + +abstract class ArrayOfArrayOfNumberOnly + implements + Built { + @BuiltValueField(wireName: r'ArrayArrayNumber') + BuiltList>? get arrayArrayNumber; + + ArrayOfArrayOfNumberOnly._(); + + static void _initializeBuilder(ArrayOfArrayOfNumberOnlyBuilder b) => b; + + factory ArrayOfArrayOfNumberOnly( + [void updates(ArrayOfArrayOfNumberOnlyBuilder b)]) = + _$ArrayOfArrayOfNumberOnly; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$ArrayOfArrayOfNumberOnlySerializer(); +} + +class _$ArrayOfArrayOfNumberOnlySerializer + implements StructuredSerializer { + @override + final Iterable types = const [ + ArrayOfArrayOfNumberOnly, + _$ArrayOfArrayOfNumberOnly + ]; + + @override + final String wireName = r'ArrayOfArrayOfNumberOnly'; + + @override + Iterable serialize( + Serializers serializers, ArrayOfArrayOfNumberOnly object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.arrayArrayNumber != null) { + result + ..add(r'ArrayArrayNumber') + ..add(serializers.serialize(object.arrayArrayNumber, + specifiedType: const FullType(BuiltList, [ + FullType(BuiltList, [FullType(num)]) + ]))); + } + return result; + } + + @override + ArrayOfArrayOfNumberOnly deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = ArrayOfArrayOfNumberOnlyBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'ArrayArrayNumber': + result.arrayArrayNumber.replace(serializers.deserialize(value, + specifiedType: const FullType(BuiltList, [ + FullType(BuiltList, [FullType(num)]) + ])) as BuiltList>); + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/array_of_number_only.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/array_of_number_only.dart new file mode 100644 index 000000000000..fc698bbc972f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/array_of_number_only.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'array_of_number_only.g.dart'; + +abstract class ArrayOfNumberOnly + implements Built { + @BuiltValueField(wireName: r'ArrayNumber') + BuiltList? get arrayNumber; + + ArrayOfNumberOnly._(); + + static void _initializeBuilder(ArrayOfNumberOnlyBuilder b) => b; + + factory ArrayOfNumberOnly([void updates(ArrayOfNumberOnlyBuilder b)]) = + _$ArrayOfNumberOnly; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$ArrayOfNumberOnlySerializer(); +} + +class _$ArrayOfNumberOnlySerializer + implements StructuredSerializer { + @override + final Iterable types = const [ArrayOfNumberOnly, _$ArrayOfNumberOnly]; + + @override + final String wireName = r'ArrayOfNumberOnly'; + + @override + Iterable serialize(Serializers serializers, ArrayOfNumberOnly object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.arrayNumber != null) { + result + ..add(r'ArrayNumber') + ..add(serializers.serialize(object.arrayNumber, + specifiedType: const FullType(BuiltList, [FullType(num)]))); + } + return result; + } + + @override + ArrayOfNumberOnly deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = ArrayOfNumberOnlyBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'ArrayNumber': + result.arrayNumber.replace(serializers.deserialize(value, + specifiedType: const FullType(BuiltList, [FullType(num)])) + as BuiltList); + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/array_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/array_test.dart new file mode 100644 index 000000000000..113614e96a3f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/array_test.dart @@ -0,0 +1,100 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/read_only_first.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'array_test.g.dart'; + +abstract class ArrayTest implements Built { + @BuiltValueField(wireName: r'array_of_string') + BuiltList? get arrayOfString; + + @BuiltValueField(wireName: r'array_array_of_integer') + BuiltList>? get arrayArrayOfInteger; + + @BuiltValueField(wireName: r'array_array_of_model') + BuiltList>? get arrayArrayOfModel; + + ArrayTest._(); + + static void _initializeBuilder(ArrayTestBuilder b) => b; + + factory ArrayTest([void updates(ArrayTestBuilder b)]) = _$ArrayTest; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ArrayTestSerializer(); +} + +class _$ArrayTestSerializer implements StructuredSerializer { + @override + final Iterable types = const [ArrayTest, _$ArrayTest]; + + @override + final String wireName = r'ArrayTest'; + + @override + Iterable serialize(Serializers serializers, ArrayTest object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.arrayOfString != null) { + result + ..add(r'array_of_string') + ..add(serializers.serialize(object.arrayOfString, + specifiedType: const FullType(BuiltList, [FullType(String)]))); + } + if (object.arrayArrayOfInteger != null) { + result + ..add(r'array_array_of_integer') + ..add(serializers.serialize(object.arrayArrayOfInteger, + specifiedType: const FullType(BuiltList, [ + FullType(BuiltList, [FullType(int)]) + ]))); + } + if (object.arrayArrayOfModel != null) { + result + ..add(r'array_array_of_model') + ..add(serializers.serialize(object.arrayArrayOfModel, + specifiedType: const FullType(BuiltList, [ + FullType(BuiltList, [FullType(ReadOnlyFirst)]) + ]))); + } + return result; + } + + @override + ArrayTest deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = ArrayTestBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'array_of_string': + result.arrayOfString.replace(serializers.deserialize(value, + specifiedType: const FullType(BuiltList, [FullType(String)])) + as BuiltList); + break; + case r'array_array_of_integer': + result.arrayArrayOfInteger.replace(serializers.deserialize(value, + specifiedType: const FullType(BuiltList, [ + FullType(BuiltList, [FullType(int)]) + ])) as BuiltList>); + break; + case r'array_array_of_model': + result.arrayArrayOfModel.replace(serializers.deserialize(value, + specifiedType: const FullType(BuiltList, [ + FullType(BuiltList, [FullType(ReadOnlyFirst)]) + ])) as BuiltList>); + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/capitalization.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/capitalization.dart new file mode 100644 index 000000000000..3979912749ce --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/capitalization.dart @@ -0,0 +1,134 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'capitalization.g.dart'; + +abstract class Capitalization + implements Built { + @BuiltValueField(wireName: r'smallCamel') + String? get smallCamel; + + @BuiltValueField(wireName: r'CapitalCamel') + String? get capitalCamel; + + @BuiltValueField(wireName: r'small_Snake') + String? get smallSnake; + + @BuiltValueField(wireName: r'Capital_Snake') + String? get capitalSnake; + + @BuiltValueField(wireName: r'SCA_ETH_Flow_Points') + String? get sCAETHFlowPoints; + + /// Name of the pet + @BuiltValueField(wireName: r'ATT_NAME') + String? get ATT_NAME; + + Capitalization._(); + + static void _initializeBuilder(CapitalizationBuilder b) => b; + + factory Capitalization([void updates(CapitalizationBuilder b)]) = + _$Capitalization; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$CapitalizationSerializer(); +} + +class _$CapitalizationSerializer + implements StructuredSerializer { + @override + final Iterable types = const [Capitalization, _$Capitalization]; + + @override + final String wireName = r'Capitalization'; + + @override + Iterable serialize(Serializers serializers, Capitalization object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.smallCamel != null) { + result + ..add(r'smallCamel') + ..add(serializers.serialize(object.smallCamel, + specifiedType: const FullType(String))); + } + if (object.capitalCamel != null) { + result + ..add(r'CapitalCamel') + ..add(serializers.serialize(object.capitalCamel, + specifiedType: const FullType(String))); + } + if (object.smallSnake != null) { + result + ..add(r'small_Snake') + ..add(serializers.serialize(object.smallSnake, + specifiedType: const FullType(String))); + } + if (object.capitalSnake != null) { + result + ..add(r'Capital_Snake') + ..add(serializers.serialize(object.capitalSnake, + specifiedType: const FullType(String))); + } + if (object.sCAETHFlowPoints != null) { + result + ..add(r'SCA_ETH_Flow_Points') + ..add(serializers.serialize(object.sCAETHFlowPoints, + specifiedType: const FullType(String))); + } + if (object.ATT_NAME != null) { + result + ..add(r'ATT_NAME') + ..add(serializers.serialize(object.ATT_NAME, + specifiedType: const FullType(String))); + } + return result; + } + + @override + Capitalization deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = CapitalizationBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'smallCamel': + result.smallCamel = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'CapitalCamel': + result.capitalCamel = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'small_Snake': + result.smallSnake = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'Capital_Snake': + result.capitalSnake = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'SCA_ETH_Flow_Points': + result.sCAETHFlowPoints = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'ATT_NAME': + result.ATT_NAME = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/cat.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/cat.dart new file mode 100644 index 000000000000..dc3de81da9ae --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/cat.dart @@ -0,0 +1,91 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:openapi/src/model/animal.dart'; +import 'package:openapi/src/model/cat_all_of.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'cat.g.dart'; + +// ignore_for_file: unused_import + +abstract class Cat implements Built { + @BuiltValueField(wireName: r'className') + String get className; + + @BuiltValueField(wireName: r'color') + String? get color; + + @BuiltValueField(wireName: r'declawed') + bool? get declawed; + + Cat._(); + + static void _initializeBuilder(CatBuilder b) => b..color = 'red'; + + factory Cat([void updates(CatBuilder b)]) = _$Cat; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$CatSerializer(); +} + +class _$CatSerializer implements StructuredSerializer { + @override + final Iterable types = const [Cat, _$Cat]; + + @override + final String wireName = r'Cat'; + + @override + Iterable serialize(Serializers serializers, Cat object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + result + ..add(r'className') + ..add(serializers.serialize(object.className, + specifiedType: const FullType(String))); + if (object.color != null) { + result + ..add(r'color') + ..add(serializers.serialize(object.color, + specifiedType: const FullType(String))); + } + if (object.declawed != null) { + result + ..add(r'declawed') + ..add(serializers.serialize(object.declawed, + specifiedType: const FullType(bool))); + } + return result; + } + + @override + Cat deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = CatBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'className': + result.className = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'color': + result.color = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'declawed': + result.declawed = serializers.deserialize(value, + specifiedType: const FullType(bool)) as bool; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/cat_all_of.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/cat_all_of.dart new file mode 100644 index 000000000000..fcecefccceec --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/cat_all_of.dart @@ -0,0 +1,63 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'cat_all_of.g.dart'; + +abstract class CatAllOf implements Built { + @BuiltValueField(wireName: r'declawed') + bool? get declawed; + + CatAllOf._(); + + static void _initializeBuilder(CatAllOfBuilder b) => b; + + factory CatAllOf([void updates(CatAllOfBuilder b)]) = _$CatAllOf; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$CatAllOfSerializer(); +} + +class _$CatAllOfSerializer implements StructuredSerializer { + @override + final Iterable types = const [CatAllOf, _$CatAllOf]; + + @override + final String wireName = r'CatAllOf'; + + @override + Iterable serialize(Serializers serializers, CatAllOf object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.declawed != null) { + result + ..add(r'declawed') + ..add(serializers.serialize(object.declawed, + specifiedType: const FullType(bool))); + } + return result; + } + + @override + CatAllOf deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = CatAllOfBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'declawed': + result.declawed = serializers.deserialize(value, + specifiedType: const FullType(bool)) as bool; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/category.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/category.dart new file mode 100644 index 000000000000..bca77eb1edb8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/category.dart @@ -0,0 +1,74 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'category.g.dart'; + +abstract class Category implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'name') + String get name; + + Category._(); + + static void _initializeBuilder(CategoryBuilder b) => b..name = 'default-name'; + + factory Category([void updates(CategoryBuilder b)]) = _$Category; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$CategorySerializer(); +} + +class _$CategorySerializer implements StructuredSerializer { + @override + final Iterable types = const [Category, _$Category]; + + @override + final String wireName = r'Category'; + + @override + Iterable serialize(Serializers serializers, Category object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.id != null) { + result + ..add(r'id') + ..add(serializers.serialize(object.id, + specifiedType: const FullType(int))); + } + result + ..add(r'name') + ..add(serializers.serialize(object.name, + specifiedType: const FullType(String))); + return result; + } + + @override + Category deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = CategoryBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'id': + result.id = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + break; + case r'name': + result.name = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/class_model.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/class_model.dart new file mode 100644 index 000000000000..7fba9383d8b7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/class_model.dart @@ -0,0 +1,63 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'class_model.g.dart'; + +abstract class ClassModel implements Built { + @BuiltValueField(wireName: r'_class') + String? get class_; + + ClassModel._(); + + static void _initializeBuilder(ClassModelBuilder b) => b; + + factory ClassModel([void updates(ClassModelBuilder b)]) = _$ClassModel; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ClassModelSerializer(); +} + +class _$ClassModelSerializer implements StructuredSerializer { + @override + final Iterable types = const [ClassModel, _$ClassModel]; + + @override + final String wireName = r'ClassModel'; + + @override + Iterable serialize(Serializers serializers, ClassModel object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.class_ != null) { + result + ..add(r'_class') + ..add(serializers.serialize(object.class_, + specifiedType: const FullType(String))); + } + return result; + } + + @override + ClassModel deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = ClassModelBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'_class': + result.class_ = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/dog.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/dog.dart new file mode 100644 index 000000000000..f82b0f789b4b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/dog.dart @@ -0,0 +1,91 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:openapi/src/model/dog_all_of.dart'; +import 'package:openapi/src/model/animal.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'dog.g.dart'; + +// ignore_for_file: unused_import + +abstract class Dog implements Built { + @BuiltValueField(wireName: r'className') + String get className; + + @BuiltValueField(wireName: r'color') + String? get color; + + @BuiltValueField(wireName: r'breed') + String? get breed; + + Dog._(); + + static void _initializeBuilder(DogBuilder b) => b..color = 'red'; + + factory Dog([void updates(DogBuilder b)]) = _$Dog; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$DogSerializer(); +} + +class _$DogSerializer implements StructuredSerializer { + @override + final Iterable types = const [Dog, _$Dog]; + + @override + final String wireName = r'Dog'; + + @override + Iterable serialize(Serializers serializers, Dog object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + result + ..add(r'className') + ..add(serializers.serialize(object.className, + specifiedType: const FullType(String))); + if (object.color != null) { + result + ..add(r'color') + ..add(serializers.serialize(object.color, + specifiedType: const FullType(String))); + } + if (object.breed != null) { + result + ..add(r'breed') + ..add(serializers.serialize(object.breed, + specifiedType: const FullType(String))); + } + return result; + } + + @override + Dog deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = DogBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'className': + result.className = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'color': + result.color = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'breed': + result.breed = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/dog_all_of.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/dog_all_of.dart new file mode 100644 index 000000000000..55bdfa93974c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/dog_all_of.dart @@ -0,0 +1,63 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'dog_all_of.g.dart'; + +abstract class DogAllOf implements Built { + @BuiltValueField(wireName: r'breed') + String? get breed; + + DogAllOf._(); + + static void _initializeBuilder(DogAllOfBuilder b) => b; + + factory DogAllOf([void updates(DogAllOfBuilder b)]) = _$DogAllOf; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$DogAllOfSerializer(); +} + +class _$DogAllOfSerializer implements StructuredSerializer { + @override + final Iterable types = const [DogAllOf, _$DogAllOf]; + + @override + final String wireName = r'DogAllOf'; + + @override + Iterable serialize(Serializers serializers, DogAllOf object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.breed != null) { + result + ..add(r'breed') + ..add(serializers.serialize(object.breed, + specifiedType: const FullType(String))); + } + return result; + } + + @override + DogAllOf deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = DogAllOfBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'breed': + result.breed = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/enum_arrays.dart new file mode 100644 index 000000000000..075c747bd783 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/enum_arrays.dart @@ -0,0 +1,119 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'enum_arrays.g.dart'; + +abstract class EnumArrays implements Built { + @BuiltValueField(wireName: r'just_symbol') + EnumArraysJustSymbolEnum? get justSymbol; + // enum justSymbolEnum { >=, $, }; + + @BuiltValueField(wireName: r'array_enum') + BuiltList? get arrayEnum; + // enum arrayEnumEnum { fish, crab, }; + + EnumArrays._(); + + static void _initializeBuilder(EnumArraysBuilder b) => b; + + factory EnumArrays([void updates(EnumArraysBuilder b)]) = _$EnumArrays; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$EnumArraysSerializer(); +} + +class _$EnumArraysSerializer implements StructuredSerializer { + @override + final Iterable types = const [EnumArrays, _$EnumArrays]; + + @override + final String wireName = r'EnumArrays'; + + @override + Iterable serialize(Serializers serializers, EnumArrays object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.justSymbol != null) { + result + ..add(r'just_symbol') + ..add(serializers.serialize(object.justSymbol, + specifiedType: const FullType(EnumArraysJustSymbolEnum))); + } + if (object.arrayEnum != null) { + result + ..add(r'array_enum') + ..add(serializers.serialize(object.arrayEnum, + specifiedType: const FullType( + BuiltList, [FullType(EnumArraysArrayEnumEnum)]))); + } + return result; + } + + @override + EnumArrays deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = EnumArraysBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'just_symbol': + result.justSymbol = serializers.deserialize(value, + specifiedType: const FullType(EnumArraysJustSymbolEnum)) + as EnumArraysJustSymbolEnum; + break; + case r'array_enum': + result.arrayEnum.replace(serializers.deserialize(value, + specifiedType: const FullType( + BuiltList, [FullType(EnumArraysArrayEnumEnum)])) + as BuiltList); + break; + } + } + return result.build(); + } +} + +class EnumArraysJustSymbolEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'>=') + static const EnumArraysJustSymbolEnum greaterThanEqual = + _$enumArraysJustSymbolEnum_greaterThanEqual; + @BuiltValueEnumConst(wireName: r'$') + static const EnumArraysJustSymbolEnum dollar = + _$enumArraysJustSymbolEnum_dollar; + + static Serializer get serializer => + _$enumArraysJustSymbolEnumSerializer; + + const EnumArraysJustSymbolEnum._(String name) : super(name); + + static BuiltSet get values => + _$enumArraysJustSymbolEnumValues; + static EnumArraysJustSymbolEnum valueOf(String name) => + _$enumArraysJustSymbolEnumValueOf(name); +} + +class EnumArraysArrayEnumEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'fish') + static const EnumArraysArrayEnumEnum fish = _$enumArraysArrayEnumEnum_fish; + @BuiltValueEnumConst(wireName: r'crab') + static const EnumArraysArrayEnumEnum crab = _$enumArraysArrayEnumEnum_crab; + + static Serializer get serializer => + _$enumArraysArrayEnumEnumSerializer; + + const EnumArraysArrayEnumEnum._(String name) : super(name); + + static BuiltSet get values => + _$enumArraysArrayEnumEnumValues; + static EnumArraysArrayEnumEnum valueOf(String name) => + _$enumArraysArrayEnumEnumValueOf(name); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/enum_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/enum_test.dart new file mode 100644 index 000000000000..57a733bb20b3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/enum_test.dart @@ -0,0 +1,251 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:openapi/src/model/outer_enum.dart'; +import 'package:openapi/src/model/outer_enum_default_value.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/outer_enum_integer.dart'; +import 'package:openapi/src/model/outer_enum_integer_default_value.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'enum_test.g.dart'; + +abstract class EnumTest implements Built { + @BuiltValueField(wireName: r'enum_string') + EnumTestEnumStringEnum? get enumString; + // enum enumStringEnum { UPPER, lower, , }; + + @BuiltValueField(wireName: r'enum_string_required') + EnumTestEnumStringRequiredEnum get enumStringRequired; + // enum enumStringRequiredEnum { UPPER, lower, , }; + + @BuiltValueField(wireName: r'enum_integer') + EnumTestEnumIntegerEnum? get enumInteger; + // enum enumIntegerEnum { 1, -1, }; + + @BuiltValueField(wireName: r'enum_number') + EnumTestEnumNumberEnum? get enumNumber; + // enum enumNumberEnum { 1.1, -1.2, }; + + @BuiltValueField(wireName: r'outerEnum') + OuterEnum? get outerEnum; + // enum outerEnumEnum { placed, approved, delivered, }; + + @BuiltValueField(wireName: r'outerEnumInteger') + OuterEnumInteger? get outerEnumInteger; + // enum outerEnumIntegerEnum { 0, 1, 2, }; + + @BuiltValueField(wireName: r'outerEnumDefaultValue') + OuterEnumDefaultValue? get outerEnumDefaultValue; + // enum outerEnumDefaultValueEnum { placed, approved, delivered, }; + + @BuiltValueField(wireName: r'outerEnumIntegerDefaultValue') + OuterEnumIntegerDefaultValue? get outerEnumIntegerDefaultValue; + // enum outerEnumIntegerDefaultValueEnum { 0, 1, 2, }; + + EnumTest._(); + + static void _initializeBuilder(EnumTestBuilder b) => b; + + factory EnumTest([void updates(EnumTestBuilder b)]) = _$EnumTest; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$EnumTestSerializer(); +} + +class _$EnumTestSerializer implements StructuredSerializer { + @override + final Iterable types = const [EnumTest, _$EnumTest]; + + @override + final String wireName = r'EnumTest'; + + @override + Iterable serialize(Serializers serializers, EnumTest object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.enumString != null) { + result + ..add(r'enum_string') + ..add(serializers.serialize(object.enumString, + specifiedType: const FullType(EnumTestEnumStringEnum))); + } + result + ..add(r'enum_string_required') + ..add(serializers.serialize(object.enumStringRequired, + specifiedType: const FullType(EnumTestEnumStringRequiredEnum))); + if (object.enumInteger != null) { + result + ..add(r'enum_integer') + ..add(serializers.serialize(object.enumInteger, + specifiedType: const FullType(EnumTestEnumIntegerEnum))); + } + if (object.enumNumber != null) { + result + ..add(r'enum_number') + ..add(serializers.serialize(object.enumNumber, + specifiedType: const FullType(EnumTestEnumNumberEnum))); + } + if (object.outerEnum != null) { + result + ..add(r'outerEnum') + ..add(serializers.serialize(object.outerEnum, + specifiedType: const FullType(OuterEnum))); + } + if (object.outerEnumInteger != null) { + result + ..add(r'outerEnumInteger') + ..add(serializers.serialize(object.outerEnumInteger, + specifiedType: const FullType(OuterEnumInteger))); + } + if (object.outerEnumDefaultValue != null) { + result + ..add(r'outerEnumDefaultValue') + ..add(serializers.serialize(object.outerEnumDefaultValue, + specifiedType: const FullType(OuterEnumDefaultValue))); + } + if (object.outerEnumIntegerDefaultValue != null) { + result + ..add(r'outerEnumIntegerDefaultValue') + ..add(serializers.serialize(object.outerEnumIntegerDefaultValue, + specifiedType: const FullType(OuterEnumIntegerDefaultValue))); + } + return result; + } + + @override + EnumTest deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = EnumTestBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'enum_string': + result.enumString = serializers.deserialize(value, + specifiedType: const FullType(EnumTestEnumStringEnum)) + as EnumTestEnumStringEnum; + break; + case r'enum_string_required': + result.enumStringRequired = serializers.deserialize(value, + specifiedType: const FullType(EnumTestEnumStringRequiredEnum)) + as EnumTestEnumStringRequiredEnum; + break; + case r'enum_integer': + result.enumInteger = serializers.deserialize(value, + specifiedType: const FullType(EnumTestEnumIntegerEnum)) + as EnumTestEnumIntegerEnum; + break; + case r'enum_number': + result.enumNumber = serializers.deserialize(value, + specifiedType: const FullType(EnumTestEnumNumberEnum)) + as EnumTestEnumNumberEnum; + break; + case r'outerEnum': + result.outerEnum = serializers.deserialize(value, + specifiedType: const FullType(OuterEnum)) as OuterEnum; + break; + case r'outerEnumInteger': + result.outerEnumInteger = serializers.deserialize(value, + specifiedType: const FullType(OuterEnumInteger)) + as OuterEnumInteger; + break; + case r'outerEnumDefaultValue': + result.outerEnumDefaultValue = serializers.deserialize(value, + specifiedType: const FullType(OuterEnumDefaultValue)) + as OuterEnumDefaultValue; + break; + case r'outerEnumIntegerDefaultValue': + result.outerEnumIntegerDefaultValue = serializers.deserialize(value, + specifiedType: const FullType(OuterEnumIntegerDefaultValue)) + as OuterEnumIntegerDefaultValue; + break; + } + } + return result.build(); + } +} + +class EnumTestEnumStringEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'UPPER') + static const EnumTestEnumStringEnum UPPER = _$enumTestEnumStringEnum_UPPER; + @BuiltValueEnumConst(wireName: r'lower') + static const EnumTestEnumStringEnum lower = _$enumTestEnumStringEnum_lower; + @BuiltValueEnumConst(wireName: r'') + static const EnumTestEnumStringEnum empty = _$enumTestEnumStringEnum_empty; + + static Serializer get serializer => + _$enumTestEnumStringEnumSerializer; + + const EnumTestEnumStringEnum._(String name) : super(name); + + static BuiltSet get values => + _$enumTestEnumStringEnumValues; + static EnumTestEnumStringEnum valueOf(String name) => + _$enumTestEnumStringEnumValueOf(name); +} + +class EnumTestEnumStringRequiredEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'UPPER') + static const EnumTestEnumStringRequiredEnum UPPER = + _$enumTestEnumStringRequiredEnum_UPPER; + @BuiltValueEnumConst(wireName: r'lower') + static const EnumTestEnumStringRequiredEnum lower = + _$enumTestEnumStringRequiredEnum_lower; + @BuiltValueEnumConst(wireName: r'') + static const EnumTestEnumStringRequiredEnum empty = + _$enumTestEnumStringRequiredEnum_empty; + + static Serializer get serializer => + _$enumTestEnumStringRequiredEnumSerializer; + + const EnumTestEnumStringRequiredEnum._(String name) : super(name); + + static BuiltSet get values => + _$enumTestEnumStringRequiredEnumValues; + static EnumTestEnumStringRequiredEnum valueOf(String name) => + _$enumTestEnumStringRequiredEnumValueOf(name); +} + +class EnumTestEnumIntegerEnum extends EnumClass { + @BuiltValueEnumConst(wireNumber: 1) + static const EnumTestEnumIntegerEnum number1 = + _$enumTestEnumIntegerEnum_number1; + @BuiltValueEnumConst(wireNumber: -1) + static const EnumTestEnumIntegerEnum numberNegative1 = + _$enumTestEnumIntegerEnum_numberNegative1; + + static Serializer get serializer => + _$enumTestEnumIntegerEnumSerializer; + + const EnumTestEnumIntegerEnum._(String name) : super(name); + + static BuiltSet get values => + _$enumTestEnumIntegerEnumValues; + static EnumTestEnumIntegerEnum valueOf(String name) => + _$enumTestEnumIntegerEnumValueOf(name); +} + +class EnumTestEnumNumberEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'1.1') + static const EnumTestEnumNumberEnum number1Period1 = + _$enumTestEnumNumberEnum_number1Period1; + @BuiltValueEnumConst(wireName: r'-1.2') + static const EnumTestEnumNumberEnum numberNegative1Period2 = + _$enumTestEnumNumberEnum_numberNegative1Period2; + + static Serializer get serializer => + _$enumTestEnumNumberEnumSerializer; + + const EnumTestEnumNumberEnum._(String name) : super(name); + + static BuiltSet get values => + _$enumTestEnumNumberEnumValues; + static EnumTestEnumNumberEnum valueOf(String name) => + _$enumTestEnumNumberEnumValueOf(name); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/file_schema_test_class.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/file_schema_test_class.dart new file mode 100644 index 000000000000..78771ae40979 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/file_schema_test_class.dart @@ -0,0 +1,89 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/model_file.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'file_schema_test_class.g.dart'; + +abstract class FileSchemaTestClass + implements Built { + @BuiltValueField(wireName: r'file') + ModelFile? get file; + + @BuiltValueField(wireName: r'files') + BuiltList? get files; + + FileSchemaTestClass._(); + + static void _initializeBuilder(FileSchemaTestClassBuilder b) => b; + + factory FileSchemaTestClass([void updates(FileSchemaTestClassBuilder b)]) = + _$FileSchemaTestClass; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$FileSchemaTestClassSerializer(); +} + +class _$FileSchemaTestClassSerializer + implements StructuredSerializer { + @override + final Iterable types = const [ + FileSchemaTestClass, + _$FileSchemaTestClass + ]; + + @override + final String wireName = r'FileSchemaTestClass'; + + @override + Iterable serialize( + Serializers serializers, FileSchemaTestClass object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.file != null) { + result + ..add(r'file') + ..add(serializers.serialize(object.file, + specifiedType: const FullType(ModelFile))); + } + if (object.files != null) { + result + ..add(r'files') + ..add(serializers.serialize(object.files, + specifiedType: const FullType(BuiltList, [FullType(ModelFile)]))); + } + return result; + } + + @override + FileSchemaTestClass deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = FileSchemaTestClassBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'file': + result.file.replace(serializers.deserialize(value, + specifiedType: const FullType(ModelFile)) as ModelFile); + break; + case r'files': + result.files.replace(serializers.deserialize(value, + specifiedType: + const FullType(BuiltList, [FullType(ModelFile)])) + as BuiltList); + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/foo.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/foo.dart new file mode 100644 index 000000000000..5c7a4f9fe846 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/foo.dart @@ -0,0 +1,63 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'foo.g.dart'; + +abstract class Foo implements Built { + @BuiltValueField(wireName: r'bar') + String? get bar; + + Foo._(); + + static void _initializeBuilder(FooBuilder b) => b..bar = 'bar'; + + factory Foo([void updates(FooBuilder b)]) = _$Foo; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FooSerializer(); +} + +class _$FooSerializer implements StructuredSerializer { + @override + final Iterable types = const [Foo, _$Foo]; + + @override + final String wireName = r'Foo'; + + @override + Iterable serialize(Serializers serializers, Foo object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.bar != null) { + result + ..add(r'bar') + ..add(serializers.serialize(object.bar, + specifiedType: const FullType(String))); + } + return result; + } + + @override + Foo deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = FooBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'bar': + result.bar = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/format_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/format_test.dart new file mode 100644 index 000000000000..45d02a328044 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/format_test.dart @@ -0,0 +1,253 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:typed_data'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'format_test.g.dart'; + +abstract class FormatTest implements Built { + @BuiltValueField(wireName: r'integer') + int? get integer; + + @BuiltValueField(wireName: r'int32') + int? get int32; + + @BuiltValueField(wireName: r'int64') + int? get int64; + + @BuiltValueField(wireName: r'number') + num get number; + + @BuiltValueField(wireName: r'float') + double? get float; + + @BuiltValueField(wireName: r'double') + double? get double_; + + @BuiltValueField(wireName: r'decimal') + double? get decimal; + + @BuiltValueField(wireName: r'string') + String? get string; + + @BuiltValueField(wireName: r'byte') + String get byte; + + @BuiltValueField(wireName: r'binary') + Uint8List? get binary; + + @BuiltValueField(wireName: r'date') + DateTime get date; + + @BuiltValueField(wireName: r'dateTime') + DateTime? get dateTime; + + @BuiltValueField(wireName: r'uuid') + String? get uuid; + + @BuiltValueField(wireName: r'password') + String get password; + + /// A string that is a 10 digit number. Can have leading zeros. + @BuiltValueField(wireName: r'pattern_with_digits') + String? get patternWithDigits; + + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + @BuiltValueField(wireName: r'pattern_with_digits_and_delimiter') + String? get patternWithDigitsAndDelimiter; + + FormatTest._(); + + static void _initializeBuilder(FormatTestBuilder b) => b; + + factory FormatTest([void updates(FormatTestBuilder b)]) = _$FormatTest; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FormatTestSerializer(); +} + +class _$FormatTestSerializer implements StructuredSerializer { + @override + final Iterable types = const [FormatTest, _$FormatTest]; + + @override + final String wireName = r'FormatTest'; + + @override + Iterable serialize(Serializers serializers, FormatTest object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.integer != null) { + result + ..add(r'integer') + ..add(serializers.serialize(object.integer, + specifiedType: const FullType(int))); + } + if (object.int32 != null) { + result + ..add(r'int32') + ..add(serializers.serialize(object.int32, + specifiedType: const FullType(int))); + } + if (object.int64 != null) { + result + ..add(r'int64') + ..add(serializers.serialize(object.int64, + specifiedType: const FullType(int))); + } + result + ..add(r'number') + ..add(serializers.serialize(object.number, + specifiedType: const FullType(num))); + if (object.float != null) { + result + ..add(r'float') + ..add(serializers.serialize(object.float, + specifiedType: const FullType(double))); + } + if (object.double_ != null) { + result + ..add(r'double') + ..add(serializers.serialize(object.double_, + specifiedType: const FullType(double))); + } + if (object.decimal != null) { + result + ..add(r'decimal') + ..add(serializers.serialize(object.decimal, + specifiedType: const FullType(double))); + } + if (object.string != null) { + result + ..add(r'string') + ..add(serializers.serialize(object.string, + specifiedType: const FullType(String))); + } + result + ..add(r'byte') + ..add(serializers.serialize(object.byte, + specifiedType: const FullType(String))); + if (object.binary != null) { + result + ..add(r'binary') + ..add(serializers.serialize(object.binary, + specifiedType: const FullType(Uint8List))); + } + result + ..add(r'date') + ..add(serializers.serialize(object.date, + specifiedType: const FullType(DateTime))); + if (object.dateTime != null) { + result + ..add(r'dateTime') + ..add(serializers.serialize(object.dateTime, + specifiedType: const FullType(DateTime))); + } + if (object.uuid != null) { + result + ..add(r'uuid') + ..add(serializers.serialize(object.uuid, + specifiedType: const FullType(String))); + } + result + ..add(r'password') + ..add(serializers.serialize(object.password, + specifiedType: const FullType(String))); + if (object.patternWithDigits != null) { + result + ..add(r'pattern_with_digits') + ..add(serializers.serialize(object.patternWithDigits, + specifiedType: const FullType(String))); + } + if (object.patternWithDigitsAndDelimiter != null) { + result + ..add(r'pattern_with_digits_and_delimiter') + ..add(serializers.serialize(object.patternWithDigitsAndDelimiter, + specifiedType: const FullType(String))); + } + return result; + } + + @override + FormatTest deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = FormatTestBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'integer': + result.integer = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + break; + case r'int32': + result.int32 = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + break; + case r'int64': + result.int64 = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + break; + case r'number': + result.number = serializers.deserialize(value, + specifiedType: const FullType(num)) as num; + break; + case r'float': + result.float = serializers.deserialize(value, + specifiedType: const FullType(double)) as double; + break; + case r'double': + result.double_ = serializers.deserialize(value, + specifiedType: const FullType(double)) as double; + break; + case r'decimal': + result.decimal = serializers.deserialize(value, + specifiedType: const FullType(double)) as double; + break; + case r'string': + result.string = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'byte': + result.byte = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'binary': + result.binary = serializers.deserialize(value, + specifiedType: const FullType(Uint8List)) as Uint8List; + break; + case r'date': + result.date = serializers.deserialize(value, + specifiedType: const FullType(DateTime)) as DateTime; + break; + case r'dateTime': + result.dateTime = serializers.deserialize(value, + specifiedType: const FullType(DateTime)) as DateTime; + break; + case r'uuid': + result.uuid = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'password': + result.password = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'pattern_with_digits': + result.patternWithDigits = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'pattern_with_digits_and_delimiter': + result.patternWithDigitsAndDelimiter = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/has_only_read_only.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/has_only_read_only.dart new file mode 100644 index 000000000000..783ada102391 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/has_only_read_only.dart @@ -0,0 +1,81 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'has_only_read_only.g.dart'; + +abstract class HasOnlyReadOnly + implements Built { + @BuiltValueField(wireName: r'bar') + String? get bar; + + @BuiltValueField(wireName: r'foo') + String? get foo; + + HasOnlyReadOnly._(); + + static void _initializeBuilder(HasOnlyReadOnlyBuilder b) => b; + + factory HasOnlyReadOnly([void updates(HasOnlyReadOnlyBuilder b)]) = + _$HasOnlyReadOnly; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$HasOnlyReadOnlySerializer(); +} + +class _$HasOnlyReadOnlySerializer + implements StructuredSerializer { + @override + final Iterable types = const [HasOnlyReadOnly, _$HasOnlyReadOnly]; + + @override + final String wireName = r'HasOnlyReadOnly'; + + @override + Iterable serialize(Serializers serializers, HasOnlyReadOnly object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.bar != null) { + result + ..add(r'bar') + ..add(serializers.serialize(object.bar, + specifiedType: const FullType(String))); + } + if (object.foo != null) { + result + ..add(r'foo') + ..add(serializers.serialize(object.foo, + specifiedType: const FullType(String))); + } + return result; + } + + @override + HasOnlyReadOnly deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = HasOnlyReadOnlyBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'bar': + result.bar = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'foo': + result.foo = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/health_check_result.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/health_check_result.dart new file mode 100644 index 000000000000..8fb18b9e352d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/health_check_result.dart @@ -0,0 +1,68 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'health_check_result.g.dart'; + +abstract class HealthCheckResult + implements Built { + @BuiltValueField(wireName: r'NullableMessage') + String? get nullableMessage; + + HealthCheckResult._(); + + static void _initializeBuilder(HealthCheckResultBuilder b) => b; + + factory HealthCheckResult([void updates(HealthCheckResultBuilder b)]) = + _$HealthCheckResult; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$HealthCheckResultSerializer(); +} + +class _$HealthCheckResultSerializer + implements StructuredSerializer { + @override + final Iterable types = const [HealthCheckResult, _$HealthCheckResult]; + + @override + final String wireName = r'HealthCheckResult'; + + @override + Iterable serialize(Serializers serializers, HealthCheckResult object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.nullableMessage != null) { + result + ..add(r'NullableMessage') + ..add(serializers.serialize(object.nullableMessage, + specifiedType: const FullType(String))); + } + return result; + } + + @override + HealthCheckResult deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = HealthCheckResultBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'NullableMessage': + result.nullableMessage = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/inline_response_default.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/inline_response_default.dart new file mode 100644 index 000000000000..be622a53992e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/inline_response_default.dart @@ -0,0 +1,73 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:openapi/src/model/foo.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'inline_response_default.g.dart'; + +abstract class InlineResponseDefault + implements Built { + @BuiltValueField(wireName: r'string') + Foo? get string; + + InlineResponseDefault._(); + + static void _initializeBuilder(InlineResponseDefaultBuilder b) => b; + + factory InlineResponseDefault( + [void updates(InlineResponseDefaultBuilder b)]) = _$InlineResponseDefault; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$InlineResponseDefaultSerializer(); +} + +class _$InlineResponseDefaultSerializer + implements StructuredSerializer { + @override + final Iterable types = const [ + InlineResponseDefault, + _$InlineResponseDefault + ]; + + @override + final String wireName = r'InlineResponseDefault'; + + @override + Iterable serialize( + Serializers serializers, InlineResponseDefault object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.string != null) { + result + ..add(r'string') + ..add(serializers.serialize(object.string, + specifiedType: const FullType(Foo))); + } + return result; + } + + @override + InlineResponseDefault deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = InlineResponseDefaultBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'string': + result.string.replace(serializers.deserialize(value, + specifiedType: const FullType(Foo)) as Foo); + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/map_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/map_test.dart new file mode 100644 index 000000000000..68ea560bbb78 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/map_test.dart @@ -0,0 +1,139 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'map_test.g.dart'; + +abstract class MapTest implements Built { + @BuiltValueField(wireName: r'map_map_of_string') + BuiltMap>? get mapMapOfString; + + @BuiltValueField(wireName: r'map_of_enum_string') + BuiltMap? get mapOfEnumString; + // enum mapOfEnumStringEnum { UPPER, lower, }; + + @BuiltValueField(wireName: r'direct_map') + BuiltMap? get directMap; + + @BuiltValueField(wireName: r'indirect_map') + BuiltMap? get indirectMap; + + MapTest._(); + + static void _initializeBuilder(MapTestBuilder b) => b; + + factory MapTest([void updates(MapTestBuilder b)]) = _$MapTest; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$MapTestSerializer(); +} + +class _$MapTestSerializer implements StructuredSerializer { + @override + final Iterable types = const [MapTest, _$MapTest]; + + @override + final String wireName = r'MapTest'; + + @override + Iterable serialize(Serializers serializers, MapTest object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.mapMapOfString != null) { + result + ..add(r'map_map_of_string') + ..add(serializers.serialize(object.mapMapOfString, + specifiedType: const FullType(BuiltMap, [ + FullType(String), + FullType(BuiltMap, [FullType(String), FullType(String)]) + ]))); + } + if (object.mapOfEnumString != null) { + result + ..add(r'map_of_enum_string') + ..add(serializers.serialize(object.mapOfEnumString, + specifiedType: const FullType(BuiltMap, + [FullType(String), FullType(MapTestMapOfEnumStringEnum)]))); + } + if (object.directMap != null) { + result + ..add(r'direct_map') + ..add(serializers.serialize(object.directMap, + specifiedType: + const FullType(BuiltMap, [FullType(String), FullType(bool)]))); + } + if (object.indirectMap != null) { + result + ..add(r'indirect_map') + ..add(serializers.serialize(object.indirectMap, + specifiedType: + const FullType(BuiltMap, [FullType(String), FullType(bool)]))); + } + return result; + } + + @override + MapTest deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = MapTestBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'map_map_of_string': + result.mapMapOfString.replace(serializers.deserialize(value, + specifiedType: const FullType(BuiltMap, [ + FullType(String), + FullType(BuiltMap, [FullType(String), FullType(String)]) + ])) as BuiltMap>); + break; + case r'map_of_enum_string': + result.mapOfEnumString.replace(serializers.deserialize(value, + specifiedType: const FullType(BuiltMap, [ + FullType(String), + FullType(MapTestMapOfEnumStringEnum) + ])) as BuiltMap); + break; + case r'direct_map': + result.directMap.replace(serializers.deserialize(value, + specifiedType: const FullType( + BuiltMap, [FullType(String), FullType(bool)])) + as BuiltMap); + break; + case r'indirect_map': + result.indirectMap.replace(serializers.deserialize(value, + specifiedType: const FullType( + BuiltMap, [FullType(String), FullType(bool)])) + as BuiltMap); + break; + } + } + return result.build(); + } +} + +class MapTestMapOfEnumStringEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'UPPER') + static const MapTestMapOfEnumStringEnum UPPER = + _$mapTestMapOfEnumStringEnum_UPPER; + @BuiltValueEnumConst(wireName: r'lower') + static const MapTestMapOfEnumStringEnum lower = + _$mapTestMapOfEnumStringEnum_lower; + + static Serializer get serializer => + _$mapTestMapOfEnumStringEnumSerializer; + + const MapTestMapOfEnumStringEnum._(String name) : super(name); + + static BuiltSet get values => + _$mapTestMapOfEnumStringEnumValues; + static MapTestMapOfEnumStringEnum valueOf(String name) => + _$mapTestMapOfEnumStringEnumValueOf(name); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/mixed_properties_and_additional_properties_class.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/mixed_properties_and_additional_properties_class.dart new file mode 100644 index 000000000000..0e4c5b275cc4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/mixed_properties_and_additional_properties_class.dart @@ -0,0 +1,111 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/animal.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'mixed_properties_and_additional_properties_class.g.dart'; + +abstract class MixedPropertiesAndAdditionalPropertiesClass + implements + Built { + @BuiltValueField(wireName: r'uuid') + String? get uuid; + + @BuiltValueField(wireName: r'dateTime') + DateTime? get dateTime; + + @BuiltValueField(wireName: r'map') + BuiltMap? get map; + + MixedPropertiesAndAdditionalPropertiesClass._(); + + static void _initializeBuilder( + MixedPropertiesAndAdditionalPropertiesClassBuilder b) => + b; + + factory MixedPropertiesAndAdditionalPropertiesClass( + [void updates( + MixedPropertiesAndAdditionalPropertiesClassBuilder b)]) = + _$MixedPropertiesAndAdditionalPropertiesClass; + + @BuiltValueSerializer(custom: true) + static Serializer + get serializer => + _$MixedPropertiesAndAdditionalPropertiesClassSerializer(); +} + +class _$MixedPropertiesAndAdditionalPropertiesClassSerializer + implements + StructuredSerializer { + @override + final Iterable types = const [ + MixedPropertiesAndAdditionalPropertiesClass, + _$MixedPropertiesAndAdditionalPropertiesClass + ]; + + @override + final String wireName = r'MixedPropertiesAndAdditionalPropertiesClass'; + + @override + Iterable serialize(Serializers serializers, + MixedPropertiesAndAdditionalPropertiesClass object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.uuid != null) { + result + ..add(r'uuid') + ..add(serializers.serialize(object.uuid, + specifiedType: const FullType(String))); + } + if (object.dateTime != null) { + result + ..add(r'dateTime') + ..add(serializers.serialize(object.dateTime, + specifiedType: const FullType(DateTime))); + } + if (object.map != null) { + result + ..add(r'map') + ..add(serializers.serialize(object.map, + specifiedType: const FullType( + BuiltMap, [FullType(String), FullType(Animal)]))); + } + return result; + } + + @override + MixedPropertiesAndAdditionalPropertiesClass deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = MixedPropertiesAndAdditionalPropertiesClassBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'uuid': + result.uuid = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'dateTime': + result.dateTime = serializers.deserialize(value, + specifiedType: const FullType(DateTime)) as DateTime; + break; + case r'map': + result.map.replace(serializers.deserialize(value, + specifiedType: const FullType( + BuiltMap, [FullType(String), FullType(Animal)])) + as BuiltMap); + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model200_response.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model200_response.dart new file mode 100644 index 000000000000..457494bed53e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model200_response.dart @@ -0,0 +1,81 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model200_response.g.dart'; + +abstract class Model200Response + implements Built { + @BuiltValueField(wireName: r'name') + int? get name; + + @BuiltValueField(wireName: r'class') + String? get class_; + + Model200Response._(); + + static void _initializeBuilder(Model200ResponseBuilder b) => b; + + factory Model200Response([void updates(Model200ResponseBuilder b)]) = + _$Model200Response; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$Model200ResponseSerializer(); +} + +class _$Model200ResponseSerializer + implements StructuredSerializer { + @override + final Iterable types = const [Model200Response, _$Model200Response]; + + @override + final String wireName = r'Model200Response'; + + @override + Iterable serialize(Serializers serializers, Model200Response object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.name != null) { + result + ..add(r'name') + ..add(serializers.serialize(object.name, + specifiedType: const FullType(int))); + } + if (object.class_ != null) { + result + ..add(r'class') + ..add(serializers.serialize(object.class_, + specifiedType: const FullType(String))); + } + return result; + } + + @override + Model200Response deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = Model200ResponseBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'name': + result.name = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + break; + case r'class': + result.class_ = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_client.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_client.dart new file mode 100644 index 000000000000..acbb28fc7322 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_client.dart @@ -0,0 +1,63 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_client.g.dart'; + +abstract class ModelClient implements Built { + @BuiltValueField(wireName: r'client') + String? get client; + + ModelClient._(); + + static void _initializeBuilder(ModelClientBuilder b) => b; + + factory ModelClient([void updates(ModelClientBuilder b)]) = _$ModelClient; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelClientSerializer(); +} + +class _$ModelClientSerializer implements StructuredSerializer { + @override + final Iterable types = const [ModelClient, _$ModelClient]; + + @override + final String wireName = r'ModelClient'; + + @override + Iterable serialize(Serializers serializers, ModelClient object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.client != null) { + result + ..add(r'client') + ..add(serializers.serialize(object.client, + specifiedType: const FullType(String))); + } + return result; + } + + @override + ModelClient deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = ModelClientBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'client': + result.client = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_enum_class.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_enum_class.dart new file mode 100644 index 000000000000..9ecc6e9fe8ee --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_enum_class.dart @@ -0,0 +1,35 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_enum_class.g.dart'; + +class ModelEnumClass extends EnumClass { + @BuiltValueEnumConst(wireName: r'_abc') + static const ModelEnumClass abc = _$abc; + @BuiltValueEnumConst(wireName: r'-efg') + static const ModelEnumClass efg = _$efg; + @BuiltValueEnumConst(wireName: r'(xyz)') + static const ModelEnumClass leftParenthesisXyzRightParenthesis = + _$leftParenthesisXyzRightParenthesis; + + static Serializer get serializer => + _$modelEnumClassSerializer; + + const ModelEnumClass._(String name) : super(name); + + static BuiltSet get values => _$values; + static ModelEnumClass valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class ModelEnumClassMixin = Object with _$ModelEnumClassMixin; diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_file.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_file.dart new file mode 100644 index 000000000000..1c5e4b869817 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_file.dart @@ -0,0 +1,64 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_file.g.dart'; + +abstract class ModelFile implements Built { + /// Test capitalization + @BuiltValueField(wireName: r'sourceURI') + String? get sourceURI; + + ModelFile._(); + + static void _initializeBuilder(ModelFileBuilder b) => b; + + factory ModelFile([void updates(ModelFileBuilder b)]) = _$ModelFile; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelFileSerializer(); +} + +class _$ModelFileSerializer implements StructuredSerializer { + @override + final Iterable types = const [ModelFile, _$ModelFile]; + + @override + final String wireName = r'ModelFile'; + + @override + Iterable serialize(Serializers serializers, ModelFile object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.sourceURI != null) { + result + ..add(r'sourceURI') + ..add(serializers.serialize(object.sourceURI, + specifiedType: const FullType(String))); + } + return result; + } + + @override + ModelFile deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = ModelFileBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'sourceURI': + result.sourceURI = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_list.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_list.dart new file mode 100644 index 000000000000..53fe912acb14 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_list.dart @@ -0,0 +1,63 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_list.g.dart'; + +abstract class ModelList implements Built { + @BuiltValueField(wireName: r'123-list') + String? get n123list; + + ModelList._(); + + static void _initializeBuilder(ModelListBuilder b) => b; + + factory ModelList([void updates(ModelListBuilder b)]) = _$ModelList; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelListSerializer(); +} + +class _$ModelListSerializer implements StructuredSerializer { + @override + final Iterable types = const [ModelList, _$ModelList]; + + @override + final String wireName = r'ModelList'; + + @override + Iterable serialize(Serializers serializers, ModelList object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.n123list != null) { + result + ..add(r'123-list') + ..add(serializers.serialize(object.n123list, + specifiedType: const FullType(String))); + } + return result; + } + + @override + ModelList deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = ModelListBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'123-list': + result.n123list = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_return.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_return.dart new file mode 100644 index 000000000000..9015504dc6ed --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/model_return.dart @@ -0,0 +1,63 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_return.g.dart'; + +abstract class ModelReturn implements Built { + @BuiltValueField(wireName: r'return') + int? get return_; + + ModelReturn._(); + + static void _initializeBuilder(ModelReturnBuilder b) => b; + + factory ModelReturn([void updates(ModelReturnBuilder b)]) = _$ModelReturn; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelReturnSerializer(); +} + +class _$ModelReturnSerializer implements StructuredSerializer { + @override + final Iterable types = const [ModelReturn, _$ModelReturn]; + + @override + final String wireName = r'ModelReturn'; + + @override + Iterable serialize(Serializers serializers, ModelReturn object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.return_ != null) { + result + ..add(r'return') + ..add(serializers.serialize(object.return_, + specifiedType: const FullType(int))); + } + return result; + } + + @override + ModelReturn deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = ModelReturnBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'return': + result.return_ = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/name.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/name.dart new file mode 100644 index 000000000000..21472493361e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/name.dart @@ -0,0 +1,100 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'name.g.dart'; + +abstract class Name implements Built { + @BuiltValueField(wireName: r'name') + int get name; + + @BuiltValueField(wireName: r'snake_case') + int? get snakeCase; + + @BuiltValueField(wireName: r'property') + String? get property; + + @BuiltValueField(wireName: r'123Number') + int? get n123number; + + Name._(); + + static void _initializeBuilder(NameBuilder b) => b; + + factory Name([void updates(NameBuilder b)]) = _$Name; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$NameSerializer(); +} + +class _$NameSerializer implements StructuredSerializer { + @override + final Iterable types = const [Name, _$Name]; + + @override + final String wireName = r'Name'; + + @override + Iterable serialize(Serializers serializers, Name object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + result + ..add(r'name') + ..add(serializers.serialize(object.name, + specifiedType: const FullType(int))); + if (object.snakeCase != null) { + result + ..add(r'snake_case') + ..add(serializers.serialize(object.snakeCase, + specifiedType: const FullType(int))); + } + if (object.property != null) { + result + ..add(r'property') + ..add(serializers.serialize(object.property, + specifiedType: const FullType(String))); + } + if (object.n123number != null) { + result + ..add(r'123Number') + ..add(serializers.serialize(object.n123number, + specifiedType: const FullType(int))); + } + return result; + } + + @override + Name deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = NameBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'name': + result.name = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + break; + case r'snake_case': + result.snakeCase = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + break; + case r'property': + result.property = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'123Number': + result.n123number = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/nullable_class.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/nullable_class.dart new file mode 100644 index 000000000000..e4ca5bfd1896 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/nullable_class.dart @@ -0,0 +1,229 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/json_object.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'nullable_class.g.dart'; + +abstract class NullableClass + implements Built { + @BuiltValueField(wireName: r'integer_prop') + int? get integerProp; + + @BuiltValueField(wireName: r'number_prop') + num? get numberProp; + + @BuiltValueField(wireName: r'boolean_prop') + bool? get booleanProp; + + @BuiltValueField(wireName: r'string_prop') + String? get stringProp; + + @BuiltValueField(wireName: r'date_prop') + DateTime? get dateProp; + + @BuiltValueField(wireName: r'datetime_prop') + DateTime? get datetimeProp; + + @BuiltValueField(wireName: r'array_nullable_prop') + BuiltList? get arrayNullableProp; + + @BuiltValueField(wireName: r'array_and_items_nullable_prop') + BuiltList? get arrayAndItemsNullableProp; + + @BuiltValueField(wireName: r'array_items_nullable') + BuiltList? get arrayItemsNullable; + + @BuiltValueField(wireName: r'object_nullable_prop') + BuiltMap? get objectNullableProp; + + @BuiltValueField(wireName: r'object_and_items_nullable_prop') + BuiltMap? get objectAndItemsNullableProp; + + @BuiltValueField(wireName: r'object_items_nullable') + BuiltMap? get objectItemsNullable; + + NullableClass._(); + + static void _initializeBuilder(NullableClassBuilder b) => b; + + factory NullableClass([void updates(NullableClassBuilder b)]) = + _$NullableClass; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$NullableClassSerializer(); +} + +class _$NullableClassSerializer implements StructuredSerializer { + @override + final Iterable types = const [NullableClass, _$NullableClass]; + + @override + final String wireName = r'NullableClass'; + + @override + Iterable serialize(Serializers serializers, NullableClass object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.integerProp != null) { + result + ..add(r'integer_prop') + ..add(serializers.serialize(object.integerProp, + specifiedType: const FullType(int))); + } + if (object.numberProp != null) { + result + ..add(r'number_prop') + ..add(serializers.serialize(object.numberProp, + specifiedType: const FullType(num))); + } + if (object.booleanProp != null) { + result + ..add(r'boolean_prop') + ..add(serializers.serialize(object.booleanProp, + specifiedType: const FullType(bool))); + } + if (object.stringProp != null) { + result + ..add(r'string_prop') + ..add(serializers.serialize(object.stringProp, + specifiedType: const FullType(String))); + } + if (object.dateProp != null) { + result + ..add(r'date_prop') + ..add(serializers.serialize(object.dateProp, + specifiedType: const FullType(DateTime))); + } + if (object.datetimeProp != null) { + result + ..add(r'datetime_prop') + ..add(serializers.serialize(object.datetimeProp, + specifiedType: const FullType(DateTime))); + } + if (object.arrayNullableProp != null) { + result + ..add(r'array_nullable_prop') + ..add(serializers.serialize(object.arrayNullableProp, + specifiedType: const FullType(BuiltList, [FullType(JsonObject)]))); + } + if (object.arrayAndItemsNullableProp != null) { + result + ..add(r'array_and_items_nullable_prop') + ..add(serializers.serialize(object.arrayAndItemsNullableProp, + specifiedType: const FullType(BuiltList, [FullType(JsonObject)]))); + } + if (object.arrayItemsNullable != null) { + result + ..add(r'array_items_nullable') + ..add(serializers.serialize(object.arrayItemsNullable, + specifiedType: const FullType(BuiltList, [FullType(JsonObject)]))); + } + if (object.objectNullableProp != null) { + result + ..add(r'object_nullable_prop') + ..add(serializers.serialize(object.objectNullableProp, + specifiedType: const FullType( + BuiltMap, [FullType(String), FullType(JsonObject)]))); + } + if (object.objectAndItemsNullableProp != null) { + result + ..add(r'object_and_items_nullable_prop') + ..add(serializers.serialize(object.objectAndItemsNullableProp, + specifiedType: const FullType( + BuiltMap, [FullType(String), FullType(JsonObject)]))); + } + if (object.objectItemsNullable != null) { + result + ..add(r'object_items_nullable') + ..add(serializers.serialize(object.objectItemsNullable, + specifiedType: const FullType( + BuiltMap, [FullType(String), FullType(JsonObject)]))); + } + return result; + } + + @override + NullableClass deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = NullableClassBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'integer_prop': + result.integerProp = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + break; + case r'number_prop': + result.numberProp = serializers.deserialize(value, + specifiedType: const FullType(num)) as num; + break; + case r'boolean_prop': + result.booleanProp = serializers.deserialize(value, + specifiedType: const FullType(bool)) as bool; + break; + case r'string_prop': + result.stringProp = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'date_prop': + result.dateProp = serializers.deserialize(value, + specifiedType: const FullType(DateTime)) as DateTime; + break; + case r'datetime_prop': + result.datetimeProp = serializers.deserialize(value, + specifiedType: const FullType(DateTime)) as DateTime; + break; + case r'array_nullable_prop': + result.arrayNullableProp.replace(serializers.deserialize(value, + specifiedType: + const FullType(BuiltList, [FullType(JsonObject)])) + as BuiltList); + break; + case r'array_and_items_nullable_prop': + result.arrayAndItemsNullableProp.replace(serializers.deserialize( + value, + specifiedType: + const FullType(BuiltList, [FullType(JsonObject)])) + as BuiltList); + break; + case r'array_items_nullable': + result.arrayItemsNullable.replace(serializers.deserialize(value, + specifiedType: + const FullType(BuiltList, [FullType(JsonObject)])) + as BuiltList); + break; + case r'object_nullable_prop': + result.objectNullableProp.replace(serializers.deserialize(value, + specifiedType: const FullType( + BuiltMap, [FullType(String), FullType(JsonObject)])) + as BuiltMap); + break; + case r'object_and_items_nullable_prop': + result.objectAndItemsNullableProp.replace(serializers.deserialize( + value, + specifiedType: const FullType( + BuiltMap, [FullType(String), FullType(JsonObject)])) + as BuiltMap); + break; + case r'object_items_nullable': + result.objectItemsNullable.replace(serializers.deserialize(value, + specifiedType: const FullType( + BuiltMap, [FullType(String), FullType(JsonObject)])) + as BuiltMap); + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/number_only.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/number_only.dart new file mode 100644 index 000000000000..3e4cde2b4069 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/number_only.dart @@ -0,0 +1,63 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'number_only.g.dart'; + +abstract class NumberOnly implements Built { + @BuiltValueField(wireName: r'JustNumber') + num? get justNumber; + + NumberOnly._(); + + static void _initializeBuilder(NumberOnlyBuilder b) => b; + + factory NumberOnly([void updates(NumberOnlyBuilder b)]) = _$NumberOnly; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$NumberOnlySerializer(); +} + +class _$NumberOnlySerializer implements StructuredSerializer { + @override + final Iterable types = const [NumberOnly, _$NumberOnly]; + + @override + final String wireName = r'NumberOnly'; + + @override + Iterable serialize(Serializers serializers, NumberOnly object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.justNumber != null) { + result + ..add(r'JustNumber') + ..add(serializers.serialize(object.justNumber, + specifiedType: const FullType(num))); + } + return result; + } + + @override + NumberOnly deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = NumberOnlyBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'JustNumber': + result.justNumber = serializers.deserialize(value, + specifiedType: const FullType(num)) as num; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/order.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/order.dart new file mode 100644 index 000000000000..15c416e59343 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/order.dart @@ -0,0 +1,154 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'order.g.dart'; + +abstract class Order implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'petId') + int? get petId; + + @BuiltValueField(wireName: r'quantity') + int? get quantity; + + @BuiltValueField(wireName: r'shipDate') + DateTime? get shipDate; + + /// Order Status + @BuiltValueField(wireName: r'status') + OrderStatusEnum? get status; + // enum statusEnum { placed, approved, delivered, }; + + @BuiltValueField(wireName: r'complete') + bool? get complete; + + Order._(); + + static void _initializeBuilder(OrderBuilder b) => b..complete = false; + + factory Order([void updates(OrderBuilder b)]) = _$Order; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$OrderSerializer(); +} + +class _$OrderSerializer implements StructuredSerializer { + @override + final Iterable types = const [Order, _$Order]; + + @override + final String wireName = r'Order'; + + @override + Iterable serialize(Serializers serializers, Order object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.id != null) { + result + ..add(r'id') + ..add(serializers.serialize(object.id, + specifiedType: const FullType(int))); + } + if (object.petId != null) { + result + ..add(r'petId') + ..add(serializers.serialize(object.petId, + specifiedType: const FullType(int))); + } + if (object.quantity != null) { + result + ..add(r'quantity') + ..add(serializers.serialize(object.quantity, + specifiedType: const FullType(int))); + } + if (object.shipDate != null) { + result + ..add(r'shipDate') + ..add(serializers.serialize(object.shipDate, + specifiedType: const FullType(DateTime))); + } + if (object.status != null) { + result + ..add(r'status') + ..add(serializers.serialize(object.status, + specifiedType: const FullType(OrderStatusEnum))); + } + if (object.complete != null) { + result + ..add(r'complete') + ..add(serializers.serialize(object.complete, + specifiedType: const FullType(bool))); + } + return result; + } + + @override + Order deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = OrderBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'id': + result.id = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + break; + case r'petId': + result.petId = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + break; + case r'quantity': + result.quantity = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + break; + case r'shipDate': + result.shipDate = serializers.deserialize(value, + specifiedType: const FullType(DateTime)) as DateTime; + break; + case r'status': + result.status = serializers.deserialize(value, + specifiedType: const FullType(OrderStatusEnum)) + as OrderStatusEnum; + break; + case r'complete': + result.complete = serializers.deserialize(value, + specifiedType: const FullType(bool)) as bool; + break; + } + } + return result.build(); + } +} + +class OrderStatusEnum extends EnumClass { + /// Order Status + @BuiltValueEnumConst(wireName: r'placed') + static const OrderStatusEnum placed = _$orderStatusEnum_placed; + + /// Order Status + @BuiltValueEnumConst(wireName: r'approved') + static const OrderStatusEnum approved = _$orderStatusEnum_approved; + + /// Order Status + @BuiltValueEnumConst(wireName: r'delivered') + static const OrderStatusEnum delivered = _$orderStatusEnum_delivered; + + static Serializer get serializer => + _$orderStatusEnumSerializer; + + const OrderStatusEnum._(String name) : super(name); + + static BuiltSet get values => _$orderStatusEnumValues; + static OrderStatusEnum valueOf(String name) => _$orderStatusEnumValueOf(name); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_composite.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_composite.dart new file mode 100644 index 000000000000..fe16ebdaa5be --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_composite.dart @@ -0,0 +1,94 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_composite.g.dart'; + +abstract class OuterComposite + implements Built { + @BuiltValueField(wireName: r'my_number') + num? get myNumber; + + @BuiltValueField(wireName: r'my_string') + String? get myString; + + @BuiltValueField(wireName: r'my_boolean') + bool? get myBoolean; + + OuterComposite._(); + + static void _initializeBuilder(OuterCompositeBuilder b) => b; + + factory OuterComposite([void updates(OuterCompositeBuilder b)]) = + _$OuterComposite; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$OuterCompositeSerializer(); +} + +class _$OuterCompositeSerializer + implements StructuredSerializer { + @override + final Iterable types = const [OuterComposite, _$OuterComposite]; + + @override + final String wireName = r'OuterComposite'; + + @override + Iterable serialize(Serializers serializers, OuterComposite object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.myNumber != null) { + result + ..add(r'my_number') + ..add(serializers.serialize(object.myNumber, + specifiedType: const FullType(num))); + } + if (object.myString != null) { + result + ..add(r'my_string') + ..add(serializers.serialize(object.myString, + specifiedType: const FullType(String))); + } + if (object.myBoolean != null) { + result + ..add(r'my_boolean') + ..add(serializers.serialize(object.myBoolean, + specifiedType: const FullType(bool))); + } + return result; + } + + @override + OuterComposite deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = OuterCompositeBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'my_number': + result.myNumber = serializers.deserialize(value, + specifiedType: const FullType(num)) as num; + break; + case r'my_string': + result.myString = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'my_boolean': + result.myBoolean = serializers.deserialize(value, + specifiedType: const FullType(bool)) as bool; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum.dart new file mode 100644 index 000000000000..24423cf8927b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum.dart @@ -0,0 +1,33 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_enum.g.dart'; + +class OuterEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'placed') + static const OuterEnum placed = _$placed; + @BuiltValueEnumConst(wireName: r'approved') + static const OuterEnum approved = _$approved; + @BuiltValueEnumConst(wireName: r'delivered') + static const OuterEnum delivered = _$delivered; + + static Serializer get serializer => _$outerEnumSerializer; + + const OuterEnum._(String name) : super(name); + + static BuiltSet get values => _$values; + static OuterEnum valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class OuterEnumMixin = Object with _$OuterEnumMixin; diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_default_value.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_default_value.dart new file mode 100644 index 000000000000..8eef49b8f75c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_default_value.dart @@ -0,0 +1,35 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_enum_default_value.g.dart'; + +class OuterEnumDefaultValue extends EnumClass { + @BuiltValueEnumConst(wireName: r'placed') + static const OuterEnumDefaultValue placed = _$placed; + @BuiltValueEnumConst(wireName: r'approved') + static const OuterEnumDefaultValue approved = _$approved; + @BuiltValueEnumConst(wireName: r'delivered') + static const OuterEnumDefaultValue delivered = _$delivered; + + static Serializer get serializer => + _$outerEnumDefaultValueSerializer; + + const OuterEnumDefaultValue._(String name) : super(name); + + static BuiltSet get values => _$values; + static OuterEnumDefaultValue valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class OuterEnumDefaultValueMixin = Object + with _$OuterEnumDefaultValueMixin; diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_integer.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_integer.dart new file mode 100644 index 000000000000..0a84bdbe7906 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_integer.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_enum_integer.g.dart'; + +class OuterEnumInteger extends EnumClass { + @BuiltValueEnumConst(wireNumber: 0) + static const OuterEnumInteger number0 = _$number0; + @BuiltValueEnumConst(wireNumber: 1) + static const OuterEnumInteger number1 = _$number1; + @BuiltValueEnumConst(wireNumber: 2) + static const OuterEnumInteger number2 = _$number2; + + static Serializer get serializer => + _$outerEnumIntegerSerializer; + + const OuterEnumInteger._(String name) : super(name); + + static BuiltSet get values => _$values; + static OuterEnumInteger valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class OuterEnumIntegerMixin = Object with _$OuterEnumIntegerMixin; diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_integer_default_value.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_integer_default_value.dart new file mode 100644 index 000000000000..f926f5580c51 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_enum_integer_default_value.dart @@ -0,0 +1,35 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_enum_integer_default_value.g.dart'; + +class OuterEnumIntegerDefaultValue extends EnumClass { + @BuiltValueEnumConst(wireNumber: 0) + static const OuterEnumIntegerDefaultValue number0 = _$number0; + @BuiltValueEnumConst(wireNumber: 1) + static const OuterEnumIntegerDefaultValue number1 = _$number1; + @BuiltValueEnumConst(wireNumber: 2) + static const OuterEnumIntegerDefaultValue number2 = _$number2; + + static Serializer get serializer => + _$outerEnumIntegerDefaultValueSerializer; + + const OuterEnumIntegerDefaultValue._(String name) : super(name); + + static BuiltSet get values => _$values; + static OuterEnumIntegerDefaultValue valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class OuterEnumIntegerDefaultValueMixin = Object + with _$OuterEnumIntegerDefaultValueMixin; diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_object_with_enum_property.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_object_with_enum_property.dart new file mode 100644 index 000000000000..5e76bfa112eb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/outer_object_with_enum_property.dart @@ -0,0 +1,75 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:openapi/src/model/outer_enum_integer.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_object_with_enum_property.g.dart'; + +abstract class OuterObjectWithEnumProperty + implements + Built { + @BuiltValueField(wireName: r'value') + OuterEnumInteger get value; + // enum valueEnum { 0, 1, 2, }; + + OuterObjectWithEnumProperty._(); + + static void _initializeBuilder(OuterObjectWithEnumPropertyBuilder b) => b; + + factory OuterObjectWithEnumProperty( + [void updates(OuterObjectWithEnumPropertyBuilder b)]) = + _$OuterObjectWithEnumProperty; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$OuterObjectWithEnumPropertySerializer(); +} + +class _$OuterObjectWithEnumPropertySerializer + implements StructuredSerializer { + @override + final Iterable types = const [ + OuterObjectWithEnumProperty, + _$OuterObjectWithEnumProperty + ]; + + @override + final String wireName = r'OuterObjectWithEnumProperty'; + + @override + Iterable serialize( + Serializers serializers, OuterObjectWithEnumProperty object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + result + ..add(r'value') + ..add(serializers.serialize(object.value, + specifiedType: const FullType(OuterEnumInteger))); + return result; + } + + @override + OuterObjectWithEnumProperty deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = OuterObjectWithEnumPropertyBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'value': + result.value = serializers.deserialize(value, + specifiedType: const FullType(OuterEnumInteger)) + as OuterEnumInteger; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/pet.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/pet.dart new file mode 100644 index 000000000000..1161b1d37e05 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/pet.dart @@ -0,0 +1,152 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/category.dart'; +import 'package:openapi/src/model/tag.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'pet.g.dart'; + +abstract class Pet implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'category') + Category? get category; + + @BuiltValueField(wireName: r'name') + String get name; + + @BuiltValueField(wireName: r'photoUrls') + BuiltSet get photoUrls; + + @BuiltValueField(wireName: r'tags') + BuiltList? get tags; + + /// pet status in the store + @BuiltValueField(wireName: r'status') + PetStatusEnum? get status; + // enum statusEnum { available, pending, sold, }; + + Pet._(); + + static void _initializeBuilder(PetBuilder b) => b; + + factory Pet([void updates(PetBuilder b)]) = _$Pet; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$PetSerializer(); +} + +class _$PetSerializer implements StructuredSerializer { + @override + final Iterable types = const [Pet, _$Pet]; + + @override + final String wireName = r'Pet'; + + @override + Iterable serialize(Serializers serializers, Pet object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.id != null) { + result + ..add(r'id') + ..add(serializers.serialize(object.id, + specifiedType: const FullType(int))); + } + if (object.category != null) { + result + ..add(r'category') + ..add(serializers.serialize(object.category, + specifiedType: const FullType(Category))); + } + result + ..add(r'name') + ..add(serializers.serialize(object.name, + specifiedType: const FullType(String))); + result + ..add(r'photoUrls') + ..add(serializers.serialize(object.photoUrls, + specifiedType: const FullType(BuiltSet, [FullType(String)]))); + if (object.tags != null) { + result + ..add(r'tags') + ..add(serializers.serialize(object.tags, + specifiedType: const FullType(BuiltList, [FullType(Tag)]))); + } + if (object.status != null) { + result + ..add(r'status') + ..add(serializers.serialize(object.status, + specifiedType: const FullType(PetStatusEnum))); + } + return result; + } + + @override + Pet deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = PetBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'id': + result.id = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + break; + case r'category': + result.category.replace(serializers.deserialize(value, + specifiedType: const FullType(Category)) as Category); + break; + case r'name': + result.name = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'photoUrls': + result.photoUrls.replace(serializers.deserialize(value, + specifiedType: const FullType(BuiltSet, [FullType(String)])) + as BuiltSet); + break; + case r'tags': + result.tags.replace(serializers.deserialize(value, + specifiedType: const FullType(BuiltList, [FullType(Tag)])) + as BuiltList); + break; + case r'status': + result.status = serializers.deserialize(value, + specifiedType: const FullType(PetStatusEnum)) as PetStatusEnum; + break; + } + } + return result.build(); + } +} + +class PetStatusEnum extends EnumClass { + /// pet status in the store + @BuiltValueEnumConst(wireName: r'available') + static const PetStatusEnum available = _$petStatusEnum_available; + + /// pet status in the store + @BuiltValueEnumConst(wireName: r'pending') + static const PetStatusEnum pending = _$petStatusEnum_pending; + + /// pet status in the store + @BuiltValueEnumConst(wireName: r'sold') + static const PetStatusEnum sold = _$petStatusEnum_sold; + + static Serializer get serializer => _$petStatusEnumSerializer; + + const PetStatusEnum._(String name) : super(name); + + static BuiltSet get values => _$petStatusEnumValues; + static PetStatusEnum valueOf(String name) => _$petStatusEnumValueOf(name); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/read_only_first.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/read_only_first.dart new file mode 100644 index 000000000000..99b152f04ccd --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/read_only_first.dart @@ -0,0 +1,80 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'read_only_first.g.dart'; + +abstract class ReadOnlyFirst + implements Built { + @BuiltValueField(wireName: r'bar') + String? get bar; + + @BuiltValueField(wireName: r'baz') + String? get baz; + + ReadOnlyFirst._(); + + static void _initializeBuilder(ReadOnlyFirstBuilder b) => b; + + factory ReadOnlyFirst([void updates(ReadOnlyFirstBuilder b)]) = + _$ReadOnlyFirst; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$ReadOnlyFirstSerializer(); +} + +class _$ReadOnlyFirstSerializer implements StructuredSerializer { + @override + final Iterable types = const [ReadOnlyFirst, _$ReadOnlyFirst]; + + @override + final String wireName = r'ReadOnlyFirst'; + + @override + Iterable serialize(Serializers serializers, ReadOnlyFirst object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.bar != null) { + result + ..add(r'bar') + ..add(serializers.serialize(object.bar, + specifiedType: const FullType(String))); + } + if (object.baz != null) { + result + ..add(r'baz') + ..add(serializers.serialize(object.baz, + specifiedType: const FullType(String))); + } + return result; + } + + @override + ReadOnlyFirst deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = ReadOnlyFirstBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'bar': + result.bar = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'baz': + result.baz = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/special_model_name.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/special_model_name.dart new file mode 100644 index 000000000000..f1db8a220511 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/special_model_name.dart @@ -0,0 +1,73 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'special_model_name.g.dart'; + +abstract class SpecialModelName + implements Built { + @BuiltValueField(wireName: r'$special[property.name]') + int? get dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + + SpecialModelName._(); + + static void _initializeBuilder(SpecialModelNameBuilder b) => b; + + factory SpecialModelName([void updates(SpecialModelNameBuilder b)]) = + _$SpecialModelName; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$SpecialModelNameSerializer(); +} + +class _$SpecialModelNameSerializer + implements StructuredSerializer { + @override + final Iterable types = const [SpecialModelName, _$SpecialModelName]; + + @override + final String wireName = r'SpecialModelName'; + + @override + Iterable serialize(Serializers serializers, SpecialModelName object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object + .dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket != + null) { + result + ..add(r'$special[property.name]') + ..add(serializers.serialize( + object + .dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket, + specifiedType: const FullType(int))); + } + return result; + } + + @override + SpecialModelName deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = SpecialModelNameBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'$special[property.name]': + result.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket = + serializers.deserialize(value, specifiedType: const FullType(int)) + as int; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/tag.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/tag.dart new file mode 100644 index 000000000000..bd591d62aa35 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/tag.dart @@ -0,0 +1,76 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'tag.g.dart'; + +abstract class Tag implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'name') + String? get name; + + Tag._(); + + static void _initializeBuilder(TagBuilder b) => b; + + factory Tag([void updates(TagBuilder b)]) = _$Tag; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$TagSerializer(); +} + +class _$TagSerializer implements StructuredSerializer { + @override + final Iterable types = const [Tag, _$Tag]; + + @override + final String wireName = r'Tag'; + + @override + Iterable serialize(Serializers serializers, Tag object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.id != null) { + result + ..add(r'id') + ..add(serializers.serialize(object.id, + specifiedType: const FullType(int))); + } + if (object.name != null) { + result + ..add(r'name') + ..add(serializers.serialize(object.name, + specifiedType: const FullType(String))); + } + return result; + } + + @override + Tag deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = TagBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'id': + result.id = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + break; + case r'name': + result.name = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/user.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/user.dart new file mode 100644 index 000000000000..67cd20d15a40 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/model/user.dart @@ -0,0 +1,155 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'user.g.dart'; + +abstract class User implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'username') + String? get username; + + @BuiltValueField(wireName: r'firstName') + String? get firstName; + + @BuiltValueField(wireName: r'lastName') + String? get lastName; + + @BuiltValueField(wireName: r'email') + String? get email; + + @BuiltValueField(wireName: r'password') + String? get password; + + @BuiltValueField(wireName: r'phone') + String? get phone; + + /// User Status + @BuiltValueField(wireName: r'userStatus') + int? get userStatus; + + User._(); + + static void _initializeBuilder(UserBuilder b) => b; + + factory User([void updates(UserBuilder b)]) = _$User; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$UserSerializer(); +} + +class _$UserSerializer implements StructuredSerializer { + @override + final Iterable types = const [User, _$User]; + + @override + final String wireName = r'User'; + + @override + Iterable serialize(Serializers serializers, User object, + {FullType specifiedType = FullType.unspecified}) { + final result = []; + if (object.id != null) { + result + ..add(r'id') + ..add(serializers.serialize(object.id, + specifiedType: const FullType(int))); + } + if (object.username != null) { + result + ..add(r'username') + ..add(serializers.serialize(object.username, + specifiedType: const FullType(String))); + } + if (object.firstName != null) { + result + ..add(r'firstName') + ..add(serializers.serialize(object.firstName, + specifiedType: const FullType(String))); + } + if (object.lastName != null) { + result + ..add(r'lastName') + ..add(serializers.serialize(object.lastName, + specifiedType: const FullType(String))); + } + if (object.email != null) { + result + ..add(r'email') + ..add(serializers.serialize(object.email, + specifiedType: const FullType(String))); + } + if (object.password != null) { + result + ..add(r'password') + ..add(serializers.serialize(object.password, + specifiedType: const FullType(String))); + } + if (object.phone != null) { + result + ..add(r'phone') + ..add(serializers.serialize(object.phone, + specifiedType: const FullType(String))); + } + if (object.userStatus != null) { + result + ..add(r'userStatus') + ..add(serializers.serialize(object.userStatus, + specifiedType: const FullType(int))); + } + return result; + } + + @override + User deserialize(Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = UserBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object? value = iterator.current; + switch (key) { + case r'id': + result.id = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + break; + case r'username': + result.username = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'firstName': + result.firstName = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'lastName': + result.lastName = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'email': + result.email = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'password': + result.password = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'phone': + result.phone = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case r'userStatus': + result.userStatus = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + break; + } + } + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/serializers.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/serializers.dart new file mode 100644 index 000000000000..e922e1d467c4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/lib/src/serializers.dart @@ -0,0 +1,129 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/json_object.dart'; +import 'package:built_value/serializer.dart'; +import 'package:built_value/standard_json_plugin.dart'; +import 'package:built_value/iso_8601_date_time_serializer.dart'; + +import 'package:openapi/src/model/additional_properties_class.dart'; +import 'package:openapi/src/model/animal.dart'; +import 'package:openapi/src/model/api_response.dart'; +import 'package:openapi/src/model/array_of_array_of_number_only.dart'; +import 'package:openapi/src/model/array_of_number_only.dart'; +import 'package:openapi/src/model/array_test.dart'; +import 'package:openapi/src/model/capitalization.dart'; +import 'package:openapi/src/model/cat.dart'; +import 'package:openapi/src/model/cat_all_of.dart'; +import 'package:openapi/src/model/category.dart'; +import 'package:openapi/src/model/class_model.dart'; +import 'package:openapi/src/model/dog.dart'; +import 'package:openapi/src/model/dog_all_of.dart'; +import 'package:openapi/src/model/enum_arrays.dart'; +import 'package:openapi/src/model/enum_test.dart'; +import 'package:openapi/src/model/file_schema_test_class.dart'; +import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/format_test.dart'; +import 'package:openapi/src/model/has_only_read_only.dart'; +import 'package:openapi/src/model/health_check_result.dart'; +import 'package:openapi/src/model/inline_response_default.dart'; +import 'package:openapi/src/model/map_test.dart'; +import 'package:openapi/src/model/mixed_properties_and_additional_properties_class.dart'; +import 'package:openapi/src/model/model200_response.dart'; +import 'package:openapi/src/model/model_client.dart'; +import 'package:openapi/src/model/model_enum_class.dart'; +import 'package:openapi/src/model/model_file.dart'; +import 'package:openapi/src/model/model_list.dart'; +import 'package:openapi/src/model/model_return.dart'; +import 'package:openapi/src/model/name.dart'; +import 'package:openapi/src/model/nullable_class.dart'; +import 'package:openapi/src/model/number_only.dart'; +import 'package:openapi/src/model/order.dart'; +import 'package:openapi/src/model/outer_composite.dart'; +import 'package:openapi/src/model/outer_enum.dart'; +import 'package:openapi/src/model/outer_enum_default_value.dart'; +import 'package:openapi/src/model/outer_enum_integer.dart'; +import 'package:openapi/src/model/outer_enum_integer_default_value.dart'; +import 'package:openapi/src/model/outer_object_with_enum_property.dart'; +import 'package:openapi/src/model/pet.dart'; +import 'package:openapi/src/model/read_only_first.dart'; +import 'package:openapi/src/model/special_model_name.dart'; +import 'package:openapi/src/model/tag.dart'; +import 'package:openapi/src/model/user.dart'; + +part 'serializers.g.dart'; + +@SerializersFor([ + AdditionalPropertiesClass, + Animal, + ApiResponse, + ArrayOfArrayOfNumberOnly, + ArrayOfNumberOnly, + ArrayTest, + Capitalization, + Cat, + CatAllOf, + Category, + ClassModel, + Dog, + DogAllOf, + EnumArrays, + EnumTest, + FileSchemaTestClass, + Foo, + FormatTest, + HasOnlyReadOnly, + HealthCheckResult, + InlineResponseDefault, + MapTest, + MixedPropertiesAndAdditionalPropertiesClass, + Model200Response, + ModelClient, + ModelEnumClass, + ModelFile, + ModelList, + ModelReturn, + Name, + NullableClass, + NumberOnly, + Order, + OuterComposite, + OuterEnum, + OuterEnumDefaultValue, + OuterEnumInteger, + OuterEnumIntegerDefaultValue, + OuterObjectWithEnumProperty, + Pet, + ReadOnlyFirst, + SpecialModelName, + Tag, + User, +]) +Serializers serializers = (_$serializers.toBuilder() + ..addBuilderFactory( + const FullType(BuiltMap, [FullType(String), FullType(String)]), + () => MapBuilder(), + ) + ..addBuilderFactory( + const FullType(BuiltSet, [FullType(Pet)]), + () => SetBuilder(), + ) + ..addBuilderFactory( + const FullType(BuiltList, [FullType(Pet)]), + () => ListBuilder(), + ) + ..addBuilderFactory( + const FullType(BuiltMap, [FullType(String), FullType(int)]), + () => MapBuilder(), + ) + ..addBuilderFactory( + const FullType(BuiltList, [FullType(User)]), + () => ListBuilder(), + ) + ..add(Iso8601DateTimeSerializer())) + .build(); + +Serializers standardSerializers = + (serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build(); diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/pom.xml b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/pom.xml new file mode 100644 index 000000000000..511129f20e61 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/pom.xml @@ -0,0 +1,170 @@ + + 4.0.0 + org.openapitools + DartDioNextPetstoreClientLibFakeTests + pom + 1.0.0-SNAPSHOT + DartDioNext Petstore Client Lib Fake + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + pub-get + pre-integration-test + + exec + + + pub + + get + + + + + format + + pre-integration-test + + exec + + + dart + + format + --set-exit-if-changed + --output=none + . + + + + + pub-run-build-runner + pre-integration-test + + exec + + + pub + + run + build_runner + build + + + + + dart-analyze + integration-test + + exec + + + dart + + analyze + --fatal-infos + + + + + dart-test + integration-test + + exec + + + dart + + test + + + + + tests-pub-get + pre-integration-test + + exec + + + ../petstore_client_lib_fake_tests + pub + + get + + + + + tests-dart-format + pre-integration-test + + exec + + + ../petstore_client_lib_fake_tests + dart + + format + --set-exit-if-changed + --output=none + . + + + + + tests-dart-analyze + integration-test + + exec + + + ../petstore_client_lib_fake_tests + dart + + analyze + --fatal-infos + + + + + tests-dart-test + integration-test + + exec + + + ../petstore_client_lib_fake_tests + dart + + test + + + + + + + + diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/pubspec.yaml new file mode 100644 index 000000000000..5bcd72573d6c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/pubspec.yaml @@ -0,0 +1,16 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client + +environment: + sdk: '>=2.12.0 <3.0.0' + +dependencies: + dio: '4.0.0-prev2' + built_value: '>=8.0.3 <9.0.0' + built_collection: '>=5.0.0 <6.0.0' + +dev_dependencies: + built_value_generator: '>=8.0.3 <9.0.0' + build_runner: any + test: '>=1.16.0 <1.17.0' diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/additional_properties_class_test.dart new file mode 100644 index 000000000000..0ee0559d710c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/additional_properties_class_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AdditionalPropertiesClass +void main() { + final instance = AdditionalPropertiesClassBuilder(); + // TODO add properties to the builder and call build() + + group(AdditionalPropertiesClass, () { + // BuiltMap mapProperty + test('to test the property `mapProperty`', () async { + // TODO + }); + + // BuiltMap> mapOfMapProperty + test('to test the property `mapOfMapProperty`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/animal_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/animal_test.dart new file mode 100644 index 000000000000..5abb8c230adb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/animal_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Animal +void main() { + final instance = AnimalBuilder(); + // TODO add properties to the builder and call build() + + group(Animal, () { + // String className + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/another_fake_api_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/another_fake_api_test.dart new file mode 100644 index 000000000000..b758bba36ae0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/another_fake_api_test.dart @@ -0,0 +1,18 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for AnotherFakeApi +void main() { + final instance = Openapi().getAnotherFakeApi(); + + group(AnotherFakeApi, () { + // To test special tags + // + // To test special tags and operation ID starting with number + // + //Future call123testSpecialTags(ModelClient modelClient) async + test('test call123testSpecialTags', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/api_response_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/api_response_test.dart new file mode 100644 index 000000000000..9587579a4ab0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/api_response_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ApiResponse +void main() { + final instance = ApiResponseBuilder(); + // TODO add properties to the builder and call build() + + group(ApiResponse, () { + // int code + test('to test the property `code`', () async { + // TODO + }); + + // String type + test('to test the property `type`', () async { + // TODO + }); + + // String message + test('to test the property `message`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart new file mode 100644 index 000000000000..ad6d165e3c83 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayOfArrayOfNumberOnly +void main() { + final instance = ArrayOfArrayOfNumberOnlyBuilder(); + // TODO add properties to the builder and call build() + + group(ArrayOfArrayOfNumberOnly, () { + // BuiltList> arrayArrayNumber + test('to test the property `arrayArrayNumber`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/array_of_number_only_test.dart new file mode 100644 index 000000000000..456681ced455 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/array_of_number_only_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayOfNumberOnly +void main() { + final instance = ArrayOfNumberOnlyBuilder(); + // TODO add properties to the builder and call build() + + group(ArrayOfNumberOnly, () { + // BuiltList arrayNumber + test('to test the property `arrayNumber`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/array_test_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/array_test_test.dart new file mode 100644 index 000000000000..7b89588b2157 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/array_test_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayTest +void main() { + final instance = ArrayTestBuilder(); + // TODO add properties to the builder and call build() + + group(ArrayTest, () { + // BuiltList arrayOfString + test('to test the property `arrayOfString`', () async { + // TODO + }); + + // BuiltList> arrayArrayOfInteger + test('to test the property `arrayArrayOfInteger`', () async { + // TODO + }); + + // BuiltList> arrayArrayOfModel + test('to test the property `arrayArrayOfModel`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/capitalization_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/capitalization_test.dart new file mode 100644 index 000000000000..c1fb9cd73dc7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/capitalization_test.dart @@ -0,0 +1,41 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Capitalization +void main() { + final instance = CapitalizationBuilder(); + // TODO add properties to the builder and call build() + + group(Capitalization, () { + // String smallCamel + test('to test the property `smallCamel`', () async { + // TODO + }); + + // String capitalCamel + test('to test the property `capitalCamel`', () async { + // TODO + }); + + // String smallSnake + test('to test the property `smallSnake`', () async { + // TODO + }); + + // String capitalSnake + test('to test the property `capitalSnake`', () async { + // TODO + }); + + // String sCAETHFlowPoints + test('to test the property `sCAETHFlowPoints`', () async { + // TODO + }); + + // Name of the pet + // String ATT_NAME + test('to test the property `ATT_NAME`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/cat_all_of_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/cat_all_of_test.dart new file mode 100644 index 000000000000..8dd99ed27ae4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/cat_all_of_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for CatAllOf +void main() { + final instance = CatAllOfBuilder(); + // TODO add properties to the builder and call build() + + group(CatAllOf, () { + // bool declawed + test('to test the property `declawed`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/cat_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/cat_test.dart new file mode 100644 index 000000000000..000e31d7f176 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/cat_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Cat +void main() { + final instance = CatBuilder(); + // TODO add properties to the builder and call build() + + group(Cat, () { + // String className + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + // bool declawed + test('to test the property `declawed`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/category_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/category_test.dart new file mode 100644 index 000000000000..c484b83670ec --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/category_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Category +void main() { + final instance = CategoryBuilder(); + // TODO add properties to the builder and call build() + + group(Category, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name (default value: 'default-name') + test('to test the property `name`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/class_model_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/class_model_test.dart new file mode 100644 index 000000000000..4e19175e4c77 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/class_model_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ClassModel +void main() { + final instance = ClassModelBuilder(); + // TODO add properties to the builder and call build() + + group(ClassModel, () { + // String class_ + test('to test the property `class_`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/default_api_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/default_api_test.dart new file mode 100644 index 000000000000..9be0a9ea3077 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/default_api_test.dart @@ -0,0 +1,14 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for DefaultApi +void main() { + final instance = Openapi().getDefaultApi(); + + group(DefaultApi, () { + //Future fooGet() async + test('test fooGet', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/dog_all_of_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/dog_all_of_test.dart new file mode 100644 index 000000000000..a14ae377677e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/dog_all_of_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DogAllOf +void main() { + final instance = DogAllOfBuilder(); + // TODO add properties to the builder and call build() + + group(DogAllOf, () { + // String breed + test('to test the property `breed`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/dog_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/dog_test.dart new file mode 100644 index 000000000000..0d810b3b9fa9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/dog_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Dog +void main() { + final instance = DogBuilder(); + // TODO add properties to the builder and call build() + + group(Dog, () { + // String className + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + // String breed + test('to test the property `breed`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/enum_arrays_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/enum_arrays_test.dart new file mode 100644 index 000000000000..c0d5de925aec --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/enum_arrays_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EnumArrays +void main() { + final instance = EnumArraysBuilder(); + // TODO add properties to the builder and call build() + + group(EnumArrays, () { + // String justSymbol + test('to test the property `justSymbol`', () async { + // TODO + }); + + // BuiltList arrayEnum + test('to test the property `arrayEnum`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/enum_test_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/enum_test_test.dart new file mode 100644 index 000000000000..d7dc20b5eb77 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/enum_test_test.dart @@ -0,0 +1,50 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EnumTest +void main() { + final instance = EnumTestBuilder(); + // TODO add properties to the builder and call build() + + group(EnumTest, () { + // String enumString + test('to test the property `enumString`', () async { + // TODO + }); + + // String enumStringRequired + test('to test the property `enumStringRequired`', () async { + // TODO + }); + + // int enumInteger + test('to test the property `enumInteger`', () async { + // TODO + }); + + // double enumNumber + test('to test the property `enumNumber`', () async { + // TODO + }); + + // OuterEnum outerEnum + test('to test the property `outerEnum`', () async { + // TODO + }); + + // OuterEnumInteger outerEnumInteger + test('to test the property `outerEnumInteger`', () async { + // TODO + }); + + // OuterEnumDefaultValue outerEnumDefaultValue + test('to test the property `outerEnumDefaultValue`', () async { + // TODO + }); + + // OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue + test('to test the property `outerEnumIntegerDefaultValue`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/fake_api_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/fake_api_test.dart new file mode 100644 index 000000000000..b51650dc3fb3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/fake_api_test.dart @@ -0,0 +1,127 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for FakeApi +void main() { + final instance = Openapi().getFakeApi(); + + group(FakeApi, () { + // Health check endpoint + // + //Future fakeHealthGet() async + test('test fakeHealthGet', () async { + // TODO + }); + + // test http signature authentication + // + //Future fakeHttpSignatureTest(Pet pet, { String query1, String header1 }) async + test('test fakeHttpSignatureTest', () async { + // TODO + }); + + // Test serialization of outer boolean types + // + //Future fakeOuterBooleanSerialize({ bool body }) async + test('test fakeOuterBooleanSerialize', () async { + // TODO + }); + + // Test serialization of object with outer number type + // + //Future fakeOuterCompositeSerialize({ OuterComposite outerComposite }) async + test('test fakeOuterCompositeSerialize', () async { + // TODO + }); + + // Test serialization of outer number types + // + //Future fakeOuterNumberSerialize({ num body }) async + test('test fakeOuterNumberSerialize', () async { + // TODO + }); + + // Test serialization of outer string types + // + //Future fakeOuterStringSerialize({ String body }) async + test('test fakeOuterStringSerialize', () async { + // TODO + }); + + // Test serialization of enum (int) properties with examples + // + //Future fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty) async + test('test fakePropertyEnumIntegerSerialize', () async { + // TODO + }); + + // For this test, the body for this request much reference a schema named `File`. + // + //Future testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) async + test('test testBodyWithFileSchema', () async { + // TODO + }); + + //Future testBodyWithQueryParams(String query, User user) async + test('test testBodyWithQueryParams', () async { + // TODO + }); + + // To test \"client\" model + // + // To test \"client\" model + // + //Future testClientModel(ModelClient modelClient) async + test('test testClientModel', () async { + // TODO + }); + + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + // + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + // + //Future testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, Uint8List binary, DateTime date, DateTime dateTime, String password, String callback }) async + test('test testEndpointParameters', () async { + // TODO + }); + + // To test enum parameters + // + // To test enum parameters + // + //Future testEnumParameters({ BuiltList enumHeaderStringArray, String enumHeaderString, BuiltList enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, BuiltList enumFormStringArray, String enumFormString }) async + test('test testEnumParameters', () async { + // TODO + }); + + // Fake endpoint to test group parameters (optional) + // + // Fake endpoint to test group parameters (optional) + // + //Future testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group }) async + test('test testGroupParameters', () async { + // TODO + }); + + // test inline additionalProperties + // + //Future testInlineAdditionalProperties(BuiltMap requestBody) async + test('test testInlineAdditionalProperties', () async { + // TODO + }); + + // test json serialization of form data + // + //Future testJsonFormData(String param, String param2) async + test('test testJsonFormData', () async { + // TODO + }); + + // To test the collection format in query parameters + // + //Future testQueryParameterCollectionFormat(BuiltList pipe, BuiltList ioutil, BuiltList http, BuiltList url, BuiltList context) async + test('test testQueryParameterCollectionFormat', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart new file mode 100644 index 000000000000..979c752e1c26 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart @@ -0,0 +1,18 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for FakeClassnameTags123Api +void main() { + final instance = Openapi().getFakeClassnameTags123Api(); + + group(FakeClassnameTags123Api, () { + // To test class name in snake case + // + // To test class name in snake case + // + //Future testClassname(ModelClient modelClient) async + test('test testClassname', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/file_schema_test_class_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/file_schema_test_class_test.dart new file mode 100644 index 000000000000..1ef8cf8861b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/file_schema_test_class_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FileSchemaTestClass +void main() { + final instance = FileSchemaTestClassBuilder(); + // TODO add properties to the builder and call build() + + group(FileSchemaTestClass, () { + // ModelFile file + test('to test the property `file`', () async { + // TODO + }); + + // BuiltList files + test('to test the property `files`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/foo_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/foo_test.dart new file mode 100644 index 000000000000..f840bcda0d17 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/foo_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Foo +void main() { + final instance = FooBuilder(); + // TODO add properties to the builder and call build() + + group(Foo, () { + // String bar (default value: 'bar') + test('to test the property `bar`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/format_test_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/format_test_test.dart new file mode 100644 index 000000000000..c2fdf962cb0f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/format_test_test.dart @@ -0,0 +1,92 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FormatTest +void main() { + final instance = FormatTestBuilder(); + // TODO add properties to the builder and call build() + + group(FormatTest, () { + // int integer + test('to test the property `integer`', () async { + // TODO + }); + + // int int32 + test('to test the property `int32`', () async { + // TODO + }); + + // int int64 + test('to test the property `int64`', () async { + // TODO + }); + + // num number + test('to test the property `number`', () async { + // TODO + }); + + // double float + test('to test the property `float`', () async { + // TODO + }); + + // double double_ + test('to test the property `double_`', () async { + // TODO + }); + + // double decimal + test('to test the property `decimal`', () async { + // TODO + }); + + // String string + test('to test the property `string`', () async { + // TODO + }); + + // String byte + test('to test the property `byte`', () async { + // TODO + }); + + // Uint8List binary + test('to test the property `binary`', () async { + // TODO + }); + + // DateTime date + test('to test the property `date`', () async { + // TODO + }); + + // DateTime dateTime + test('to test the property `dateTime`', () async { + // TODO + }); + + // String uuid + test('to test the property `uuid`', () async { + // TODO + }); + + // String password + test('to test the property `password`', () async { + // TODO + }); + + // A string that is a 10 digit number. Can have leading zeros. + // String patternWithDigits + test('to test the property `patternWithDigits`', () async { + // TODO + }); + + // A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + // String patternWithDigitsAndDelimiter + test('to test the property `patternWithDigitsAndDelimiter`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/has_only_read_only_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/has_only_read_only_test.dart new file mode 100644 index 000000000000..8b00db3d0711 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/has_only_read_only_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for HasOnlyReadOnly +void main() { + final instance = HasOnlyReadOnlyBuilder(); + // TODO add properties to the builder and call build() + + group(HasOnlyReadOnly, () { + // String bar + test('to test the property `bar`', () async { + // TODO + }); + + // String foo + test('to test the property `foo`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/health_check_result_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/health_check_result_test.dart new file mode 100644 index 000000000000..050e2c9b814f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/health_check_result_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for HealthCheckResult +void main() { + final instance = HealthCheckResultBuilder(); + // TODO add properties to the builder and call build() + + group(HealthCheckResult, () { + // String nullableMessage + test('to test the property `nullableMessage`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/inline_response_default_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/inline_response_default_test.dart new file mode 100644 index 000000000000..669478bbc5d2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/inline_response_default_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for InlineResponseDefault +void main() { + final instance = InlineResponseDefaultBuilder(); + // TODO add properties to the builder and call build() + + group(InlineResponseDefault, () { + // Foo string + test('to test the property `string`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/map_test_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/map_test_test.dart new file mode 100644 index 000000000000..56c3d448c6c5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/map_test_test.dart @@ -0,0 +1,30 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for MapTest +void main() { + final instance = MapTestBuilder(); + // TODO add properties to the builder and call build() + + group(MapTest, () { + // BuiltMap> mapMapOfString + test('to test the property `mapMapOfString`', () async { + // TODO + }); + + // BuiltMap mapOfEnumString + test('to test the property `mapOfEnumString`', () async { + // TODO + }); + + // BuiltMap directMap + test('to test the property `directMap`', () async { + // TODO + }); + + // BuiltMap indirectMap + test('to test the property `indirectMap`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart new file mode 100644 index 000000000000..dcaa8d351ae5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for MixedPropertiesAndAdditionalPropertiesClass +void main() { + final instance = MixedPropertiesAndAdditionalPropertiesClassBuilder(); + // TODO add properties to the builder and call build() + + group(MixedPropertiesAndAdditionalPropertiesClass, () { + // String uuid + test('to test the property `uuid`', () async { + // TODO + }); + + // DateTime dateTime + test('to test the property `dateTime`', () async { + // TODO + }); + + // BuiltMap map + test('to test the property `map`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/model200_response_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/model200_response_test.dart new file mode 100644 index 000000000000..b65bd1407629 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/model200_response_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Model200Response +void main() { + final instance = Model200ResponseBuilder(); + // TODO add properties to the builder and call build() + + group(Model200Response, () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // String class_ + test('to test the property `class_`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/model_client_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/model_client_test.dart new file mode 100644 index 000000000000..1998f27d715a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/model_client_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelClient +void main() { + final instance = ModelClientBuilder(); + // TODO add properties to the builder and call build() + + group(ModelClient, () { + // String client + test('to test the property `client`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/model_enum_class_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/model_enum_class_test.dart new file mode 100644 index 000000000000..fa31f816801c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/model_enum_class_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelEnumClass +void main() { + group(ModelEnumClass, () {}); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/model_file_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/model_file_test.dart new file mode 100644 index 000000000000..a07c60c5d85d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/model_file_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelFile +void main() { + final instance = ModelFileBuilder(); + // TODO add properties to the builder and call build() + + group(ModelFile, () { + // Test capitalization + // String sourceURI + test('to test the property `sourceURI`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/model_list_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/model_list_test.dart new file mode 100644 index 000000000000..0c4e3c45c7a9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/model_list_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelList +void main() { + final instance = ModelListBuilder(); + // TODO add properties to the builder and call build() + + group(ModelList, () { + // String n123list + test('to test the property `n123list`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/model_return_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/model_return_test.dart new file mode 100644 index 000000000000..b60abdfd6021 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/model_return_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelReturn +void main() { + final instance = ModelReturnBuilder(); + // TODO add properties to the builder and call build() + + group(ModelReturn, () { + // int return_ + test('to test the property `return_`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/name_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/name_test.dart new file mode 100644 index 000000000000..d04e76fef9e0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/name_test.dart @@ -0,0 +1,30 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Name +void main() { + final instance = NameBuilder(); + // TODO add properties to the builder and call build() + + group(Name, () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // int snakeCase + test('to test the property `snakeCase`', () async { + // TODO + }); + + // String property + test('to test the property `property`', () async { + // TODO + }); + + // int n123number + test('to test the property `n123number`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/nullable_class_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/nullable_class_test.dart new file mode 100644 index 000000000000..4bc622df0dd6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/nullable_class_test.dart @@ -0,0 +1,70 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for NullableClass +void main() { + final instance = NullableClassBuilder(); + // TODO add properties to the builder and call build() + + group(NullableClass, () { + // int integerProp + test('to test the property `integerProp`', () async { + // TODO + }); + + // num numberProp + test('to test the property `numberProp`', () async { + // TODO + }); + + // bool booleanProp + test('to test the property `booleanProp`', () async { + // TODO + }); + + // String stringProp + test('to test the property `stringProp`', () async { + // TODO + }); + + // DateTime dateProp + test('to test the property `dateProp`', () async { + // TODO + }); + + // DateTime datetimeProp + test('to test the property `datetimeProp`', () async { + // TODO + }); + + // BuiltList arrayNullableProp + test('to test the property `arrayNullableProp`', () async { + // TODO + }); + + // BuiltList arrayAndItemsNullableProp + test('to test the property `arrayAndItemsNullableProp`', () async { + // TODO + }); + + // BuiltList arrayItemsNullable + test('to test the property `arrayItemsNullable`', () async { + // TODO + }); + + // BuiltMap objectNullableProp + test('to test the property `objectNullableProp`', () async { + // TODO + }); + + // BuiltMap objectAndItemsNullableProp + test('to test the property `objectAndItemsNullableProp`', () async { + // TODO + }); + + // BuiltMap objectItemsNullable + test('to test the property `objectItemsNullable`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/number_only_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/number_only_test.dart new file mode 100644 index 000000000000..7f34d2a5ce60 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/number_only_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for NumberOnly +void main() { + final instance = NumberOnlyBuilder(); + // TODO add properties to the builder and call build() + + group(NumberOnly, () { + // num justNumber + test('to test the property `justNumber`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/order_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/order_test.dart new file mode 100644 index 000000000000..3ed96043d80c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/order_test.dart @@ -0,0 +1,41 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Order +void main() { + final instance = OrderBuilder(); + // TODO add properties to the builder and call build() + + group(Order, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // int petId + test('to test the property `petId`', () async { + // TODO + }); + + // int quantity + test('to test the property `quantity`', () async { + // TODO + }); + + // DateTime shipDate + test('to test the property `shipDate`', () async { + // TODO + }); + + // Order Status + // String status + test('to test the property `status`', () async { + // TODO + }); + + // bool complete (default value: false) + test('to test the property `complete`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/outer_composite_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/outer_composite_test.dart new file mode 100644 index 000000000000..99a7cb7db596 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/outer_composite_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterComposite +void main() { + final instance = OuterCompositeBuilder(); + // TODO add properties to the builder and call build() + + group(OuterComposite, () { + // num myNumber + test('to test the property `myNumber`', () async { + // TODO + }); + + // String myString + test('to test the property `myString`', () async { + // TODO + }); + + // bool myBoolean + test('to test the property `myBoolean`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/outer_enum_default_value_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/outer_enum_default_value_test.dart new file mode 100644 index 000000000000..a5c83f615194 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/outer_enum_default_value_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumDefaultValue +void main() { + group(OuterEnumDefaultValue, () {}); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart new file mode 100644 index 000000000000..49ebbfcead7f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumIntegerDefaultValue +void main() { + group(OuterEnumIntegerDefaultValue, () {}); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/outer_enum_integer_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/outer_enum_integer_test.dart new file mode 100644 index 000000000000..3c6b81305c71 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/outer_enum_integer_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumInteger +void main() { + group(OuterEnumInteger, () {}); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/outer_enum_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/outer_enum_test.dart new file mode 100644 index 000000000000..4ee10f379d5e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/outer_enum_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnum +void main() { + group(OuterEnum, () {}); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart new file mode 100644 index 000000000000..cb621828cbc0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterObjectWithEnumProperty +void main() { + final instance = OuterObjectWithEnumPropertyBuilder(); + // TODO add properties to the builder and call build() + + group(OuterObjectWithEnumProperty, () { + // OuterEnumInteger value + test('to test the property `value`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/pet_api_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/pet_api_test.dart new file mode 100644 index 000000000000..8b7c576988d3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/pet_api_test.dart @@ -0,0 +1,78 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for PetApi +void main() { + final instance = Openapi().getPetApi(); + + group(PetApi, () { + // Add a new pet to the store + // + //Future addPet(Pet pet) async + test('test addPet', () async { + // TODO + }); + + // Deletes a pet + // + //Future deletePet(int petId, { String apiKey }) async + test('test deletePet', () async { + // TODO + }); + + // Finds Pets by status + // + // Multiple status values can be provided with comma separated strings + // + //Future> findPetsByStatus(BuiltList status) async + test('test findPetsByStatus', () async { + // TODO + }); + + // Finds Pets by tags + // + // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + // + //Future> findPetsByTags(BuiltSet tags) async + test('test findPetsByTags', () async { + // TODO + }); + + // Find pet by ID + // + // Returns a single pet + // + //Future getPetById(int petId) async + test('test getPetById', () async { + // TODO + }); + + // Update an existing pet + // + //Future updatePet(Pet pet) async + test('test updatePet', () async { + // TODO + }); + + // Updates a pet in the store with form data + // + //Future updatePetWithForm(int petId, { String name, String status }) async + test('test updatePetWithForm', () async { + // TODO + }); + + // uploads an image + // + //Future uploadFile(int petId, { String additionalMetadata, Uint8List file }) async + test('test uploadFile', () async { + // TODO + }); + + // uploads an image (required) + // + //Future uploadFileWithRequiredFile(int petId, Uint8List requiredFile, { String additionalMetadata }) async + test('test uploadFileWithRequiredFile', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/pet_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/pet_test.dart new file mode 100644 index 000000000000..7d57000d4d98 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/pet_test.dart @@ -0,0 +1,41 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Pet +void main() { + final instance = PetBuilder(); + // TODO add properties to the builder and call build() + + group(Pet, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // Category category + test('to test the property `category`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // BuiltSet photoUrls + test('to test the property `photoUrls`', () async { + // TODO + }); + + // BuiltList tags + test('to test the property `tags`', () async { + // TODO + }); + + // pet status in the store + // String status + test('to test the property `status`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/read_only_first_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/read_only_first_test.dart new file mode 100644 index 000000000000..f4652322f2c7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/read_only_first_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ReadOnlyFirst +void main() { + final instance = ReadOnlyFirstBuilder(); + // TODO add properties to the builder and call build() + + group(ReadOnlyFirst, () { + // String bar + test('to test the property `bar`', () async { + // TODO + }); + + // String baz + test('to test the property `baz`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/special_model_name_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/special_model_name_test.dart new file mode 100644 index 000000000000..f81e03f7188d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/special_model_name_test.dart @@ -0,0 +1,17 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for SpecialModelName +void main() { + final instance = SpecialModelNameBuilder(); + // TODO add properties to the builder and call build() + + group(SpecialModelName, () { + // int dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket + test( + 'to test the property `dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket`', + () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/store_api_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/store_api_test.dart new file mode 100644 index 000000000000..98046d8a635c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/store_api_test.dart @@ -0,0 +1,43 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for StoreApi +void main() { + final instance = Openapi().getStoreApi(); + + group(StoreApi, () { + // Delete purchase order by ID + // + // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + // + //Future deleteOrder(String orderId) async + test('test deleteOrder', () async { + // TODO + }); + + // Returns pet inventories by status + // + // Returns a map of status codes to quantities + // + //Future> getInventory() async + test('test getInventory', () async { + // TODO + }); + + // Find purchase order by ID + // + // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + // + //Future getOrderById(int orderId) async + test('test getOrderById', () async { + // TODO + }); + + // Place an order for a pet + // + //Future placeOrder(Order order) async + test('test placeOrder', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/tag_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/tag_test.dart new file mode 100644 index 000000000000..253a283fc867 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/tag_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Tag +void main() { + final instance = TagBuilder(); + // TODO add properties to the builder and call build() + + group(Tag, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/user_api_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/user_api_test.dart new file mode 100644 index 000000000000..0009ec07b4b2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/user_api_test.dart @@ -0,0 +1,71 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for UserApi +void main() { + final instance = Openapi().getUserApi(); + + group(UserApi, () { + // Create user + // + // This can only be done by the logged in user. + // + //Future createUser(User user) async + test('test createUser', () async { + // TODO + }); + + // Creates list of users with given input array + // + //Future createUsersWithArrayInput(BuiltList user) async + test('test createUsersWithArrayInput', () async { + // TODO + }); + + // Creates list of users with given input array + // + //Future createUsersWithListInput(BuiltList user) async + test('test createUsersWithListInput', () async { + // TODO + }); + + // Delete user + // + // This can only be done by the logged in user. + // + //Future deleteUser(String username) async + test('test deleteUser', () async { + // TODO + }); + + // Get user by user name + // + //Future getUserByName(String username) async + test('test getUserByName', () async { + // TODO + }); + + // Logs user into the system + // + //Future loginUser(String username, String password) async + test('test loginUser', () async { + // TODO + }); + + // Logs out current logged in user session + // + //Future logoutUser() async + test('test logoutUser', () async { + // TODO + }); + + // Updated user + // + // This can only be done by the logged in user. + // + //Future updateUser(String username, User user) async + test('test updateUser', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/user_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/user_test.dart new file mode 100644 index 000000000000..40bef6e6d21c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake/test/user_test.dart @@ -0,0 +1,51 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for User +void main() { + final instance = UserBuilder(); + // TODO add properties to the builder and call build() + + group(User, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String username + test('to test the property `username`', () async { + // TODO + }); + + // String firstName + test('to test the property `firstName`', () async { + // TODO + }); + + // String lastName + test('to test the property `lastName`', () async { + // TODO + }); + + // String email + test('to test the property `email`', () async { + // TODO + }); + + // String password + test('to test the property `password`', () async { + // TODO + }); + + // String phone + test('to test the property `phone`', () async { + // TODO + }); + + // User Status + // int userStatus + test('to test the property `userStatus`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/README.md b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/README.md new file mode 100644 index 000000000000..7f36256df602 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/README.md @@ -0,0 +1,6 @@ +# Manual tests for Dart-DIO (DO NOT DELETE) + +These tests depend on the `build_runner` having already been run in the +parent package. + +The test are part of the integration tests for the parent package \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/analysis_options.yaml b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/analysis_options.yaml new file mode 100644 index 000000000000..a611887d3acf --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/analysis_options.yaml @@ -0,0 +1,9 @@ +analyzer: + language: + strict-inference: true + strict-raw-types: true + strong-mode: + implicit-dynamic: false + implicit-casts: false + exclude: + - test/*.dart diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/pubspec.yaml new file mode 100644 index 000000000000..73a5b2fbe307 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/pubspec.yaml @@ -0,0 +1,24 @@ +name: petstore_client_lib_fake_tests +version: 1.0.0 +description: OpenAPI API Dart DIO client tests for petstore_client_lib_fake + +publish_to: none + +environment: + sdk: '>=2.10.0 <3.0.0' + +dev_dependencies: + built_collection: '>=5.0.0 <6.0.0' + built_value: '>=8.0.3 <9.0.0' + dio: '4.0.0-prev2' + http_mock_adapter: 1.0.0-nullsafety.1 + mockito: ^5.0.0 + openapi: + path: ../petstore_client_lib_fake + test: ^1.16.5 + +dependency_overrides: + http_mock_adapter: + git: + url: https://github.com/kuhnroyal/http-mock-adapter.git + ref: 6f4489cbceb076494d3fb956665259749520a3bf diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/test/api/fake_api_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/test/api/fake_api_test.dart new file mode 100644 index 000000000000..5448f90adce8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/test/api/fake_api_test.dart @@ -0,0 +1,118 @@ +import 'dart:typed_data'; + +import 'package:built_collection/built_collection.dart'; +import 'package:dio/dio.dart'; +import 'package:http_mock_adapter/http_mock_adapter.dart'; +import 'package:openapi/openapi.dart'; +import 'package:test/test.dart'; + +void main() { + Openapi client; + DioAdapter server; + + setUp(() { + server = DioAdapter(); + client = Openapi(dio: Dio()..httpClientAdapter = server); + }); + + tearDown(() { + server.close(); + }); + + group(FakeApi, () { + group('testEndpointParameters', () { + test('complete', () async { + server.onPost( + '/fake', + (request) => request.reply(200, null), + data: { + 'number': '3', + 'double': '-13.57', + 'pattern_without_delimiter': 'patternWithoutDelimiter', + 'byte': '0', + 'float': '1.23', + 'integer': '45', + 'int32': '2147483647', + 'int64': '9223372036854775807', + 'date': '2020-08-11T00:00:00.000Z', + 'dateTime': '2020-08-11T12:30:55.123Z', + 'binary': "Instance of 'MultipartFile'", + }, + headers: { + 'content-type': 'application/x-www-form-urlencoded', + 'content-length': Matchers.integer, + }, + ); + + final response = await client.getFakeApi().testEndpointParameters( + number: 3, + double_: -13.57, + patternWithoutDelimiter: 'patternWithoutDelimiter', + byte: '0', + float: 1.23, + integer: 45, + int32: 2147483647, + int64: 9223372036854775807, + date: DateTime.utc(2020, 8, 11), + dateTime: DateTime.utc(2020, 8, 11, 12, 30, 55, 123), + binary: Uint8List.fromList([0, 1, 2, 3, 4, 5]), + ); + + expect(response.statusCode, 200); + }); + + test('minimal', () async { + server.onPost( + '/fake', + (request) => request.reply(200, null), + data: { + 'byte': '0', + 'double': '-13.57', + 'number': '3', + 'pattern_without_delimiter': 'patternWithoutDelimiter', + }, + headers: { + 'content-type': 'application/x-www-form-urlencoded', + 'content-length': Matchers.integer, + }, + ); + + final response = await client.getFakeApi().testEndpointParameters( + number: 3, + double_: -13.57, + patternWithoutDelimiter: 'patternWithoutDelimiter', + byte: '0', + ); + + expect(response.statusCode, 200); + }); + }); + + group('testEnumParameters', () { + test('in body data', () async { + // Not sure if this is correct, we are not sending + // form data in the body but some weird map + server.onGet( + '/fake', + (request) => request.reply(200, null), + data: { + 'enum_form_string': 'formString', + 'enum_form_string_array': '[foo, bar]', + }, + headers: { + 'content-type': 'application/x-www-form-urlencoded', + }, + ); + + final response = await client.getFakeApi().testEnumParameters( + enumFormString: 'formString', + enumFormStringArray: ListBuilder( + ['foo', 'bar'], + ).build(), + ); + + expect(response.statusCode, 200); + }); + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/test/api/pet_api_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/test/api/pet_api_test.dart new file mode 100644 index 000000000000..80aa2b8bfac1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/test/api/pet_api_test.dart @@ -0,0 +1,225 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:dio/dio.dart'; +import 'package:http_mock_adapter/http_mock_adapter.dart'; +import 'package:openapi/openapi.dart'; +import 'package:test/test.dart'; + +void main() { + const photo1 = 'https://localhost/photo1.jpg'; + const photo2 = 'https://localhost/photo2.jpg'; + + Openapi client; + DioAdapter server; + + setUp(() { + server = DioAdapter(); + client = Openapi(dio: Dio()..httpClientAdapter = server); + }); + + tearDown(() { + server.close(); + }); + + group(PetApi, () { + group('getPetById', () { + test('complete', () async { + server.onGet( + '/pet/5', + (request) => request.reply(200, { + 'id': 5, + 'name': 'Paula', + 'status': 'sold', + 'category': { + 'id': 1, + 'name': 'dog', + }, + 'photoUrls': [ + '$photo1', + '$photo2', + ], + 'tags': [ + { + 'id': 3, + 'name': 'smart', + }, + { + 'id': 4, + 'name': 'cute', + }, + ] + }), + headers: { + Headers.contentTypeHeader: Matchers.pattern('application/json'), + }, + ); + + final response = await client.getPetApi().getPetById(petId: 5); + + expect(response.statusCode, 200); + expect(response.data, isNotNull); + expect(response.data.id, 5); + expect(response.data.name, 'Paula'); + expect(response.data.status, PetStatusEnum.sold); + expect(response.data.category.id, 1); + expect(response.data.category.name, 'dog'); + expect(response.data.photoUrls.length, 2); + expect(response.data.tags.length, 2); + }); + + test('minimal', () async { + server.onGet( + '/pet/5', + (request) => request.reply(200, { + 'id': 5, + 'name': 'Paula', + 'photoUrls': [], + }), + headers: { + Headers.contentTypeHeader: Matchers.pattern('application/json'), + }, + ); + + final response = await client.getPetApi().getPetById(petId: 5); + + expect(response.statusCode, 200); + expect(response.data, isNotNull); + expect(response.data.id, 5); + expect(response.data.name, 'Paula'); + expect(response.data.status, isNull); + expect(response.data.category, isNull); + expect(response.data.photoUrls, isNotNull); + expect(response.data.photoUrls, isEmpty); + }); + }); + + group('addPet', () { + test('complete', () async { + server.onPost( + '/pet', + (request) => request.reply(200, ''), + data: { + 'id': 5, + 'name': 'Paula', + 'status': 'sold', + 'category': { + 'id': 1, + 'name': 'dog', + }, + 'photoUrls': [ + '$photo1', + '$photo2', + ], + 'tags': [ + { + 'id': 3, + 'name': 'smart', + }, + { + 'id': 4, + 'name': 'cute', + }, + ] + }, + headers: { + Headers.contentTypeHeader: Matchers.pattern('application/json'), + Headers.contentLengthHeader: Matchers.integer, + }, + ); + + final response = await client.getPetApi().addPet( + pet: Pet((p) => p + ..id = 5 + ..name = 'Paula' + ..status = PetStatusEnum.sold + ..category = (CategoryBuilder() + ..id = 1 + ..name = 'dog') + ..photoUrls = SetBuilder([photo1, photo2]) + ..tags = ListBuilder([ + Tag((t) => t + ..id = 3 + ..name = 'smart'), + Tag((t) => t + ..id = 4 + ..name = 'cute'), + ]))); + + expect(response.statusCode, 200); + }); + + test('minimal', () async { + server.onPost( + '/pet', + (request) => request.reply(200, ''), + data: { + 'id': 5, + 'name': 'Paula', + 'photoUrls': [], + }, + headers: { + Headers.contentTypeHeader: Matchers.pattern('application/json'), + Headers.contentLengthHeader: Matchers.integer, + }, + ); + + final response = await client.getPetApi().addPet( + pet: Pet((p) => p + ..id = 5 + ..name = 'Paula')); + + expect(response.statusCode, 200); + }); + }); + + group('getMultiplePets', () { + test('findByStatus', () async { + server.onRoute( + '/pet/findByStatus', + (request) => request.reply(200, [ + { + 'id': 5, + 'name': 'Paula', + 'status': 'sold', + 'photoUrls': [], + }, + { + 'id': 1, + 'name': 'Mickey', + 'status': 'available', + 'photoUrls': [], + }, + ]), + request: Request( + method: RequestMethods.GET, + queryParameters: { + 'status': [ + 'available', + 'sold', + ], + }, + headers: { + Headers.contentTypeHeader: Matchers.pattern('application/json'), + }, + ), + ); + + final response = await client.getPetApi().findPetsByStatus( + status: ListBuilder([ + PetStatusEnum.available.name, + PetStatusEnum.sold.name, + ]).build(), + ); + + expect(response.statusCode, 200); + expect(response.data, isNotNull); + expect(response.data.length, 2); + expect(response.data[0].id, 5); + expect(response.data[0].name, 'Paula'); + expect(response.data[0].status, PetStatusEnum.sold); + expect(response.data[1].id, 1); + expect(response.data[1].name, 'Mickey'); + expect(response.data[1].status, PetStatusEnum.available); + }); + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/test/api/store_api_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/test/api/store_api_test.dart new file mode 100644 index 000000000000..693f84a2f4c6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/test/api/store_api_test.dart @@ -0,0 +1,45 @@ +import 'package:dio/dio.dart'; +import 'package:http_mock_adapter/http_mock_adapter.dart'; +import 'package:openapi/openapi.dart'; +import 'package:test/test.dart'; + +void main() { + Openapi client; + DioAdapter server; + + setUp(() { + server = DioAdapter(); + client = Openapi(dio: Dio()..httpClientAdapter = server); + }); + + tearDown(() { + server.close(); + }); + + group(StoreApi, () { + group('getInventory', () { + test('with API key', () async { + client.setApiKey('api_key', 'SECRET_API_KEY'); + + server.onGet( + '/store/inventory', + (request) => request.reply(200, { + 'foo': 5, + 'bar': 999, + 'baz': 0, + }), + headers: { + Headers.contentTypeHeader: Matchers.pattern('application/json'), + 'api_key': 'SECRET_API_KEY', + }, + ); + + final response = await client.getStoreApi().getInventory(); + + expect(response.statusCode, 200); + expect(response.data, isNotNull); + expect(response.data.length, 3); + }); + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/test/api_util_test.dart b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/test/api_util_test.dart new file mode 100644 index 000000000000..b636c5b8ca6e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio-next/petstore_client_lib_fake_tests/test/api_util_test.dart @@ -0,0 +1,229 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; +import 'package:openapi/openapi.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:test/test.dart'; + +void main() { + group('api_utils', () { + group('encodeFormParameter should return', () { + test('empty String for null', () { + expect( + encodeFormParameter( + standardSerializers, + null, + const FullType(Cat), + ), + '', + ); + }); + + test('String for String', () { + expect( + encodeFormParameter( + standardSerializers, + 'foo', + const FullType(String), + ), + 'foo', + ); + }); + + test('List for BuiltList', () { + expect( + encodeFormParameter( + standardSerializers, + ListBuilder(['foo', 'bar', 'baz']).build(), + const FullType(BuiltList, [FullType(String)]), + ), + ['foo', 'bar', 'baz'], + ); + }); + + test('Map for BuiltList', () { + expect( + encodeFormParameter( + standardSerializers, + MapBuilder({ + 'foo': 'foo-value', + 'bar': 'bar-value', + 'baz': 'baz-value', + }).build(), + const FullType(BuiltMap, [FullType(String), FullType(String)]), + ), + { + 'foo': 'foo-value', + 'bar': 'bar-value', + 'baz': 'baz-value', + }, + ); + }); + + test('num for num', () { + expect( + encodeFormParameter(standardSerializers, 0, const FullType(int)), + 0, + ); + expect( + encodeFormParameter(standardSerializers, 1, const FullType(int)), + 1, + ); + expect( + encodeFormParameter(standardSerializers, 1.0, const FullType(num)), + 1.0, + ); + expect( + encodeFormParameter( + standardSerializers, 1.234, const FullType(double)), + 1.234, + ); + }); + + test('List for BuiltList', () { + expect( + encodeFormParameter( + standardSerializers, + ListBuilder([0, 1, 2, 3, 4.5, -123.456]).build(), + const FullType(BuiltList, [FullType(num)]), + ), + [0, 1, 2, 3, 4.5, -123.456], + ); + }); + + test('bool for bool', () { + expect( + encodeFormParameter( + standardSerializers, + true, + const FullType(bool), + ), + true, + ); + expect( + encodeFormParameter( + standardSerializers, + false, + const FullType(bool), + ), + false, + ); + }); + + test('String for Date', () { + expect( + encodeFormParameter( + standardSerializers, + DateTime.utc(2020, 8, 11), + const FullType(DateTime), + ), + '2020-08-11T00:00:00.000Z', + ); + }); + + test('String for DateTime', () { + expect( + encodeFormParameter( + standardSerializers, + DateTime.utc(2020, 8, 11, 12, 30, 55, 123), + const FullType(DateTime), + ), + '2020-08-11T12:30:55.123Z', + ); + }); + + test('JSON String for Cat', () { + // Not sure that is even a valid case, + // sending complex objects via FormData may not work as expected + expect( + encodeFormParameter( + standardSerializers, + (CatBuilder() + ..color = 'black' + ..className = 'cat' + ..declawed = false) + .build(), + const FullType(Cat), + ), + '{"className":"cat","color":"black","declawed":false}', + ); + }); + }); + + test('encodes FormData correctly', () { + final data = FormData.fromMap({ + 'null': encodeFormParameter( + standardSerializers, + null, + const FullType(num), + ), + 'empty': encodeFormParameter( + standardSerializers, + '', + const FullType(String), + ), + 'string_list': encodeFormParameter( + standardSerializers, + ListBuilder(['foo', 'bar', 'baz']).build(), + const FullType(BuiltList, [FullType(String)]), + ), + 'num_list': encodeFormParameter( + standardSerializers, + ListBuilder([0, 1, 2, 3, 4.5, -123.456]).build(), + const FullType(BuiltList, [FullType(num)]), + ), + 'string_map': encodeFormParameter( + standardSerializers, + MapBuilder({ + 'foo': 'foo-value', + 'bar': 'bar-value', + 'baz': 'baz-value', + }).build(), + const FullType(BuiltMap, [FullType(String), FullType(String)]), + ), + 'bool': encodeFormParameter( + standardSerializers, + true, + const FullType(bool), + ), + 'double': encodeFormParameter( + standardSerializers, + -123.456, + const FullType(double), + ), + 'date_time': encodeFormParameter( + standardSerializers, + DateTime.utc(2020, 8, 11, 12, 30, 55, 123), + const FullType(DateTime), + ), + }); + + expect( + data.fields, + pairwiseCompare, MapEntry>( + >[ + MapEntry('null', ''), + MapEntry('empty', ''), + MapEntry('string_list', 'foo'), + MapEntry('string_list', 'bar'), + MapEntry('string_list', 'baz'), + MapEntry('num_list', '0'), + MapEntry('num_list', '1'), + MapEntry('num_list', '2'), + MapEntry('num_list', '3'), + MapEntry('num_list', '4.5'), + MapEntry('num_list', '-123.456'), + MapEntry('string_map[foo]', 'foo-value'), + MapEntry('string_map[bar]', 'bar-value'), + MapEntry('string_map[baz]', 'baz-value'), + MapEntry('bool', 'true'), + MapEntry('double', '-123.456'), + MapEntry('date_time', '2020-08-11T12:30:55.123Z'), + ], + (e, a) => e.key == a.key && e.value == a.value, + 'Compares map entries by key and value', + ), + ); + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/README.md index 67e37ea3847f..af1b22de4d52 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/README.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/README.md @@ -40,12 +40,12 @@ Please follow the [installation procedure](#installation--usage) and then run th import 'package:openapi/api.dart'; -var api_instance = new PetApi(); -var pet = new Pet(); // Pet | Pet object that needs to be added to the store +final api = PetApi(); +final pet = Pet(); // Pet | Pet object that needs to be added to the store try { - var result = api_instance.addPet(pet); - print(result); + final response = await api.addPet(pet); + print(response); } catch (e) { print("Exception when calling PetApi->addPet: $e\n"); } @@ -58,36 +58,36 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*PetApi* | [**addPet**](doc//PetApi.md#addpet) | **post** /pet | Add a new pet to the store -*PetApi* | [**deletePet**](doc//PetApi.md#deletepet) | **delete** /pet/{petId} | Deletes a pet -*PetApi* | [**findPetsByStatus**](doc//PetApi.md#findpetsbystatus) | **get** /pet/findByStatus | Finds Pets by status -*PetApi* | [**findPetsByTags**](doc//PetApi.md#findpetsbytags) | **get** /pet/findByTags | Finds Pets by tags -*PetApi* | [**getPetById**](doc//PetApi.md#getpetbyid) | **get** /pet/{petId} | Find pet by ID -*PetApi* | [**updatePet**](doc//PetApi.md#updatepet) | **put** /pet | Update an existing pet -*PetApi* | [**updatePetWithForm**](doc//PetApi.md#updatepetwithform) | **post** /pet/{petId} | Updates a pet in the store with form data -*PetApi* | [**uploadFile**](doc//PetApi.md#uploadfile) | **post** /pet/{petId}/uploadImage | uploads an image -*StoreApi* | [**deleteOrder**](doc//StoreApi.md#deleteorder) | **delete** /store/order/{orderId} | Delete purchase order by ID -*StoreApi* | [**getInventory**](doc//StoreApi.md#getinventory) | **get** /store/inventory | Returns pet inventories by status -*StoreApi* | [**getOrderById**](doc//StoreApi.md#getorderbyid) | **get** /store/order/{orderId} | Find purchase order by ID -*StoreApi* | [**placeOrder**](doc//StoreApi.md#placeorder) | **post** /store/order | Place an order for a pet -*UserApi* | [**createUser**](doc//UserApi.md#createuser) | **post** /user | Create user -*UserApi* | [**createUsersWithArrayInput**](doc//UserApi.md#createuserswitharrayinput) | **post** /user/createWithArray | Creates list of users with given input array -*UserApi* | [**createUsersWithListInput**](doc//UserApi.md#createuserswithlistinput) | **post** /user/createWithList | Creates list of users with given input array -*UserApi* | [**deleteUser**](doc//UserApi.md#deleteuser) | **delete** /user/{username} | Delete user -*UserApi* | [**getUserByName**](doc//UserApi.md#getuserbyname) | **get** /user/{username} | Get user by user name -*UserApi* | [**loginUser**](doc//UserApi.md#loginuser) | **get** /user/login | Logs user into the system -*UserApi* | [**logoutUser**](doc//UserApi.md#logoutuser) | **get** /user/logout | Logs out current logged in user session -*UserApi* | [**updateUser**](doc//UserApi.md#updateuser) | **put** /user/{username} | Updated user +*PetApi* | [**addPet**](doc/PetApi.md#addpet) | **post** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](doc/PetApi.md#deletepet) | **delete** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](doc/PetApi.md#findpetsbystatus) | **get** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](doc/PetApi.md#findpetsbytags) | **get** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](doc/PetApi.md#getpetbyid) | **get** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](doc/PetApi.md#updatepet) | **put** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](doc/PetApi.md#updatepetwithform) | **post** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](doc/PetApi.md#uploadfile) | **post** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**deleteOrder**](doc/StoreApi.md#deleteorder) | **delete** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**getInventory**](doc/StoreApi.md#getinventory) | **get** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](doc/StoreApi.md#getorderbyid) | **get** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**placeOrder**](doc/StoreApi.md#placeorder) | **post** /store/order | Place an order for a pet +*UserApi* | [**createUser**](doc/UserApi.md#createuser) | **post** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](doc/UserApi.md#createuserswitharrayinput) | **post** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](doc/UserApi.md#createuserswithlistinput) | **post** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](doc/UserApi.md#deleteuser) | **delete** /user/{username} | Delete user +*UserApi* | [**getUserByName**](doc/UserApi.md#getuserbyname) | **get** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](doc/UserApi.md#loginuser) | **get** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](doc/UserApi.md#logoutuser) | **get** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](doc/UserApi.md#updateuser) | **put** /user/{username} | Updated user ## Documentation For Models - - [ApiResponse](doc//ApiResponse.md) - - [Category](doc//Category.md) - - [Order](doc//Order.md) - - [Pet](doc//Pet.md) - - [Tag](doc//Tag.md) - - [User](doc//User.md) + - [ApiResponse](doc/ApiResponse.md) + - [Category](doc/Category.md) + - [Order](doc/Order.md) + - [Pet](doc/Pet.md) + - [Tag](doc/Tag.md) + - [User](doc/User.md) ## Documentation For Authorization diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md index e9d815eafcc0..3a78296f3834 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/PetApi.md @@ -9,14 +9,14 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**addPet**](PetApi.md#addPet) | **post** /pet | Add a new pet to the store -[**deletePet**](PetApi.md#deletePet) | **delete** /pet/{petId} | Deletes a pet -[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **get** /pet/findByStatus | Finds Pets by status -[**findPetsByTags**](PetApi.md#findPetsByTags) | **get** /pet/findByTags | Finds Pets by tags -[**getPetById**](PetApi.md#getPetById) | **get** /pet/{petId} | Find pet by ID -[**updatePet**](PetApi.md#updatePet) | **put** /pet | Update an existing pet -[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **post** /pet/{petId} | Updates a pet in the store with form data -[**uploadFile**](PetApi.md#uploadFile) | **post** /pet/{petId}/uploadImage | uploads an image +[**addPet**](PetApi.md#addpet) | **post** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletepet) | **delete** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findpetsbystatus) | **get** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findpetsbytags) | **get** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getpetbyid) | **get** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatepet) | **put** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatepetwithform) | **post** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadfile) | **post** /pet/{petId}/uploadImage | uploads an image # **addPet** diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md index 2c033925bba3..0b016d70a84e 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/StoreApi.md @@ -9,10 +9,10 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**deleteOrder**](StoreApi.md#deleteOrder) | **delete** /store/order/{orderId} | Delete purchase order by ID -[**getInventory**](StoreApi.md#getInventory) | **get** /store/inventory | Returns pet inventories by status -[**getOrderById**](StoreApi.md#getOrderById) | **get** /store/order/{orderId} | Find purchase order by ID -[**placeOrder**](StoreApi.md#placeOrder) | **post** /store/order | Place an order for a pet +[**deleteOrder**](StoreApi.md#deleteorder) | **delete** /store/order/{orderId} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getinventory) | **get** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getorderbyid) | **get** /store/order/{orderId} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeorder) | **post** /store/order | Place an order for a pet # **deleteOrder** diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md index 7bc40983f690..c939d874a997 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib/doc/UserApi.md @@ -9,14 +9,14 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**createUser**](UserApi.md#createUser) | **post** /user | Create user -[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **post** /user/createWithArray | Creates list of users with given input array -[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **post** /user/createWithList | Creates list of users with given input array -[**deleteUser**](UserApi.md#deleteUser) | **delete** /user/{username} | Delete user -[**getUserByName**](UserApi.md#getUserByName) | **get** /user/{username} | Get user by user name -[**loginUser**](UserApi.md#loginUser) | **get** /user/login | Logs user into the system -[**logoutUser**](UserApi.md#logoutUser) | **get** /user/logout | Logs out current logged in user session -[**updateUser**](UserApi.md#updateUser) | **put** /user/{username} | Updated user +[**createUser**](UserApi.md#createuser) | **post** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **post** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createuserswithlistinput) | **post** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteuser) | **delete** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getuserbyname) | **get** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginuser) | **get** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutuser) | **get** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateuser) | **put** /user/{username} | Updated user # **createUser** diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md index b22891db2144..af00b20ee1d5 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md @@ -40,12 +40,12 @@ Please follow the [installation procedure](#installation--usage) and then run th import 'package:openapi/api.dart'; -var api_instance = new AnotherFakeApi(); -var modelClient = new ModelClient(); // ModelClient | client model +final api = AnotherFakeApi(); +final modelClient = ModelClient(); // ModelClient | client model try { - var result = api_instance.call123testSpecialTags(modelClient); - print(result); + final response = await api.call123testSpecialTags(modelClient); + print(response); } catch (e) { print("Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n"); } @@ -58,94 +58,94 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**call123testSpecialTags**](doc//AnotherFakeApi.md#call123testspecialtags) | **patch** /another-fake/dummy | To test special tags -*DefaultApi* | [**fooGet**](doc//DefaultApi.md#fooget) | **get** /foo | -*FakeApi* | [**fakeHealthGet**](doc//FakeApi.md#fakehealthget) | **get** /fake/health | Health check endpoint -*FakeApi* | [**fakeHttpSignatureTest**](doc//FakeApi.md#fakehttpsignaturetest) | **get** /fake/http-signature-test | test http signature authentication -*FakeApi* | [**fakeOuterBooleanSerialize**](doc//FakeApi.md#fakeouterbooleanserialize) | **post** /fake/outer/boolean | -*FakeApi* | [**fakeOuterCompositeSerialize**](doc//FakeApi.md#fakeoutercompositeserialize) | **post** /fake/outer/composite | -*FakeApi* | [**fakeOuterNumberSerialize**](doc//FakeApi.md#fakeouternumberserialize) | **post** /fake/outer/number | -*FakeApi* | [**fakeOuterStringSerialize**](doc//FakeApi.md#fakeouterstringserialize) | **post** /fake/outer/string | -*FakeApi* | [**fakePropertyEnumIntegerSerialize**](doc//FakeApi.md#fakepropertyenumintegerserialize) | **post** /fake/property/enum-int | -*FakeApi* | [**testBodyWithFileSchema**](doc//FakeApi.md#testbodywithfileschema) | **put** /fake/body-with-file-schema | -*FakeApi* | [**testBodyWithQueryParams**](doc//FakeApi.md#testbodywithqueryparams) | **put** /fake/body-with-query-params | -*FakeApi* | [**testClientModel**](doc//FakeApi.md#testclientmodel) | **patch** /fake | To test \"client\" model -*FakeApi* | [**testEndpointParameters**](doc//FakeApi.md#testendpointparameters) | **post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -*FakeApi* | [**testEnumParameters**](doc//FakeApi.md#testenumparameters) | **get** /fake | To test enum parameters -*FakeApi* | [**testGroupParameters**](doc//FakeApi.md#testgroupparameters) | **delete** /fake | Fake endpoint to test group parameters (optional) -*FakeApi* | [**testInlineAdditionalProperties**](doc//FakeApi.md#testinlineadditionalproperties) | **post** /fake/inline-additionalProperties | test inline additionalProperties -*FakeApi* | [**testJsonFormData**](doc//FakeApi.md#testjsonformdata) | **get** /fake/jsonFormData | test json serialization of form data -*FakeApi* | [**testQueryParameterCollectionFormat**](doc//FakeApi.md#testqueryparametercollectionformat) | **put** /fake/test-query-paramters | -*FakeClassnameTags123Api* | [**testClassname**](doc//FakeClassnameTags123Api.md#testclassname) | **patch** /fake_classname_test | To test class name in snake case -*PetApi* | [**addPet**](doc//PetApi.md#addpet) | **post** /pet | Add a new pet to the store -*PetApi* | [**deletePet**](doc//PetApi.md#deletepet) | **delete** /pet/{petId} | Deletes a pet -*PetApi* | [**findPetsByStatus**](doc//PetApi.md#findpetsbystatus) | **get** /pet/findByStatus | Finds Pets by status -*PetApi* | [**findPetsByTags**](doc//PetApi.md#findpetsbytags) | **get** /pet/findByTags | Finds Pets by tags -*PetApi* | [**getPetById**](doc//PetApi.md#getpetbyid) | **get** /pet/{petId} | Find pet by ID -*PetApi* | [**updatePet**](doc//PetApi.md#updatepet) | **put** /pet | Update an existing pet -*PetApi* | [**updatePetWithForm**](doc//PetApi.md#updatepetwithform) | **post** /pet/{petId} | Updates a pet in the store with form data -*PetApi* | [**uploadFile**](doc//PetApi.md#uploadfile) | **post** /pet/{petId}/uploadImage | uploads an image -*PetApi* | [**uploadFileWithRequiredFile**](doc//PetApi.md#uploadfilewithrequiredfile) | **post** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) -*StoreApi* | [**deleteOrder**](doc//StoreApi.md#deleteorder) | **delete** /store/order/{order_id} | Delete purchase order by ID -*StoreApi* | [**getInventory**](doc//StoreApi.md#getinventory) | **get** /store/inventory | Returns pet inventories by status -*StoreApi* | [**getOrderById**](doc//StoreApi.md#getorderbyid) | **get** /store/order/{order_id} | Find purchase order by ID -*StoreApi* | [**placeOrder**](doc//StoreApi.md#placeorder) | **post** /store/order | Place an order for a pet -*UserApi* | [**createUser**](doc//UserApi.md#createuser) | **post** /user | Create user -*UserApi* | [**createUsersWithArrayInput**](doc//UserApi.md#createuserswitharrayinput) | **post** /user/createWithArray | Creates list of users with given input array -*UserApi* | [**createUsersWithListInput**](doc//UserApi.md#createuserswithlistinput) | **post** /user/createWithList | Creates list of users with given input array -*UserApi* | [**deleteUser**](doc//UserApi.md#deleteuser) | **delete** /user/{username} | Delete user -*UserApi* | [**getUserByName**](doc//UserApi.md#getuserbyname) | **get** /user/{username} | Get user by user name -*UserApi* | [**loginUser**](doc//UserApi.md#loginuser) | **get** /user/login | Logs user into the system -*UserApi* | [**logoutUser**](doc//UserApi.md#logoutuser) | **get** /user/logout | Logs out current logged in user session -*UserApi* | [**updateUser**](doc//UserApi.md#updateuser) | **put** /user/{username} | Updated user +*AnotherFakeApi* | [**call123testSpecialTags**](doc/AnotherFakeApi.md#call123testspecialtags) | **patch** /another-fake/dummy | To test special tags +*DefaultApi* | [**fooGet**](doc/DefaultApi.md#fooget) | **get** /foo | +*FakeApi* | [**fakeHealthGet**](doc/FakeApi.md#fakehealthget) | **get** /fake/health | Health check endpoint +*FakeApi* | [**fakeHttpSignatureTest**](doc/FakeApi.md#fakehttpsignaturetest) | **get** /fake/http-signature-test | test http signature authentication +*FakeApi* | [**fakeOuterBooleanSerialize**](doc/FakeApi.md#fakeouterbooleanserialize) | **post** /fake/outer/boolean | +*FakeApi* | [**fakeOuterCompositeSerialize**](doc/FakeApi.md#fakeoutercompositeserialize) | **post** /fake/outer/composite | +*FakeApi* | [**fakeOuterNumberSerialize**](doc/FakeApi.md#fakeouternumberserialize) | **post** /fake/outer/number | +*FakeApi* | [**fakeOuterStringSerialize**](doc/FakeApi.md#fakeouterstringserialize) | **post** /fake/outer/string | +*FakeApi* | [**fakePropertyEnumIntegerSerialize**](doc/FakeApi.md#fakepropertyenumintegerserialize) | **post** /fake/property/enum-int | +*FakeApi* | [**testBodyWithFileSchema**](doc/FakeApi.md#testbodywithfileschema) | **put** /fake/body-with-file-schema | +*FakeApi* | [**testBodyWithQueryParams**](doc/FakeApi.md#testbodywithqueryparams) | **put** /fake/body-with-query-params | +*FakeApi* | [**testClientModel**](doc/FakeApi.md#testclientmodel) | **patch** /fake | To test \"client\" model +*FakeApi* | [**testEndpointParameters**](doc/FakeApi.md#testendpointparameters) | **post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**testEnumParameters**](doc/FakeApi.md#testenumparameters) | **get** /fake | To test enum parameters +*FakeApi* | [**testGroupParameters**](doc/FakeApi.md#testgroupparameters) | **delete** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**testInlineAdditionalProperties**](doc/FakeApi.md#testinlineadditionalproperties) | **post** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**testJsonFormData**](doc/FakeApi.md#testjsonformdata) | **get** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**testQueryParameterCollectionFormat**](doc/FakeApi.md#testqueryparametercollectionformat) | **put** /fake/test-query-paramters | +*FakeClassnameTags123Api* | [**testClassname**](doc/FakeClassnameTags123Api.md#testclassname) | **patch** /fake_classname_test | To test class name in snake case +*PetApi* | [**addPet**](doc/PetApi.md#addpet) | **post** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](doc/PetApi.md#deletepet) | **delete** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](doc/PetApi.md#findpetsbystatus) | **get** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](doc/PetApi.md#findpetsbytags) | **get** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](doc/PetApi.md#getpetbyid) | **get** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](doc/PetApi.md#updatepet) | **put** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](doc/PetApi.md#updatepetwithform) | **post** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](doc/PetApi.md#uploadfile) | **post** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithRequiredFile**](doc/PetApi.md#uploadfilewithrequiredfile) | **post** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**deleteOrder**](doc/StoreApi.md#deleteorder) | **delete** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**getInventory**](doc/StoreApi.md#getinventory) | **get** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](doc/StoreApi.md#getorderbyid) | **get** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**placeOrder**](doc/StoreApi.md#placeorder) | **post** /store/order | Place an order for a pet +*UserApi* | [**createUser**](doc/UserApi.md#createuser) | **post** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](doc/UserApi.md#createuserswitharrayinput) | **post** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](doc/UserApi.md#createuserswithlistinput) | **post** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](doc/UserApi.md#deleteuser) | **delete** /user/{username} | Delete user +*UserApi* | [**getUserByName**](doc/UserApi.md#getuserbyname) | **get** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](doc/UserApi.md#loginuser) | **get** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](doc/UserApi.md#logoutuser) | **get** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](doc/UserApi.md#updateuser) | **put** /user/{username} | Updated user ## Documentation For Models - - [AdditionalPropertiesClass](doc//AdditionalPropertiesClass.md) - - [Animal](doc//Animal.md) - - [ApiResponse](doc//ApiResponse.md) - - [ArrayOfArrayOfNumberOnly](doc//ArrayOfArrayOfNumberOnly.md) - - [ArrayOfNumberOnly](doc//ArrayOfNumberOnly.md) - - [ArrayTest](doc//ArrayTest.md) - - [Capitalization](doc//Capitalization.md) - - [Cat](doc//Cat.md) - - [CatAllOf](doc//CatAllOf.md) - - [Category](doc//Category.md) - - [ClassModel](doc//ClassModel.md) - - [Dog](doc//Dog.md) - - [DogAllOf](doc//DogAllOf.md) - - [EnumArrays](doc//EnumArrays.md) - - [EnumTest](doc//EnumTest.md) - - [FileSchemaTestClass](doc//FileSchemaTestClass.md) - - [Foo](doc//Foo.md) - - [FormatTest](doc//FormatTest.md) - - [HasOnlyReadOnly](doc//HasOnlyReadOnly.md) - - [HealthCheckResult](doc//HealthCheckResult.md) - - [InlineResponseDefault](doc//InlineResponseDefault.md) - - [MapTest](doc//MapTest.md) - - [MixedPropertiesAndAdditionalPropertiesClass](doc//MixedPropertiesAndAdditionalPropertiesClass.md) - - [Model200Response](doc//Model200Response.md) - - [ModelClient](doc//ModelClient.md) - - [ModelEnumClass](doc//ModelEnumClass.md) - - [ModelFile](doc//ModelFile.md) - - [ModelList](doc//ModelList.md) - - [ModelReturn](doc//ModelReturn.md) - - [Name](doc//Name.md) - - [NullableClass](doc//NullableClass.md) - - [NumberOnly](doc//NumberOnly.md) - - [Order](doc//Order.md) - - [OuterComposite](doc//OuterComposite.md) - - [OuterEnum](doc//OuterEnum.md) - - [OuterEnumDefaultValue](doc//OuterEnumDefaultValue.md) - - [OuterEnumInteger](doc//OuterEnumInteger.md) - - [OuterEnumIntegerDefaultValue](doc//OuterEnumIntegerDefaultValue.md) - - [OuterObjectWithEnumProperty](doc//OuterObjectWithEnumProperty.md) - - [Pet](doc//Pet.md) - - [ReadOnlyFirst](doc//ReadOnlyFirst.md) - - [SpecialModelName](doc//SpecialModelName.md) - - [Tag](doc//Tag.md) - - [User](doc//User.md) + - [AdditionalPropertiesClass](doc/AdditionalPropertiesClass.md) + - [Animal](doc/Animal.md) + - [ApiResponse](doc/ApiResponse.md) + - [ArrayOfArrayOfNumberOnly](doc/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](doc/ArrayOfNumberOnly.md) + - [ArrayTest](doc/ArrayTest.md) + - [Capitalization](doc/Capitalization.md) + - [Cat](doc/Cat.md) + - [CatAllOf](doc/CatAllOf.md) + - [Category](doc/Category.md) + - [ClassModel](doc/ClassModel.md) + - [Dog](doc/Dog.md) + - [DogAllOf](doc/DogAllOf.md) + - [EnumArrays](doc/EnumArrays.md) + - [EnumTest](doc/EnumTest.md) + - [FileSchemaTestClass](doc/FileSchemaTestClass.md) + - [Foo](doc/Foo.md) + - [FormatTest](doc/FormatTest.md) + - [HasOnlyReadOnly](doc/HasOnlyReadOnly.md) + - [HealthCheckResult](doc/HealthCheckResult.md) + - [InlineResponseDefault](doc/InlineResponseDefault.md) + - [MapTest](doc/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](doc/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](doc/Model200Response.md) + - [ModelClient](doc/ModelClient.md) + - [ModelEnumClass](doc/ModelEnumClass.md) + - [ModelFile](doc/ModelFile.md) + - [ModelList](doc/ModelList.md) + - [ModelReturn](doc/ModelReturn.md) + - [Name](doc/Name.md) + - [NullableClass](doc/NullableClass.md) + - [NumberOnly](doc/NumberOnly.md) + - [Order](doc/Order.md) + - [OuterComposite](doc/OuterComposite.md) + - [OuterEnum](doc/OuterEnum.md) + - [OuterEnumDefaultValue](doc/OuterEnumDefaultValue.md) + - [OuterEnumInteger](doc/OuterEnumInteger.md) + - [OuterEnumIntegerDefaultValue](doc/OuterEnumIntegerDefaultValue.md) + - [OuterObjectWithEnumProperty](doc/OuterObjectWithEnumProperty.md) + - [Pet](doc/Pet.md) + - [ReadOnlyFirst](doc/ReadOnlyFirst.md) + - [SpecialModelName](doc/SpecialModelName.md) + - [Tag](doc/Tag.md) + - [User](doc/User.md) ## Documentation For Authorization diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AnotherFakeApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AnotherFakeApi.md index 525a6b5735bb..d55663297c13 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AnotherFakeApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/AnotherFakeApi.md @@ -9,7 +9,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **patch** /another-fake/dummy | To test special tags +[**call123testSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **patch** /another-fake/dummy | To test special tags # **call123testSpecialTags** diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/DefaultApi.md index b16e9ddaeeee..be916c3037d5 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/DefaultApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/DefaultApi.md @@ -9,7 +9,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**fooGet**](DefaultApi.md#fooGet) | **get** /foo | +[**fooGet**](DefaultApi.md#fooget) | **get** /foo | # **fooGet** diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md index ef42f41081fd..41ab4e4fc126 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md @@ -9,22 +9,22 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **get** /fake/health | Health check endpoint -[**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **get** /fake/http-signature-test | test http signature authentication -[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **post** /fake/outer/boolean | -[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **post** /fake/outer/composite | -[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **post** /fake/outer/number | -[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **post** /fake/outer/string | -[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **post** /fake/property/enum-int | -[**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 假端點 偽のエンドポイント 가짜 엔드 포인트 -[**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 -[**testJsonFormData**](FakeApi.md#testJsonFormData) | **get** /fake/jsonFormData | test json serialization of form data -[**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **put** /fake/test-query-paramters | +[**fakeHealthGet**](FakeApi.md#fakehealthget) | **get** /fake/health | Health check endpoint +[**fakeHttpSignatureTest**](FakeApi.md#fakehttpsignaturetest) | **get** /fake/http-signature-test | test http signature authentication +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **post** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **post** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **post** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **post** /fake/outer/string | +[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **post** /fake/property/enum-int | +[**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 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**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 +[**testJsonFormData**](FakeApi.md#testjsonformdata) | **get** /fake/jsonFormData | test json serialization of form data +[**testQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **put** /fake/test-query-paramters | # **fakeHealthGet** diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md index e00f3705bfd6..9745ca8e3ffe 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md @@ -9,7 +9,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **patch** /fake_classname_test | To test class name in snake case +[**testClassname**](FakeClassnameTags123Api.md#testclassname) | **patch** /fake_classname_test | To test class name in snake case # **testClassname** diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md index f844ee8eaf33..d5a07d5046e2 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/PetApi.md @@ -9,15 +9,15 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**addPet**](PetApi.md#addPet) | **post** /pet | Add a new pet to the store -[**deletePet**](PetApi.md#deletePet) | **delete** /pet/{petId} | Deletes a pet -[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **get** /pet/findByStatus | Finds Pets by status -[**findPetsByTags**](PetApi.md#findPetsByTags) | **get** /pet/findByTags | Finds Pets by tags -[**getPetById**](PetApi.md#getPetById) | **get** /pet/{petId} | Find pet by ID -[**updatePet**](PetApi.md#updatePet) | **put** /pet | Update an existing pet -[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **post** /pet/{petId} | Updates a pet in the store with form data -[**uploadFile**](PetApi.md#uploadFile) | **post** /pet/{petId}/uploadImage | uploads an image -[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **post** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +[**addPet**](PetApi.md#addpet) | **post** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletepet) | **delete** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findpetsbystatus) | **get** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findpetsbytags) | **get** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getpetbyid) | **get** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatepet) | **put** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatepetwithform) | **post** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadfile) | **post** /pet/{petId}/uploadImage | uploads an image +[**uploadFileWithRequiredFile**](PetApi.md#uploadfilewithrequiredfile) | **post** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) # **addPet** diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/StoreApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/StoreApi.md index 430099012086..1fcb8f71eea9 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/StoreApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/StoreApi.md @@ -9,10 +9,10 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**deleteOrder**](StoreApi.md#deleteOrder) | **delete** /store/order/{order_id} | Delete purchase order by ID -[**getInventory**](StoreApi.md#getInventory) | **get** /store/inventory | Returns pet inventories by status -[**getOrderById**](StoreApi.md#getOrderById) | **get** /store/order/{order_id} | Find purchase order by ID -[**placeOrder**](StoreApi.md#placeOrder) | **post** /store/order | Place an order for a pet +[**deleteOrder**](StoreApi.md#deleteorder) | **delete** /store/order/{order_id} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getinventory) | **get** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getorderbyid) | **get** /store/order/{order_id} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeorder) | **post** /store/order | Place an order for a pet # **deleteOrder** diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/UserApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/UserApi.md index 83a3fa85a5e8..62e01652e800 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/UserApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/UserApi.md @@ -9,14 +9,14 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**createUser**](UserApi.md#createUser) | **post** /user | Create user -[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **post** /user/createWithArray | Creates list of users with given input array -[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **post** /user/createWithList | Creates list of users with given input array -[**deleteUser**](UserApi.md#deleteUser) | **delete** /user/{username} | Delete user -[**getUserByName**](UserApi.md#getUserByName) | **get** /user/{username} | Get user by user name -[**loginUser**](UserApi.md#loginUser) | **get** /user/login | Logs user into the system -[**logoutUser**](UserApi.md#logoutUser) | **get** /user/logout | Logs out current logged in user session -[**updateUser**](UserApi.md#updateUser) | **put** /user/{username} | Updated user +[**createUser**](UserApi.md#createuser) | **post** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **post** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createuserswithlistinput) | **post** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteuser) | **delete** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getuserbyname) | **get** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginuser) | **get** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutuser) | **get** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateuser) | **put** /user/{username} | Updated user # **createUser** diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/PetApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/PetApi.md index f4902fe552d2..cd49e1878023 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/PetApi.md @@ -9,14 +9,14 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store -[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status -[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags -[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID -[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet -[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data -[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**addPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image # **addPet** diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md index 8ec0bb80443a..eac035a7f557 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/StoreApi.md @@ -9,10 +9,10 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status -[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID -[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +[**deleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet # **deleteOrder** diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/UserApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/UserApi.md index 7b1d33715297..05beed995066 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/UserApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/doc/UserApi.md @@ -9,14 +9,14 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**createUser**](UserApi.md#createUser) | **POST** /user | Create user -[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array -[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array -[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user -[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name -[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system -[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session -[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user +[**createUser**](UserApi.md#createuser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user # **createUser** diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/AnotherFakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/AnotherFakeApi.md index c3781f381379..377ad777a2ed 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/AnotherFakeApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/AnotherFakeApi.md @@ -9,7 +9,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags +[**call123testSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags # **call123testSpecialTags** diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/DefaultApi.md index fb0ca9b20128..68516124419b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/DefaultApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/DefaultApi.md @@ -9,7 +9,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | +[**fooGet**](DefaultApi.md#fooget) | **GET** /foo | # **fooGet** diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md index 1a42d2f9341a..8b7f63bf8bde 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md @@ -9,22 +9,22 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint -[**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication -[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | -[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | -[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | -[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | -[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | -[**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 假端點 偽のエンドポイント 가짜 엔드 포인트 -[**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 -[**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data -[**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-paramters | +[**fakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint +[**fakeHttpSignatureTest**](FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | +[**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 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**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 +[**testJsonFormData**](FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +[**testQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-paramters | # **fakeHealthGet** diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md index e1045471420d..243ce4e57736 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md @@ -9,7 +9,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case +[**testClassname**](FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case # **testClassname** diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md index aeb082c96863..725de36a431f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/PetApi.md @@ -9,15 +9,15 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store -[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status -[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags -[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID -[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet -[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data -[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image -[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +[**addPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**uploadFileWithRequiredFile**](PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) # **addPet** diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/StoreApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/StoreApi.md index 258b08e898c8..6823f6761779 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/StoreApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/StoreApi.md @@ -9,10 +9,10 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID -[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status -[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID -[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +[**deleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet # **deleteOrder** diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/UserApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/UserApi.md index 1fcc5faa1cb4..c624e6d5536d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/UserApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/UserApi.md @@ -9,14 +9,14 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**createUser**](UserApi.md#createUser) | **POST** /user | Create user -[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array -[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array -[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user -[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name -[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system -[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session -[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user +[**createUser**](UserApi.md#createuser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user # **createUser** diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/AnotherFakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/AnotherFakeApi.md index c3781f381379..377ad777a2ed 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/AnotherFakeApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/AnotherFakeApi.md @@ -9,7 +9,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags +[**call123testSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags # **call123testSpecialTags** diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DefaultApi.md index fb0ca9b20128..68516124419b 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DefaultApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DefaultApi.md @@ -9,7 +9,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | +[**fooGet**](DefaultApi.md#fooget) | **GET** /foo | # **fooGet** diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md index 1a42d2f9341a..8b7f63bf8bde 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md @@ -9,22 +9,22 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint -[**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication -[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | -[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | -[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | -[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | -[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | -[**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 假端點 偽のエンドポイント 가짜 엔드 포인트 -[**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 -[**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data -[**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-paramters | +[**fakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint +[**fakeHttpSignatureTest**](FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | +[**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 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**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 +[**testJsonFormData**](FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +[**testQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-paramters | # **fakeHealthGet** diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeClassnameTags123Api.md index e1045471420d..243ce4e57736 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeClassnameTags123Api.md +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeClassnameTags123Api.md @@ -9,7 +9,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case +[**testClassname**](FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case # **testClassname** diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/PetApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/PetApi.md index aeb082c96863..725de36a431f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/PetApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/PetApi.md @@ -9,15 +9,15 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store -[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet -[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status -[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags -[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID -[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet -[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data -[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image -[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +[**addPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**uploadFileWithRequiredFile**](PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) # **addPet** diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/StoreApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/StoreApi.md index 258b08e898c8..6823f6761779 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/StoreApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/StoreApi.md @@ -9,10 +9,10 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID -[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status -[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID -[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet +[**deleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet # **deleteOrder** diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/UserApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/UserApi.md index 1fcc5faa1cb4..c624e6d5536d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/UserApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/UserApi.md @@ -9,14 +9,14 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**createUser**](UserApi.md#createUser) | **POST** /user | Create user -[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array -[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array -[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user -[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name -[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system -[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session -[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user +[**createUser**](UserApi.md#createuser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user # **createUser**