diff --git a/.github/.test/samples.json b/.github/.test/samples.json index 9d960634ec3b..9fb8604c194f 100644 --- a/.github/.test/samples.json +++ b/.github/.test/samples.json @@ -151,6 +151,12 @@ "Client: Dart" ] }, + { + "input": "dart-next-petstore.sh", + "matches": [ + "Client: Dart" + ] + }, { "input": "dart-petstore.sh", "matches": [ diff --git a/bin/configs/dart-next-dio-built_value-v3.yaml b/bin/configs/dart-next-dio-built_value-v3.yaml new file mode 100644 index 000000000000..aa5d08d10267 --- /dev/null +++ b/bin/configs/dart-next-dio-built_value-v3.yaml @@ -0,0 +1,15 @@ +generatorName: dart-next +outputDir: samples/client/echo_api/dart/dio/built_value +inputSpec: modules/openapi-generator/src/test/resources/3_0/dart/v3.0.0.yaml +templateDir: modules/openapi-generator/src/main/resources/dart-next +typeMappings: + Client: "ModelClient" + File: "ModelFile" + EnumClass: "ModelEnumClass" +additionalProperties: + hideGenerationTimestamp: "true" + enumUnknownDefaultCase: "true" + library: dio + serializationLibrary: built_value +reservedWordsMappings: + class: "classField" diff --git a/bin/configs/dart-next-dio-json_serializable-v3.yaml b/bin/configs/dart-next-dio-json_serializable-v3.yaml new file mode 100644 index 000000000000..dd6ecf828822 --- /dev/null +++ b/bin/configs/dart-next-dio-json_serializable-v3.yaml @@ -0,0 +1,13 @@ +generatorName: dart-next +outputDir: samples/client/echo_api/dart/dio/json_serializable +inputSpec: modules/openapi-generator/src/test/resources/3_0/dart/v3.0.0.yaml +templateDir: modules/openapi-generator/src/main/resources/dart-next +typeMappings: + Client: "ModelClient" + File: "ModelFile" + EnumClass: "ModelEnumClass" +additionalProperties: + hideGenerationTimestamp: "true" + enumUnknownDefaultCase: "true" + library: dio + serializationLibrary: json_serializable diff --git a/docs/generators.md b/docs/generators.md index 1fe95d2ad933..6109dd235aa3 100644 --- a/docs/generators.md +++ b/docs/generators.md @@ -21,6 +21,7 @@ The following generators are available: * [csharp](generators/csharp.md) * [dart](generators/dart.md) * [dart-dio](generators/dart-dio.md) +* [dart-next (experimental)](generators/dart-next.md) * [eiffel](generators/eiffel.md) * [elixir](generators/elixir.md) * [elm](generators/elm.md) diff --git a/docs/generators/README.md b/docs/generators/README.md index 3b624bd8b8f6..919a7dda6bc6 100644 --- a/docs/generators/README.md +++ b/docs/generators/README.md @@ -15,6 +15,7 @@ The following generators are available: * [csharp-functions](csharp-functions.md) * [dart](dart.md) * [dart-dio](dart-dio.md) +* [dart-next](dart-next.md) * [eiffel](eiffel.md) * [elixir](elixir.md) * [elm](elm.md) diff --git a/docs/generators/dart-next.md b/docs/generators/dart-next.md new file mode 100644 index 000000000000..5d3f229df2ab --- /dev/null +++ b/docs/generators/dart-next.md @@ -0,0 +1,257 @@ +--- +title: Documentation for the dart-next Generator +--- + +## METADATA + +| Property | Value | Notes | +| -------- | ----- | ----- | +| generator name | dart-next | pass this to the generate command after -g | +| generator stability | EXPERIMENTAL | | +| generator type | CLIENT | | +| generator language | Dart | | +| generator default templating engine | mustache | | +| helpTxt | Generates a Dart client library. | | + +## CONFIG OPTIONS +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| +|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enum's are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| +|finalProperties|Whether properties are marked as final when using Json Serializable for serialization| |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| +|library|Specify networking library|
**dio**
[DEFAULT] dio
**http**
[BETA] http
|dio| +|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| +|pubAuthor|Author name in generated pubspec| |Author| +|pubAuthorEmail|Email address of the author in generated pubspec| |author@homepage| +|pubDescription|Description in generated pubspec| |OpenAPI API client| +|pubHomepage|Homepage in generated pubspec| |homepage| +|pubLibrary|Library name in generated code| |openapi.api| +|pubName|Name in generated pubspec| |openapi| +|pubPublishTo|Publish_to in generated pubspec| |null| +|pubRepository|Repository in generated pubspec| |null| +|pubVersion|Version in generated pubspec| |1.0.0| +|serializationLibrary|Specify serialization library|
**built_value**
[DEFAULT] built_value
**json_serializable**
[BETA] json_serializable
|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| |src| +|useEnumExtension|Allow the 'x-enum-values' extension for enums| |false| + +## 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 +|Uuid|✗| +|Array|✓|OAS2,OAS3 +|Null|✗|OAS3 +|AnyType|✗|OAS2,OAS3 +|Object|✓|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 +|allOf|✓|OAS2,OAS3 +|anyOf|✓|OAS3 +|oneOf|✓|OAS3 +|not|✗|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 +|SignatureAuth|✗|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/languages/DartNextAbstractCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartNextAbstractCodegen.java new file mode 100644 index 000000000000..ccd92373b12b --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartNextAbstractCodegen.java @@ -0,0 +1,846 @@ +package org.openapitools.codegen.languages; + +import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER; +import static org.openapitools.codegen.utils.StringUtils.camelize; +import static org.openapitools.codegen.utils.StringUtils.escape; +import static org.openapitools.codegen.utils.StringUtils.underscore; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Stream; + +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.CodegenModel; +import org.openapitools.codegen.CodegenOperation; +import org.openapitools.codegen.CodegenProperty; +import org.openapitools.codegen.CodegenType; +import org.openapitools.codegen.DefaultCodegen; +import org.openapitools.codegen.GeneratorLanguage; +import org.openapitools.codegen.meta.features.ClientModificationFeature; +import org.openapitools.codegen.meta.features.DocumentationFeature; +import org.openapitools.codegen.meta.features.GlobalFeature; +import org.openapitools.codegen.meta.features.ParameterFeature; +import org.openapitools.codegen.meta.features.SchemaSupportFeature; +import org.openapitools.codegen.meta.features.SecurityFeature; +import org.openapitools.codegen.meta.features.WireFormatFeature; +import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; +import org.openapitools.codegen.utils.ModelUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.collect.Sets; + +import io.swagger.v3.oas.models.media.ArraySchema; +import io.swagger.v3.oas.models.media.ComposedSchema; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.media.StringSchema; + +public abstract class DartNextAbstractCodegen extends DefaultCodegen { + + private final Logger LOGGER = LoggerFactory.getLogger(AbstractDartCodegen.class); + + protected static final List DEFAULT_SUPPORTED_CONTENT_TYPES = Arrays.asList( + "application/json", "application/x-www-form-urlencoded", "multipart/form-data"); + + public static final String PUB_LIBRARY = "pubLibrary"; + public static final String PUB_NAME = "pubName"; + public static final String PUB_VERSION = "pubVersion"; + public static final String PUB_DESCRIPTION = "pubDescription"; + public static final String PUB_AUTHOR = "pubAuthor"; + public static final String PUB_AUTHOR_EMAIL = "pubAuthorEmail"; + public static final String PUB_HOMEPAGE = "pubHomepage"; + public static final String PUB_REPOSITORY = "pubRepository"; + public static final String PUB_PUBLISH_TO = "pubPublishTo"; + public static final String USE_ENUM_EXTENSION = "useEnumExtension"; + + protected String pubLibrary = "openapi.api"; + protected String pubName = "openapi"; + protected String pubVersion = "1.0.0"; + protected String pubDescription = "OpenAPI API client"; + protected String pubAuthor = "Author"; + protected String pubAuthorEmail = "author@homepage"; + protected String pubHomepage = "homepage"; + protected String pubRepository = null; + protected String pubPublishTo = null; + protected boolean useEnumExtension = false; + protected String sourceFolder = "src"; + protected String libPath = "lib" + File.separator; + protected String apiDocPath = "doc" + File.separator; + protected String modelDocPath = "doc" + File.separator; + protected String apiTestPath = "test" + File.separator; + protected String modelTestPath = "test" + File.separator; + + protected Map imports = new HashMap<>(); + + public DartNextAbstractCodegen() { + super(); + + modifyFeatureSet(features -> features + .includeDocumentationFeatures(DocumentationFeature.Readme) + .securityFeatures(EnumSet.of( + SecurityFeature.OAuth2_Implicit, + SecurityFeature.BasicAuth, + SecurityFeature.BearerToken, + SecurityFeature.ApiKey + )) + .excludeGlobalFeatures( + GlobalFeature.XMLStructureDefinitions, + GlobalFeature.Callbacks, + GlobalFeature.LinkObjects, + GlobalFeature.ParameterStyling + ) + .excludeSchemaSupportFeatures( + SchemaSupportFeature.Polymorphism, + SchemaSupportFeature.Union, + SchemaSupportFeature.Composite + ) + .includeParameterFeatures( + ParameterFeature.Cookie + ) + .includeClientModificationFeatures( + ClientModificationFeature.BasePath + ) + .excludeWireFormatFeatures( + WireFormatFeature.XML + ) + ); + + ///src/main/resources/dart-next + // outputFolder = "generated-code/dart"; + modelTemplateFiles.put("model.mustache", ".dart"); + apiTemplateFiles.put("api.mustache", ".dart"); + // embeddedTemplateDir = templateDir = "dart2"; + apiPackage = "api"; + modelPackage = "model"; + modelDocTemplateFiles.put("object_doc.mustache", ".md"); + apiDocTemplateFiles.put("api_doc.mustache", ".md"); + + modelTestTemplateFiles.put("model_test.mustache", ".dart"); + apiTestTemplateFiles.put("api_test.mustache", ".dart"); + + final List reservedWordsList = new ArrayList<>(); + try (BufferedReader reader = new BufferedReader( + new InputStreamReader(DartClientCodegen.class.getResourceAsStream("/dart/dart-keywords.txt"), + StandardCharsets.UTF_8))) { + while (reader.ready()) { + reservedWordsList.add(reader.readLine()); + } + } catch (Exception e) { + LOGGER.error("Error reading dart keywords. Exception: {}", e.getMessage()); + } + setReservedWordsLowerCase(reservedWordsList); + + // These types return isPrimitive=true in templates + languageSpecificPrimitives = Sets.newHashSet( + "String", + "bool", + "int", + "num", + "double" + ); + + typeMapping = new HashMap<>(); + typeMapping.put("Array", "List"); + typeMapping.put("array", "List"); + typeMapping.put("map", "Map"); + typeMapping.put("List", "List"); + typeMapping.put("set", "Set"); + typeMapping.put("boolean", "bool"); + typeMapping.put("string", "String"); + typeMapping.put("char", "String"); + typeMapping.put("int", "int"); + typeMapping.put("long", "int"); + typeMapping.put("short", "int"); + typeMapping.put("number", "num"); + typeMapping.put("float", "double"); + typeMapping.put("double", "double"); + typeMapping.put("decimal", "double"); + typeMapping.put("integer", "int"); + typeMapping.put("Date", "DateTime"); + typeMapping.put("date", "DateTime"); + typeMapping.put("DateTime", "DateTime"); + typeMapping.put("file", "MultipartFile"); + typeMapping.put("binary", "MultipartFile"); + typeMapping.put("UUID", "String"); + typeMapping.put("URI", "String"); + typeMapping.put("ByteArray", "String"); + typeMapping.put("object", "Object"); + typeMapping.put("AnyType", "Object"); + + // Data types of the above values which are automatically imported + defaultIncludes = Sets.newHashSet( + "String", + "bool", + "int", + "num", + "double", + "List", + "Set", + "Map", + "DateTime", + "Object" + ); + + imports.put("String", "dart:core"); + imports.put("bool", "dart:core"); + imports.put("int", "dart:core"); + imports.put("num", "dart:core"); + imports.put("double", "dart:core"); + imports.put("List", "dart:core"); + imports.put("Set", "dart:core"); + imports.put("Map", "dart:core"); + imports.put("DateTime", "dart:core"); + imports.put("Object", "dart:core"); + imports.put("MultipartFile", "package:http/http.dart"); + + addOption(PUB_LIBRARY, "Library name in generated code", pubLibrary); + addOption(PUB_NAME, "Name in generated pubspec", pubName); + addOption(PUB_VERSION, "Version in generated pubspec", pubVersion); + addOption(PUB_DESCRIPTION, "Description in generated pubspec", pubDescription); + addOption(PUB_AUTHOR, "Author name in generated pubspec", pubAuthor); + addOption(PUB_AUTHOR_EMAIL, "Email address of the author in generated pubspec", pubAuthorEmail); + addOption(PUB_HOMEPAGE, "Homepage in generated pubspec", pubHomepage); + addOption(PUB_REPOSITORY, "Repository in generated pubspec", pubRepository); + addOption(PUB_PUBLISH_TO, "Publish_to in generated pubspec", pubPublishTo); + addOption(USE_ENUM_EXTENSION, "Allow the 'x-enum-values' extension for enums", String.valueOf(useEnumExtension)); + addOption(CodegenConstants.SOURCE_FOLDER, CodegenConstants.SOURCE_FOLDER_DESC, sourceFolder); + } + + @Override + public CodegenType getTag() { + return CodegenType.CLIENT; + } + + @Override + public String getName() { + return "dart"; + } + + @Override + public String getHelp() { + return "Generates a Dart 2.x client library."; + } + + @Override + public void processOpts() { + super.processOpts(); + + // Fix a couple Java notation properties + modelPackage = modelPackage.replace('.', '/'); + apiPackage = apiPackage.replace('.', '/'); + // And overwrite them in the additional properties + additionalProperties.put(CodegenConstants.MODEL_PACKAGE, modelPackage); + additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage); + + 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(PUB_NAME)) { + this.setPubName((String) additionalProperties.get(PUB_NAME)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_NAME, pubName); + } + + if (additionalProperties.containsKey(PUB_LIBRARY)) { + this.setPubLibrary((String) additionalProperties.get(PUB_LIBRARY)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_LIBRARY, pubLibrary); + } + + if (additionalProperties.containsKey(PUB_VERSION)) { + this.setPubVersion((String) additionalProperties.get(PUB_VERSION)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_VERSION, pubVersion); + } + + if (additionalProperties.containsKey(PUB_DESCRIPTION)) { + this.setPubDescription((String) additionalProperties.get(PUB_DESCRIPTION)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_DESCRIPTION, pubDescription); + } + + if (additionalProperties.containsKey(PUB_AUTHOR)) { + this.setPubAuthor((String) additionalProperties.get(PUB_AUTHOR)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_AUTHOR, pubAuthor); + } + + if (additionalProperties.containsKey(PUB_AUTHOR_EMAIL)) { + this.setPubAuthorEmail((String) additionalProperties.get(PUB_AUTHOR_EMAIL)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_AUTHOR_EMAIL, pubAuthorEmail); + } + + if (additionalProperties.containsKey(PUB_HOMEPAGE)) { + this.setPubHomepage((String) additionalProperties.get(PUB_HOMEPAGE)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_HOMEPAGE, pubHomepage); + } + + if (additionalProperties.containsKey(PUB_REPOSITORY)) { + this.setPubRepository((String) additionalProperties.get(PUB_REPOSITORY)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_REPOSITORY, pubRepository); + } + + if (additionalProperties.containsKey(PUB_PUBLISH_TO)) { + this.setPubPublishTo((String) additionalProperties.get(PUB_PUBLISH_TO)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_PUBLISH_TO, pubPublishTo); + } + + if (additionalProperties.containsKey(USE_ENUM_EXTENSION)) { + this.setUseEnumExtension(convertPropertyToBooleanAndWriteBack(USE_ENUM_EXTENSION)); + } else { + // Not set, use to be passed to template. + additionalProperties.put(USE_ENUM_EXTENSION, useEnumExtension); + } + + if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) { + String srcFolder = (String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER); + this.setSourceFolder(srcFolder.replace('/', File.separatorChar)); + } + additionalProperties.put(CodegenConstants.SOURCE_FOLDER, sourceFolder); + + // make api and model doc path available in mustache template + additionalProperties.put("apiDocPath", apiDocPath); + additionalProperties.put("modelDocPath", modelDocPath); + + // check to not overwrite a custom templateDir + // if (templateDir == null) { + // embeddedTemplateDir = templateDir = "dart2"; + // } + } + + @Override + protected boolean needToImport(String type) { + // Import everything, unless it is from dart:core. + return StringUtils.isNotBlank(type) && (!imports.containsKey(type) || !imports.get(type).equals("dart:core")); + } + + @Override + protected boolean isReservedWord(String word) { + // consider everything as reserved that is + // * a keyword + // * a word that has been mapped in the reservedWordsMappings + // * a default included type or a type include through some library + return super.isReservedWord(word) || reservedWordsMappings().containsKey(word) || defaultIncludes().contains(word); + } + + @Override + public String escapeReservedWord(String name) { + if (reservedWordsMappings().containsKey(name)) { + return reservedWordsMappings().get(name); + } + return name + "_"; + } + + @Override + public String apiFileFolder() { + return (outputFolder + File.separator + libPath + sourceFolder + File.separator + apiPackage()).replace('/', File.separatorChar); + } + + @Override + public String modelFileFolder() { + return (outputFolder + File.separator + libPath + sourceFolder + File.separator + modelPackage()).replace('/', File.separatorChar); + } + + @Override + public String apiTestFileFolder() { + return outputFolder + File.separator + apiTestPath; + } + + @Override + public String modelTestFileFolder() { + return outputFolder + File.separator + modelTestPath; + } + + @Override + public String apiDocFileFolder() { + return outputFolder + File.separator + apiDocPath; + } + + @Override + public String modelDocFileFolder() { + return outputFolder + File.separator + modelDocPath; + } + + @Override + public String toVarName(String name) { + // replace - with _ e.g. created-at => created_at + name = name.replace("-", "_"); + + // always need to replace leading underscores first + name = name.replaceAll("^_", ""); + + // if it's all upper case, do nothing + if (name.matches("^[A-Z_]*$")) { + return name; + } + + // replace all characters that have a mapping but ignore underscores + // append an underscore to each replacement so that it can be camelized + if (name.chars().anyMatch(character -> specialCharReplacements.containsKey(String.valueOf((char) character)))) { + name = escape(name, specialCharReplacements, Collections.singletonList("_"), "_"); + } + // remove the rest + name = sanitizeName(name); + + // camelize (lower first character) the variable name + // pet_id => petId + name = camelize(name, LOWERCASE_FIRST_LETTER); + + if (name.matches("^\\d.*")) { + name = "n" + name; + } + + if (isReservedWord(name)) { + name = escapeReservedWord(name); + } + + return name; + } + + @Override + public String toParamName(String name) { + // should be the same as variable name + return toVarName(name); + } + + @Override + public String toModelName(final String name) { + String sanitizedName = sanitizeName(name); + + if (!StringUtils.isEmpty(modelNamePrefix)) { + // add '_' so that model name can be camelized correctly + sanitizedName = modelNamePrefix + "_" + sanitizedName; + } + + if (!StringUtils.isEmpty(modelNameSuffix)) { + // add '_' so that model name can be camelized correctly + sanitizedName = sanitizedName + "_" + modelNameSuffix; + } + + // camelize the model name + // phone_number => PhoneNumber + final String camelizedName = camelize(sanitizedName); + + // Check if there is a mapping that can be used + if (typeMapping().containsKey(camelizedName)) { + String typeName = typeMapping().get(camelizedName); + if (imports.containsKey(typeName)) { + // Anything with an import mapping is likely + // generator specific and can not be used as model name. + final String modelName = "Model" + camelizedName; + LOGGER.warn("{} (existing type) cannot be used as model name. Renamed to {}", camelizedName, modelName); + return modelName; + } + return typeName; + } + + // model name cannot use reserved keyword, e.g. return + if (isReservedWord(camelizedName)) { + final String modelName = "Model" + camelizedName; + LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", camelizedName, modelName); + return modelName; + } + + // model name starts with number + if (camelizedName.matches("^\\d.*")) { + final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize) + LOGGER.warn("{} (model name starts with number) cannot be used as model name. Renamed to {}", name, modelName); + return modelName; + } + + return camelizedName; + } + + @Override + public String toModelFilename(String name) { + return underscore(toModelName(name)); + } + + @Override + public String toModelDocFilename(String name) { + return toModelName(name); + } + + @Override + public String toApiFilename(String name) { + return underscore(toApiName(name)); + } + + @Override + public String toApiTestFilename(String name) { + return toApiFilename(name) + "_test"; + } + + @Override + public String toModelTestFilename(String name) { + return toModelFilename(name) + "_test"; + } + + @Override + public String toDefaultValue(Schema schema) { + if (ModelUtils.isMapSchema(schema) || ModelUtils.isSet(schema)) { + return "const {}"; + } + if (ModelUtils.isArraySchema(schema)) { + return "const []"; + } + + if (schema.getDefault() != null) { + if (ModelUtils.isDateSchema(schema) || ModelUtils.isDateTimeSchema(schema)) { + // this is currently not supported and would create compile errors + return null; + } + if (ModelUtils.isStringSchema(schema)) { + return "r'" + schema.getDefault().toString().replace("'", "\\'") + "'"; + } + return schema.getDefault().toString(); + } + return null; + } + + @Override + public String getTypeDeclaration(Schema p) { + Schema schema = unaliasSchema(p); + Schema target = ModelUtils.isGenerateAliasAsModel() ? p : schema; + if (ModelUtils.isArraySchema(target)) { + Schema items = getSchemaItems((ArraySchema) schema); + return getSchemaType(target) + "<" + getTypeDeclaration(items) + ">"; + } + if (ModelUtils.isMapSchema(target)) { + // Note: ModelUtils.isMapSchema(p) returns true when p is a composed schema that also defines + // additionalproperties: true + Schema inner = ModelUtils.getAdditionalProperties(target); + if (inner == null) { + LOGGER.error("`{}` (map property) does not have a proper inner type defined. Default to type:string", p.getName()); + inner = new StringSchema().description("TODO default missing map inner type to string"); + p.setAdditionalProperties(inner); + } + return getSchemaType(target) + ""; + } + return super.getTypeDeclaration(p); + } + + @Override + public String getSchemaType(Schema p) { + String openAPIType = super.getSchemaType(p); + if (openAPIType == null) { + LOGGER.error("No Type defined for Schema {}", p); + } + if (typeMapping().containsKey(openAPIType)) { + return typeMapping().get(openAPIType); + } + return toModelName(openAPIType); + } + + @Override + public ModelsMap postProcessModels(ModelsMap objs) { + return postProcessModelsEnum(objs); + } + + @Override + public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { + super.postProcessModelProperty(model, property); + if (!model.isEnum && property.isEnum && property.getComposedSchemas() == null) { + // These are inner enums, enums which do not exist as models, just as properties. + // They are handled via the enum_inline template and are generated in the + // same file as the containing class. To prevent name clashes the inline enum classes + // are prefix with the classname of the containing class in the template. + // Here the datatypeWithEnum template variable gets updated to match that scheme. + // Also taking into account potential collection types e.g. List -> List + final String enumName = model.classname + property.enumName; + if (property.items != null) { + // inner items e.g. enums in collections, only works for one level + // but same is the case for DefaultCodegen + property.setDatatypeWithEnum(property.datatypeWithEnum.replace(property.items.datatypeWithEnum, enumName)); + property.items.setDatatypeWithEnum(enumName); + property.items.setEnumName(enumName); + } else { + // plain enum property + property.setDatatypeWithEnum(property.datatypeWithEnum.replace(property.enumName, enumName)); + } + property.setEnumName(enumName); + } + } + + @Override + public CodegenProperty fromProperty(String name, Schema p, boolean required) { + final CodegenProperty property = super.fromProperty(name, p, required); + + // Handle composed properties and it's NOT allOf with a single ref only + if (ModelUtils.isComposedSchema(p) && !(ModelUtils.isAllOf(p) && p.getAllOf().size() == 1)) { + ComposedSchema composed = (ComposedSchema) p; + + // Count the occurrences of allOf/anyOf/oneOf with exactly one child element + long count = Stream.of(composed.getAllOf(), composed.getAnyOf(), composed.getOneOf()) + .filter(list -> list != null && list.size() == 1).count(); + + if (count == 1) { + // Continue only if there is one element that matches + // and basically treat it as simple property. + Stream.of(composed.getAllOf(), composed.getAnyOf(), composed.getOneOf()) + .filter(list -> list != null && list.size() == 1) + .findFirst() + .map(list -> list.get(0).get$ref()) + .map(ModelUtils::getSimpleRef) + .map(ref -> ModelUtils.getSchemas(this.openAPI).get(ref)) + .ifPresent(schema -> { + property.isEnum = schema.getEnum() != null; + property.isModel = true; + }); + + } + } + return property; + } + + @Override + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + super.postProcessOperationsWithModels(objs, allModels); + OperationMap operations = objs.getOperations(); + if (operations != null) { + List ops = operations.getOperation(); + for (CodegenOperation op : ops) { + if (op.hasConsumes) { + if (!op.formParams.isEmpty() || op.isMultipart) { + // DefaultCodegen only sets this if the first consumes mediaType + // is application/x-www-form-urlencoded or multipart. + // Can just use the original + op.prioritizedContentTypes = op.consumes; + } else { + // Prioritize content types by moving application/json to the front + // similar to JavaCodegen + op.prioritizedContentTypes = prioritizeContentTypes(op.consumes); + String mediaType = op.prioritizedContentTypes.get(0).get("mediaType"); + if (!DEFAULT_SUPPORTED_CONTENT_TYPES.contains(mediaType)) { + LOGGER.warn("The media-type '{}' for operation '{}' is not support in the Dart generators by default.", mediaType, op.path); + } + } + } + } + } + return objs; + } + + private List> prioritizeContentTypes(List> consumes) { + if (consumes.size() <= 1) { + // no need to change any order + return consumes; + } + + List> prioritizedContentTypes = new ArrayList<>(consumes.size()); + + List> jsonVendorMimeTypes = new ArrayList<>(consumes.size()); + List> jsonMimeTypes = new ArrayList<>(consumes.size()); + + for (Map consume : consumes) { + String mediaType = consume.get("mediaType"); + if (isJsonVendorMimeType(mediaType)) { + jsonVendorMimeTypes.add(consume); + } else if (isJsonMimeType(mediaType)) { + jsonMimeTypes.add(consume); + } else { + prioritizedContentTypes.add(consume); + } + } + + prioritizedContentTypes.addAll(0, jsonMimeTypes); + prioritizedContentTypes.addAll(0, jsonVendorMimeTypes); + return prioritizedContentTypes; + } + + @Override + protected void updateEnumVarsWithExtensions(List> enumVars, Map vendorExtensions, String dataType) { + if (vendorExtensions != null && useEnumExtension && vendorExtensions.containsKey("x-enum-values")) { + // Use the x-enum-values extension for this enum + // Existing enumVars added by the default handling need to be removed first + enumVars.clear(); + + Object extension = vendorExtensions.get("x-enum-values"); + List> values = (List>) extension; + for (Map value : values) { + Map enumVar = new HashMap<>(); + enumVar.put("name", toEnumVarName((String) value.get("identifier"), dataType)); + enumVar.put("value", toEnumValue(value.get("numericValue").toString(), dataType)); + enumVar.put("isString", isDataTypeString(dataType)); + if (value.containsKey("description")) { + enumVar.put("description", value.get("description").toString()); + } + enumVars.add(enumVar); + } + } else { + super.updateEnumVarsWithExtensions(enumVars, vendorExtensions, dataType); + } + } + + @Override + public String toEnumVarName(String value, String datatype) { + if (value.length() == 0) { + return "empty"; + } + if (("number".equalsIgnoreCase(datatype) || + "double".equalsIgnoreCase(datatype) || + "int".equalsIgnoreCase(datatype)) && + value.matches("^-?\\d.*")) { + // Only rename numeric values when the datatype is numeric + // AND the name is not changed by enum extensions (matches a numeric value). + boolean isNegative = value.startsWith("-"); + return toVarName("number" + (isNegative ? "_negative" : "") + value); + } + return toVarName(value); + } + + @Override + public String toEnumValue(String value, String datatype) { + if ("number".equalsIgnoreCase(datatype) || + "int".equalsIgnoreCase(datatype)) { + return value; + } else { + return "r'" + escapeText(value) + "'"; + } + } + + @Override + public String toOperationId(String operationId) { + operationId = super.toOperationId(operationId); + + operationId = camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER); + + // method name cannot use reserved keyword, e.g. return + if (isReservedWord(operationId)) { + String newOperationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER); + LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId); + return newOperationId; + } + + // operationId starts with a number + if (operationId.matches("^\\d.*")) { + String newOperationId = camelize("call_" + operationId, LOWERCASE_FIRST_LETTER); + LOGGER.warn("{} (starting with a number) cannot be used as method name. Renamed to {}", operationId, newOperationId); + operationId = newOperationId; + } + + return operationId; + } + + public void setPubLibrary(String pubLibrary) { + this.pubLibrary = pubLibrary; + } + + public void setPubName(String pubName) { + this.pubName = pubName; + } + + public void setPubVersion(String pubVersion) { + this.pubVersion = pubVersion; + } + + public void setPubDescription(String pubDescription) { + this.pubDescription = pubDescription; + } + + public void setPubAuthor(String pubAuthor) { + this.pubAuthor = pubAuthor; + } + + public void setPubAuthorEmail(String pubAuthorEmail) { + this.pubAuthorEmail = pubAuthorEmail; + } + + public void setPubHomepage(String pubHomepage) { + this.pubHomepage = pubHomepage; + } + + public void setPubRepository(String pubRepository) { + this.pubRepository = pubRepository; + } + + public void setPubPublishTo(String pubPublishTo) { + this.pubPublishTo = pubPublishTo; + } + + public void setUseEnumExtension(boolean useEnumExtension) { + this.useEnumExtension = useEnumExtension; + } + + public void setSourceFolder(String sourceFolder) { + this.sourceFolder = sourceFolder; + } + + @Override + public String escapeQuotationMark(String input) { + // remove " to avoid code injection + return input.replace("\"", ""); + } + + @Override + public String escapeUnsafeCharacters(String input) { + return input.replace("*/", "*_/").replace("/*", "/_*"); + } + + @Override + public void postProcessFile(File file, String fileType) { + super.postProcessFile(file, fileType); + if (file == null) { + return; + } + + String dartPostProcessFile = System.getenv("DART_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(dartPostProcessFile)) { + return; // skip if DART_POST_PROCESS_FILE env variable is not defined + } + + // process all files with dart extension + if ("dart".equals(FilenameUtils.getExtension(file.toString()))) { + // currently supported is "dartfmt -w" and "dart format" + String command = dartPostProcessFile + " " + file; + 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 (InterruptedException | IOException e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + // Restore interrupted state + Thread.currentThread().interrupt(); + } + } + } + + @Override + public GeneratorLanguage generatorLanguage() { + return GeneratorLanguage.DART; + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartNextClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartNextClientCodegen.java new file mode 100644 index 000000000000..b1bca5e5fac5 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartNextClientCodegen.java @@ -0,0 +1,1049 @@ +package org.openapitools.codegen.languages; + +import static org.openapitools.codegen.utils.StringUtils.underscore; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; +import org.openapitools.codegen.CliOption; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.CodegenDiscriminator; +import org.openapitools.codegen.CodegenDiscriminator.MappedModel; +import org.openapitools.codegen.CodegenModel; +import org.openapitools.codegen.CodegenOperation; +import org.openapitools.codegen.CodegenParameter; +import org.openapitools.codegen.CodegenProperty; +import org.openapitools.codegen.SupportingFile; +import org.openapitools.codegen.TemplateManager; +import org.openapitools.codegen.api.TemplatePathLocator; +import org.openapitools.codegen.config.GlobalSettings; +import org.openapitools.codegen.meta.GeneratorMetadata; +import org.openapitools.codegen.meta.Stability; +import org.openapitools.codegen.meta.features.ClientModificationFeature; +import org.openapitools.codegen.meta.features.SchemaSupportFeature; +import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; +import org.openapitools.codegen.templating.CommonTemplateContentLocator; +import org.openapitools.codegen.templating.GeneratorTemplateContentLocator; +import org.openapitools.codegen.templating.MustacheEngineAdapter; +import org.openapitools.codegen.templating.TemplateManagerOptions; +import org.openapitools.codegen.utils.ModelUtils; +import org.openapitools.codegen.utils.ProcessUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.collect.Sets; +import com.samskivert.mustache.Mustache; +import com.samskivert.mustache.Template; + +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.media.Discriminator; +import io.swagger.v3.oas.models.media.Schema; + + + +/* + * 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. + */ + +public class DartNextClientCodegen extends DartNextAbstractCodegen { + + private final Logger LOGGER = LoggerFactory.getLogger(DartDioClientCodegen.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_JSON_SERIALIZABLE = "json_serializable"; + public static final String SERIALIZATION_LIBRARY_DEFAULT = SERIALIZATION_LIBRARY_BUILT_VALUE; + + public static final String NETWORKING_LIBRARY_DIO = "dio"; + public static final String NETWORKING_LIBRARY_HTTP = "http"; + public static final String NETWORKING_LIBRARY_DEFAULT = NETWORKING_LIBRARY_DIO; + + private static final String DIO_IMPORT = "package:dio/dio.dart"; + public static final String FINAL_PROPERTIES = "finalProperties"; + public static final String FINAL_PROPERTIES_DEFAULT_VALUE = "true"; + + private static final String CLIENT_NAME = "clientName"; + + private String dateLibrary; + + private String serializationLibrary; + + private String clientName; + + private TemplateManager templateManager; + + private final Map supportedSerializationLibraries = new LinkedHashMap<>(); + + public DartNextClientCodegen() { + super(); + + modifyFeatureSet(features -> features + .includeClientModificationFeatures( + ClientModificationFeature.Authorizations, + ClientModificationFeature.UserAgent) + .includeSchemaSupportFeatures( + SchemaSupportFeature.Polymorphism, + SchemaSupportFeature.Union, + SchemaSupportFeature.Composite, + SchemaSupportFeature.allOf, + SchemaSupportFeature.oneOf, + SchemaSupportFeature.anyOf)); + generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata) + .stability(Stability.EXPERIMENTAL) + .build(); + + outputFolder = "generated-code/dart-next"; + embeddedTemplateDir = "dart-next"; + this.setTemplateDir(embeddedTemplateDir); + + supportedLibraries.put(NETWORKING_LIBRARY_DIO, "[DEFAULT] dio"); + supportedLibraries.put(NETWORKING_LIBRARY_HTTP, "[BETA] http"); + final CliOption networkingLibraryOptions = CliOption.newString(CodegenConstants.LIBRARY, + "Specify networking library"); + networkingLibraryOptions.setEnum(supportedLibraries); + networkingLibraryOptions.setDefault(NETWORKING_LIBRARY_DEFAULT); + cliOptions.add(networkingLibraryOptions); + + supportedSerializationLibraries.put(SERIALIZATION_LIBRARY_BUILT_VALUE, "[DEFAULT] built_value"); + supportedSerializationLibraries.put(SERIALIZATION_LIBRARY_JSON_SERIALIZABLE, "[BETA] json_serializable"); + final CliOption serializationLibraryOptions = CliOption.newString(CodegenConstants.SERIALIZATION_LIBRARY, + "Specify serialization library"); + serializationLibraryOptions.setEnum(supportedSerializationLibraries); + serializationLibraryOptions.setDefault(SERIALIZATION_LIBRARY_DEFAULT); + cliOptions.add(serializationLibraryOptions); + + // Date Library Option + final CliOption dateOption = CliOption.newString(DATE_LIBRARY, "Specify Date library"); + dateOption.setDefault(DATE_LIBRARY_DEFAULT); + + final CliOption finalProperties = CliOption.newBoolean(FINAL_PROPERTIES, + "Whether properties are marked as final when using Json Serializable for serialization"); + finalProperties.setDefault(FINAL_PROPERTIES_DEFAULT_VALUE); + cliOptions.add(finalProperties); + + 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 getSerializationLibrary() { + return serializationLibrary; + } + + /** + * Set serialization library template. + * + * @param serializationLibrary Serialization Library template + */ + public void setSerializationLibrary(String serializationLibrary) { + if (serializationLibrary != null && !supportedSerializationLibraries.containsKey(serializationLibrary)) { + StringBuilder sb = new StringBuilder( + "Unknown serialization library: " + serializationLibrary + "\nAvailable serialization libraries:"); + if (supportedSerializationLibraries.size() == 0) { + sb.append("\n ").append("NONE"); + } else { + for (String lib : supportedSerializationLibraries.keySet()) { + sb.append("\n ").append(lib); + } + } + throw new RuntimeException(sb.toString()); + } + this.serializationLibrary = serializationLibrary; + } + + public String getClientName() { + return clientName; + } + + public void setClientName(String clientName) { + this.clientName = clientName; + } + + @Override + public String getName() { + return "dart-next"; + } + + @Override + public String getHelp() { + return "Generates a Dart client library."; + } + + @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.LIBRARY)) { + additionalProperties.put(CodegenConstants.LIBRARY, NETWORKING_LIBRARY_DEFAULT); + LOGGER.debug("Networking library not set, using default {}", NETWORKING_LIBRARY_DEFAULT); + } + setLibrary(additionalProperties.get(CodegenConstants.LIBRARY).toString()); + + 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); + } + setSerializationLibrary(additionalProperties.get(CodegenConstants.SERIALIZATION_LIBRARY).toString()); + if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(serializationLibrary)) { + this.setLegacyDiscriminatorBehavior(false); + } + + 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(FINAL_PROPERTIES)) { + additionalProperties.put(FINAL_PROPERTIES, Boolean.parseBoolean(FINAL_PROPERTIES_DEFAULT_VALUE)); + LOGGER.debug("finalProperties not set, using default {}", FINAL_PROPERTIES_DEFAULT_VALUE); + } else { + additionalProperties.put(FINAL_PROPERTIES, + Boolean.parseBoolean(additionalProperties.get(FINAL_PROPERTIES).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")); + + supportingFiles.add(new SupportingFile("lib_api_exports.mustache", libPath, "apis.dart")); + supportingFiles.add(new SupportingFile("lib_model_exports.mustache", libPath, "models.dart")); + supportingFiles.add(new SupportingFile("lib.mustache", libPath, pubName + ".dart")); + + final String srcFolder = libPath + sourceFolder; + supportingFiles + .add(new SupportingFile("serialization/repository_base.mustache", srcFolder, "repository_base.dart")); + + configureNetworkingLibrary(srcFolder); + configureSerializationLibrary(srcFolder); + configureDateLibrary(srcFolder); + } + + private void configureNetworkingLibrary(String sourceFolder) { + switch (library) { + case NETWORKING_LIBRARY_DIO: + additionalProperties.put("useDio", "true"); + configureNetworkingLibraryDio(sourceFolder); + break; + default: + case NETWORKING_LIBRARY_HTTP: + additionalProperties.put("useHttp", "true"); + configureNetworkingLibraryHttp(sourceFolder); + break; + } + + TemplateManagerOptions templateManagerOptions = new TemplateManagerOptions(isEnableMinimalUpdate(), + isSkipOverwrite()); + TemplatePathLocator commonTemplateLocator = new CommonTemplateContentLocator(); + TemplatePathLocator generatorTemplateLocator = new GeneratorTemplateContentLocator(this); + templateManager = new TemplateManager( + templateManagerOptions, + getTemplatingEngine(), + new TemplatePathLocator[] { generatorTemplateLocator, commonTemplateLocator }); + + // A lambda which allows for easy includes of serialization library specific + // templates without having to change the main template files. + additionalProperties.put("includeLibraryTemplate", (Mustache.Lambda) (fragment, writer) -> { + MustacheEngineAdapter engine = ((MustacheEngineAdapter) getTemplatingEngine()); + String templateFile = "libraries/" + library + "/" + fragment.execute() + ".mustache"; + Template tmpl = engine.getCompiler() + .withLoader(name -> engine.findTemplate(templateManager, name)) + .defaultValue("") + .compile(templateManager.getFullTemplateContents(templateFile)); + + fragment.executeTemplate(tmpl, writer); + }); + } + + private void configureNetworkingLibraryDio(String srcFolder) { + imports.put("MultipartFile", DIO_IMPORT); + final String dioMustacheFolder = "libraries/dio/"; + supportingFiles + .add(new SupportingFile(dioMustacheFolder + "api_client.mustache", srcFolder, "api_client.dart")); + supportingFiles.add(new SupportingFile(dioMustacheFolder + "api_util.mustache", srcFolder, "api_util.dart")); + final String authFolder = srcFolder + File.separator + "auth"; + final String authMustacheFolder = dioMustacheFolder + "auth/"; + supportingFiles + .add(new SupportingFile(authMustacheFolder + "auth_exports.mustache", authFolder, "_exports.dart")); + supportingFiles + .add(new SupportingFile(authMustacheFolder + "api_key_auth.mustache", authFolder, "api_key_auth.dart")); + supportingFiles + .add(new SupportingFile(authMustacheFolder + "basic_auth.mustache", authFolder, "basic_auth.dart")); + supportingFiles + .add(new SupportingFile(authMustacheFolder + "bearer_auth.mustache", authFolder, "bearer_auth.dart")); + supportingFiles.add(new SupportingFile(authMustacheFolder + "oauth.mustache", authFolder, "oauth.dart")); + supportingFiles.add(new SupportingFile(authMustacheFolder + "auth.mustache", authFolder, "auth.dart")); + } + + private void configureNetworkingLibraryHttp(String srcFolder) { + + } + + private void configureSerializationLibrary(String srcFolder) { + switch (serializationLibrary) { + case SERIALIZATION_LIBRARY_JSON_SERIALIZABLE: + additionalProperties.put("useJsonSerializable", "true"); + configureSerializationLibraryJsonSerializable(srcFolder); + break; + default: + case SERIALIZATION_LIBRARY_BUILT_VALUE: + additionalProperties.put("useBuiltValue", "true"); + configureSerializationLibraryBuiltValue(srcFolder); + break; + } + + TemplateManagerOptions templateManagerOptions = new TemplateManagerOptions(isEnableMinimalUpdate(), + isSkipOverwrite()); + TemplatePathLocator commonTemplateLocator = new CommonTemplateContentLocator(); + TemplatePathLocator generatorTemplateLocator = new GeneratorTemplateContentLocator(this); + templateManager = new TemplateManager( + templateManagerOptions, + getTemplatingEngine(), + new TemplatePathLocator[] { generatorTemplateLocator, commonTemplateLocator }); + + // A lambda which allows for easy includes of serialization library specific + // templates without having to change the main template files. + additionalProperties.put("includeSerializationTemplate", (Mustache.Lambda) (fragment, writer) -> { + MustacheEngineAdapter engine = ((MustacheEngineAdapter) getTemplatingEngine()); + String templateFile = "serialization/" + serializationLibrary + "/" + fragment.execute() + ".mustache"; + Template tmpl = engine.getCompiler() + .withLoader(name -> engine.findTemplate(templateManager, name)) + .defaultValue("") + .compile(templateManager.getFullTemplateContents(templateFile)); + + fragment.executeTemplate(tmpl, writer); + }); + } + + private void configureSerializationLibraryBuiltValue(String srcFolder) { + supportingFiles.add(new SupportingFile("serialization/built_value/repository_impl.mustache", srcFolder, + "repository_impl.dart")); + 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"); + + imports.put("BuiltList", "package:built_collection/built_collection.dart"); + imports.put("BuiltSet", "package:built_collection/built_collection.dart"); + imports.put("BuiltMap", "package:built_collection/built_collection.dart"); + imports.put("JsonObject", "package:built_value/json_object.dart"); + imports.put("Uint8List", "dart:typed_data"); + } + + private void configureSerializationLibraryJsonSerializable(String srcFolder) { + supportingFiles.add(new SupportingFile("serialization/json_serializable/repository_impl.mustache", srcFolder, + "repository_impl.dart")); + supportingFiles.add(new SupportingFile("serialization/json_serializable/build.yaml.mustache", + "" /* main project dir */, "build.yaml")); + + // most of these are defined in AbstractDartCodegen, we are overriding + // just the binary / file handling + languageSpecificPrimitives.add("Object"); + imports.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"); + imports.put("OffsetDate", "package:time_machine/time_machine.dart"); + imports.put("OffsetDateTime", "package:time_machine/time_machine.dart"); + if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(serializationLibrary)) { + supportingFiles.add(new SupportingFile("serialization/built_value/offset_date_serializer.mustache", + srcFolder, "local_date_serializer.dart")); + } + break; + default: + case DATE_LIBRARY_CORE: + additionalProperties.put("useDateLibCore", "true"); + if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(serializationLibrary)) { + typeMapping.put("date", "Date"); + typeMapping.put("Date", "Date"); + importMapping.put("Date", + "package:" + pubName + "/" + sourceFolder + "/" + modelPackage() + "/date.dart"); + supportingFiles.add(new SupportingFile("serialization/built_value/date.mustache", + srcFolder + File.separator + modelPackage(), "date.dart")); + supportingFiles.add(new SupportingFile("serialization/built_value/date_serializer.mustache", + srcFolder, "date_serializer.dart")); + } + break; + } + } + + @Override + public String toDefaultValue(Schema schema) { + if (schema.getDefault() != null) { + if (schema.getEnum() != null) { + return super.toDefaultValue(schema); + } + if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(serializationLibrary)) { + 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 String toDefaultParameterValue(Schema schema) { + var result = super.toDefaultParameterValue(schema); + return result; + } + + @Override + public void updateCodegenPropertyEnum(CodegenProperty var) { + super.updateCodegenPropertyEnum(var); + var enumName = var.getEnumName(); + if (enumName != null) { + if (var.defaultValue != null) { + var allowable = var.getAllowableValues(); + if (allowable != null) { + var matchingMap = (ArrayList) allowable.get("enumVars"); + String matchingName = null; + for (Object enumMember : matchingMap) { + if (!(enumMember instanceof HashMap)) { + continue; + } + var castedEnumMember = (HashMap) enumMember; + var name = (String) castedEnumMember.get("name"); + var value = castedEnumMember.get("value"); + if (value.equals(var.defaultValue)) { + matchingName = name; + break; + } + } + if (matchingName != null) { + var newDefaultValue = enumName + "." + matchingName; + var oldDefaultValue = var.getDefaultValue(); + LOGGER.info("Modifying enum {} with default value {} to {}", enumName, oldDefaultValue, + newDefaultValue); + var.setDefaultValue(newDefaultValue); + } + } + + } + } + } + + + @Override + public ModelsMap postProcessModels(ModelsMap objs) { + objs = super.postProcessModels(objs); + List models = objs.getModels(); + ProcessUtils.addIndexToProperties(models, 1); + return objs; + } + + /// Gets all ancestors of a given model, and puts it in accumulator + private void getAncestors(CodegenModel cm, Map allModels, Set accumulator) { + + // get direct parents + Set directParentNames = cm.allOf; + if (directParentNames != null && !directParentNames.isEmpty()) { + for (String directParentName : directParentNames) { + if (accumulator.add(directParentName)) { + CodegenModel parent = allModels.get(directParentName); + getAncestors(parent, allModels, accumulator); + } + } + } + } + + private void syncRootTypesWithInnerVars(Map objs) { + Map allModels = new HashMap<>(); + for (ModelsMap modelsEntries : objs.values()) { + for (ModelMap modelsMap : modelsEntries.getModels()) { + CodegenModel model = modelsMap.getModel(); + allModels.put(model.getClassname(), model); + } + } + + for (CodegenModel model : allModels.values()) { + syncRootTypesWithInnerVars(allModels, model); + } + } + + @Override + public CodegenProperty fromProperty(String name, Schema p, boolean required, + boolean schemaIsFromAdditionalProperties) { + CodegenProperty result = super.fromProperty(name, p, required, schemaIsFromAdditionalProperties); + if (result.containerType != null && typeMapping.containsKey(result.containerType)) { + result.containerType = typeMapping.get(result.containerType); + } + return result; + } + + private void syncRootTypesWithInnerVars(Map objs, CodegenModel model) { + List allVars = new ArrayList<>(); + allVars.addAll(((Collection) model.vendorExtensions.get(kSelfAndAncestorOnlyProps))); + allVars.addAll(((Collection) model.vendorExtensions.get(kSelfOnlyProps))); + allVars.addAll(((Collection) model.vendorExtensions.get(kAncestorOnlyProps))); + + for (CodegenProperty prop : allVars) { + // check if type exists in parent map + String type = prop.openApiType; + if (objs.containsKey(type)) { + // get the type + CodegenModel relatedModel = objs.get(type); + // fill the property's VendorExtensions with the type's VendorExtensions + prop.getVendorExtensions().put(kIsParent, relatedModel.getVendorExtensions().get(kIsParent)); + prop.isEnum = relatedModel.isEnum; + + } + } + } + + private final String kIsChild = "x-is-child"; + private final String kIsParent = "x-is-parent"; + private final String kIsPure = "x-is-pure"; + private final String kSelfOnlyProps = "x-self-only-props"; + private final String kHasSelfOnlyProps = "x-has-self-only-props"; + private final String kAncestorOnlyProps = "x-ancestor-only-props"; + private final String kHasAncestorOnlyProps = "x-has-ancestor-only-props"; + private final String kSelfAndAncestorOnlyProps = "x-self-and-ancestor-only-props"; + private final String kHasSelfAndAncestorOnlyProps = "x-has-self-and-ancestor-only-props"; + private final String kParentDiscriminator = "x-parent-discriminator"; + + // adapts codegen models and property to dart rules of inheritance + private void adaptToDartInheritance(Map objs) { + // get all models + Map allModels = new HashMap<>(); + for (ModelsMap modelsEntries : objs.values()) { + for (ModelMap modelsMap : modelsEntries.getModels()) { + CodegenModel model = modelsMap.getModel(); + allModels.put(model.getClassname(), model); + } + } + + // all ancestors + Set allAncestorsForAllModelsFlat = new HashSet<>(); + // maps a model to its ancestors + Map> allAncestorsForAllModels = new HashMap<>(); + for (java.util.Map.Entry cm : allModels.entrySet()) { + Set allAncestors = new HashSet<>(); + // get all ancestors + // TODO: optimize this logic ? + getAncestors(cm.getValue(), allModels, allAncestors); + // just in case, a model can't be its own ancestor + allAncestors.remove(cm.getKey()); + + allAncestorsForAllModels.put(cm.getKey(), allAncestors); + allAncestorsForAllModelsFlat.addAll(allAncestors); + } + + Set allPureClasses = new HashSet<>(); + // set isChild,isParent,isPure + for (java.util.Map.Entry cmEntry : allModels.entrySet()) { + String key = cmEntry.getKey(); + CodegenModel cm = cmEntry.getValue(); + // get all ancestors + Set allAncestors = allAncestorsForAllModels.get(key); + + // a class is a parent when it's an ancestor to another class + boolean isParent = allAncestorsForAllModelsFlat.contains(key); + // a class is a child when it has any ancestor + boolean isChild = !allAncestors.isEmpty(); + // a class is pure when it's not a child, and has no oneOf nor anyOf + boolean isPure = !isChild && (cm.oneOf == null || cm.oneOf.isEmpty()) + && (cm.anyOf == null || cm.anyOf.isEmpty()); + + cm.vendorExtensions.put(kIsChild, isChild); + cm.vendorExtensions.put(kIsParent, isParent); + cm.vendorExtensions.put(kIsPure, isPure); + if (!isParent && (cm.oneOf == null || cm.oneOf.isEmpty())) { + // discriminator has no meaning here + if (cm.discriminator != null) { + cm.vendorExtensions.put(kParentDiscriminator, cm.discriminator); + cm.discriminator = null; + } + + } + // when pure: + // vars = allVars = selfOnlyProperties = kSelfAndAncestorOnlyProps + // ancestorOnlyProps = empty + if (isPure) { + cm.vendorExtensions.put(kSelfOnlyProps, new ArrayList<>(cm.getVars())); + cm.vendorExtensions.put(kHasSelfOnlyProps, !cm.getVars().isEmpty()); + cm.vendorExtensions.put(kAncestorOnlyProps, new ArrayList()); + cm.vendorExtensions.put(kHasAncestorOnlyProps, false); + cm.vendorExtensions.put(kSelfAndAncestorOnlyProps, new ArrayList<>(cm.getVars())); + cm.vendorExtensions.put(kHasSelfAndAncestorOnlyProps, !cm.getVars().isEmpty()); + + allPureClasses.add(key); + } + } + + // handle impure models + for (java.util.Map.Entry cmEntry : allModels.entrySet()) { + String key = cmEntry.getKey(); + CodegenModel cm = cmEntry.getValue(); + if (allPureClasses.contains(key)) { + continue; + } + // get all ancestors + Set allAncestors = allAncestorsForAllModels.get(key); + + // get direct parents + // Set directParentNames = cm.allOf == null ? new HashSet<>() : + // cm.allOf; + Set compositeProperties = new HashSet<>(); + + Set compositeModelNames = new HashSet(); + compositeModelNames.addAll(ObjectUtils.firstNonNull(cm.oneOf, new HashSet<>())); + compositeModelNames.addAll(ObjectUtils.firstNonNull(cm.anyOf, new HashSet<>())); + compositeModelNames.addAll(allAncestors); + + for (String compositeModelName : compositeModelNames) { + CodegenModel model = allModels.get(compositeModelName); + if (model == null) + continue; + List allVars = ObjectUtils.firstNonNull(model.getAllVars(), new ArrayList<>()); + for (CodegenProperty prop : allVars) { + compositeProperties.add(prop.getName()); + } + } + // dart classes declare selfOnlyProperties as direct members (they exist in + // "vars") + // for pure models, this will equal vars + Map selfOnlyProperties = new HashMap<>(); + + // ancestorOnlyProperties are properties defined by all ancestors + // NOTE: oneOf,anyOf are NOT considered ancestors + // since a child in dart must implement ALL OF the parent (using implements) + Map ancestorOnlyProperties = new HashMap<>(); + + // combines both selfOnlyProperties and ancestorOnlyProperties + // this will be used by the custom serializer as "x-handled-vars" and + // "x-has-handled-vars" + Map selfAndAncestorOnlyProperties = new HashMap<>(); + + // STEP 1: calculating selfOnlyProperties + // get all vars of all ancestors and add them to ancestorPropNames + // Set _ancestorPropNames = new HashSet<>(); + for (String ancestorKey : allAncestors) { + CodegenModel ancestorCM = allModels.get(ancestorKey); + for (CodegenProperty prop : ancestorCM.getVars()) { + ancestorOnlyProperties.put(prop.getName(), prop); + } + } + for (CodegenProperty p : cm.getVars()) { + p.isInherited = ancestorOnlyProperties.containsKey(p.getName()); + if (!p.isInherited && !compositeProperties.contains(p.getName())) { + selfOnlyProperties.put(p.getName(), p); + } + } + selfAndAncestorOnlyProperties.putAll(selfOnlyProperties); + selfAndAncestorOnlyProperties.putAll(ancestorOnlyProperties); + + cm.vendorExtensions.put(kSelfOnlyProps, new ArrayList<>(selfOnlyProperties.values())); + cm.vendorExtensions.put(kHasSelfOnlyProps, !selfOnlyProperties.isEmpty()); + cm.vendorExtensions.put(kAncestorOnlyProps, new ArrayList<>(ancestorOnlyProperties.values())); + cm.vendorExtensions.put(kHasAncestorOnlyProps, !ancestorOnlyProperties.isEmpty()); + cm.vendorExtensions.put(kSelfAndAncestorOnlyProps, new ArrayList<>(selfAndAncestorOnlyProperties.values())); + cm.vendorExtensions.put(kHasSelfAndAncestorOnlyProps, !selfAndAncestorOnlyProperties.isEmpty()); + // fixes missing imports + Set interfaceImports = new HashSet(); + interfaceImports.addAll(cm.allOf); + interfaceImports.addAll(cm.oneOf); + interfaceImports.addAll(cm.anyOf); + cm.imports.addAll(rewriteImports(interfaceImports, true)); + } + } + + /// override the default behavior of createDiscriminator + /// to remove extra mappings added as a side effect of + /// setLegacyDiscriminatorBehavior(false) + /// this ensures 1-1 schema mapping instead of 1-many + @Override + protected CodegenDiscriminator createDiscriminator(String schemaName, Schema schema) { + CodegenDiscriminator sub = super.createDiscriminator(schemaName, schema); + Discriminator originalDiscriminator = schema.getDiscriminator(); + if (originalDiscriminator != null) { + Map originalMapping = originalDiscriminator.getMapping(); + if (originalMapping != null && !originalMapping.isEmpty()) { + // we already have a discriminator mapping, remove everything else + for (MappedModel currentMappings : new HashSet<>(sub.getMappedModels())) { + if (originalMapping.containsKey(currentMappings.getMappingName())) { + // all good + } else { + sub.getMapping().remove(currentMappings.getMappingName()); + sub.getMappedModels().remove(currentMappings); + } + } + } + } + return sub; + } + + @Override + public Map postProcessAllModels(Map objs) { + objs = super.postProcessAllModels(objs); + if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(serializationLibrary)) { + adaptToDartInheritance(objs); + syncRootTypesWithInnerVars(objs); + } + + // loop through models to update the imports + for (ModelsMap entry : objs.values()) { + for (ModelMap mo : entry.getModels()) { + CodegenModel cm = mo.getModel(); + cm.imports = rewriteImports(cm.imports, true); + cm.vendorExtensions.put("x-has-vars", !cm.vars.isEmpty()); + } + } + + return objs; + } + + @Override + public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { + super.postProcessModelProperty(model, property); + if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(serializationLibrary)) { + if (property.isEnum && property.getComposedSchemas() == null) { + // enums are generated with built_value and make use of BuiltSet + model.imports.add("BuiltSet"); + } + + if (property.isContainer) { + // Figure out if there are any container type additionalProperties + // that need a custom serializer builder factory added. + final CodegenProperty items = property.items; + if (items.getAdditionalProperties() != null) { + addBuiltValueSerializer(BuiltValueSerializer.fromCodegenProperty(items)); + } + } + } + } + + @Override + public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List allModels) { + super.postProcessOperationsWithModels(objs, allModels); + OperationMap operations = objs.getOperations(); + List operationList = operations.getOperation(); + + Set resultImports = new HashSet<>(); + + for (CodegenOperation op : operationList) { + for (CodegenParameter param : Stream.of(op.allParams, op.bodyParams, op.formParams) + .flatMap(Collection::stream) + .collect(Collectors.toList())) { + if (((op.isMultipart && param.isFormParam) || param.isBodyParam) && (param.isBinary || param.isFile)) { + param.dataType = param.dataType.replace("Uint8List", "MultipartFile"); + // param.containerType = param.containerType.replace("Uint8List", + // "MultipartFile"); + op.imports.add("MultipartFile"); + + if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(serializationLibrary)) { + boolean skipFormModel = Boolean + .parseBoolean(GlobalSettings.getProperty(CodegenConstants.SKIP_FORM_MODEL, "true")); + if (param.isFormParam && param.isContainer && !skipFormModel) { + // Because of skipFormModel=false, there is a model class generated which has + // "BuiltList" as property and it requires the correct + // serializer imports to be added in order to compile. + addBuiltValueSerializerImport("Uint8List"); + } + } + } + + } + // The MultipartFile handling above changes the type of some parameters from + // `UInt8List`, the default for files, to `MultipartFile`. + // + // The following block removes the required import for Uint8List if it is no + // longer in use. + if (op.allParams.stream().noneMatch(param -> param.dataType.equals("Uint8List")) + && op.responses.stream().filter(response -> response.dataType != null) + .noneMatch(response -> response.dataType.equals("Uint8List"))) { + // Remove unused imports after processing + op.imports.remove("Uint8List"); + } + + resultImports.addAll(rewriteImports(op.imports, false)); + + if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(serializationLibrary)) { + + for (CodegenParameter param : op.allParams) { + // Generate serializer factories for all container type parameters. + // But skip binary and file parameters, JSON serializers don't make sense there. + if (param.isContainer && !(param.isBinary || param.isFile)) { + addBuiltValueSerializer(BuiltValueSerializer.fromCodegenParameter(param)); + } + } + } + + if (op.returnContainer != null && !(op.isResponseBinary || op.isResponseFile)) { + addBuiltValueSerializer(BuiltValueSerializer.fromCodegenProperty(op.returnProperty)); + } + } + // for some reason "import" structure is changed .. + objs.put("imports", resultImports.stream().sorted().collect(Collectors.toList())); + + return objs; + } + + private void addBuiltValueSerializerImport(String type) { + additionalProperties.compute("builtValueSerializerImports", (k, v) -> { + Set imports = v == null ? Sets.newHashSet() : ((Set) v); + imports.addAll(rewriteImports(Sets.newHashSet(type), true)); + return imports; + }); + } + + /** + * Adds the serializer to the global list of custom built_value serializers. + * + * @param serializer + */ + private void addBuiltValueSerializer(BuiltValueSerializer serializer) { + additionalProperties.compute("builtValueSerializers", (k, v) -> { + Set serializers = v == null ? Sets.newHashSet() : ((Set) v); + serializers.add(serializer); + return serializers; + }); + } + + private Set rewriteImports(Set originalImports, boolean isModel) { + Set resultImports = Sets.newHashSet(); + for (String modelImport : originalImports) { + if (modelImport.startsWith("BuiltList", 0)) { + modelImport = "BuiltList"; + } else if (modelImport.startsWith("BuiltSet", 0)) { + modelImport = "BuiltSet"; + } else if (modelImport.startsWith("BuiltMap", 0)) { + modelImport = "BuiltMap"; + } + + if (imports.containsKey(modelImport)) { + String i = imports.get(modelImport); + if (Objects.equals(i, DIO_IMPORT) && !isModel) { + // Don't add imports to operations that are already imported + continue; + } + resultImports.add(i); + } else if (importMapping().containsKey(modelImport)) { + resultImports.add(importMapping().get(modelImport)); + } else if (modelImport.startsWith("dart:")) { // import dart:* directly + resultImports.add(modelImport); + } else if (modelImport.startsWith("package:")) { // e.g. package:openapi/src/model/child.dart + resultImports.add(modelImport); + } else { + resultImports.add("package:" + pubName + "/" + sourceFolder + "/" + modelPackage() + "/" + + underscore(modelImport) + ".dart"); + } + } + return resultImports; + } + + static class BuiltValueSerializer { + final String containerType; + final boolean isContainer; + final boolean isArray; + final boolean uniqueItems; + final boolean isMap; + final BuiltValueSerializer items; + final boolean isNullable; + + final String datatypeWithEnum; + final String dataType; + + public static BuiltValueSerializer fromCodegenParameter(CodegenParameter parameter) { + if (parameter == null) { + return null; + } + return new BuiltValueSerializer(parameter.isArray, parameter.getUniqueItems(), parameter.getIsMap(), + /// Recursion to handle subtypes + fromCodegenProperty(parameter.items), + parameter.isNullable, parameter.datatypeWithEnum, parameter.dataType, parameter.containerType, + parameter.isContainer); + } + + public static BuiltValueSerializer fromCodegenProperty(CodegenProperty property) { + if (property == null) { + return null; + } + return new BuiltValueSerializer(property.isArray, property.getUniqueItems(), property.getIsMap(), + /// Recursion to handle subtypes + fromCodegenProperty(property.items), + property.isNullable, property.datatypeWithEnum, property.dataType, property.containerType, + property.isContainer); + } + + private BuiltValueSerializer(boolean isArray, boolean uniqueItems, boolean isMap, BuiltValueSerializer items, + boolean isNullable, String datatypeWithEnum, String dataType, String containerType, + boolean isContainer) { + this.isArray = isArray; + this.uniqueItems = uniqueItems; + this.isMap = isMap; + this.items = items; + this.isNullable = isNullable; + this.datatypeWithEnum = datatypeWithEnum; + this.dataType = dataType; + this.containerType = containerType; + this.isContainer = isContainer; + } + + public boolean isContainer() { + return isContainer; + } + + public boolean isArray() { + return isArray; + } + + public boolean isUniqueItems() { + return uniqueItems; + } + + public boolean isMap() { + return isMap; + } + + public BuiltValueSerializer getItems() { + return items; + } + + public boolean isNullable() { + return isNullable; + } + + public String getDatatypeWithEnum() { + return datatypeWithEnum; + } + + public String getContainerType() { + return containerType; + } + + public String getDataType() { + return dataType; + } + + @Override + public int hashCode() { + return Objects.hash(isContainer, isArray, uniqueItems, isMap, items, isNullable, datatypeWithEnum, + dataType); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + BuiltValueSerializer other = (BuiltValueSerializer) obj; + if (isContainer != other.isContainer) + return false; + if (isArray != other.isArray) + return false; + if (uniqueItems != other.uniqueItems) + return false; + if (isMap != other.isMap) + return false; + if (items == null) { + if (other.items != null) + return false; + } else if (!items.equals(other.items)) + return false; + if (isNullable != other.isNullable) + return false; + if (datatypeWithEnum == null) { + if (other.datatypeWithEnum != null) + return false; + } else if (!datatypeWithEnum.equals(other.datatypeWithEnum)) + return false; + if (dataType == null) { + if (other.dataType != null) + return false; + } else if (!dataType.equals(other.dataType)) + return false; + return true; + } + } +} 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 ba2d139af981..33a6c3bc5c03 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.CSharpClientCodegen org.openapitools.codegen.languages.CSharpFunctionsServerCodegen org.openapitools.codegen.languages.DartClientCodegen org.openapitools.codegen.languages.DartDioClientCodegen +org.openapitools.codegen.languages.DartNextClientCodegen org.openapitools.codegen.languages.EiffelClientCodegen org.openapitools.codegen.languages.ElixirClientCodegen org.openapitools.codegen.languages.ElmClientCodegen diff --git a/modules/openapi-generator/src/main/resources/dart-next/README.mustache b/modules/openapi-generator/src/main/resources/dart-next/README.mustache new file mode 100644 index 000000000000..50f467f647a3 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/README.mustache @@ -0,0 +1,126 @@ +# {{pubName}} (EXPERIMENTAL) +{{#appDescriptionWithNewLines}} +{{{.}}} +{{/appDescriptionWithNewLines}} + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: {{appVersion}} +{{#artifactVersion}} +- Package version: {{.}} +{{/artifactVersion}} +{{^hideGenerationTimestamp}} +- Build date: {{generatedDate}} +{{/hideGenerationTimestamp}} +- Build package: {{generatorClass}} +{{#infoUrl}} +For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} + +## Requirements + +* Dart 2.15.0+ or Flutter 2.8.0+ +* Dio 5.0.0+ (https://pub.dev/packages/dio) +{{#useJsonSerializable}} +* JSON Serializable 6.1.5+ (https://pub.dev/packages/json_serializable) +{{/useJsonSerializable}} +{{#useDateLibTimeMachine}} +* timemachine option currently **DOES NOT** support sound null-safety and may not work +{{/useDateLibTimeMachine}} + +## Installation & Usage + +### pub.dev +To use the package from [pub.dev](https://pub.dev), please include the following in pubspec.yaml +```yaml +dependencies: + {{pubName}}: {{pubVersion}} +``` + +### Github +If this Dart package is published to Github, please include the following in pubspec.yaml +```yaml +dependencies: + {{pubName}}: + git: + url: https://github.com/{{gitUserId}}/{{gitRepoId}}.git + #ref: main +``` + +### Local development +To use the package from your local drive, please include the following in pubspec.yaml +```yaml +dependencies: + {{pubName}}: + path: /path/to/{{pubName}} +``` + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```dart +import 'package:{{pubName}}/{{pubName}}.dart'; +{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} + +final api = {{clientName}}().get{{classname}}(); +{{#allParams}} +final {{{dataType}}} {{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}} +{{/allParams}} + +try { + {{#returnType}}final response = await {{/returnType}}api.{{{operationId}}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + {{#returnType}} + print(response); + {{/returnType}} +} catch on DioException (e) { + print("Exception when calling {{classname}}->{{operationId}}: $e\n"); +} +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +``` + +## Documentation for API Endpoints + +All URIs are relative to *{{basePath}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}[*{{classname}}*]({{modelDocPath}}{{{classname}}}.md) | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + +## Documentation For Models + +{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) +{{/model}}{{/models}} + +## Documentation For Authorization + +{{^authMethods}}Endpoints do not require authorization.{{/authMethods}} +{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}} +{{#authMethods}} +### {{{name}}} + +{{#isApiKey}}- **Type**: API key +- **API key parameter name**: {{{keyParamName}}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} +{{/isApiKey}} +{{#isBasicBasic}}- **Type**: HTTP basic authentication +{{/isBasicBasic}} +{{#isBasicBearer}}- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} +{{/isBasicBearer}} +{{#isHttpSignature}}- **Type**: HTTP signature authentication +{{/isHttpSignature}} +{{#isOAuth}}- **Type**: OAuth +- **Flow**: {{{flow}}} +- **Authorization URL**: {{{authorizationUrl}}} +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} - **{{{scope}}}**: {{{description}}} +{{/scopes}} +{{/isOAuth}} + +{{/authMethods}} + +## Author + +{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} +{{/-last}}{{/apis}}{{/apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/dart-next/analysis_options.mustache b/modules/openapi-generator/src/main/resources/dart-next/analysis_options.mustache new file mode 100644 index 000000000000..ce808d16a9e6 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/analysis_options.mustache @@ -0,0 +1,12 @@ +analyzer: + language: + strict-inference: true + strict-raw-types: true + strict-casts: true + exclude: {{#useJsonSerializable}} + - lib/{{sourceFolder}}/model/*.g.dart{{/useJsonSerializable}} + errors: + deprecated_member_use_from_same_package: ignore + unused_import: ignore + unused_local_variable: ignore + unnecessary_import: ignore \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/api.mustache b/modules/openapi-generator/src/main/resources/dart-next/api.mustache new file mode 100644 index 000000000000..187a30335685 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/api.mustache @@ -0,0 +1 @@ +{{#includeLibraryTemplate}}api{{/includeLibraryTemplate}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/api_doc.mustache b/modules/openapi-generator/src/main/resources/dart-next/api_doc.mustache new file mode 100644 index 000000000000..d0b44d0205fd --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/api_doc.mustache @@ -0,0 +1 @@ +{{#includeLibraryTemplate}}api_doc{{/includeLibraryTemplate}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/api_test.mustache b/modules/openapi-generator/src/main/resources/dart-next/api_test.mustache new file mode 100644 index 000000000000..11cce1054484 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/api_test.mustache @@ -0,0 +1 @@ +{{#includeLibraryTemplate}}api_test{{/includeLibraryTemplate}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/class.mustache b/modules/openapi-generator/src/main/resources/dart-next/class.mustache new file mode 100644 index 000000000000..5b68e4fdbb30 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/class.mustache @@ -0,0 +1 @@ +{{#includeSerializationTemplate}}class{{/includeSerializationTemplate}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/enum.mustache b/modules/openapi-generator/src/main/resources/dart-next/enum.mustache new file mode 100644 index 000000000000..57cb742ded14 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/enum.mustache @@ -0,0 +1 @@ +{{#includeSerializationTemplate}}enum{{/includeSerializationTemplate}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/gitignore.mustache b/modules/openapi-generator/src/main/resources/dart-next/gitignore.mustache new file mode 100644 index 000000000000..4298cdcbd1a2 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/gitignore.mustache @@ -0,0 +1,41 @@ +# 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: + +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ + +# Mac +.DS_Store diff --git a/modules/openapi-generator/src/main/resources/dart-next/header.mustache b/modules/openapi-generator/src/main/resources/dart-next/header.mustache new file mode 100644 index 000000000000..32c88287e5cf --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/header.mustache @@ -0,0 +1,3 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// diff --git a/modules/openapi-generator/src/main/resources/dart-next/lib.mustache b/modules/openapi-generator/src/main/resources/dart-next/lib.mustache new file mode 100644 index 000000000000..b6cd7489e0ea --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/lib.mustache @@ -0,0 +1,5 @@ +{{>header}} + +export 'apis.dart'; +export 'models.dart'; +export 'package:{{pubName}}/{{sourceFolder}}/auth/_exports.dart'; diff --git a/modules/openapi-generator/src/main/resources/dart-next/lib_api_exports.mustache b/modules/openapi-generator/src/main/resources/dart-next/lib_api_exports.mustache new file mode 100644 index 000000000000..81c0ad99e277 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/lib_api_exports.mustache @@ -0,0 +1,3 @@ +{{#useDio}}export 'package:{{pubName}}/{{sourceFolder}}/api_client.dart';{{/useDio}}{{#apiInfo}} +{{#apis}}export 'package:{{pubName}}/{{sourceFolder}}/{{apiPackage}}/{{classFilename}}.dart'; +{{/apis}}{{/apiInfo}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/lib_model_exports.mustache b/modules/openapi-generator/src/main/resources/dart-next/lib_model_exports.mustache new file mode 100644 index 000000000000..6e16f8cc6693 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/lib_model_exports.mustache @@ -0,0 +1,7 @@ +{{#useBuiltValue}}export 'package:{{pubName}}/{{sourceFolder}}/serializers.dart'; +{{#useDateLibCore}}export 'package:{{pubName}}/{{sourceFolder}}/date_serializer.dart'; +export 'package:{{pubName}}/{{sourceFolder}}/{{modelPackage}}/date.dart';{{/useDateLibCore}}{{/useBuiltValue}} +export 'package:{{pubName}}/{{sourceFolder}}/repository_base.dart'; +export 'package:{{pubName}}/{{sourceFolder}}/repository_impl.dart'; +{{#models}}{{#model}}export 'package:{{pubName}}/{{sourceFolder}}/{{modelPackage}}/{{classFilename}}.dart'; +{{/model}}{{/models}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api.mustache b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api.mustache new file mode 100644 index 000000000000..74d4c9e9fab1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api.mustache @@ -0,0 +1,37 @@ +{{>header}} +import 'dart:async'; +import 'package:dio/dio.dart'; +{{#useBuiltValue}} +import 'package:built_value/built_value.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart';{{/useBuiltValue}}{{#useJsonSerializable}} +import 'package:json_annotation/json_annotation.dart';{{/useJsonSerializable}} +import 'package:{{pubName}}/{{sourceFolder}}/repository_base.dart'; +import 'package:{{pubName}}/{{sourceFolder}}/api_util.dart'; +import 'package:{{pubName}}/models.dart'; +{{#operations}} +{{#imports}}import '{{.}}'; +{{/imports}} + +{{#operation}} +{{#allParams}} +{{^isModel}} +{{#enumName}} +{{#-first}} +part '{{classFilename}}.g.dart'; +{{/-first}} +{{/enumName}} +{{/isModel}} +{{/allParams}} +{{/operation}} + +{{>libraries/dio/api_typed}} +{{>libraries/dio/api_raw}} + +{{#operation}} +{{#allParams}} +{{>serialization/recursion_enum_inline}} +{{/allParams}} +{{/operation}} +{{/operations}} + diff --git a/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api_client.mustache b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api_client.mustache new file mode 100644 index 000000000000..b4a5db7bdc57 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api_client.mustache @@ -0,0 +1,68 @@ +{{>header}} +import 'package:dio/dio.dart'; +import 'repository_base.dart'; +import 'repository_impl.dart'; +import 'package:{{pubName}}/apis.dart'; +import 'package:{{pubName}}/models.dart'; +import 'package:{{pubName}}/{{sourceFolder}}/auth/_exports.dart'; + +class {{clientName}} { + static const String basePath = r'{{{basePath}}}'; + + final Dio dio; + final SerializationRepositoryBase serializationRepository; + + + {{clientName}}({ + Dio? dio, + SerializationRepositoryBase? serializationRepositoryOverride, + String? basePathOverride, + List? interceptors, + }) : this.dio = dio ?? + Dio(BaseOptions( + baseUrl: basePathOverride ?? basePath, + connectTimeout: const Duration(milliseconds: 5000), + receiveTimeout: const Duration(milliseconds: 3000), + )), this.serializationRepository = serializationRepositoryOverride ?? {{#includeSerializationTemplate}}repository_construction{{/includeSerializationTemplate}} { + if (interceptors == null) { + this.dio.interceptors.addAll([ + OAuthInterceptor(), + BasicAuthInterceptor(), + BearerAuthInterceptor(), + 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 setBearerAuth(String name, String token) { + if (this.dio.interceptors.any((i) => i is BearerAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is BearerAuthInterceptor) as BearerAuthInterceptor).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}}({{classname}}Raw(dio), serializationRepository); + }{{/apis}}{{/apiInfo}} +} diff --git a/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api_doc.mustache b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api_doc.mustache new file mode 100644 index 000000000000..1d852cd31e65 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api_doc.mustache @@ -0,0 +1,86 @@ +# {{pubName}}.api.{{classname}}{{#description}} +{{.}}{{/description}} + +## Load the API package +```dart +import 'package:{{pubName}}/{{pubName}}.dart'; +``` + +All URIs are relative to *{{basePath}}* + +Method | HTTP request | Description +------------- | ------------- | ------------- +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}} +{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} +# **{{{operationId}}}** +> {{#returnType}}{{{.}}} {{/returnType}}{{{operationId}}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) + +{{{summary}}}{{#notes}} + +{{{.}}}{{/notes}} + +### Example +```dart +import 'package:{{pubName}}/{{pubName}}.dart'; +{{#hasAuthMethods}} +{{#authMethods}} +{{#isBasicBasic}} +// TODO Configure HTTP basic authorization: {{{name}}} +//defaultApiClient.getAuthentication('{{{name}}}').username = 'YOUR_USERNAME' +//defaultApiClient.getAuthentication('{{{name}}}').password = 'YOUR_PASSWORD'; +{{/isBasicBasic}} +{{#isApiKey}} +// TODO Configure API key authorization: {{{name}}} +//defaultApiClient.getAuthentication('{{{name}}}').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('{{{name}}}').apiKeyPrefix = 'Bearer'; +{{/isApiKey}} +{{#isOAuth}} +// TODO Configure OAuth2 access token for authorization: {{{name}}} +//defaultApiClient.getAuthentication('{{{name}}}').accessToken = 'YOUR_ACCESS_TOKEN'; +{{/isOAuth}} +{{/authMethods}} +{{/hasAuthMethods}} + +final api = {{clientName}}().get{{classname}}(); +{{#allParams}} +final {{{dataType}}} {{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}} +{{/allParams}} + +try { + {{#returnType}}final response = {{/returnType}}api.{{{operationId}}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + {{#returnType}} + print(response); + {{/returnType}} +} catch on DioException (e) { + print('Exception when calling {{classname}}->{{operationId}}: $e\n'); +} +``` + +### Parameters +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +Name | Type | Description | Notes +------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} +{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}| {{{description}}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} +{{/allParams}} + +### Return type + +{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}} + +### Authorization + +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}} + +### HTTP request headers + + - **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} + - **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +{{/operation}} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api_raw.mustache b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api_raw.mustache new file mode 100644 index 000000000000..dbe677b57bfd --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api_raw.mustache @@ -0,0 +1,94 @@ +class {{classname}}Raw { + + final Dio _dio; + + const {{classname}}Raw(this._dio); + + {{#operation}} + /// {{summary}}{{^summary}}{{nickname}}{{/summary}} + /// {{notes}} + /// + /// Parameters: + {{#allParams}} + /// * [{{paramName}}] {{#description}}- {{{.}}}{{/description}}{{#defaultValue}} (Default: {{.}}) {{/defaultValue}} + {{/allParams}} + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future]{{#returnType}} containing a [Response] with a [{{{.}}}] as data{{/returnType}} + /// Throws [DioException] if API call or serialization fails + {{#externalDocs}} + /// {{description}} + /// Also see [{{summary}} Documentation]({{url}}) + {{/externalDocs}} + {{#isDeprecated}} + @Deprecated('This operation has been deprecated') + {{/isDeprecated}} + Future> {{nickname}}({ {{#allParams}}{{#isPathParam}} + {{#isDeprecated}}@Deprecated('{{paramName}} is deprecated') {{/isDeprecated}}required String {{paramName}},{{/isPathParam}}{{#isQueryParam}} + {{#isDeprecated}}@Deprecated('{{paramName}} is deprecated') {{/isDeprecated}}{{#required}}{{^isNullable}}{{^defaultValue}}required {{/defaultValue}}{{/isNullable}}{{/required}}Object{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}},{{/isQueryParam}}{{#isHeaderParam}} + {{#isDeprecated}}@Deprecated('{{paramName}} is deprecated') {{/isDeprecated}}{{#required}}{{^isNullable}}{{^defaultValue}}required {{/defaultValue}}{{/isNullable}}{{/required}}String{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}},{{/isHeaderParam}}{{/allParams}} + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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}}', + headers: { + {{#httpUserAgent}} + r'User-Agent': r'{{{.}}}', + {{/httpUserAgent}} + {{#headerParams}} + {{^required}}{{^isNullable}}if ({{{paramName}}} != null) {{/isNullable}}{{/required}}r'{{baseName}}': {{paramName}}, + {{/headerParams}} + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[{{^hasAuthMethods}}],{{/hasAuthMethods}}{{#hasAuthMethods}} + {{#authMethods}}{ + 'type': '{{type}}',{{#scheme}} + 'scheme': '{{.}}',{{/scheme}} + 'name': '{{name}}',{{#isApiKey}} + 'keyName': '{{keyParamName}}', + 'where': '{{#isKeyInQuery}}query{{/isKeyInQuery}}{{#isKeyInHeader}}header{{/isKeyInHeader}}',{{/isApiKey}} + },{{/authMethods}} + ],{{/hasAuthMethods}} + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + );{{#hasQueryParams}} + + final _queryParameters = { + {{#queryParams}} + {{^required}}{{^isNullable}}if ({{{paramName}}} != null) {{/isNullable}}{{/required}}r'{{baseName}}': {{paramName}}, + {{/queryParams}} + };{{/hasQueryParams}} + + return await _dio.request( + _path, + data: body, + options: _options,{{#hasQueryParams}} + queryParameters: _queryParameters,{{/hasQueryParams}} + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + {{/operation}} +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api_test.mustache b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api_test.mustache new file mode 100644 index 000000000000..3adeec7072af --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/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}}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 { + + }); + + {{/operation}} + }); +} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api_typed.mustache b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api_typed.mustache new file mode 100644 index 000000000000..d5419ffac53c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api_typed.mustache @@ -0,0 +1,112 @@ +class {{classname}} { + + final {{classname}}Raw rawApi; + final SerializationRepositoryBase _repository; + + const {{classname}}(this.rawApi, this._repository); + + {{#operation}} + /// {{summary}}{{^summary}}{{nickname}}{{/summary}} + /// {{notes}} + /// + /// Parameters: + {{#allParams}} + /// * [{{paramName}}] {{#description}}- {{{.}}}{{/description}}{{#defaultValue}} (Default: {{.}}) {{/defaultValue}} + {{/allParams}} + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future]{{#returnType}} containing a [Response] with a [{{{.}}}] as data{{/returnType}} + /// Throws [DioException] if API call or serialization fails + {{#externalDocs}} + /// {{description}} + /// Also see [{{summary}} Documentation]({{url}}) + {{/externalDocs}} + {{#isDeprecated}} + @Deprecated('This operation has been deprecated') + {{/isDeprecated}} + Future> {{nickname}}({ {{#allParams}} + {{#isDeprecated}}@Deprecated('{{paramName}} is deprecated') {{/isDeprecated}}{{>types/required}} {{>types/recursion_type}} {{paramName}}{{#defaultValue}} = {{{.}}}{{/defaultValue}},{{/allParams}} + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + {{#hasBodyOrFormParams}} + Object? _bodyData; + {{#hasFormParams}} + final _bodyMap = { + {{#formParams}} + {{^required}}if ({{{paramName}}} != null) {{/required}}r'{{{baseName}}}': await encodeFormParameter(_repository, {{{paramName}}}, {{>types/recursion_type_info}}), + {{/formParams}} + }; + {{#isMultipart}} + _bodyData = FormData.fromMap(_bodyMap); + {{/isMultipart}} + {{^isMultipart}} + _bodyData = _bodyMap; + {{/isMultipart}} + {{/hasFormParams}} + {{#bodyParam}} + _bodyData = await encodeBodyParameter(_repository, {{{paramName}}}, {{>types/recursion_type_info}}); + {{/bodyParam}} + {{/hasBodyOrFormParams}} + + final _response = await rawApi.{{nickname}}( + {{#allParams}}{{#isPathParam}} + {{paramName}}: await encodeStringParameter(_repository, {{paramName}}, {{>types/recursion_type_info}}),{{/isPathParam}}{{#isQueryParam}} + {{paramName}}: await encodeQueryParameter(_repository, {{paramName}}, {{>types/recursion_type_info}}, {{#collectionFormat}}format: ListFormat.{{.}},{{/collectionFormat}}),{{/isQueryParam}}{{#isHeaderParam}} + {{paramName}}: await encodeStringParameter(_repository, {{paramName}}, {{>types/recursion_type_info}}), {{/isHeaderParam}}{{/allParams}} + {{#hasConsumes}} + body: _bodyData, + requestContentType: '{{#prioritizedContentTypes}}{{#-first}}{{{mediaType}}}{{/-first}}{{/prioritizedContentTypes}}',{{/hasConsumes}} + cancelToken: cancelToken, + headers: headers, + extra: extra, + {{#isResponseFile}} + responseType: responseType.bytes, + {{/isResponseFile}} + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + {{#returnType}} + + {{{.}}}? _responseData; + + try { + final rawResponse = _response.data; + {{#returnProperty}} + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, {{>types/recursion_type_info}}); + {{/returnProperty}} + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + );{{/returnType}}{{^returnType}} + return _response;{{/returnType}} + } + + {{/operation}} +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api_util.mustache b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api_util.mustache new file mode 100644 index 000000000000..e6357fd191b6 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/api_util.mustache @@ -0,0 +1,82 @@ +import 'package:dio/dio.dart'; +import 'dart:async'; +import 'dart:convert'; +import 'package:openapi/models.dart'; +import 'dart:typed_data'; + +/// Format the given form parameter object into something that Dio can handle. +Future encodeFormParameter( + SerializationRepositoryBase repository, + T value, + TypeInfo type, +) async { + return repository.serialize( + value, + type, + ); +} + +Future encodeStringParameter( + SerializationRepositoryBase repository, + T value, + TypeInfo type, +) async { + return (await repository.serialize(value, type)).toString(); +} + +Future encodeBodyParameter( + SerializationRepositoryBase repository, + T value, + TypeInfo type, +) async { + return await repository.serialize( + value, + type, + ); +} + +Future encodeQueryParameter( + SerializationRepositoryBase repository, + T value, + TypeInfo type, { + ListFormat format = ListFormat.multi, +}) async { + if (value == null) { + return null; + } + if (value is String || value is num || value is bool) { + return value; + } + if (value is Uint8List) { + // Currently not sure how to serialize this + return value; + } + final serialized = repository.serialize( + value, + type, + ); + return serialized; +} + +Future> encodeCollectionQueryParameter( + SerializationRepositoryBase repository, + Iterable value, + TypeInfo type, { + ListFormat format = ListFormat.multi, +}) async { + final serialized = await repository.serialize( + value, + type, + ); + if (serialized == null) { + return ListParam([], format); + } + if (serialized is Iterable) { + return ListParam(serialized.toList(), format); + } + throw ArgumentError('Invalid value passed to encodeCollectionQueryParameter'); +} + +Future decodeResponse(SerializationRepositoryBase repository, TInput value, TypeInfo type) async { + return await repository.deserialize(value, type); +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/auth/api_key_auth.mustache b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/auth/api_key_auth.mustache new file mode 100644 index 000000000000..5d9da99bd5d8 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/auth/api_key_auth.mustache @@ -0,0 +1,27 @@ +{{>header}} + +import 'package:dio/dio.dart'; +import 'package:{{pubName}}/{{sourceFolder}}/auth/auth.dart'; + +class ApiKeyAuthInterceptor extends AuthInterceptor { + final Map apiKeys = {}; + + @override + void onRequest(RequestOptions options, RequestInterceptorHandler handler) { + final authInfo = getAuthInfo(options, (secure) => secure['type'] == '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-next/libraries/dio/auth/auth.mustache b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/auth/auth.mustache new file mode 100644 index 000000000000..a266e2384c77 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/auth/auth.mustache @@ -0,0 +1,15 @@ +{{>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, bool Function(Map secure) handles) { + if (route.extra.containsKey('secure')) { + final auth = route.extra['secure'] as List>; + return auth.where((secure) => handles(secure)).toList(); + } + return []; + } +} diff --git a/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/auth/auth_exports.mustache b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/auth/auth_exports.mustache new file mode 100644 index 000000000000..f038e92358ef --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/auth/auth_exports.mustache @@ -0,0 +1,5 @@ +export 'api_key_auth.dart'; +export 'basic_auth.dart'; +export 'oauth.dart'; +export 'bearer_auth.dart'; +export 'auth.dart'; \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/auth/basic_auth.mustache b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/auth/basic_auth.mustache new file mode 100644 index 000000000000..c2a4426937da --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/auth/basic_auth.mustache @@ -0,0 +1,34 @@ +{{>header}} +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:{{pubName}}/{{sourceFolder}}/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, (secure) => (secure['type'] == 'http' && secure['scheme'] == 'basic') || secure['type'] == '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-next/libraries/dio/auth/bearer_auth.mustache b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/auth/bearer_auth.mustache new file mode 100644 index 000000000000..b4bce45ca61f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/auth/bearer_auth.mustache @@ -0,0 +1,23 @@ +{{>header}} +import 'package:dio/dio.dart'; +import 'package:{{pubName}}/{{sourceFolder}}/auth/auth.dart'; + +class BearerAuthInterceptor extends AuthInterceptor { + final Map tokens = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'http' && secure['scheme'] == 'bearer'); + 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-next/libraries/dio/auth/oauth.mustache b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/auth/oauth.mustache new file mode 100644 index 000000000000..e5af801f39be --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/libraries/dio/auth/oauth.mustache @@ -0,0 +1,23 @@ +{{>header}} +import 'package:dio/dio.dart'; +import 'package:{{pubName}}/{{sourceFolder}}/auth/auth.dart'; + +class OAuthInterceptor extends AuthInterceptor { + final Map tokens = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'oauth' || secure['type'] == 'oauth2'); + 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-next/model.mustache b/modules/openapi-generator/src/main/resources/dart-next/model.mustache new file mode 100644 index 000000000000..1917decaf6c6 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/model.mustache @@ -0,0 +1,10 @@ +{{>header}} +// ignore_for_file: unused_element +{{#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-next/model_test.mustache b/modules/openapi-generator/src/main/resources/dart-next/model_test.mustache new file mode 100644 index 000000000000..e11b878ff632 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/model_test.mustache @@ -0,0 +1,27 @@ +{{#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 }} +{{#includeSerializationTemplate}}test_instance{{/includeSerializationTemplate}} + {{/isEnum}} + + group({{{classname}}}, () { + {{#vars}} + {{#description}} + // {{{.}}} + {{/description}} + // {{{dataType}}} {{{name}}}{{#defaultValue}} (default value: {{{.}}}){{/defaultValue}} + test('to test the property `{{{name}}}`', () async { + + }); + + {{/vars}} + }); +} +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/dart-next/object_doc.mustache b/modules/openapi-generator/src/main/resources/dart-next/object_doc.mustache new file mode 100644 index 000000000000..6dae3f1d7779 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/object_doc.mustache @@ -0,0 +1,16 @@ +{{#models}}{{#model}}# {{pubName}}.model.{{classname}} + +## Load the model package +```dart +import 'package:{{pubName}}/{{pubName}}.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{{description}}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/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) + +{{/model}}{{/models}} diff --git a/modules/openapi-generator/src/main/resources/dart-next/pubspec.mustache b/modules/openapi-generator/src/main/resources/dart-next/pubspec.mustache new file mode 100644 index 000000000000..8e1e1d153dae --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/pubspec.mustache @@ -0,0 +1,39 @@ +name: {{pubName}} +version: {{pubVersion}} +description: {{pubDescription}} +homepage: {{pubHomepage}} +{{#pubRepository}} +repository: {{.}} +{{/pubRepository}} +{{#pubPublishTo}} +publish_to: {{.}} +{{/pubPublishTo}} + +environment: + sdk: '>=2.15.0 <3.0.0' + +dependencies: + dio: '^5.2.0' +{{#useBuiltValue}} + one_of: '>=1.5.0 <2.0.0' + one_of_serializer: '>=1.5.0 <2.0.0' + built_value: '>=8.4.0 <9.0.0' + built_collection: '>=5.1.1 <6.0.0' +{{/useBuiltValue}} +{{#useJsonSerializable}} + json_annotation: ^4.8.1 +{{/useJsonSerializable}} +{{#useDateLibTimeMachine}} + time_machine: ^0.9.16 +{{/useDateLibTimeMachine}} + +dev_dependencies: +{{#useBuiltValue}} + built_value_generator: '>=8.4.0 <9.0.0' + build_runner: any +{{/useBuiltValue}} +{{#useJsonSerializable}} + build_runner: any + json_serializable: '^6.1.5' +{{/useJsonSerializable}} + test: ^1.16.0 diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/class.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/class.mustache new file mode 100644 index 000000000000..b917ad0c085d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/class.mustache @@ -0,0 +1,28 @@ +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart';{{#oneOf}}{{#-first}} +import 'package:one_of/one_of.dart';{{/-first}}{{/oneOf}}{{#anyOf}}{{#-first}} +import 'package:one_of/any_of.dart';{{/-first}}{{/anyOf}} + +{{#imports}} +{{/imports}} +part '{{classFilename}}.g.dart'; + +{{>serialization/built_value/class_header}} { +{{>serialization/built_value/class_members}} +} +{{#discriminator}}{{#hasDiscriminatorWithNonEmptyMapping}} +{{>serialization/built_value/class_discriminator}} +{{/hasDiscriminatorWithNonEmptyMapping}}{{/discriminator}} +{{>serialization/built_value/class_serializer}}{{#vendorExtensions.x-is-parent}} + +{{>serialization/built_value/class_concrete}}{{/vendorExtensions.x-is-parent}} +{{! + 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. + enumName only exists for inline enums +}} +{{#vars}} +{{>serialization/built_value/recursion_enum_inline}} +{{/vars}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/class_concrete.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/class_concrete.mustache new file mode 100644 index 000000000000..44cad763010a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/class_concrete.mustache @@ -0,0 +1,56 @@ +/// a concrete implementation of [{{classname}}], since [{{classname}}] is not instantiable +@BuiltValue(instantiable: true) +abstract class ${{classname}} implements {{classname}}, Built<${{classname}}, ${{classname}}Builder> { + ${{classname}}._(); + + factory ${{classname}}([void Function(${{classname}}Builder)? updates]) = _$${{classname}}; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(${{classname}}Builder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<${{classname}}> get serializer => _$${{classname}}Serializer(); +} + +class _$${{classname}}Serializer implements PrimitiveSerializer<${{classname}}> { + @override + final Iterable types = const [${{classname}}, _$${{classname}}]; + + @override + final String wireName = r'${{classname}}'; + + @override + Object serialize( + Serializers serializers, + ${{{classname}}} object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType({{classname}}))!; + } + +{{#vendorExtensions.x-has-self-and-ancestor-only-props}}{{>serialization/built_value/deserialize_properties}} + +{{/vendorExtensions.x-has-self-and-ancestor-only-props}} + @override + ${{classname}} deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ${{classname}}Builder(); + {{#vendorExtensions.x-has-self-and-ancestor-only-props}} + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + {{/vendorExtensions.x-has-self-and-ancestor-only-props}} + {{! when discriminator is involved, read it, then return based on value }} + return result.build(); + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/class_discriminator.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/class_discriminator.mustache new file mode 100644 index 000000000000..f867345883b1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/class_discriminator.mustache @@ -0,0 +1,20 @@ +extension {{classname}}DiscriminatorExt on {{classname}} { + String? get discriminatorValue { + {{#mappedModels}} + if (this is {{modelName}}) { + return r'{{mappingName}}'; + } + {{/mappedModels}} + return null; + } +} +extension {{classname}}BuilderDiscriminatorExt on {{classname}}Builder { + String? get discriminatorValue { + {{#mappedModels}} + if (this is {{modelName}}Builder) { + return r'{{mappingName}}'; + } + {{/mappedModels}} + return null; + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/class_header.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/class_header.mustache new file mode 100644 index 000000000000..a059dc504798 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/class_header.mustache @@ -0,0 +1,13 @@ +/// {{{description}}}{{^description}}{{classname}}{{/description}} +{{#hasVars}} +/// +/// Properties: +{{#allVars}} +/// * [{{{name}}}] {{#description}}- {{{.}}}{{/description}} +{{/allVars}} +{{/hasVars}} +{{#isDeprecated}} +@Deprecated('{{{classname}}} has been deprecated') +{{/isDeprecated}} +@BuiltValue({{#vendorExtensions.x-is-parent}}instantiable: false{{/vendorExtensions.x-is-parent}}) +abstract class {{classname}} {{^allOf}}{{^vendorExtensions.x-is-parent}}implements {{/vendorExtensions.x-is-parent}}{{/allOf}}{{#allOf}}{{#-first}}implements {{/-first}}{{/allOf}}{{#allOf}}{{{.}}}{{^-last}}, {{/-last}}{{/allOf}}{{^vendorExtensions.x-is-parent}}{{#allOf}}{{#-first}}, {{/-first}}{{/allOf}}{{/vendorExtensions.x-is-parent}}{{^vendorExtensions.x-is-parent}}Built<{{classname}}, {{classname}}Builder>{{/vendorExtensions.x-is-parent}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/class_members.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/class_members.mustache new file mode 100644 index 000000000000..47a355ed5e1e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/class_members.mustache @@ -0,0 +1,38 @@ +{{! define variables that aren't inherited from allOf/anyOf/oneOf }} +{{#vendorExtensions.x-self-only-props}} + {{#description}} + /// {{{.}}} + {{/description}} + {{#deprecated}} + @Deprecated('{{{name}}} has been deprecated') + {{/deprecated}} + @BuiltValueField(wireName: r'{{baseName}}') + {{>types/recursion_type}}{{^isNullable}}{{^required}}?{{/required}}{{/isNullable}} get {{name}}; + {{#allowableValues}} + // {{#min}}range from {{{min}}} to {{{max}}}{{/min}}{{^min}}enum {{name}}Enum { {{#values}} {{{.}}}, {{/values}} };{{/min}} + {{/allowableValues}} + +{{/vendorExtensions.x-self-only-props}}{{#anyOf}}{{#-first}} /// Any Of {{#anyOf}}[{{{.}}}]{{^-last}}, {{/-last}}{{/anyOf}} + AnyOf get anyOf; + +{{/-first}}{{/anyOf}}{{#oneOf}}{{#-first}} /// One Of {{#oneOf}}[{{{.}}}]{{^-last}}, {{/-last}}{{/oneOf}} + OneOf get oneOf; + +{{/-first}}{{/oneOf}}{{#discriminator}} static const String discriminatorFieldName = r'{{propertyBaseName}}';{{#hasDiscriminatorWithNonEmptyMapping}} + + static const Map discriminatorMapping = { + {{#mappedModels}} + r'{{mappingName}}': {{modelName}}, + {{/mappedModels}} + };{{/hasDiscriminatorWithNonEmptyMapping}} + +{{/discriminator}}{{^vendorExtensions.x-is-parent}} {{classname}}._(); + + factory {{classname}}([void updates({{classname}}Builder b)]) = _${{classname}}; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults({{{classname}}}Builder b) => b{{#vendorExtensions.x-parent-discriminator}}..{{propertyName}}=b.discriminatorValue{{/vendorExtensions.x-parent-discriminator}}{{#vendorExtensions.x-self-and-ancestor-only-props}}{{#defaultValue}} + ..{{{name}}} = {{#isEnum}}{{^isContainer}}const {{{enumName}}}._({{/isContainer}}{{/isEnum}}{{{defaultValue}}}{{#isEnum}}{{^isContainer}}){{/isContainer}}{{/isEnum}}{{/defaultValue}}{{/vendorExtensions.x-self-and-ancestor-only-props}}; + +{{/vendorExtensions.x-is-parent}} @BuiltValueSerializer(custom: true) + static Serializer<{{classname}}> get serializer => _${{classname}}Serializer(); \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/class_serializer.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/class_serializer.mustache new file mode 100644 index 000000000000..4cd02f3506de --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/class_serializer.mustache @@ -0,0 +1,307 @@ +class _${{classname}}Serializer implements PrimitiveSerializer<{{classname}}> { + @override + final Iterable types = const [{{classname}}{{^vendorExtensions.x-is-parent}}, _${{classname}}{{/vendorExtensions.x-is-parent}}]; + + @override + final String wireName = r'{{classname}}'; + + Iterable _serializeProperties( + Serializers serializers, + {{{classname}}} object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + {{#vendorExtensions.x-self-and-ancestor-only-props}} + {{#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. + }} + yield r'{{baseName}}'; + yield {{#isNullable}}object.{{{name}}} == null ? null : {{/isNullable}}serializers.serialize( + object.{{{name}}}, + specifiedType: const {{>serialization/built_value/variable_serializer_type}}, + ); + {{/required}} + {{^required}} + if (object.{{{name}}} != null) { + {{! Non-required properties are only serialized if not null. }} + yield r'{{baseName}}'; + yield serializers.serialize( + object.{{{name}}}, + specifiedType: const {{>serialization/built_value/variable_serializer_type}}, + ); + } + {{/required}} + {{/vendorExtensions.x-self-and-ancestor-only-props}} + } + + @override + Object serialize( + Serializers serializers, + {{{classname}}} object, { + FullType specifiedType = FullType.unspecified, + }) { + {{! oneOf }} + {{#oneOf}} + {{#-first}} + final oneOf = object.oneOf; + {{#vendorExtensions.x-self-and-ancestor-only-props}} + final result = _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + result.addAll(serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType)) as Iterable); + return result; + {{/vendorExtensions.x-self-and-ancestor-only-props}} + {{^vendorExtensions.x-self-and-ancestor-only-props}} + return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + {{/vendorExtensions.x-self-and-ancestor-only-props}} + {{/-first}} + {{/oneOf}} + {{! anyOf }} + {{#anyOf}} + {{#-first}} + final anyOf = object.anyOf; + {{#vendorExtensions.x-self-and-ancestor-only-props}} + final result = _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + final serialized = serializers.serialize(anyOf, specifiedType: FullType(AnyOf, anyOf.valueTypes.map((type) => FullType(type)).toList())); + result.addAll((serialized is Map ? serialized.entries.map((e) => [e.key, e.value]).expand((e) => e) : serialized) as Iterable); + return result; + {{/vendorExtensions.x-self-and-ancestor-only-props}} + {{^vendorExtensions.x-self-and-ancestor-only-props}} + return serializers.serialize(anyOf, specifiedType: FullType(AnyOf, anyOf.valueTypes.map((type) => FullType(type)).toList()))!; + {{/vendorExtensions.x-self-and-ancestor-only-props}} + {{/-first}} + {{/anyOf}} + {{^oneOf}} + {{^anyOf}} + {{#hasDiscriminatorWithNonEmptyMapping}} + {{#discriminator}} + {{! handle discriminator }} + {{#mappedModels}} + if (object is {{modelName}}) { + return serializers.serialize(object, specifiedType: FullType({{modelName}}))!; + } + {{/mappedModels}} + {{/discriminator}} + {{/hasDiscriminatorWithNonEmptyMapping}} + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + {{/anyOf}} + {{/oneOf}} + } + +{{#vendorExtensions.x-has-self-and-ancestor-only-props}}{{^vendorExtensions.x-is-parent}}{{>serialization/built_value/deserialize_properties}} + +{{/vendorExtensions.x-is-parent}}{{/vendorExtensions.x-has-self-and-ancestor-only-props}} @override + {{classname}} deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + {{! oneOf }} + {{#oneOf}} + {{#-first}} + final result = {{#vendorExtensions.x-is-parent}}${{/vendorExtensions.x-is-parent}}{{classname}}Builder(); + Object? oneOfDataSrc; + {{#hasDiscriminatorWithNonEmptyMapping}} + {{#discriminator}} + {{! has props, assign them to result, and extract unhandled }} + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf({{classname}}.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + {{#vendorExtensions.x-has-self-and-ancestor-only-props}} + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result + ); + {{! only deserialize unhandled props }} + oneOfDataSrc = unhandled; + {{/vendorExtensions.x-has-self-and-ancestor-only-props}} + {{^vendorExtensions.x-has-self-and-ancestor-only-props}} + oneOfDataSrc = serialized; + {{! has no probs at all, pass the serialized as is }} + {{/vendorExtensions.x-has-self-and-ancestor-only-props}} + final oneOfTypes = [{{#mappedModels}}{{modelName}}, {{/mappedModels}}{{#vendorExtensions.x-is-parent}}${{classname}}{{/vendorExtensions.x-is-parent}}]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + {{#mappedModels}} + case r'{{mappingName}}': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType({{modelName}}), + ) as {{modelName}}; + oneOfType = {{modelName}}; + break; + {{/mappedModels}} + default: + {{#vendorExtensions.x-is-parent}} + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(${{classname}}), + ) as ${{classname}}; + oneOfType = ${{classname}}; + {{/vendorExtensions.x-is-parent}} + {{^vendorExtensions.x-is-parent}} + throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + {{/vendorExtensions.x-is-parent}} + } + result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + {{/discriminator}} + {{/hasDiscriminatorWithNonEmptyMapping}} + {{^hasDiscriminatorWithNonEmptyMapping}} + {{! use the OneOfSerializer when there is no discriminator }} + final targetType = const FullType(OneOf, [{{#composedSchemas}}{{#oneOf}}{{>serialization/built_value/variable_serializer_type}}, {{/oneOf}}{{/composedSchemas}}]); + {{#vendorExtensions.x-has-self-and-ancestor-only-props}} + {{! has props, assign them to result, and extract unhandled }} + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + {{! only deserialize unhandled props }} + oneOfDataSrc = unhandled; + {{/vendorExtensions.x-has-self-and-ancestor-only-props}} + {{^vendorExtensions.x-has-self-and-ancestor-only-props}} + {{! has no probs at all, pass the serialized as is }} + oneOfDataSrc = serialized; + {{/vendorExtensions.x-has-self-and-ancestor-only-props}} + result.oneOf = serializers.deserialize(oneOfDataSrc, specifiedType: targetType) as OneOf; + {{/hasDiscriminatorWithNonEmptyMapping}} + return result.build(); + {{/-first}} + {{/oneOf}} + {{! anyOf }} + {{#anyOf}} + {{#-first}} + final result = {{#vendorExtensions.x-is-parent}}${{/vendorExtensions.x-is-parent}}{{classname}}Builder(); + Object? anyOfDataSrc; + {{#hasDiscriminatorWithNonEmptyMapping}} + {{#discriminator}} + {{! has props, assign them to result, and extract unhandled }} + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf({{classname}}.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + {{#vendorExtensions.x-has-self-and-ancestor-only-props}} + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + {{! only deserialize unhandled props }} + anyOfDataSrc = unhandled; + {{/vendorExtensions.x-has-self-and-ancestor-only-props}} + {{^vendorExtensions.x-has-self-and-ancestor-only-props}} + anyOfDataSrc = serialized; + {{! has no probs at all, pass the serialized as is }} + {{/vendorExtensions.x-has-self-and-ancestor-only-props}} + final anyOfTypes = [{{#mappedModels}}{{modelName}}, {{/mappedModels}}{{#vendorExtensions.x-is-parent}}${{classname}}{{/vendorExtensions.x-is-parent}}]; + Object anyOfResult; + Type anyOfType; + switch (discValue) { + {{#mappedModels}} + case r'{{mappingName}}': + anyOfResult = serializers.deserialize(anyOfDataSrc, specifiedType: FullType({{modelName}})) as {{modelName}}; + anyOfType = {{modelName}}; + break; + {{/mappedModels}} + default: + {{#vendorExtensions.x-is-parent}} + anyOfResult = serializers.deserialize(anyOfDataSrc, specifiedType: FullType(${{classname}})) as ${{classname}}; + anyOfType = ${{classname}}; + {{/vendorExtensions.x-is-parent}} + {{^vendorExtensions.x-is-parent}} + throw UnsupportedError("Couldn't deserialize anyOf for the discriminator value: ${discValue}"); + {{/vendorExtensions.x-is-parent}} + } + result.anyOf = AnyOfDynamic(values: {anyOfTypes.indexOf(anyOfType): anyOfResult}, types: anyOfTypes); + {{/discriminator}} + {{/hasDiscriminatorWithNonEmptyMapping}} + {{^hasDiscriminatorWithNonEmptyMapping}} + {{! use the OneOfSerializer when there is no discriminator }} + final targetType = const FullType(AnyOf, [{{#composedSchemas}}{{#anyOf}}{{>serialization/built_value/variable_serializer_type}}, {{/anyOf}}{{/composedSchemas}}]); + {{#vendorExtensions.x-has-self-and-ancestor-only-props}} + {{! has props, assign them to result, and extract unhandled }} + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + {{! only deserialize unhandled props }} + anyOfDataSrc = unhandled; + {{/vendorExtensions.x-has-self-and-ancestor-only-props}} + {{^vendorExtensions.x-has-self-and-ancestor-only-props}} + {{! has no probs at all, pass the serialized as is }} + anyOfDataSrc = serialized; + {{/vendorExtensions.x-has-self-and-ancestor-only-props}} + result.anyOf = serializers.deserialize(anyOfDataSrc, specifiedType: targetType) as AnyOf; + {{/hasDiscriminatorWithNonEmptyMapping}} + return result.build(); + {{/-first}} + {{/anyOf}} + {{! no anyOf nor oneOf, handles allOf trees }} + {{^oneOf}} + {{^anyOf}} + {{#vendorExtensions.x-is-parent}} + {{! + parent classes don't have builder + so they must delegate to another serializer using + 1) discriminator + mapping + 2) concrete implementation ($classname) + }} + {{#hasDiscriminatorWithNonEmptyMapping}} + {{#discriminator}} + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf({{classname}}.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + switch (discValue) { + {{#mappedModels}} + case r'{{mappingName}}': + return serializers.deserialize(serialized, specifiedType: FullType({{modelName}})) as {{modelName}}; + {{/mappedModels}} + default: + return serializers.deserialize(serialized, specifiedType: FullType(${{classname}})) as ${{classname}}; + } + {{/discriminator}} + {{/hasDiscriminatorWithNonEmptyMapping}} + {{^hasDiscriminatorWithNonEmptyMapping}} + return serializers.deserialize(serialized, specifiedType: FullType(${{classname}})) as ${{classname}}; + {{/hasDiscriminatorWithNonEmptyMapping}} + {{/vendorExtensions.x-is-parent}} + {{^vendorExtensions.x-is-parent}} + final result = {{classname}}Builder(); + final serializedList = (serialized as Iterable).toList(); + {{#vendorExtensions.x-has-self-and-ancestor-only-props}} + {{! has props, assign them to result, and extract unhandled }} + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + {{/vendorExtensions.x-has-self-and-ancestor-only-props}} + return result.build(); + {{/vendorExtensions.x-is-parent}} + {{/anyOf}} + {{/oneOf}} + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/date.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/date.mustache new file mode 100644 index 000000000000..b21c7f544bee --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/date.mustache @@ -0,0 +1,70 @@ +/// A gregorian calendar date generated by +/// OpenAPI generator to differentiate +/// between [DateTime] and [Date] formats. +class Date implements Comparable { + final int year; + + /// January is 1. + final int month; + + /// First day is 1. + final int day; + + Date(this.year, this.month, this.day); + + /// The current date + static Date now({bool utc = false}) { + var now = DateTime.now(); + if (utc) { + now = now.toUtc(); + } + return now.toDate(); + } + + /// Convert to a [DateTime]. + DateTime toDateTime({bool utc = false}) { + if (utc) { + return DateTime.utc(year, month, day); + } else { + return DateTime(year, month, day); + } + } + + @override + int compareTo(Date other) { + int d = year.compareTo(other.year); + if (d != 0) { + return d; + } + d = month.compareTo(other.month); + if (d != 0) { + return d; + } + return day.compareTo(other.day); + } + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Date && + runtimeType == other.runtimeType && + year == other.year && + month == other.month && + day == other.day; + + @override + int get hashCode => year.hashCode ^ month.hashCode ^ day.hashCode; + + @override + String toString() { + final yyyy = year.toString(); + final mm = month.toString().padLeft(2, '0'); + final dd = day.toString().padLeft(2, '0'); + + return '$yyyy-$mm-$dd'; + } +} + +extension DateTimeToDate on DateTime { + Date toDate() => Date(year, month, day); +} diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/date_serializer.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/date_serializer.mustache new file mode 100644 index 000000000000..3391e775c7f7 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/date_serializer.mustache @@ -0,0 +1,28 @@ +{{>header}} +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; +import '{{modelPackage}}/date.dart'; + +class DateSerializer implements PrimitiveSerializer { + + const DateSerializer(); + + @override + Iterable get types => BuiltList.of([Date]); + + @override + String get wireName => 'Date'; + + @override + Date deserialize(Serializers serializers, Object serialized, + {FullType specifiedType = FullType.unspecified}) { + final parsed = DateTime.parse(serialized as String); + return Date(parsed.year, parsed.month, parsed.day); + } + + @override + Object serialize(Serializers serializers, Date date, + {FullType specifiedType = FullType.unspecified}) { + return date.toString(); + } +} diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/deserialize_properties.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/deserialize_properties.mustache new file mode 100644 index 000000000000..d8dbfdfd4d8d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/deserialize_properties.mustache @@ -0,0 +1,57 @@ + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required {{classname}}Builder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + {{#vendorExtensions.x-self-and-ancestor-only-props}} + case r'{{baseName}}': + final valueDes = serializers.deserialize( + value, + specifiedType: const {{>serialization/built_value/variable_serializer_type}}, + ) as {{>types/recursion_type}}; + {{#isNullable}} + if (valueDes == null) continue; + {{/isNullable}} + {{#isContainer}} + result.{{{name}}}.replace(valueDes); + {{/isContainer}} + {{^isContainer}} + {{#isEnum}} + result.{{{name}}} = valueDes; + {{/isEnum}} + {{^isEnum}} + {{#isModel}} + {{#isPrimitiveType}} + {{! These are models that have been manually marked as primitive via generator param. }} + result.{{{name}}} = valueDes; + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{#vendorExtensions.x-is-parent}} + result.{{{name}}} = valueDes; + {{/vendorExtensions.x-is-parent}} + {{^vendorExtensions.x-is-parent}} + result.{{{name}}}.replace(valueDes); + {{/vendorExtensions.x-is-parent}} + {{/isPrimitiveType}} + {{/isModel}} + {{^isModel}} + result.{{{name}}} = valueDes; + {{/isModel}} + {{/isEnum}} + {{/isContainer}} + break; + {{/vendorExtensions.x-self-and-ancestor-only-props}} + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/enum.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/enum.mustache new file mode 100644 index 000000000000..83033f367aab --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/enum.mustache @@ -0,0 +1,36 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part '{{classFilename}}.g.dart'; + +{{#isDeprecated}} +@Deprecated('{{{classname}}} has been deprecated') +{{/isDeprecated}} +class {{classname}} extends EnumClass { + + {{#allowableValues}} + {{#enumVars}} + {{#description}} + /// {{{.}}} + {{/description}} + @BuiltValueEnumConst({{#isInteger}}wireNumber: {{{value}}}{{/isInteger}}{{#isLong}}wireNumber: {{{value}}}{{/isLong}}{{^isInteger}}{{^isLong}}wireName: {{{value}}}{{/isLong}}{{/isInteger}}{{#enumUnknownDefaultCase}}{{#-last}}, fallback: true{{/-last}}{{/enumUnknownDefaultCase}}) + 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. +typedef {{classname}}Mixin = _${{classname}}Mixin; diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/enum_inline.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/enum_inline.mustache new file mode 100644 index 000000000000..d1fd32192c83 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/enum_inline.mustache @@ -0,0 +1,22 @@ +{{#isDeprecated}} +@Deprecated('{{{enumName}}} has been deprecated') +{{/isDeprecated}} +class {{{enumName}}} extends EnumClass { + + {{#allowableValues}} + {{#enumVars}} + {{#description}} + /// {{{.}}} + {{/description}} + @BuiltValueEnumConst({{#isInteger}}wireNumber: {{{value}}}{{/isInteger}}{{#isLong}}wireNumber: {{{value}}}{{/isLong}}{{^isInteger}}{{^isLong}}wireName: {{{value}}}{{/isLong}}{{/isInteger}}{{#enumUnknownDefaultCase}}{{#-last}}, fallback: true{{/-last}}{{/enumUnknownDefaultCase}}) + 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-next/serialization/built_value/offset_date_serializer.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/offset_date_serializer.mustache new file mode 100644 index 000000000000..2698caf0f493 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/offset_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.of([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-next/serialization/built_value/recursion_enum_inline.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/recursion_enum_inline.mustache new file mode 100644 index 000000000000..b6c8bb4bcc98 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/recursion_enum_inline.mustache @@ -0,0 +1,12 @@ +{{^isModel}} +{{#enumName}} +{{^isContainer}} +{{>serialization/built_value/enum_inline}} +{{/isContainer}} +{{#isContainer}} + {{#items}} +{{>serialization/built_value/recursion_enum_inline}} + {{/items}} +{{/isContainer}} +{{/enumName}} +{{/isModel}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/repository_construction.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/repository_construction.mustache new file mode 100644 index 000000000000..08ea99a41dc5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/repository_construction.mustache @@ -0,0 +1 @@ +BuiltValueJsonRepository(standardSerializers) \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/repository_impl.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/repository_impl.mustache new file mode 100644 index 000000000000..2c7beee1e417 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/repository_impl.mustache @@ -0,0 +1,48 @@ +{{>header}} +import 'dart:async'; +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; +import 'repository_base.dart'; +import 'serializers.dart'; + +/// Converts our `TypeInfo` to `built_value`'s `FullType` +FullType typeInfoToFullType(TypeInfo info) { + if (info.nullable) { + return FullType.nullable( + info.root, info.parameters.map(typeInfoToFullType).toList(),); + } else { + return FullType( + info.root, info.parameters.map(typeInfoToFullType).toList(),); + } +} + +class BuiltValueJsonRepository extends SerializationRepositoryBase { + final Serializers serializers; + const BuiltValueJsonRepository(this.serializers); + + @override + FutureOr deserialize(Object? value, TypeInfo targetTypeInfo, {Object? context}) { + if (value is T) { + return value; + } + return serializers.deserialize( + value, + specifiedType: typeInfoToFullType(targetTypeInfo), + ) as T; + } + + @override + FutureOr serialize(T src, TypeInfo inputTypeInfo, {Object? context}) { + if (src == null) { + return null; + } + return serializers.serialize( + src, + specifiedType: typeInfoToFullType(inputTypeInfo), + ) as Object; + } +} diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/serializers.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/serializers.mustache new file mode 100644 index 000000000000..4cb672f0bc5f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/serializers.mustache @@ -0,0 +1,37 @@ +{{>header}} +// ignore_for_file: unused_import + +import 'package:one_of_serializer/any_of_serializer.dart'; +import 'package:one_of_serializer/one_of_serializer.dart'; +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:{{pubName}}/apis.dart'; +{{#useDateLibCore}}import 'package:built_value/iso_8601_date_time_serializer.dart';{{/useDateLibCore}} +{{#useDateLibTimeMachine}}import 'package:time_machine/time_machine.dart'; +import 'package:{{pubName}}/{{sourceFolder}}/offset_date_serializer.dart';{{/useDateLibTimeMachine}} +import 'package:{{pubName}}/models.dart';{{#builtValueSerializerImports}}import '{{{.}}}'; +{{/builtValueSerializerImports}} + +part 'serializers.g.dart'; + +@SerializersFor([{{#models}}{{#model}} + {{classname}},{{#vendorExtensions.x-is-parent}}${{classname}},{{/vendorExtensions.x-is-parent}}{{/model}}{{/models}} +]) +Serializers serializers = (_$serializers.toBuilder(){{#builtValueSerializers}} + ..addBuilderFactory( + const {{>serialization/built_value/variable_serializer_type}}, + () => {{>serialization/built_value/variable_builder_type}}, + ){{/builtValueSerializers}} + {{#models}}{{#model}}{{#vendorExtensions.x-is-parent}}..add({{classname}}.serializer) + {{/vendorExtensions.x-is-parent}}{{/model}}{{/models}}..add(const OneOfSerializer()) + ..add(const AnyOfSerializer()){{#useDateLibTimeMachine}} + ..add(const OffsetDateSerializer()) + ..add(const OffsetDateTimeSerializer()){{/useDateLibTimeMachine}}{{#useDateLibCore}} + ..add(const DateSerializer()) + ..add(Iso8601DateTimeSerializer())){{/useDateLibCore}} + .build(); + +Serializers standardSerializers = + (serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build(); diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/test_instance.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/test_instance.mustache new file mode 100644 index 000000000000..993f5db1d64f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/test_instance.mustache @@ -0,0 +1,2 @@ + {{#vendorExtensions.x-is-parent}}//{{/vendorExtensions.x-is-parent}}final instance = {{{classname}}}Builder(); + // add properties to the builder and call build() \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/variable_builder_type.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/variable_builder_type.mustache new file mode 100644 index 000000000000..87e6197af25f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/variable_builder_type.mustache @@ -0,0 +1 @@ +{{#isContainer}}{{#isArray}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}{{/isArray}}{{#isMap}}Map{{/isMap}}Builder<{{#isMap}}String, {{/isMap}}{{#items}}{{>types/recursion_type}}{{/items}}>{{/isContainer}}{{^isContainer}}{{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{dataType}}}{{/datatypeWithEnum}}{{/isContainer}}{{#isNullable}}?{{/isNullable}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/variable_serializer_type.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/variable_serializer_type.mustache new file mode 100644 index 000000000000..3ebd82b55cac --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/built_value/variable_serializer_type.mustache @@ -0,0 +1 @@ +FullType{{#isNullable}}.nullable{{/isNullable}}({{#isContainer}}{{containerType}}, [{{#isMap}}FullType(String), {{/isMap}}{{#items}}{{>serialization/built_value/variable_serializer_type}}{{/items}}]{{/isContainer}}{{^isContainer}}{{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{dataType}}}{{/datatypeWithEnum}}{{/isContainer}}) \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/build.yaml.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/build.yaml.mustache new file mode 100644 index 000000000000..89a4dd6e1c2e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/build.yaml.mustache @@ -0,0 +1,18 @@ +targets: + $default: + builders: + json_serializable: + options: + # Options configure how source code is generated for every + # `@JsonSerializable`-annotated class in the package. + # + # The default value for each is listed. + any_map: false + checked: true + create_factory: true + create_to_json: true + disallow_unrecognized_keys: true + explicit_to_json: true + field_rename: none + ignore_unannotated: false + include_if_null: false diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/class.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/class.mustache new file mode 100644 index 000000000000..4bc0161261e5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/class.mustache @@ -0,0 +1,99 @@ +import 'package:json_annotation/json_annotation.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}} + +{{#isDeprecated}} +@Deprecated('{{{classname}}} has been deprecated') +{{/isDeprecated}} +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class {{{classname}}} { +{{>serialization/json_serializable/dart_constructor}} + +{{#vars}} + {{#description}} + /// {{{description}}} + {{/description}} + {{^isEnum}} + {{#minimum}} + // minimum: {{{minimum}}} + {{/minimum}} + {{#maximum}} + // maximum: {{{maximum}}} + {{/maximum}} + {{/isEnum}} + {{#deprecated}} + @Deprecated('{{{name}}} has been deprecated') + {{/deprecated}} + {{^isBinary}} + @JsonKey( + {{#defaultValue}}defaultValue: {{{defaultValue}}},{{/defaultValue}} + name: r'{{{baseName}}}', + required: {{#required}}true{{/required}}{{^required}}false{{/required}}, + includeIfNull: {{#required}}{{#isNullable}}true{{/isNullable}}false{{/required}}{{^required}}false{{/required}} + ) + {{/isBinary}} + {{#isBinary}} + @JsonKey(ignore: true) + {{/isBinary}} + + + {{#required}} + {{#finalProperties}}final {{/finalProperties}}{{{datatypeWithEnum}}}{{#isNullable}}?{{/isNullable}} {{{name}}}; + {{/required}} + {{^required}} + {{#finalProperties}}final {{/finalProperties}}{{{datatypeWithEnum}}}? {{{name}}}; + {{/required}} + + + +{{/vars}} + @override + bool operator ==(Object other) => identical(this, other) || other is {{{classname}}} && + {{#vars}} + other.{{{name}}} == {{{name}}}{{^-last}} &&{{/-last}}{{#-last}};{{/-last}} + {{/vars}} + + @override + int get hashCode => + {{#vars}} + {{#isNullable}}({{{name}}} == null ? 0 : {{{name}}}.hashCode){{/isNullable}}{{^isNullable}}{{{name}}}.hashCode{{/isNullable}}{{^-last}} +{{/-last}}{{#-last}};{{/-last}} + {{/vars}} + + factory {{{classname}}}.fromJson(Map json) => _${{{classname}}}FromJson(json); + + Map toJson() => _${{{classname}}}ToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} +{{#vars}} + {{#isEnum}} + {{^isContainer}} + +{{>serialization/json_serializable/enum_inline}} + {{/isContainer}} + {{#isContainer}} + {{#mostInnerItems}} + +{{>serialization/json_serializable/enum_inline}} + {{/mostInnerItems}} + {{/isContainer}} + {{/isEnum}} +{{/vars}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/dart_constructor.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/dart_constructor.mustache new file mode 100644 index 000000000000..3b99f0c54016 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/dart_constructor.mustache @@ -0,0 +1,11 @@ + /// Returns a new [{{{classname}}}] instance. + {{{classname}}}({ + {{#vars}} + + {{! + A field is required in Dart when it is + required && !defaultValue in OAS + }} + {{#required}}{{^defaultValue}}required {{/defaultValue}}{{/required}} this.{{{name}}}{{#defaultValue}} = {{#isEnum}}{{^isContainer}}const {{{enumName}}}._({{/isContainer}}{{/isEnum}}{{{defaultValue}}}{{#isEnum}}{{^isContainer}}){{/isContainer}}{{/isEnum}}{{/defaultValue}}, + {{/vars}} + }); \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/enum.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/enum.mustache new file mode 100644 index 000000000000..dbb1ed2cd22a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/enum.mustache @@ -0,0 +1,17 @@ +import 'package:json_annotation/json_annotation.dart'; + +{{#description}}/// {{{description}}}{{/description}} +{{#isDeprecated}} +@Deprecated('{{{classname}}} has been deprecated') +{{/isDeprecated}} +enum {{{classname}}} { +{{#allowableValues}} +{{#enumVars}} + {{#description}} + /// {{{.}}} + {{/description}} + @JsonValue({{#isString}}r{{/isString}}{{{value}}}) + {{{name}}}, +{{/enumVars}} +{{/allowableValues}} +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/enum_inline.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/enum_inline.mustache new file mode 100644 index 000000000000..53cd77098740 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/enum_inline.mustache @@ -0,0 +1,14 @@ +{{#enumName}} +{{#description}}/// {{{description}}}{{/description}} +{{#isDeprecated}} +@Deprecated('{{{enumName}}} has been deprecated') +{{/isDeprecated}} +enum {{{ enumName }}} { +{{#allowableValues}} +{{#enumVars}} + @JsonValue({{#isString}}r{{/isString}}{{{value}}}) + {{{name}}}, +{{/enumVars}} +{{/allowableValues}} +} +{{/enumName}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/repository_construction.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/repository_construction.mustache new file mode 100644 index 000000000000..f4c0803bc604 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/repository_construction.mustache @@ -0,0 +1 @@ +JsonSerializableRepository() \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/repository_impl.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/repository_impl.mustache new file mode 100644 index 000000000000..85b20e8b3ae3 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/repository_impl.mustache @@ -0,0 +1,122 @@ +import 'dart:convert'; +import 'dart:async'; +import 'dart:typed_data'; +import 'repository_base.dart'; +import 'package:{{pubName}}/models.dart'; + +class JsonSerializableRepository extends SerializationRepositoryBase { + JsonSerializableRepository(); + + /// Transforms an object of arbitrary type [T] (whose information is passed in inputTypeInfo) to a dart primitive + @override + FutureOr serialize(T src, TypeInfo inputTypeInfo, {Object? context}) { + if (src == null) { + return null; + } + if (src is String) { + return src; + } + if (src is bool) { + return src; + } + if (src is DateTime) { + return src.toIso8601String(); + } + if (src is num) { + return src; + } + if (src is Uint8List) { + return src; + } + if (src is Iterable) { + return src.map((value) => serialize(value, inputTypeInfo.parameters[0], context: context)).toList(); + } + if (src is Map) { + return src.map((key,value) => MapEntry( + //Json Map keys must always be strings + serialize(key, inputTypeInfo.parameters[0], context: context).toString(), + serialize(value, inputTypeInfo.parameters[1], context: context) + )); + } + + if (context is Object? Function(Object?)) { + return context(src); + } + + try { + return (src as dynamic).toJson(); + } on NoSuchMethodError { + assert(false, + ''' + Failed to serialize the object properly, falling back to `toString()` + '''); + return src.toString(); + } + } + + /// Transforms a dart primitive to an object of arbitrary type [T] (whose information is passed in inputTypeInfo) + @override + T deserialize(Object? value, TypeInfo targetTypeInfo, {Object? context}) { + //Don't rely on T being accurate here, since it won't get passed for generic arguments. + if (value == null) { + return null as T; + } + final targetRootType = targetTypeInfo.root; + if (targetRootType == T) { + //short circuit if we already have the output as the input + return value as T; + } + switch (targetRootType) { + case String: + return value.toString() as T; + case double: + return (value is num ? value.toDouble() : double.tryParse(value.toString())) as T; + case int: + return (value is num ? value.toInt() : int.tryParse(value.toString())) as T; + case num: + return (value is num ? value : num.tryParse(value.toString())) as T; + case bool: + return (value is bool ? value : bool.tryParse(value.toString())) as T; + case DateTime: + return (value is DateTime ? value : DateTime.tryParse(value.toString())) as T; + case Iterable: + case List: + case Set: + if (value is! Iterable) { + throw Exception('Cannot deserialize'); + } + final mappedItems = value.map((v) => deserialize(v, targetTypeInfo.parameters[0], context: context)); + if (targetRootType == List) { + return List.from(mappedItems); + } else if (targetRootType == Set) { + return Set.from(mappedItems); + } else if (targetRootType == Iterable) { + return mappedItems; + } else { + throw Exception('Cannot deserialize'); + } + case Map: + if (value is! Map) { + throw Exception('Cannot deserialize'); + } + return value.map((k,v) => MapEntry(deserialize(k, targetTypeInfo.parameters[0], context: context),deserialize(v, targetTypeInfo.parameters[1], context: context))); + {{#models}} + {{#model}} + case {{{classname}}}: + {{#isEnum}} + //TODO: find a way to support enums + return value as T; + {{/isEnum}} + {{^isEnum}} + return {{{classname}}}.fromJson(value as Map) as T; + {{/isEnum}} + {{/model}} + {{/models}} + default: + if (value is T) { + return value; + } + throw Exception('Cannot deserialize'); + } + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/test_instance.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/test_instance.mustache new file mode 100644 index 000000000000..489ed278e439 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/json_serializable/test_instance.mustache @@ -0,0 +1,2 @@ + final {{{classname}}}? instance = /* {{{classname}}}(...) */ null; + // add properties to the entity \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/recursion_enum_inline.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/recursion_enum_inline.mustache new file mode 100644 index 000000000000..30786f599443 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/recursion_enum_inline.mustache @@ -0,0 +1,12 @@ +{{^isModel}} +{{#enumName}} +{{^isContainer}} +{{#includeSerializationTemplate}}enum_inline{{/includeSerializationTemplate}} +{{/isContainer}} +{{#isContainer}} + {{#items}} +{{>serialization/recursion_enum_inline}} + {{/items}} +{{/isContainer}} +{{/enumName}} +{{/isModel}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/serialization/repository_base.mustache b/modules/openapi-generator/src/main/resources/dart-next/serialization/repository_base.mustache new file mode 100644 index 000000000000..fa1f81f13c5b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/serialization/repository_base.mustache @@ -0,0 +1,60 @@ +import 'dart:async'; + +/// The general rule for implementing this class is +/// json == serialize(deserialize(json)) +/// object == deserialize(serialize(object)) +/// Where json in this context means a dart primitive +/// JSON = String | num | bool | null | Uint8List | List | Map +abstract class SerializationRepositoryBase { + const SerializationRepositoryBase(); + + FutureOr serialize(T src, TypeInfo inputTypeInfo, {Object? context,}); + FutureOr deserialize(Object? value, TypeInfo targetTypeInfo, {Object? context,}); +} + +/// A modified version of `built_value`'s `FullType` class, found here +/// https://github.com/google/built_value.dart/blob/ee22d400a69c673330481a6da1f0796b90bb369b/built_value/lib/serializer.dart +/// It holds type information known by the spec (including generic type parameters) +class TypeInfo { + final Type root; + final bool nullable; + final List parameters; + + /// The [Object] type. + static const TypeInfo object = TypeInfo(Object); + + const TypeInfo(this.root, [this.parameters = const []]) : nullable = false; + const TypeInfo.nullable(this.root, [this.parameters = const []]) : nullable = true; + + @override + bool operator ==(dynamic other) { + if (identical(other, this)) return true; + if (other is! TypeInfo) return false; + if (root != other.root) return false; + if (nullable != other.nullable) return false; + if (parameters.length != other.parameters.length) return false; + for (var i = 0; i != parameters.length; ++i) { + if (parameters[i] != other.parameters[i]) return false; + } + return true; + } + + @override + int get hashCode { + return Object.hash(root, Object.hashAll(parameters), nullable); + } + + @override + String toString() => (parameters.isEmpty + ? _getRawName(root) + : '${_getRawName(root)}<${parameters.join(", ")}>') + + _nullabilitySuffix; + + String get _nullabilitySuffix => nullable ? '?' : ''; + + static String _getRawName(Type? type) { + var name = type.toString(); + var genericsStart = name.indexOf('<'); + return genericsStart == -1 ? name : name.substring(0, genericsStart); + } +} diff --git a/modules/openapi-generator/src/main/resources/dart-next/types/recursion_type.mustache b/modules/openapi-generator/src/main/resources/dart-next/types/recursion_type.mustache new file mode 100644 index 000000000000..8b15970ec9aa --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/types/recursion_type.mustache @@ -0,0 +1 @@ +{{#isContainer}}{{containerType}}<{{#isMap}}String, {{/isMap}}{{#items}}{{>types/recursion_type}}{{/items}}>{{/isContainer}}{{^isContainer}}{{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{dataType}}}{{/datatypeWithEnum}}{{/isContainer}}{{#isNullable}}?{{/isNullable}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-next/types/recursion_type_info.mustache b/modules/openapi-generator/src/main/resources/dart-next/types/recursion_type_info.mustache new file mode 100644 index 000000000000..4eb44953b8df --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/types/recursion_type_info.mustache @@ -0,0 +1,9 @@ +const TypeInfo{{#isNullable}}.nullable{{/isNullable}}( + {{#isContainer}}{{containerType}}, [ + {{#isMap}}TypeInfo(String), {{/isMap}} + {{#items}}{{>types/recursion_type_info}}{{/items}}, + ]{{/isContainer}}{{^isContainer}} + {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}} + {{^datatypeWithEnum}}{{{dataType}}}{{/datatypeWithEnum}} + {{/isContainer}}) + diff --git a/modules/openapi-generator/src/main/resources/dart-next/types/required.mustache b/modules/openapi-generator/src/main/resources/dart-next/types/required.mustache new file mode 100644 index 000000000000..bcf4538e8b3e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-next/types/required.mustache @@ -0,0 +1,15 @@ +{{! + a parameter is removed in dart json if its OAS properties are: + 1. not required + has null value + + a parameter is nullable in dart if its OAS properties are: + 1. nullable + 2. non-nullable + no default value + not required + + a parameter is required in dart if its OAS properties are: + 1. no default value + non-nullable + 2. no default value + nullable + required + + as a general rule, a required paramter can't have a default value, since it will throw a syntax error. +}} +{{^defaultValue}}{{#isNullable}}{{#required}}required{{/required}}{{/isNullable}}{{^isNullable}}required{{/isNullable}}{{/defaultValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/next/DartNextClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/next/DartNextClientCodegenTest.java new file mode 100644 index 000000000000..8611a8040de0 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/next/DartNextClientCodegenTest.java @@ -0,0 +1,126 @@ +/* + * 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.next; + +import org.openapitools.codegen.ClientOptInput; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.DefaultGenerator; +import org.openapitools.codegen.Generator; +import org.openapitools.codegen.TestUtils; +import org.openapitools.codegen.config.CodegenConfigurator; +import org.openapitools.codegen.languages.DartNextClientCodegen; +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +public class DartNextClientCodegenTest { + + @Test + public void testInitialConfigValues() throws Exception { + final DartNextClientCodegen codegen = new DartNextClientCodegen(); + codegen.processOpts(); + + Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.TRUE); + Assert.assertTrue(codegen.isHideGenerationTimestamp()); + } + + @Test + public void testInitialFeatures() { + final DartNextClientCodegen codegen = new DartNextClientCodegen(); + codegen.processOpts(); + + Assert.assertNotNull(codegen.getFeatureSet().getSecurityFeatures()); + Assert.assertFalse(codegen.getFeatureSet().getSecurityFeatures().isEmpty()); + } + + @Test + public void testSettersForConfigValues() throws Exception { + final DartNextClientCodegen codegen = new DartNextClientCodegen(); + codegen.setHideGenerationTimestamp(false); + codegen.processOpts(); + + Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE); + Assert.assertFalse(codegen.isHideGenerationTimestamp()); + } + + @Test + public void testAdditionalPropertiesPutForConfigValues() throws Exception { + final DartNextClientCodegen codegen = new DartNextClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, false); + codegen.processOpts(); + + Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP), Boolean.FALSE); + Assert.assertFalse(codegen.isHideGenerationTimestamp()); + } + + @Test + public void testKeywords() { + final DartNextClientCodegen codegen = new DartNextClientCodegen(); + + List reservedWordsList = new ArrayList<>(); + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("src/main/resources/dart/dart-keywords.txt"), StandardCharsets.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.assertTrue(reservedWordsList.size() > 20); + Assert.assertEquals(codegen.reservedWords().size(), reservedWordsList.size()); + for(String keyword : reservedWordsList) { + // reserved words are stored in lowercase + Assert.assertTrue(codegen.reservedWords().contains(keyword.toLowerCase(Locale.ROOT)), String.format(Locale.ROOT, "%s, part of %s, was not found in %s", keyword, reservedWordsList, codegen.reservedWords().toString())); + } + } + + @Test + public void verifyDartNextGeneratorRuns() throws IOException { + File output = Files.createTempDirectory("test").toFile(); + output.deleteOnExit(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("dart-next") + .setGitUserId("my-user") + .setGitRepoId("my-repo") + .setPackageName("my-package") + .setInputSpec("src/test/resources/3_0/petstore.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + + ClientOptInput opts = configurator.toClientOptInput(); + + Generator generator = new DefaultGenerator().opts(opts); + List files = generator.generate(); + files.forEach(File::deleteOnExit); + + TestUtils.ensureContainsFile(files, output, "README.md"); + TestUtils.ensureContainsFile(files, output, "lib/apis.dart"); + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/next/DartNextClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/next/DartNextClientOptionsTest.java new file mode 100644 index 000000000000..bc49b234cebf --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/next/DartNextClientOptionsTest.java @@ -0,0 +1,59 @@ +/* + * 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.next; + +import org.openapitools.codegen.AbstractOptionsTest; +import org.openapitools.codegen.CodegenConfig; +import org.openapitools.codegen.languages.DartNextClientCodegen; +import org.openapitools.codegen.options.DartNextClientOptionsProvider; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +public class DartNextClientOptionsTest extends AbstractOptionsTest { + private DartNextClientCodegen clientCodegen = mock(DartNextClientCodegen.class, mockSettings); + + public DartNextClientOptionsTest() { + super(new DartNextClientOptionsProvider()); + } + + @Override + protected CodegenConfig getCodegenConfig() { + return clientCodegen; + } + + @SuppressWarnings("unused") + @Override + protected void verifyOptions() { + verify(clientCodegen).setSortParamsByRequiredFlag(Boolean.valueOf(DartNextClientOptionsProvider.SORT_PARAMS_VALUE)); + verify(clientCodegen).setPubLibrary(DartNextClientOptionsProvider.PUB_LIBRARY_VALUE); + verify(clientCodegen).setPubName(DartNextClientOptionsProvider.PUB_NAME_VALUE); + verify(clientCodegen).setPubVersion(DartNextClientOptionsProvider.PUB_VERSION_VALUE); + verify(clientCodegen).setPubDescription(DartNextClientOptionsProvider.PUB_DESCRIPTION_VALUE); + verify(clientCodegen).setPubAuthor(DartNextClientOptionsProvider.PUB_AUTHOR_VALUE); + verify(clientCodegen).setPubAuthorEmail(DartNextClientOptionsProvider.PUB_AUTHOR_EMAIL_VALUE); + verify(clientCodegen).setPubHomepage(DartNextClientOptionsProvider.PUB_HOMEPAGE_VALUE); + verify(clientCodegen).setPubRepository(DartNextClientOptionsProvider.PUB_REPOSITORY_VALUE); + verify(clientCodegen).setPubPublishTo(DartNextClientOptionsProvider.PUB_PUBLISH_TO_VALUE); + verify(clientCodegen).setSourceFolder(DartNextClientOptionsProvider.SOURCE_FOLDER_VALUE); + verify(clientCodegen).setUseEnumExtension(Boolean.parseBoolean(DartNextClientOptionsProvider.USE_ENUM_EXTENSION)); + verify(clientCodegen).setDateLibrary(DartNextClientCodegen.DATE_LIBRARY_DEFAULT); + verify(clientCodegen).setLibrary(DartNextClientCodegen.NETWORKING_LIBRARY_DEFAULT); + verify(clientCodegen).setSerializationLibrary(DartNextClientCodegen.SERIALIZATION_LIBRARY_DEFAULT); + verify(clientCodegen).setEnumUnknownDefaultCase(Boolean.parseBoolean(DartNextClientOptionsProvider.ENUM_UNKNOWN_DEFAULT_CASE_VALUE)); + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/next/DartNextModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/next/DartNextModelTest.java new file mode 100644 index 000000000000..57de59bbd3a7 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/next/DartNextModelTest.java @@ -0,0 +1,500 @@ +/* + * 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.next; + +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.media.*; +import org.openapitools.codegen.*; +import org.openapitools.codegen.languages.DartNextClientCodegen; +import org.testng.Assert; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +@SuppressWarnings("static-method") +public class DartNextModelTest { + + @Test(description = "convert a simple model") + public void simpleModelTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperty("id", new IntegerSchema()) + .addProperty("name", new StringSchema()) + .addProperty("createdAt", new DateTimeSchema()) + .addRequiredItem("id") + .addRequiredItem("name"); + final DefaultCodegen codegen = new DartNextClientCodegen(); + 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") + .addProperty("id", new IntegerSchema()) + .addProperty("name", new StringSchema()) + .addProperty("createdAt", new DateTimeSchema()) + .addProperty("birthDate", new DateSchema()) + .addRequiredItem("id") + .addRequiredItem("name"); + + final DartNextClientCodegen codegen = new DartNextClientCodegen(); + codegen.additionalProperties().put(DartNextClientCodegen.DATE_LIBRARY, DartNextClientCodegen.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") + .addProperty("id", new IntegerSchema()) + .addProperty("urls", new ArraySchema() + .items(new StringSchema())) + .addRequiredItem("id"); + + final DefaultCodegen codegen = new DartNextClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartNextClientCodegen.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"); + //TODO: change this back to array after containerTypeMapped lands + Assert.assertEquals(property2.containerType, "BuiltList"); + 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") + .addProperty("id", new IntegerSchema()) + .addProperty("urls", new ArraySchema().items(new StringSchema()).uniqueItems(true)) + .addRequiredItem("id"); + + final DefaultCodegen codegen = new DartNextClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartNextClientCodegen.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"); + //TODO: change this back to set after containerTypeMapped lands + Assert.assertEquals(property2.containerType, "BuiltSet"); + 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") + .addProperty("translations", new MapSchema() + .additionalProperties(new StringSchema())) + .addRequiredItem("id"); + + final DefaultCodegen codegen = new DartNextClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartNextClientCodegen.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"); + //TODO: change this back to map after containerTypeMapped lands + Assert.assertEquals(property1.containerType, "BuiltMap"); + 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") + .addProperty("children", new Schema().$ref("#/definitions/Children")); + + final DefaultCodegen codegen = new DartNextClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartNextClientCodegen.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") + .addProperty("children", new ArraySchema() + .items(new Schema().$ref("#/definitions/Children"))); + + final DefaultCodegen codegen = new DartNextClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartNextClientCodegen.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"); + //TODO: change this back to array after containerTypeMapped lands + Assert.assertEquals(property1.containerType, "BuiltList"); + 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") + .addProperty("children", new MapSchema() + .additionalProperties(new Schema().$ref("#/definitions/Children"))); + + final DefaultCodegen codegen = new DartNextClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartNextClientCodegen.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"); + //TODO: change this back to array after containerTypeMapped lands + Assert.assertEquals(property1.containerType, "BuiltMap"); + 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 DartNextClientCodegen(); + 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 DartNextClientCodegen(); + 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", "TestModelEnumClass"}, + {"JsonObject", "TestModelJsonObject"}, + }; + } + + @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 DartNextClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartNextClientCodegen.SERIALIZATION_LIBRARY_BUILT_VALUE); + codegen.processOpts(); + codegen.typeMapping().put("EnumClass", "TestModelEnumClass"); + codegen.typeMapping().put("JsonObject", "TestModelJsonObject"); + 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", "TestModelEnumClass"}, + {"JsonObject", "TestModelJsonObject"}, + {"OffsetDate", "TestModelOffsetDate"}, + }; + } + + @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 DartNextClientCodegen codegen = new DartNextClientCodegen(); + codegen.additionalProperties().put(DartNextClientCodegen.DATE_LIBRARY, DartNextClientCodegen.DATE_LIBRARY_TIME_MACHINE); + codegen.processOpts(); + codegen.typeMapping().put("EnumClass", "TestModelEnumClass"); + codegen.typeMapping().put("JsonObject", "TestModelJsonObject"); + codegen.typeMapping().put("OffsetDate", "TestModelOffsetDate"); + 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") + .addProperty("arrayNoDefault", new ArraySchema()) + .addProperty("arrayEmptyDefault", array) + .addProperty("mapNoDefault", new MapSchema()); + final DefaultCodegen codegen = new DartNextClientCodegen(); + codegen.additionalProperties().put(CodegenConstants.SERIALIZATION_LIBRARY, DartNextClientCodegen.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") + .addProperty("date", date) + .addProperty("dateTime", dateTime) + .addProperty("mapNoDefault", new MapSchema()); + final DefaultCodegen codegen = new DartNextClientCodegen(); + 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/DartNextClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartNextClientOptionsProvider.java new file mode 100644 index 000000000000..59f08614fc9a --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartNextClientOptionsProvider.java @@ -0,0 +1,82 @@ +/* + * 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.DartNextClientCodegen; + +import java.util.Map; + +public class DartNextClientOptionsProvider 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-next"; + 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"; + public static final String PUB_REPOSITORY_VALUE = "Repository"; + public static final String PUB_PUBLISH_TO_VALUE = "Publish to"; + public static final String ENUM_UNKNOWN_DEFAULT_CASE_VALUE = "false"; + + @Override + public String getLanguage() { + return "dart-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(DartNextClientCodegen.PUB_LIBRARY, PUB_LIBRARY_VALUE) + .put(DartNextClientCodegen.PUB_NAME, PUB_NAME_VALUE) + .put(DartNextClientCodegen.PUB_VERSION, PUB_VERSION_VALUE) + .put(DartNextClientCodegen.PUB_DESCRIPTION, PUB_DESCRIPTION_VALUE) + .put(DartNextClientCodegen.PUB_AUTHOR, PUB_AUTHOR_VALUE) + .put(DartNextClientCodegen.PUB_AUTHOR_EMAIL, PUB_AUTHOR_EMAIL_VALUE) + .put(DartNextClientCodegen.PUB_HOMEPAGE, PUB_HOMEPAGE_VALUE) + .put(DartNextClientCodegen.PUB_REPOSITORY, PUB_REPOSITORY_VALUE) + .put(DartNextClientCodegen.PUB_PUBLISH_TO, PUB_PUBLISH_TO_VALUE) + .put(CodegenConstants.LIBRARY, DartNextClientCodegen.NETWORKING_LIBRARY_DEFAULT) + .put(CodegenConstants.SERIALIZATION_LIBRARY, DartNextClientCodegen.SERIALIZATION_LIBRARY_DEFAULT) + .put(DartNextClientCodegen.DATE_LIBRARY, DartNextClientCodegen.DATE_LIBRARY_DEFAULT) + .put(DartNextClientCodegen.FINAL_PROPERTIES, DartNextClientCodegen.FINAL_PROPERTIES_DEFAULT_VALUE) + .put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE) + .put(DartNextClientCodegen.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") + .put(CodegenConstants.ENUM_UNKNOWN_DEFAULT_CASE, ENUM_UNKNOWN_DEFAULT_CASE_VALUE) + .build(); + } + + @Override + public boolean isServer() { + return false; + } +} diff --git a/modules/openapi-generator/src/test/resources/3_0/dart/v3.0.0.yaml b/modules/openapi-generator/src/test/resources/3_0/dart/v3.0.0.yaml new file mode 100644 index 000000000000..2116b49c5dc0 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/dart/v3.0.0.yaml @@ -0,0 +1,2503 @@ +openapi: 3.0.0 +info: + description: >- + This spec is mainly for testing Petstore server and contains fake endpoints, + models. Please do not use this for any other purpose. Special characters: " + \ + version: 1.0.0 + title: OpenAPI Petstore + license: + name: Apache-2.0 + url: "https://www.apache.org/licenses/LICENSE-2.0.html" +tags: + - name: pet + description: Everything about your Pets + - name: store + description: Access to Petstore orders + - name: user + description: Operations about user + - name: Foo + - name: Bar +paths: + /foo: + get: + tags: + - Foo + summary: GET all Foos + operationId: getAllFoos + responses: + "200": + $ref: "#/components/responses/200FooArray" + post: + tags: + - Foo + summary: Create a Foo + operationId: createFoo + requestBody: + $ref: "#/components/requestBodies/Foo" + responses: + "201": + $ref: "#/components/responses/201Foo" + /bar: + post: + tags: + - Bar + summary: Create a Bar + operationId: createBar + requestBody: + required: true + content: + "application/json": + schema: + $ref: "#/components/schemas/Bar_Create" + responses: + 200: + description: Bar created + content: + "application/json": + schema: + $ref: "#/components/schemas/Bar" + + /foo-basic: + get: + responses: + default: + description: response + content: + application/json: + schema: + type: object + properties: + string: + $ref: "#/components/schemas/Foo" + /pet: + servers: + - url: "http://petstore.swagger.io/v2" + - url: "http://path-server-test.petstore.local/v2" + - url: "http://{server}.swagger.io:{port}/v2" + description: test server with variables + variables: + server: + description: target server + enum: + - "petstore" + - "qa-petstore" + - "dev-petstore" + default: "petstore" + port: + enum: + - "80" + - "8080" + default: "80" + post: + tags: + - pet + summary: Add a new pet to the store + description: "" + operationId: addPet + responses: + "200": + description: Successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - "write:pets" + - "read:pets" + requestBody: + $ref: "#/components/requestBodies/Pet" + put: + tags: + - pet + summary: Update an existing pet + description: "" + operationId: updatePet + x-webclient-blocking: true + responses: + "200": + description: Successful operation + "400": + description: Invalid ID supplied + "404": + description: Pet not found + "405": + description: Validation exception + security: + - petstore_auth: + - "write:pets" + - "read:pets" + requestBody: + $ref: "#/components/requestBodies/Pet" + /pet/findByStatus: + get: + tags: + - pet + summary: Finds Pets by status + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + x-webclient-blocking: true + parameters: + - name: status + in: query + description: Status values that need to be considered for filter + required: true + style: form + explode: false + deprecated: true + schema: + type: array + items: + type: string + enum: + - available + - pending + - sold + default: available + responses: + "200": + description: successful operation + content: + application/xml: + schema: + type: array + items: + $ref: "#/components/schemas/Pet" + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Pet" + "400": + description: Invalid status value + security: + - petstore_auth: + - "write:pets" + - "read:pets" + /pet/findByTags: + get: + tags: + - pet + summary: Finds Pets by tags + description: >- + Multiple tags can be provided with comma separated strings. Use tag1, + tag2, tag3 for testing. + operationId: findPetsByTags + x-webclient-blocking: true + parameters: + - name: tags + in: query + description: Tags to filter by + required: true + style: form + explode: false + schema: + type: array + items: + type: string + uniqueItems: true + responses: + "200": + description: successful operation + content: + application/xml: + schema: + type: array + items: + $ref: "#/components/schemas/Pet" + uniqueItems: true + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Pet" + uniqueItems: true + "400": + description: Invalid tag value + security: + - petstore_auth: + - "write:pets" + - "read:pets" + deprecated: true + "/pet/{petId}": + get: + tags: + - pet + summary: Find pet by ID + description: Returns a single pet + operationId: getPetById + x-webclient-blocking: true + parameters: + - name: petId + in: path + description: ID of pet to return + required: true + schema: + type: integer + format: int64 + responses: + "200": + description: successful operation + content: + application/xml: + schema: + $ref: "#/components/schemas/Pet" + application/json: + schema: + $ref: "#/components/schemas/Pet" + "400": + description: Invalid ID supplied + "404": + description: Pet not found + security: + - api_key: [] + post: + tags: + - pet + summary: Updates a pet in the store with form data + description: "" + operationId: updatePetWithForm + parameters: + - name: petId + in: path + description: ID of pet that needs to be updated + required: true + schema: + type: integer + format: int64 + responses: + "200": + description: Successful operation + "405": + description: Invalid input + security: + - petstore_auth: + - "write:pets" + - "read:pets" + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + delete: + tags: + - pet + summary: Deletes a pet + description: "" + operationId: deletePet + parameters: + - name: api_key + in: header + required: false + schema: + type: string + - name: petId + in: path + description: Pet id to delete + required: true + schema: + type: integer + format: int64 + responses: + "200": + description: Successful operation + "400": + description: Invalid pet value + security: + - petstore_auth: + - "write:pets" + - "read:pets" + "/pet/{petId}/uploadImage": + post: + tags: + - pet + summary: uploads an image + description: "" + operationId: uploadFile + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + schema: + type: integer + format: int64 + responses: + "200": + description: successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + security: + - petstore_auth: + - "write:pets" + - "read:pets" + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + type: string + format: binary + /store/inventory: + get: + tags: + - store + summary: Returns pet inventories by status + description: Returns a map of status codes to quantities + operationId: getInventory + x-webclient-blocking: false + responses: + "200": + description: successful operation + content: + application/json: + schema: + type: object + additionalProperties: + type: integer + format: int32 + security: + - api_key: [] + /store/order: + post: + tags: + - store + summary: Place an order for a pet + description: "" + operationId: placeOrder + responses: + "200": + description: successful operation + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + "400": + description: Invalid Order + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/Order" + description: order placed for purchasing the pet + required: true + "/store/order/{order_id}": + get: + tags: + - store + summary: Find purchase order by ID + description: >- + For valid response try integer IDs with value <= 5 or > 10. Other values + will generate exceptions + operationId: getOrderById + parameters: + - name: order_id + in: path + description: ID of pet that needs to be fetched + required: true + schema: + type: integer + format: int64 + minimum: 1 + maximum: 5 + responses: + "200": + description: successful operation + content: + application/xml: + schema: + $ref: "#/components/schemas/Order" + application/json: + schema: + $ref: "#/components/schemas/Order" + "400": + description: Invalid ID supplied + "404": + description: Order not found + delete: + tags: + - store + summary: Delete purchase order by ID + description: >- + For valid response try integer IDs with value < 1000. Anything above + 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - name: order_id + in: path + description: ID of the order that needs to be deleted + required: true + schema: + type: string + responses: + "400": + description: Invalid ID supplied + "404": + description: Order not found + /user: + post: + tags: + - user + summary: Create user + description: This can only be done by the logged in user. + operationId: createUser + responses: + default: + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Created user object + required: true + /user/createWithArray: + post: + tags: + - user + summary: Creates list of users with given input array + description: "" + operationId: createUsersWithArrayInput + responses: + default: + description: successful operation + requestBody: + $ref: "#/components/requestBodies/UserArray" + /user/createWithList: + post: + tags: + - user + summary: Creates list of users with given input array + description: "" + operationId: createUsersWithListInput + responses: + default: + description: successful operation + requestBody: + $ref: "#/components/requestBodies/UserArray" + /user/login: + get: + tags: + - user + summary: Logs user into the system + description: "" + operationId: loginUser + parameters: + - name: username + in: query + description: The user name for login + required: true + schema: + type: string + - name: password + in: query + description: The password for login in clear text + required: true + schema: + type: string + responses: + "200": + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + type: integer + format: int32 + X-Expires-After: + description: date in UTC when token expires + schema: + type: string + format: date-time + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + "400": + description: Invalid username/password supplied + /user/logout: + get: + tags: + - user + summary: Logs out current logged in user session + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + "/user/{username}": + get: + tags: + - user + summary: Get user by user name + description: "" + operationId: getUserByName + parameters: + - name: username + in: path + description: The name that needs to be fetched. Use user1 for testing. + required: true + schema: + type: string + responses: + "200": + description: successful operation + content: + application/xml: + schema: + $ref: "#/components/schemas/User" + application/json: + schema: + $ref: "#/components/schemas/User" + "400": + description: Invalid username supplied + "404": + description: User not found + put: + tags: + - user + summary: Updated user + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - name: username + in: path + description: name that need to be deleted + required: true + schema: + type: string + responses: + "400": + description: Invalid user supplied + "404": + description: User not found + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + description: Updated user object + required: true + delete: + tags: + - user + summary: Delete user + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - name: username + in: path + description: The name that needs to be deleted + required: true + schema: + type: string + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + /fake_classname_test: + patch: + tags: + - "fake_classname_tags 123#$%^" + summary: To test class name in snake case + description: To test class name in snake case + operationId: testClassname + responses: + "200": + description: successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + security: + - api_key_query: [] + requestBody: + $ref: "#/components/requestBodies/Client" + /fake: + patch: + tags: + - fake + summary: To test "client" model + description: To test "client" model + operationId: testClientModel + responses: + "200": + description: successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + requestBody: + $ref: "#/components/requestBodies/Client" + get: + tags: + - fake + summary: To test enum parameters + description: To test enum parameters + operationId: testEnumParameters + parameters: + - name: enum_header_string_array + in: header + description: Header parameter enum test (string array) + schema: + type: array + items: + type: string + default: $ + enum: + - ">" + - $ + - name: enum_header_string + in: header + description: Header parameter enum test (string) + schema: + type: string + enum: + - _abc + - "-efg" + - (xyz) + default: "-efg" + - name: enum_query_string_array + in: query + description: Query parameter enum test (string array) + schema: + type: array + items: + type: string + default: $ + enum: + - ">" + - $ + - name: enum_query_string + in: query + description: Query parameter enum test (string) + schema: + type: string + enum: + - _abc + - "-efg" + - (xyz) + default: "-efg" + - name: enum_query_integer + in: query + description: Query parameter enum test (double) + schema: + type: integer + format: int32 + enum: + - 1 + - -2 + - name: enum_query_double + in: query + description: Query parameter enum test (double) + schema: + type: number + format: double + enum: + - 1.1 + - -1.2 + - name: enum_query_model_array + in: query + schema: + type: array + items: + $ref: "#/components/schemas/EnumClass" + responses: + "400": + description: Invalid request + "404": + description: Not found + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + type: array + items: + type: string + default: $ + enum: + - ">" + - $ + enum_form_string: + description: Form parameter enum test (string) + type: string + enum: + - _abc + - "-efg" + - (xyz) + default: "-efg" + post: + tags: + - fake + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - http_basic_test: [] + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + integer: + description: None + type: integer + minimum: 10 + maximum: 100 + int32: + description: None + type: integer + format: int32 + minimum: 20 + maximum: 200 + int64: + description: None + type: integer + format: int64 + number: + description: None + type: number + minimum: 32.1 + maximum: 543.2 + float: + description: None + type: number + format: float + maximum: 987.6 + double: + description: None + type: number + format: double + minimum: 67.8 + maximum: 123.4 + string: + description: None + type: string + pattern: "/[a-z]/i" + pattern_without_delimiter: + description: None + type: string + pattern: "^[A-Z].*" + byte: + description: None + type: string + format: byte + binary: + description: None + type: string + format: binary + date: + description: None + type: string + format: date + dateTime: + description: None + type: string + format: date-time + password: + description: None + type: string + format: password + minLength: 10 + maxLength: 64 + callback: + description: None + type: string + required: + - number + - double + - pattern_without_delimiter + - byte + delete: + tags: + - fake + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + x-group-parameters: true + parameters: + - name: required_string_group + in: query + description: Required String in group parameters + required: true + schema: + type: integer + - name: required_boolean_group + in: header + description: Required Boolean in group parameters + required: true + schema: + type: boolean + - name: required_int64_group + in: query + description: Required Integer in group parameters + required: true + schema: + type: integer + format: int64 + - name: string_group + in: query + description: String in group parameters + schema: + type: integer + - name: boolean_group + in: header + description: Boolean in group parameters + schema: + type: boolean + - name: int64_group + in: query + description: Integer in group parameters + schema: + type: integer + format: int64 + responses: + "400": + description: Something wrong + /fake/outer/number: + post: + tags: + - fake + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + responses: + "200": + description: Output number + content: + "*/*": + schema: + $ref: "#/components/schemas/OuterNumber" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterNumber" + description: Input number as post body + /fake/property/enum-int: + post: + tags: + - fake + description: Test serialization of enum (int) properties with examples + operationId: fakePropertyEnumIntegerSerialize + responses: + "200": + description: Output enum (int) + content: + "*/*": + schema: + $ref: "#/components/schemas/OuterObjectWithEnumProperty" + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/OuterObjectWithEnumProperty" + description: Input enum (int) as post body + /fake/outer/string: + post: + tags: + - fake + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + responses: + "200": + description: Output string + content: + "*/*": + schema: + $ref: "#/components/schemas/OuterString" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterString" + description: Input string as post body + /fake/outer/boolean: + post: + tags: + - fake + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + responses: + "200": + description: Output boolean + content: + "*/*": + schema: + $ref: "#/components/schemas/OuterBoolean" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterBoolean" + description: Input boolean as post body + /fake/outer/composite: + post: + tags: + - fake + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + responses: + "200": + description: Output composite + content: + "*/*": + schema: + $ref: "#/components/schemas/OuterComposite" + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/OuterComposite" + description: Input composite as post body + /fake/jsonFormData: + get: + tags: + - fake + summary: test json serialization of form data + description: "" + operationId: testJsonFormData + responses: + "200": + description: successful operation + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + /fake/inline-additionalProperties: + post: + tags: + - fake + summary: test inline additionalProperties + description: "" + operationId: testInlineAdditionalProperties + responses: + "200": + description: successful operation + requestBody: + content: + application/json: + schema: + type: object + additionalProperties: + type: string + description: request body + required: true + /fake/body-with-query-params: + put: + tags: + - fake + operationId: testBodyWithQueryParams + parameters: + - name: query + in: query + required: true + schema: + type: string + responses: + "200": + description: Success + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/User" + required: true + /another-fake/dummy: + patch: + tags: + - $another-fake? + summary: To test special tags + description: To test special tags and operation ID starting with number + operationId: "123_test_@#$%_special_tags" + responses: + "200": + description: successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + requestBody: + $ref: "#/components/requestBodies/Client" + /fake/body-with-file-schema: + put: + tags: + - fake + description: >- + For this test, the body for this request must reference a schema named + `File`. + operationId: testBodyWithFileSchema + responses: + "200": + description: Success + requestBody: + content: + application/json: + schema: + $ref: "#/components/schemas/FileSchemaTestClass" + required: true + /fake/body-with-binary: + put: + tags: + - fake + description: >- + For this test, the body has to be a binary file. + operationId: testBodyWithBinary + responses: + "200": + description: Success + requestBody: + content: + image/png: + schema: + type: string + nullable: true + format: binary + description: image to upload + required: true + /fake/test-query-parameters: + put: + tags: + - fake + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - name: pipe + in: query + required: true + style: pipeDelimited + schema: + type: array + items: + type: string + - name: ioutil + in: query + required: true + style: form + explode: false + schema: + type: array + items: + type: string + - name: http + in: query + required: true + style: spaceDelimited + schema: + type: array + items: + type: string + - name: url + in: query + required: true + style: form + explode: false + schema: + type: array + items: + type: string + - name: context + in: query + required: true + explode: true + schema: + type: array + items: + type: string + - name: language + in: query + required: false + schema: + type: object + additionalProperties: + type: string + format: string + - name: allowEmpty + in: query + required: true + allowEmptyValue: true + schema: + type: string + responses: + "200": + description: Success + "/fake/{petId}/uploadImageWithRequiredFile": + post: + tags: + - pet + summary: uploads an image (required) + description: "" + operationId: uploadFileWithRequiredFile + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + schema: + type: integer + format: int64 + responses: + "200": + description: successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/ApiResponse" + security: + - petstore_auth: + - "write:pets" + - "read:pets" + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + type: string + format: binary + required: + - requiredFile + /fake/health: + get: + tags: + - fake + summary: Health check endpoint + responses: + 200: + description: The instance started successfully + content: + application/json: + schema: + $ref: "#/components/schemas/HealthCheckResult" + /fake/http-signature-test: + get: + tags: + - fake + summary: test http signature authentication + operationId: fake-http-signature-test + parameters: + - name: query_1 + in: query + description: query parameter + required: false + schema: + type: string + - name: header_1 + in: header + description: header parameter + required: false + schema: + type: string + security: + - http_signature_test: [] + requestBody: + $ref: "#/components/requestBodies/Pet" + responses: + 200: + description: The instance started successfully + /oneof: + get: + responses: + "200": + description: desc + content: + application/json: + schema: + $ref: "#/components/schemas/fruit" + /oneof-primitive: + get: + operationId: list + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/GigaOneOf" + /variant1: + get: + responses: + "200": + description: desc + content: + application/json: + schema: + $ref: "#/components/schemas/fruitVariant1" + put: + operationId: test + parameters: [] + requestBody: + content: + application/json: + schema: {} + responses: + "204": + description: Success + /variant2: + get: + responses: + "200": + description: desc + content: + application/json: + schema: + $ref: "#/components/schemas/FruitAllOfDisc" +servers: + - url: "http://{server}.swagger.io:{port}/v2" + description: petstore server + variables: + server: + enum: + - "petstore" + - "qa-petstore" + - "dev-petstore" + default: "petstore" + port: + enum: + - "80" + - "8080" + default: "80" + - url: https://localhost:8080/{version} + description: The local server + variables: + version: + enum: + - "v1" + - "v2" + default: "v2" + - url: https://127.0.0.1/no_varaible + description: The local server without variables +components: + requestBodies: + UserArray: + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/User" + description: List of user object + required: true + Client: + content: + application/json: + schema: + $ref: "#/components/schemas/Client" + description: client model + required: true + Pet: + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + application/xml: + schema: + $ref: "#/components/schemas/Pet" + description: Pet object that needs to be added to the store + required: true + Foo: + description: The Foo to be created + content: + application/json;charset=utf-8: + schema: + $ref: "#/components/schemas/Foo" + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog" + scopes: + "write:pets": modify pets in your account + "read:pets": read your pets + api_key: + type: apiKey + name: api_key + in: header + api_key_query: + type: apiKey + name: api_key_query + in: query + http_basic_test: + type: http + scheme: basic + bearer_test: + type: http + scheme: bearer + bearerFormat: JWT + http_signature_test: + type: http + scheme: signature + schemas: + FruitType: + properties: + fruitType: + type: string + required: + - fruitType + FruitInlineDisc: + oneOf: + - type: object + required: + - seeds + - fruitType + properties: + seeds: + type: integer + fruitType: + type: string + - type: object + required: + - length + - fruitType + properties: + length: + type: integer + fruitType: + type: string + discriminator: + propertyName: fruitType + FruitInlineInlineDisc: + oneOf: + - type: object + required: + - seeds + properties: + seeds: + type: integer + oneOf: + - type: object + properties: + fruitType: + type: string + required: + - fruitType + - type: object + required: + - length + properties: + length: + type: integer + oneOf: + - type: object + properties: + fruitType: + type: string + required: + - fruitType + discriminator: + propertyName: fruitType + FruitReqDisc: + oneOf: + - $ref: "#/components/schemas/AppleReqDisc" + - $ref: "#/components/schemas/BananaReqDisc" + discriminator: + propertyName: fruitType + AppleReqDisc: + type: object + required: + - seeds + - fruitType + properties: + seeds: + type: integer + fruitType: + type: string + BananaReqDisc: + type: object + required: + - length + - fruitType + properties: + length: + type: integer + fruitType: + type: string + FruitAllOfDisc: + oneOf: + - $ref: "#/components/schemas/AppleAllOfDisc" + - $ref: "#/components/schemas/BananaAllOfDisc" + discriminator: + propertyName: fruitType + AppleAllOfDisc: + type: object + required: + - seeds + properties: + seeds: + type: integer + allOf: + - $ref: "#/components/schemas/FruitType" + BananaAllOfDisc: + type: object + required: + - length + properties: + length: + type: integer + allOf: + - $ref: "#/components/schemas/FruitType" + FruitAnyOfDisc: + anyOf: + - $ref: "#/components/schemas/AppleAnyOfDisc" + - $ref: "#/components/schemas/BananaAnyOfDisc" + discriminator: + propertyName: fruitType + AppleAnyOfDisc: + type: object + required: + - seeds + properties: + seeds: + type: integer + anyOf: + - $ref: "#/components/schemas/FruitType" + BananaAnyOfDisc: + type: object + required: + - length + properties: + length: + type: integer + anyOf: + - $ref: "#/components/schemas/FruitType" + FruitOneOfDisc: + oneOf: + - $ref: "#/components/schemas/AppleOneOfDisc" + - $ref: "#/components/schemas/BananaOneOfDisc" + discriminator: + propertyName: fruitType + AppleOneOfDisc: + type: object + required: + - seeds + properties: + seeds: + type: integer + oneOf: + - $ref: "#/components/schemas/FruitType" + BananaOneOfDisc: + type: object + required: + - length + properties: + length: + type: integer + oneOf: + - $ref: "#/components/schemas/FruitType" + FruitGrandparentDisc: + oneOf: + - $ref: "#/components/schemas/AppleGrandparentDisc" + - $ref: "#/components/schemas/BananaGrandparentDisc" + discriminator: + propertyName: fruitType + Parent: + type: object + allOf: + # the FruitType schema is a grandparent of AppleGrandparentDisc + BananaGrandparentDisc + - $ref: "#/components/schemas/FruitType" + AppleGrandparentDisc: + type: object + required: + - seeds + properties: + seeds: + type: integer + allOf: + - $ref: "#/components/schemas/Parent" + BananaGrandparentDisc: + type: object + required: + - length + properties: + length: + type: integer + allOf: + - $ref: "#/components/schemas/Parent" + # ComposedDiscMissingNoProperties: + # oneOf: + # - $ref: "#/components/schemas/DiscMissingNoProperties" + # discriminator: + # propertyName: fruitType + # # Model DiscMissingNoProperties not generated since it's a free-form object + # DiscMissingNoProperties: + # type: object + ComposedDiscMissingFromProperties: + oneOf: + - $ref: "#/components/schemas/DiscMissingFromProperties" + discriminator: + propertyName: fruitType + DiscMissingFromProperties: + type: object + properties: + length: + type: integer + ComposedDiscOptionalTypeCorrect: + oneOf: + - $ref: "#/components/schemas/DiscOptionalTypeCorrect" + discriminator: + propertyName: fruitType + DiscOptionalTypeCorrect: + type: object + properties: + fruitType: + type: string + ComposedDiscOptionalTypeIncorrect: + oneOf: + - $ref: "#/components/schemas/DiscOptionalTypeIncorrect" + discriminator: + propertyName: fruitType + DiscOptionalTypeIncorrect: + type: object + properties: + fruitType: + type: integer + ComposedDiscOptionalTypeInconsistent: + oneOf: + - $ref: "#/components/schemas/DiscOptionalTypeIncorrect" + - $ref: "#/components/schemas/DiscOptionalTypeCorrect" + discriminator: + propertyName: fruitType + ComposedDiscTypeIncorrect: + oneOf: + - $ref: "#/components/schemas/DiscTypeIncorrect" + discriminator: + propertyName: fruitType + DiscTypeIncorrect: + type: object + properties: + fruitType: + type: integer + required: + - fruitType + ComposedDiscTypeInconsistent: + oneOf: + - $ref: "#/components/schemas/DiscTypeIncorrect" + - $ref: "#/components/schemas/FruitType" + discriminator: + propertyName: fruitType + ComposedDiscRequiredInconsistent: + oneOf: + - $ref: "#/components/schemas/DiscOptionalTypeCorrect" + - $ref: "#/components/schemas/FruitType" + discriminator: + propertyName: fruitType + + fruitVariant1: + title: fruit + properties: + color: + type: string + oneOf: + - $ref: "#/components/schemas/appleVariant1" + - $ref: "#/components/schemas/grapesVariant1" + # additionalProperties: + # type: string + # uncomment this when https://github.com/swagger-api/swagger-parser/issues/1252 is resolved + appleVariant1: + title: apple + type: object + properties: + kind: + type: string + applesVariant1: + title: apples + type: object + additionalProperties: + $ref: "#/components/schemas/appleVariant1" + grapeVariant1: + title: grape + type: object + properties: + color: + type: string + grapesVariant1: + title: grapes + type: array + items: + $ref: "#/components/schemas/grapeVariant1" + + GigaOneOf: + oneOf: + - type: string + format: uuid + - type: string + format: date-time + - type: integer + - type: number + - $ref: "#/components/schemas/OneOfPrimitiveChild" + - type: integer + format: int32 + OneOfPrimitiveChild: + type: object + properties: + name: + type: string + + fruit: + title: fruit + properties: + color: + type: string + oneOf: + - $ref: "#/components/schemas/apple" + - $ref: "#/components/schemas/banana" + # additionalProperties: + # type: string + # uncomment this when https://github.com/swagger-api/swagger-parser/issues/1252 is resolved + apple: + title: apple + type: object + properties: + kind: + type: string + banana: + title: banana + type: object + properties: + count: + type: number + Addressable: + type: object + properties: + href: + type: string + description: Hyperlink reference + id: + type: string + description: unique identifier + description: Base schema for addressable entities + Extensible: + type: object + properties: + "@schemaLocation": + type: string + description: + A URI to a JSON-Schema file that defines additional attributes + and relationships + "@baseType": + type: string + description: When sub-classing, this defines the super-class + "@type": + type: string + description: When sub-classing, this defines the sub-class Extensible name + required: + - "@type" + Entity: + type: object + discriminator: + propertyName: "@type" + allOf: + - "$ref": "#/components/schemas/Addressable" + - "$ref": "#/components/schemas/Extensible" + EntityRef: + type: object + discriminator: + propertyName: "@type" + description: Entity reference schema to be use for all entityRef class. + properties: + name: + type: string + description: Name of the related entity. + "@referredType": + type: string + description: The actual type of the target instance when needed for disambiguation. + allOf: + - $ref: "#/components/schemas/Addressable" + - "$ref": "#/components/schemas/Extensible" + FooRefOrValue: + type: object + oneOf: + - $ref: "#/components/schemas/Foo" + - $ref: "#/components/schemas/FooRef" + discriminator: + propertyName: "@type" + Foo: + type: object + properties: + fooPropA: + type: string + fooPropB: + type: string + allOf: + - $ref: "#/components/schemas/Entity" + FooRef: + type: object + properties: + foorefPropA: + type: string + allOf: + - $ref: "#/components/schemas/EntityRef" + BarRef: + type: object + allOf: + - $ref: "#/components/schemas/EntityRef" + Bar_Create: + type: object + properties: + barPropA: + type: string + fooPropB: + type: string + foo: + $ref: "#/components/schemas/FooRefOrValue" + allOf: + - $ref: "#/components/schemas/Entity" + Bar: + type: object + required: + - id + properties: + id: + type: string + barPropA: + type: string + fooPropB: + type: string + foo: + $ref: "#/components/schemas/FooRefOrValue" + allOf: + - $ref: "#/components/schemas/Entity" + BarRefOrValue: + type: object + oneOf: + - $ref: "#/components/schemas/Bar" + - $ref: "#/components/schemas/BarRef" + Pizza: + type: object + properties: + pizzaSize: + type: number + allOf: + - $ref: "#/components/schemas/Entity" + Pasta: + type: object + properties: + vendor: + type: string + allOf: + - $ref: "#/components/schemas/Entity" + PizzaSpeziale: + type: object + properties: + toppings: + type: string + allOf: + - $ref: "#/components/schemas/Pizza" + + Order: + type: object + properties: + id: + type: integer + format: int64 + petId: + type: integer + format: int64 + quantity: + type: integer + format: int32 + shipDate: + type: string + format: date-time + status: + type: string + description: Order Status + enum: + - placed + - approved + - delivered + complete: + type: boolean + default: false + xml: + name: Order + Category: + type: object + required: + - name + properties: + id: + type: integer + format: int64 + name: + type: string + default: default-name + xml: + name: Category + User: + type: object + properties: + id: + type: integer + format: int64 + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + type: integer + format: int32 + description: User Status + xml: + name: User + Tag: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Tag + Pet: + type: object + required: + - name + - photoUrls + properties: + id: + type: integer + format: int64 + x-is-unique: true + category: + $ref: "#/components/schemas/Category" + name: + type: string + example: doggie + photoUrls: + type: array + xml: + name: photoUrl + wrapped: true + items: + type: string + uniqueItems: true + tags: + type: array + xml: + name: tag + wrapped: true + items: + $ref: "#/components/schemas/Tag" + status: + type: string + description: pet status in the store + enum: + - available + - pending + - sold + xml: + name: Pet + ApiResponse: + type: object + properties: + code: + type: integer + format: int32 + type: + type: string + message: + type: string + Return: + description: Model for testing reserved words + properties: + return: + type: integer + format: int32 + xml: + name: Return + Name: + description: Model for testing model name same as property name + required: + - name + properties: + name: + type: integer + format: int32 + snake_case: + readOnly: true + type: integer + format: int32 + property: + type: string + 123Number: + type: integer + readOnly: true + xml: + name: Name + 200_response: + description: Model for testing model name starting with number + properties: + name: + type: integer + format: int32 + class: + type: string + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + Dog: + allOf: + - $ref: "#/components/schemas/Animal" + - type: object + properties: + breed: + type: string + Cat: + allOf: + - $ref: "#/components/schemas/Animal" + - type: object + properties: + declawed: + type: boolean + Animal: + type: object + discriminator: + propertyName: className + mapping: + DOG: "#/components/schemas/Dog" + CAT: "#/components/schemas/Cat" + required: + - className + properties: + className: + type: string + color: + type: string + default: red + AnimalFarm: + type: array + items: + $ref: "#/components/schemas/Animal" + format_test: + type: object + required: + - number + - byte + - date + - password + properties: + integer: + type: integer + maximum: 100 + minimum: 10 + int32: + type: integer + format: int32 + maximum: 200 + minimum: 20 + int64: + type: integer + format: int64 + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + type: number + format: float + maximum: 987.6 + minimum: 54.3 + double: + type: number + format: double + maximum: 123.4 + minimum: 67.8 + decimal: + type: string + format: number + string: + type: string + pattern: "/[a-z]/i" + byte: + type: string + format: byte + binary: + type: string + format: binary + date: + type: string + format: date + dateTime: + type: string + format: date-time + uuid: + type: string + format: uuid + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + password: + type: string + format: password + maxLength: 64 + minLength: 10 + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + type: string + pattern: '^\d{10}$' + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + type: string + pattern: '/^image_\d{1,3}$/i' + EnumClass: + type: string + default: "-efg" + enum: + - _abc + - "-efg" + - (xyz) + Enum_Test: + type: object + required: + - enum_string_required + properties: + enum_string: + type: string + enum: + - UPPER + - lower + - "" + enum_string_required: + type: string + enum: + - UPPER + - lower + - "" + enum_integer: + type: integer + format: int32 + enum: + - 1 + - -1 + enum_number: + type: number + format: double + enum: + - 1.1 + - -1.2 + outerEnum: + $ref: "#/components/schemas/OuterEnum" + outerEnumInteger: + $ref: "#/components/schemas/OuterEnumInteger" + outerEnumDefaultValue: + $ref: "#/components/schemas/OuterEnumDefaultValue" + outerEnumIntegerDefaultValue: + $ref: "#/components/schemas/OuterEnumIntegerDefaultValue" + AdditionalPropertiesClass: + type: object + properties: + map_property: + type: object + additionalProperties: + type: string + map_of_map_property: + type: object + additionalProperties: + type: object + additionalProperties: + type: string + MixedPropertiesAndAdditionalPropertiesClass: + type: object + properties: + uuid: + type: string + format: uuid + dateTime: + type: string + format: date-time + map: + type: object + additionalProperties: + $ref: "#/components/schemas/Animal" + List: + type: object + properties: + 123-list: + type: string + Client: + type: object + properties: + client: + type: string + ReadOnlyFirst: + type: object + properties: + bar: + type: string + readOnly: true + baz: + type: string + hasOnlyReadOnly: + type: object + properties: + bar: + type: string + readOnly: true + foo: + type: string + readOnly: true + Capitalization: + type: object + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + MapTest: + type: object + properties: + map_map_of_string: + type: object + additionalProperties: + type: object + additionalProperties: + type: string + map_of_enum_string: + type: object + additionalProperties: + type: string + enum: + - UPPER + - lower + direct_map: + type: object + additionalProperties: + type: boolean + indirect_map: + $ref: "#/components/schemas/StringBooleanMap" + ArrayTest: + type: object + properties: + array_of_string: + type: array + items: + type: string + minItems: 0 + maxItems: 3 + array_array_of_integer: + type: array + items: + type: array + items: + type: integer + format: int64 + array_array_of_model: + type: array + items: + type: array + items: + $ref: "#/components/schemas/ReadOnlyFirst" + NumberOnly: + type: object + properties: + JustNumber: + type: number + ArrayOfNumberOnly: + type: object + properties: + ArrayNumber: + type: array + items: + type: number + ArrayOfArrayOfNumberOnly: + type: object + properties: + ArrayArrayNumber: + type: array + items: + type: array + items: + type: number + EnumArrays: + type: object + properties: + just_symbol: + type: string + enum: + - ">=" + - $ + array_enum: + type: array + items: + type: string + enum: + - fish + - crab + OuterEnum: + nullable: true + type: string + enum: + - placed + - approved + - delivered + OuterEnumInteger: + type: integer + enum: + - 0 + - 1 + - 2 + example: 2 + OuterEnumDefaultValue: + type: string + enum: + - placed + - approved + - delivered + default: placed + OuterEnumIntegerDefaultValue: + type: integer + enum: + - 0 + - 1 + - 2 + default: 0 + OuterComposite: + type: object + properties: + my_number: + $ref: "#/components/schemas/OuterNumber" + my_string: + $ref: "#/components/schemas/OuterString" + my_boolean: + $ref: "#/components/schemas/OuterBoolean" + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + StringBooleanMap: + additionalProperties: + type: boolean + FileSchemaTestClass: + type: object + properties: + file: + $ref: "#/components/schemas/File" + files: + type: array + items: + $ref: "#/components/schemas/File" + File: + type: object + description: Must be named `File` for test. + properties: + sourceURI: + description: Test capitalization + type: string + _special_model.name_: + properties: + "$special[property.name]": + type: integer + format: int64 + xml: + name: "$special[model.name]" + HealthCheckResult: + type: object + properties: + NullableMessage: + nullable: true + type: string + description: Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + NullableClass: + type: object + properties: + integer_prop: + type: integer + nullable: true + number_prop: + type: number + nullable: true + boolean_prop: + type: boolean + nullable: true + string_prop: + type: string + nullable: true + date_prop: + type: string + format: date + nullable: true + datetime_prop: + type: string + format: date-time + nullable: true + array_nullable_prop: + type: array + nullable: true + items: + type: object + array_and_items_nullable_prop: + type: array + nullable: true + items: + type: object + nullable: true + array_items_nullable: + type: array + items: + type: object + nullable: true + object_nullable_prop: + type: object + nullable: true + additionalProperties: + type: object + object_and_items_nullable_prop: + type: object + nullable: true + additionalProperties: + type: object + nullable: true + object_items_nullable: + type: object + additionalProperties: + type: object + nullable: true + additionalProperties: + type: object + nullable: true + OuterObjectWithEnumProperty: + type: object + example: + value: 2 + required: + - value + properties: + value: + $ref: "#/components/schemas/OuterEnumInteger" + DeprecatedObject: + type: object + deprecated: true + properties: + name: + type: string + ObjectWithDeprecatedFields: + type: object + properties: + uuid: + type: string + id: + type: number + deprecated: true + deprecatedRef: + $ref: "#/components/schemas/DeprecatedObject" + bars: + type: array + deprecated: true + items: + $ref: "#/components/schemas/Bar" + AllOfWithSingleRef: + type: object + properties: + username: + type: string + SingleRefType: + allOf: + - $ref: "#/components/schemas/SingleRefType" + SingleRefType: + type: string + title: SingleRefType + enum: + - admin + - user + responses: + "204": + description: Deleted + content: {} + 201Foo: + description: Error + content: + application/json: + schema: + $ref: "#/components/schemas/FooRefOrValue" + 200FooArray: + description: Success + content: + application/json;charset=utf-8: + schema: + type: array + items: + $ref: "#/components/schemas/FooRefOrValue" diff --git a/pom.xml b/pom.xml index 2bbdefe67e90..3a519a34d28b 100644 --- a/pom.xml +++ b/pom.xml @@ -1135,6 +1135,239 @@ samples/server/petstore/java-undertow + + samples + + + env + samples + + + + + + + + + + + + + samples/client/petstore/rust + samples/client/petstore/rust/hyper/petstore + samples/client/petstore/rust/reqwest/petstore + samples/client/petstore/rust/reqwest/petstore-async + samples/client/petstore/rust/reqwest/petstore-async-middleware + + + + + + samples.circleci + + + env + samples.circleci + + + + samples/client/petstore/ruby + samples/client/petstore/ruby-faraday + samples/client/petstore/ruby-autoload + + + + samples.circleci.spring + + + env + samples.circleci.spring + + + + + samples/client/petstore/spring-cloud + + + + + samples.circleci.node3 + + + env + samples.circleci.node3 + + + + + samples/openapi3/client/petstore/python + samples/openapi3/client/petstore/python-aiohttp + + + samples/client/others/typescript-angular + samples/client/petstore/typescript-angular-v12-provided-in-root + samples/client/petstore/typescript-angular-v13-provided-in-root + samples/client/petstore/typescript-angular-v14-provided-in-root + samples/client/petstore/typescript-angular-v15-provided-in-root + samples/client/petstore/typescript-angular-v16-provided-in-root + samples/openapi3/client/petstore/typescript/builds/default + samples/openapi3/client/petstore/typescript/tests/default + samples/openapi3/client/petstore/typescript/builds/jquery + samples/openapi3/client/petstore/typescript/tests/jquery + samples/openapi3/client/petstore/typescript/builds/object_params + samples/openapi3/client/petstore/typescript/tests/object_params + samples/openapi3/client/petstore/typescript/builds/inversify + + samples/openapi3/client/petstore/typescript/builds/browser + samples/openapi3/client/petstore/typescript/tests/browser + samples/client/petstore/typescript-fetch/builds/default + samples/client/petstore/typescript-fetch/builds/es6-target + samples/client/petstore/typescript-fetch/builds/with-npm-version + samples/client/petstore/typescript-fetch/tests/default + samples/client/petstore/typescript-node/npm + samples/client/petstore/typescript-rxjs/builds/with-npm-version + samples/client/petstore/typescript-axios/builds/with-npm-version + samples/client/petstore/typescript-axios/tests/default + samples/client/petstore/javascript-flowtyped + samples/client/petstore/javascript-es6 + samples/client/petstore/javascript-promise-es6 + + + + + samples.circleci.node4 + + + env + samples.circleci.node4 + + + + + + + + samples.circleci.others + + + env + samples.circleci.others + + + + + + samples/client/petstore/scala-akka + samples/client/petstore/scala-sttp + samples/client/petstore/scala-sttp4 + samples/client/petstore/clojure + samples/client/petstore/java/jersey2-java8 + samples/openapi3/client/petstore/java/jersey2-java8 + samples/client/petstore/java/jersey3 + samples/client/others/java/okhttp-gson-streaming + samples/client/petstore/java/okhttp-gson + samples/client/petstore/java-micronaut-client + samples/client/petstore/java/apache-httpclient + + + + + samples.misc + + + env + samples.misc + + + + + + + + + samples/client/petstore/go + samples/openapi3/client/petstore/go + + + + + samples.dart + + + env + samples.dart + + + + samples/openapi3/client/petstore/dart2/petstore_client_lib + samples/openapi3/client/petstore/dart-dio/oneof + samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance + samples/openapi3/client/petstore/dart-dio/oneof_primitive + samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake + samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable + samples/client/echo_api/dart/dio/built_value + samples/client/echo_api/dart/dio/json_serializable + + + + samples.ios + + + env + samples.ios + + + + + samples/client/petstore/swift5/alamofireLibrary + samples/client/petstore/swift5/combineLibrary + samples/client/petstore/swift5/default + samples/client/petstore/swift5/deprecated + samples/client/petstore/swift5/frozenEnums + samples/client/petstore/swift5/nonPublicApi + samples/client/petstore/swift5/objcCompatible + samples/client/petstore/swift5/promisekitLibrary + samples/client/petstore/swift5/readonlyProperties + samples/client/petstore/swift5/resultLibrary + samples/client/petstore/swift5/rxswiftLibrary + samples/client/petstore/swift5/urlsessionLibrary + + + + + + openapi-generator diff --git a/samples/client/echo_api/dart/dio/built_value/.gitignore b/samples/client/echo_api/dart/dio/built_value/.gitignore new file mode 100644 index 000000000000..4298cdcbd1a2 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/.gitignore @@ -0,0 +1,41 @@ +# 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: + +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ + +# Mac +.DS_Store diff --git a/samples/client/echo_api/dart/dio/built_value/.openapi-generator-ignore b/samples/client/echo_api/dart/dio/built_value/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/echo_api/dart/dio/built_value/.openapi-generator/FILES b/samples/client/echo_api/dart/dio/built_value/.openapi-generator/FILES new file mode 100644 index 000000000000..18008f8208c3 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/.openapi-generator/FILES @@ -0,0 +1,347 @@ +.gitignore +README.md +analysis_options.yaml +doc/AdditionalPropertiesClass.md +doc/Addressable.md +doc/AllOfWithSingleRef.md +doc/Animal.md +doc/AnotherFakeApi.md +doc/ApiResponse.md +doc/Apple.md +doc/AppleAllOfDisc.md +doc/AppleGrandparentDisc.md +doc/AppleOneOfDisc.md +doc/AppleReqDisc.md +doc/AppleVariant1.md +doc/ArrayOfArrayOfNumberOnly.md +doc/ArrayOfNumberOnly.md +doc/ArrayTest.md +doc/Banana.md +doc/BananaAllOfDisc.md +doc/BananaGrandparentDisc.md +doc/BananaOneOfDisc.md +doc/BananaReqDisc.md +doc/Bar.md +doc/BarApi.md +doc/BarCreate.md +doc/BarRef.md +doc/BarRefOrValue.md +doc/Capitalization.md +doc/Cat.md +doc/Category.md +doc/ClassModel.md +doc/ComposedDiscMissingFromProperties.md +doc/ComposedDiscOptionalTypeCorrect.md +doc/ComposedDiscOptionalTypeInconsistent.md +doc/ComposedDiscOptionalTypeIncorrect.md +doc/ComposedDiscRequiredInconsistent.md +doc/ComposedDiscTypeInconsistent.md +doc/ComposedDiscTypeIncorrect.md +doc/DefaultApi.md +doc/DeprecatedObject.md +doc/DiscMissingFromProperties.md +doc/DiscOptionalTypeCorrect.md +doc/DiscOptionalTypeIncorrect.md +doc/DiscTypeIncorrect.md +doc/Dog.md +doc/Entity.md +doc/EntityRef.md +doc/EnumArrays.md +doc/EnumTest.md +doc/Extensible.md +doc/FakeApi.md +doc/FakeClassnameTags123Api.md +doc/FileSchemaTestClass.md +doc/Foo.md +doc/FooApi.md +doc/FooBasicGetDefaultResponse.md +doc/FooRef.md +doc/FooRefOrValue.md +doc/FormatTest.md +doc/Fruit.md +doc/FruitAllOfDisc.md +doc/FruitAnyOfDisc.md +doc/FruitGrandparentDisc.md +doc/FruitInlineDisc.md +doc/FruitInlineDiscOneOf.md +doc/FruitInlineDiscOneOf1.md +doc/FruitInlineInlineDisc.md +doc/FruitInlineInlineDiscOneOf.md +doc/FruitInlineInlineDiscOneOf1.md +doc/FruitInlineInlineDiscOneOfOneOf.md +doc/FruitOneOfDisc.md +doc/FruitReqDisc.md +doc/FruitType.md +doc/FruitVariant1.md +doc/GigaOneOf.md +doc/GrapeVariant1.md +doc/HasOnlyReadOnly.md +doc/HealthCheckResult.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/ObjectWithDeprecatedFields.md +doc/OneOfPrimitiveChild.md +doc/Order.md +doc/OuterComposite.md +doc/OuterEnum.md +doc/OuterEnumDefaultValue.md +doc/OuterEnumInteger.md +doc/OuterEnumIntegerDefaultValue.md +doc/OuterObjectWithEnumProperty.md +doc/Parent.md +doc/Pasta.md +doc/Pet.md +doc/PetApi.md +doc/Pizza.md +doc/PizzaSpeziale.md +doc/ReadOnlyFirst.md +doc/SingleRefType.md +doc/SpecialModelName.md +doc/StoreApi.md +doc/Tag.md +doc/User.md +doc/UserApi.md +lib/apis.dart +lib/models.dart +lib/openapi.dart +lib/src/api/another_fake_api.dart +lib/src/api/bar_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/foo_api.dart +lib/src/api/pet_api.dart +lib/src/api/store_api.dart +lib/src/api/user_api.dart +lib/src/api_client.dart +lib/src/api_util.dart +lib/src/auth/_exports.dart +lib/src/auth/api_key_auth.dart +lib/src/auth/auth.dart +lib/src/auth/basic_auth.dart +lib/src/auth/bearer_auth.dart +lib/src/auth/oauth.dart +lib/src/date_serializer.dart +lib/src/model/additional_properties_class.dart +lib/src/model/addressable.dart +lib/src/model/all_of_with_single_ref.dart +lib/src/model/animal.dart +lib/src/model/api_response.dart +lib/src/model/apple.dart +lib/src/model/apple_all_of_disc.dart +lib/src/model/apple_grandparent_disc.dart +lib/src/model/apple_one_of_disc.dart +lib/src/model/apple_req_disc.dart +lib/src/model/apple_variant1.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/banana.dart +lib/src/model/banana_all_of_disc.dart +lib/src/model/banana_grandparent_disc.dart +lib/src/model/banana_one_of_disc.dart +lib/src/model/banana_req_disc.dart +lib/src/model/bar.dart +lib/src/model/bar_create.dart +lib/src/model/bar_ref.dart +lib/src/model/bar_ref_or_value.dart +lib/src/model/capitalization.dart +lib/src/model/cat.dart +lib/src/model/category.dart +lib/src/model/class_model.dart +lib/src/model/composed_disc_missing_from_properties.dart +lib/src/model/composed_disc_optional_type_correct.dart +lib/src/model/composed_disc_optional_type_inconsistent.dart +lib/src/model/composed_disc_optional_type_incorrect.dart +lib/src/model/composed_disc_required_inconsistent.dart +lib/src/model/composed_disc_type_inconsistent.dart +lib/src/model/composed_disc_type_incorrect.dart +lib/src/model/date.dart +lib/src/model/deprecated_object.dart +lib/src/model/disc_missing_from_properties.dart +lib/src/model/disc_optional_type_correct.dart +lib/src/model/disc_optional_type_incorrect.dart +lib/src/model/disc_type_incorrect.dart +lib/src/model/dog.dart +lib/src/model/entity.dart +lib/src/model/entity_ref.dart +lib/src/model/enum_arrays.dart +lib/src/model/enum_test.dart +lib/src/model/extensible.dart +lib/src/model/file_schema_test_class.dart +lib/src/model/foo.dart +lib/src/model/foo_basic_get_default_response.dart +lib/src/model/foo_ref.dart +lib/src/model/foo_ref_or_value.dart +lib/src/model/format_test.dart +lib/src/model/fruit.dart +lib/src/model/fruit_all_of_disc.dart +lib/src/model/fruit_any_of_disc.dart +lib/src/model/fruit_grandparent_disc.dart +lib/src/model/fruit_inline_disc.dart +lib/src/model/fruit_inline_disc_one_of.dart +lib/src/model/fruit_inline_disc_one_of1.dart +lib/src/model/fruit_inline_inline_disc.dart +lib/src/model/fruit_inline_inline_disc_one_of.dart +lib/src/model/fruit_inline_inline_disc_one_of1.dart +lib/src/model/fruit_inline_inline_disc_one_of_one_of.dart +lib/src/model/fruit_one_of_disc.dart +lib/src/model/fruit_req_disc.dart +lib/src/model/fruit_type.dart +lib/src/model/fruit_variant1.dart +lib/src/model/giga_one_of.dart +lib/src/model/grape_variant1.dart +lib/src/model/has_only_read_only.dart +lib/src/model/health_check_result.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/object_with_deprecated_fields.dart +lib/src/model/one_of_primitive_child.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/parent.dart +lib/src/model/pasta.dart +lib/src/model/pet.dart +lib/src/model/pizza.dart +lib/src/model/pizza_speziale.dart +lib/src/model/read_only_first.dart +lib/src/model/single_ref_type.dart +lib/src/model/special_model_name.dart +lib/src/model/tag.dart +lib/src/model/user.dart +lib/src/repository_base.dart +lib/src/repository_impl.dart +lib/src/serializers.dart +pubspec.yaml +test/additional_properties_class_test.dart +test/addressable_test.dart +test/all_of_with_single_ref_test.dart +test/animal_test.dart +test/another_fake_api_test.dart +test/api_response_test.dart +test/apple_all_of_disc_test.dart +test/apple_grandparent_disc_test.dart +test/apple_one_of_disc_test.dart +test/apple_req_disc_test.dart +test/apple_test.dart +test/apple_variant1_test.dart +test/array_of_array_of_number_only_test.dart +test/array_of_number_only_test.dart +test/array_test_test.dart +test/banana_all_of_disc_test.dart +test/banana_grandparent_disc_test.dart +test/banana_one_of_disc_test.dart +test/banana_req_disc_test.dart +test/banana_test.dart +test/bar_api_test.dart +test/bar_create_test.dart +test/bar_ref_or_value_test.dart +test/bar_ref_test.dart +test/bar_test.dart +test/capitalization_test.dart +test/cat_test.dart +test/category_test.dart +test/class_model_test.dart +test/composed_disc_missing_from_properties_test.dart +test/composed_disc_optional_type_correct_test.dart +test/composed_disc_optional_type_inconsistent_test.dart +test/composed_disc_optional_type_incorrect_test.dart +test/composed_disc_required_inconsistent_test.dart +test/composed_disc_type_inconsistent_test.dart +test/composed_disc_type_incorrect_test.dart +test/default_api_test.dart +test/deprecated_object_test.dart +test/disc_missing_from_properties_test.dart +test/disc_optional_type_correct_test.dart +test/disc_optional_type_incorrect_test.dart +test/disc_type_incorrect_test.dart +test/dog_test.dart +test/entity_ref_test.dart +test/entity_test.dart +test/enum_arrays_test.dart +test/enum_test_test.dart +test/extensible_test.dart +test/fake_api_test.dart +test/fake_classname_tags123_api_test.dart +test/file_schema_test_class_test.dart +test/foo_api_test.dart +test/foo_basic_get_default_response_test.dart +test/foo_ref_or_value_test.dart +test/foo_ref_test.dart +test/foo_test.dart +test/format_test_test.dart +test/fruit_all_of_disc_test.dart +test/fruit_any_of_disc_test.dart +test/fruit_grandparent_disc_test.dart +test/fruit_inline_disc_one_of1_test.dart +test/fruit_inline_disc_one_of_test.dart +test/fruit_inline_disc_test.dart +test/fruit_inline_inline_disc_one_of1_test.dart +test/fruit_inline_inline_disc_one_of_one_of_test.dart +test/fruit_inline_inline_disc_one_of_test.dart +test/fruit_inline_inline_disc_test.dart +test/fruit_one_of_disc_test.dart +test/fruit_req_disc_test.dart +test/fruit_test.dart +test/fruit_type_test.dart +test/fruit_variant1_test.dart +test/giga_one_of_test.dart +test/grape_variant1_test.dart +test/has_only_read_only_test.dart +test/health_check_result_test.dart +test/map_test_test.dart +test/mixed_properties_and_additional_properties_class_test.dart +test/model200_response_test.dart +test/model_client_test.dart +test/model_enum_class_test.dart +test/model_file_test.dart +test/model_list_test.dart +test/model_return_test.dart +test/name_test.dart +test/nullable_class_test.dart +test/number_only_test.dart +test/object_with_deprecated_fields_test.dart +test/one_of_primitive_child_test.dart +test/order_test.dart +test/outer_composite_test.dart +test/outer_enum_default_value_test.dart +test/outer_enum_integer_default_value_test.dart +test/outer_enum_integer_test.dart +test/outer_enum_test.dart +test/outer_object_with_enum_property_test.dart +test/parent_test.dart +test/pasta_test.dart +test/pet_api_test.dart +test/pet_test.dart +test/pizza_speziale_test.dart +test/pizza_test.dart +test/read_only_first_test.dart +test/single_ref_type_test.dart +test/special_model_name_test.dart +test/store_api_test.dart +test/tag_test.dart +test/user_api_test.dart +test/user_test.dart diff --git a/samples/client/echo_api/dart/dio/built_value/.openapi-generator/VERSION b/samples/client/echo_api/dart/dio/built_value/.openapi-generator/VERSION new file mode 100644 index 000000000000..757e67400401 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/echo_api/dart/dio/built_value/README.md b/samples/client/echo_api/dart/dio/built_value/README.md new file mode 100644 index 000000000000..fe2ee6a43a13 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/README.md @@ -0,0 +1,263 @@ +# 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.DartNextClientCodegen + +## Requirements + +* Dart 2.15.0+ or Flutter 2.8.0+ +* Dio 5.0.0+ (https://pub.dev/packages/dio) + +## Installation & Usage + +### pub.dev +To use the package from [pub.dev](https://pub.dev), please include the following in pubspec.yaml +```yaml +dependencies: + openapi: 1.0.0 +``` + +### Github +If this Dart package is published to Github, please include the following in pubspec.yaml +```yaml +dependencies: + openapi: + git: + url: https://github.com/GIT_USER_ID/GIT_REPO_ID.git + #ref: main +``` + +### Local development +To use the package from your local drive, please include the following in pubspec.yaml +```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 = Openapi().getAnotherFakeApi(); +final ModelClient modelClient = ; // ModelClient | client model + +try { + final response = await api.call123testSpecialTags(modelClient); + print(response); +} catch on DioException (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*](doc/AnotherFakeApi.md) | [**call123testSpecialTags**](doc/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +[*BarApi*](doc/BarApi.md) | [**createBar**](doc/BarApi.md#createbar) | **POST** /bar | Create a Bar +[*DefaultApi*](doc/DefaultApi.md) | [**fooBasicGet**](doc/DefaultApi.md#foobasicget) | **GET** /foo-basic | +[*DefaultApi*](doc/DefaultApi.md) | [**list**](doc/DefaultApi.md#list) | **GET** /oneof-primitive | +[*DefaultApi*](doc/DefaultApi.md) | [**oneofGet**](doc/DefaultApi.md#oneofget) | **GET** /oneof | +[*DefaultApi*](doc/DefaultApi.md) | [**test**](doc/DefaultApi.md#test) | **PUT** /variant1 | +[*DefaultApi*](doc/DefaultApi.md) | [**variant1Get**](doc/DefaultApi.md#variant1get) | **GET** /variant1 | +[*DefaultApi*](doc/DefaultApi.md) | [**variant2Get**](doc/DefaultApi.md#variant2get) | **GET** /variant2 | +[*FakeApi*](doc/FakeApi.md) | [**fakeHealthGet**](doc/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint +[*FakeApi*](doc/FakeApi.md) | [**fakeHttpSignatureTest**](doc/FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication +[*FakeApi*](doc/FakeApi.md) | [**fakeOuterBooleanSerialize**](doc/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +[*FakeApi*](doc/FakeApi.md) | [**fakeOuterCompositeSerialize**](doc/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +[*FakeApi*](doc/FakeApi.md) | [**fakeOuterNumberSerialize**](doc/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | +[*FakeApi*](doc/FakeApi.md) | [**fakeOuterStringSerialize**](doc/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +[*FakeApi*](doc/FakeApi.md) | [**fakePropertyEnumIntegerSerialize**](doc/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | +[*FakeApi*](doc/FakeApi.md) | [**testBodyWithBinary**](doc/FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | +[*FakeApi*](doc/FakeApi.md) | [**testBodyWithFileSchema**](doc/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | +[*FakeApi*](doc/FakeApi.md) | [**testBodyWithQueryParams**](doc/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | +[*FakeApi*](doc/FakeApi.md) | [**testClientModel**](doc/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model +[*FakeApi*](doc/FakeApi.md) | [**testEndpointParameters**](doc/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[*FakeApi*](doc/FakeApi.md) | [**testEnumParameters**](doc/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters +[*FakeApi*](doc/FakeApi.md) | [**testGroupParameters**](doc/FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[*FakeApi*](doc/FakeApi.md) | [**testInlineAdditionalProperties**](doc/FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[*FakeApi*](doc/FakeApi.md) | [**testJsonFormData**](doc/FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +[*FakeApi*](doc/FakeApi.md) | [**testQueryParameterCollectionFormat**](doc/FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | +[*FakeClassnameTags123Api*](doc/FakeClassnameTags123Api.md) | [**testClassname**](doc/FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case +[*FooApi*](doc/FooApi.md) | [**createFoo**](doc/FooApi.md#createfoo) | **POST** /foo | Create a Foo +[*FooApi*](doc/FooApi.md) | [**getAllFoos**](doc/FooApi.md#getallfoos) | **GET** /foo | GET all Foos +[*PetApi*](doc/PetApi.md) | [**addPet**](doc/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +[*PetApi*](doc/PetApi.md) | [**deletePet**](doc/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[*PetApi*](doc/PetApi.md) | [**findPetsByStatus**](doc/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +[*PetApi*](doc/PetApi.md) | [**findPetsByTags**](doc/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +[*PetApi*](doc/PetApi.md) | [**getPetById**](doc/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[*PetApi*](doc/PetApi.md) | [**updatePet**](doc/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +[*PetApi*](doc/PetApi.md) | [**updatePetWithForm**](doc/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +[*PetApi*](doc/PetApi.md) | [**uploadFile**](doc/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +[*PetApi*](doc/PetApi.md) | [**uploadFileWithRequiredFile**](doc/PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +[*StoreApi*](doc/StoreApi.md) | [**deleteOrder**](doc/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[*StoreApi*](doc/StoreApi.md) | [**getInventory**](doc/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[*StoreApi*](doc/StoreApi.md) | [**getOrderById**](doc/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID +[*StoreApi*](doc/StoreApi.md) | [**placeOrder**](doc/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet +[*UserApi*](doc/UserApi.md) | [**createUser**](doc/UserApi.md#createuser) | **POST** /user | Create user +[*UserApi*](doc/UserApi.md) | [**createUsersWithArrayInput**](doc/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +[*UserApi*](doc/UserApi.md) | [**createUsersWithListInput**](doc/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +[*UserApi*](doc/UserApi.md) | [**deleteUser**](doc/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +[*UserApi*](doc/UserApi.md) | [**getUserByName**](doc/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +[*UserApi*](doc/UserApi.md) | [**loginUser**](doc/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +[*UserApi*](doc/UserApi.md) | [**logoutUser**](doc/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +[*UserApi*](doc/UserApi.md) | [**updateUser**](doc/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + +## Documentation For Models + + - [AdditionalPropertiesClass](doc/AdditionalPropertiesClass.md) + - [Addressable](doc/Addressable.md) + - [AllOfWithSingleRef](doc/AllOfWithSingleRef.md) + - [Animal](doc/Animal.md) + - [ApiResponse](doc/ApiResponse.md) + - [Apple](doc/Apple.md) + - [AppleAllOfDisc](doc/AppleAllOfDisc.md) + - [AppleGrandparentDisc](doc/AppleGrandparentDisc.md) + - [AppleOneOfDisc](doc/AppleOneOfDisc.md) + - [AppleReqDisc](doc/AppleReqDisc.md) + - [AppleVariant1](doc/AppleVariant1.md) + - [ArrayOfArrayOfNumberOnly](doc/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](doc/ArrayOfNumberOnly.md) + - [ArrayTest](doc/ArrayTest.md) + - [Banana](doc/Banana.md) + - [BananaAllOfDisc](doc/BananaAllOfDisc.md) + - [BananaGrandparentDisc](doc/BananaGrandparentDisc.md) + - [BananaOneOfDisc](doc/BananaOneOfDisc.md) + - [BananaReqDisc](doc/BananaReqDisc.md) + - [Bar](doc/Bar.md) + - [BarCreate](doc/BarCreate.md) + - [BarRef](doc/BarRef.md) + - [BarRefOrValue](doc/BarRefOrValue.md) + - [Capitalization](doc/Capitalization.md) + - [Cat](doc/Cat.md) + - [Category](doc/Category.md) + - [ClassModel](doc/ClassModel.md) + - [ComposedDiscMissingFromProperties](doc/ComposedDiscMissingFromProperties.md) + - [ComposedDiscOptionalTypeCorrect](doc/ComposedDiscOptionalTypeCorrect.md) + - [ComposedDiscOptionalTypeInconsistent](doc/ComposedDiscOptionalTypeInconsistent.md) + - [ComposedDiscOptionalTypeIncorrect](doc/ComposedDiscOptionalTypeIncorrect.md) + - [ComposedDiscRequiredInconsistent](doc/ComposedDiscRequiredInconsistent.md) + - [ComposedDiscTypeInconsistent](doc/ComposedDiscTypeInconsistent.md) + - [ComposedDiscTypeIncorrect](doc/ComposedDiscTypeIncorrect.md) + - [DeprecatedObject](doc/DeprecatedObject.md) + - [DiscMissingFromProperties](doc/DiscMissingFromProperties.md) + - [DiscOptionalTypeCorrect](doc/DiscOptionalTypeCorrect.md) + - [DiscOptionalTypeIncorrect](doc/DiscOptionalTypeIncorrect.md) + - [DiscTypeIncorrect](doc/DiscTypeIncorrect.md) + - [Dog](doc/Dog.md) + - [Entity](doc/Entity.md) + - [EntityRef](doc/EntityRef.md) + - [EnumArrays](doc/EnumArrays.md) + - [EnumTest](doc/EnumTest.md) + - [Extensible](doc/Extensible.md) + - [FileSchemaTestClass](doc/FileSchemaTestClass.md) + - [Foo](doc/Foo.md) + - [FooBasicGetDefaultResponse](doc/FooBasicGetDefaultResponse.md) + - [FooRef](doc/FooRef.md) + - [FooRefOrValue](doc/FooRefOrValue.md) + - [FormatTest](doc/FormatTest.md) + - [Fruit](doc/Fruit.md) + - [FruitAllOfDisc](doc/FruitAllOfDisc.md) + - [FruitAnyOfDisc](doc/FruitAnyOfDisc.md) + - [FruitGrandparentDisc](doc/FruitGrandparentDisc.md) + - [FruitInlineDisc](doc/FruitInlineDisc.md) + - [FruitInlineDiscOneOf](doc/FruitInlineDiscOneOf.md) + - [FruitInlineDiscOneOf1](doc/FruitInlineDiscOneOf1.md) + - [FruitInlineInlineDisc](doc/FruitInlineInlineDisc.md) + - [FruitInlineInlineDiscOneOf](doc/FruitInlineInlineDiscOneOf.md) + - [FruitInlineInlineDiscOneOf1](doc/FruitInlineInlineDiscOneOf1.md) + - [FruitInlineInlineDiscOneOfOneOf](doc/FruitInlineInlineDiscOneOfOneOf.md) + - [FruitOneOfDisc](doc/FruitOneOfDisc.md) + - [FruitReqDisc](doc/FruitReqDisc.md) + - [FruitType](doc/FruitType.md) + - [FruitVariant1](doc/FruitVariant1.md) + - [GigaOneOf](doc/GigaOneOf.md) + - [GrapeVariant1](doc/GrapeVariant1.md) + - [HasOnlyReadOnly](doc/HasOnlyReadOnly.md) + - [HealthCheckResult](doc/HealthCheckResult.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) + - [ObjectWithDeprecatedFields](doc/ObjectWithDeprecatedFields.md) + - [OneOfPrimitiveChild](doc/OneOfPrimitiveChild.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) + - [Parent](doc/Parent.md) + - [Pasta](doc/Pasta.md) + - [Pet](doc/Pet.md) + - [Pizza](doc/Pizza.md) + - [PizzaSpeziale](doc/PizzaSpeziale.md) + - [ReadOnlyFirst](doc/ReadOnlyFirst.md) + - [SingleRefType](doc/SingleRefType.md) + - [SpecialModelName](doc/SpecialModelName.md) + - [Tag](doc/Tag.md) + - [User](doc/User.md) + + +## Documentation For Authorization + + +Authentication schemes defined for the API: +### 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 + +### 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 + +### http_basic_test + +- **Type**: HTTP basic authentication + +### bearer_test + +- **Type**: HTTP Bearer Token authentication (JWT) + +### http_signature_test + +- **Type**: HTTP signature authentication + + +## Author + + + diff --git a/samples/client/echo_api/dart/dio/built_value/analysis_options.yaml b/samples/client/echo_api/dart/dio/built_value/analysis_options.yaml new file mode 100644 index 000000000000..c84e864f76be --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/analysis_options.yaml @@ -0,0 +1,11 @@ +analyzer: + language: + strict-inference: true + strict-raw-types: true + strict-casts: true + exclude: + errors: + deprecated_member_use_from_same_package: ignore + unused_import: ignore + unused_local_variable: ignore + unnecessary_import: ignore \ No newline at end of file diff --git a/samples/client/echo_api/dart/dio/built_value/doc/AdditionalPropertiesClass.md b/samples/client/echo_api/dart/dio/built_value/doc/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..601ddeb51087 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/AdditionalPropertiesClass.md @@ -0,0 +1,16 @@ +# openapi.model.AdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapProperty** | **BuiltMap<String, String>** | | [optional] +**mapOfMapProperty** | [**BuiltMap<String, BuiltMap<String, String>>**](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/client/echo_api/dart/dio/built_value/doc/Addressable.md b/samples/client/echo_api/dart/dio/built_value/doc/Addressable.md new file mode 100644 index 000000000000..d8b9beee9f52 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Addressable.md @@ -0,0 +1,16 @@ +# openapi.model.Addressable + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/AllOfWithSingleRef.md b/samples/client/echo_api/dart/dio/built_value/doc/AllOfWithSingleRef.md new file mode 100644 index 000000000000..b8c8c51c80af --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/AllOfWithSingleRef.md @@ -0,0 +1,16 @@ +# openapi.model.AllOfWithSingleRef + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **String** | | [optional] +**singleRefType** | [**SingleRefType**](SingleRefType.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/client/echo_api/dart/dio/built_value/doc/Animal.md b/samples/client/echo_api/dart/dio/built_value/doc/Animal.md new file mode 100644 index 000000000000..df78e9937613 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Animal.md @@ -0,0 +1,16 @@ +# openapi.model.Animal + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/AnotherFakeApi.md b/samples/client/echo_api/dart/dio/built_value/doc/AnotherFakeApi.md new file mode 100644 index 000000000000..d45812aa3fde --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/AnotherFakeApi.md @@ -0,0 +1,57 @@ +# openapi.api.AnotherFakeApi + +## Load the API package +```dart +import 'package:openapi/openapi.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/openapi.dart'; + +final api = Openapi().getAnotherFakeApi(); +final ModelClient modelClient = ; // ModelClient | client model + +try { + final response = api.call123testSpecialTags(modelClient); + print(response); +} catch on DioException (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/client/echo_api/dart/dio/built_value/doc/ApiResponse.md b/samples/client/echo_api/dart/dio/built_value/doc/ApiResponse.md new file mode 100644 index 000000000000..2928d50be81a --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/ApiResponse.md @@ -0,0 +1,17 @@ +# openapi.model.ApiResponse + +## Load the model package +```dart +import 'package:openapi/openapi.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/petstore_client_lib_fake-json_serializable/doc/DogAllOf.md b/samples/client/echo_api/dart/dio/built_value/doc/Apple.md similarity index 75% rename from samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/DogAllOf.md rename to samples/client/echo_api/dart/dio/built_value/doc/Apple.md index 97a7c8fba492..14d4a3415182 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/DogAllOf.md +++ b/samples/client/echo_api/dart/dio/built_value/doc/Apple.md @@ -1,14 +1,14 @@ -# openapi.model.DogAllOf +# openapi.model.Apple ## Load the model package ```dart -import 'package:openapi/api.dart'; +import 'package:openapi/openapi.dart'; ``` ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**breed** | **String** | | [optional] +**kind** | **String** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/echo_api/dart/dio/built_value/doc/AppleAllOfDisc.md b/samples/client/echo_api/dart/dio/built_value/doc/AppleAllOfDisc.md new file mode 100644 index 000000000000..0e7d4c990e48 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/AppleAllOfDisc.md @@ -0,0 +1,16 @@ +# openapi.model.AppleAllOfDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/AppleGrandparentDisc.md b/samples/client/echo_api/dart/dio/built_value/doc/AppleGrandparentDisc.md new file mode 100644 index 000000000000..41bb14fd764b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/AppleGrandparentDisc.md @@ -0,0 +1,16 @@ +# openapi.model.AppleGrandparentDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/AppleOneOfDisc.md b/samples/client/echo_api/dart/dio/built_value/doc/AppleOneOfDisc.md new file mode 100644 index 000000000000..85eeb8a99eea --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/AppleOneOfDisc.md @@ -0,0 +1,16 @@ +# openapi.model.AppleOneOfDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/AppleReqDisc.md b/samples/client/echo_api/dart/dio/built_value/doc/AppleReqDisc.md new file mode 100644 index 000000000000..262c02ab50eb --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/AppleReqDisc.md @@ -0,0 +1,16 @@ +# openapi.model.AppleReqDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/AppleVariant1.md b/samples/client/echo_api/dart/dio/built_value/doc/AppleVariant1.md new file mode 100644 index 000000000000..82de5e6a492a --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/AppleVariant1.md @@ -0,0 +1,15 @@ +# openapi.model.AppleVariant1 + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/ArrayOfArrayOfNumberOnly.md b/samples/client/echo_api/dart/dio/built_value/doc/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..93a7169d0f72 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayArrayNumber** | [**BuiltList<BuiltList<num>>**](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/client/echo_api/dart/dio/built_value/doc/ArrayOfNumberOnly.md b/samples/client/echo_api/dart/dio/built_value/doc/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..7e739e91fc33 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/ArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayNumber** | **BuiltList<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/client/echo_api/dart/dio/built_value/doc/ArrayTest.md b/samples/client/echo_api/dart/dio/built_value/doc/ArrayTest.md new file mode 100644 index 000000000000..1dd8a3a41ac8 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/ArrayTest.md @@ -0,0 +1,17 @@ +# openapi.model.ArrayTest + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayOfString** | **BuiltList<String>** | | [optional] +**arrayArrayOfInteger** | [**BuiltList<BuiltList<int>>**](BuiltList.md) | | [optional] +**arrayArrayOfModel** | [**BuiltList<BuiltList<ReadOnlyFirst>>**](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/petstore_client_lib_fake/doc/DogAllOf.md b/samples/client/echo_api/dart/dio/built_value/doc/Banana.md similarity index 75% rename from samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/DogAllOf.md rename to samples/client/echo_api/dart/dio/built_value/doc/Banana.md index 97a7c8fba492..cdae69466a61 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/DogAllOf.md +++ b/samples/client/echo_api/dart/dio/built_value/doc/Banana.md @@ -1,14 +1,14 @@ -# openapi.model.DogAllOf +# openapi.model.Banana ## Load the model package ```dart -import 'package:openapi/api.dart'; +import 'package:openapi/openapi.dart'; ``` ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**breed** | **String** | | [optional] +**count** | **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/client/echo_api/dart/dio/built_value/doc/BananaAllOfDisc.md b/samples/client/echo_api/dart/dio/built_value/doc/BananaAllOfDisc.md new file mode 100644 index 000000000000..668b2bf1af02 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/BananaAllOfDisc.md @@ -0,0 +1,16 @@ +# openapi.model.BananaAllOfDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/BananaGrandparentDisc.md b/samples/client/echo_api/dart/dio/built_value/doc/BananaGrandparentDisc.md new file mode 100644 index 000000000000..81bbb6cb54a6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/BananaGrandparentDisc.md @@ -0,0 +1,16 @@ +# openapi.model.BananaGrandparentDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/BananaOneOfDisc.md b/samples/client/echo_api/dart/dio/built_value/doc/BananaOneOfDisc.md new file mode 100644 index 000000000000..951cc5839179 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/BananaOneOfDisc.md @@ -0,0 +1,16 @@ +# openapi.model.BananaOneOfDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/BananaReqDisc.md b/samples/client/echo_api/dart/dio/built_value/doc/BananaReqDisc.md new file mode 100644 index 000000000000..574a3383916b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/BananaReqDisc.md @@ -0,0 +1,16 @@ +# openapi.model.BananaReqDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/Bar.md b/samples/client/echo_api/dart/dio/built_value/doc/Bar.md new file mode 100644 index 000000000000..e0668151935d --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Bar.md @@ -0,0 +1,22 @@ +# openapi.model.Bar + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**barPropA** | **String** | | [optional] +**fooPropB** | **String** | | [optional] +**foo** | [**FooRefOrValue**](FooRefOrValue.md) | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/built_value/doc/BarApi.md b/samples/client/echo_api/dart/dio/built_value/doc/BarApi.md new file mode 100644 index 000000000000..fd968c59c3ef --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/BarApi.md @@ -0,0 +1,55 @@ +# openapi.api.BarApi + +## Load the API package +```dart +import 'package:openapi/openapi.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createBar**](BarApi.md#createbar) | **POST** /bar | Create a Bar + + +# **createBar** +> Bar createBar(barCreate) + +Create a Bar + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getBarApi(); +final BarCreate barCreate = ; // BarCreate | + +try { + final response = api.createBar(barCreate); + print(response); +} catch on DioException (e) { + print('Exception when calling BarApi->createBar: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **barCreate** | [**BarCreate**](BarCreate.md)| | + +### Return type + +[**Bar**](Bar.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/client/echo_api/dart/dio/built_value/doc/BarCreate.md b/samples/client/echo_api/dart/dio/built_value/doc/BarCreate.md new file mode 100644 index 000000000000..bb0dbfd55790 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/BarCreate.md @@ -0,0 +1,22 @@ +# openapi.model.BarCreate + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**barPropA** | **String** | | [optional] +**fooPropB** | **String** | | [optional] +**foo** | [**FooRefOrValue**](FooRefOrValue.md) | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/oneof_polymorphism_and_inheritance/doc/FooRefOrValueWithProperties.md b/samples/client/echo_api/dart/dio/built_value/doc/BarRef.md similarity index 90% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/FooRefOrValueWithProperties.md rename to samples/client/echo_api/dart/dio/built_value/doc/BarRef.md index 05aa2b0bbc1c..b9eab1af1a9b 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/FooRefOrValueWithProperties.md +++ b/samples/client/echo_api/dart/dio/built_value/doc/BarRef.md @@ -1,8 +1,8 @@ -# openapi.model.FooRefOrValueWithProperties +# openapi.model.BarRef ## Load the model package ```dart -import 'package:openapi/api.dart'; +import 'package:openapi/openapi.dart'; ``` ## Properties diff --git a/samples/client/echo_api/dart/dio/built_value/doc/BarRefOrValue.md b/samples/client/echo_api/dart/dio/built_value/doc/BarRefOrValue.md new file mode 100644 index 000000000000..fea6617a3c12 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/BarRefOrValue.md @@ -0,0 +1,19 @@ +# openapi.model.BarRefOrValue + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/built_value/doc/Capitalization.md b/samples/client/echo_api/dart/dio/built_value/doc/Capitalization.md new file mode 100644 index 000000000000..7e933ba524a7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Capitalization.md @@ -0,0 +1,20 @@ +# openapi.model.Capitalization + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/Cat.md b/samples/client/echo_api/dart/dio/built_value/doc/Cat.md new file mode 100644 index 000000000000..b7998f19f95f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Cat.md @@ -0,0 +1,17 @@ +# openapi.model.Cat + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/Category.md b/samples/client/echo_api/dart/dio/built_value/doc/Category.md new file mode 100644 index 000000000000..5e51f5aa35bc --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Category.md @@ -0,0 +1,16 @@ +# openapi.model.Category + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/ClassModel.md b/samples/client/echo_api/dart/dio/built_value/doc/ClassModel.md new file mode 100644 index 000000000000..20a4715e3ca0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/ClassModel.md @@ -0,0 +1,15 @@ +# openapi.model.ClassModel + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**classField** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscMissingFromProperties.md b/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscMissingFromProperties.md new file mode 100644 index 000000000000..4137cc1a0add --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscMissingFromProperties.md @@ -0,0 +1,15 @@ +# openapi.model.ComposedDiscMissingFromProperties + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **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/client/echo_api/dart/dio/built_value/doc/ComposedDiscOptionalTypeCorrect.md b/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscOptionalTypeCorrect.md new file mode 100644 index 000000000000..ab27d1c4473a --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscOptionalTypeCorrect.md @@ -0,0 +1,15 @@ +# openapi.model.ComposedDiscOptionalTypeCorrect + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscOptionalTypeInconsistent.md b/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscOptionalTypeInconsistent.md new file mode 100644 index 000000000000..8c32b4c72b6b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscOptionalTypeInconsistent.md @@ -0,0 +1,15 @@ +# openapi.model.ComposedDiscOptionalTypeInconsistent + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscOptionalTypeIncorrect.md b/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscOptionalTypeIncorrect.md new file mode 100644 index 000000000000..4f0fab65accc --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscOptionalTypeIncorrect.md @@ -0,0 +1,15 @@ +# openapi.model.ComposedDiscOptionalTypeIncorrect + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **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/client/echo_api/dart/dio/built_value/doc/ComposedDiscRequiredInconsistent.md b/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscRequiredInconsistent.md new file mode 100644 index 000000000000..bc60f26b183c --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscRequiredInconsistent.md @@ -0,0 +1,15 @@ +# openapi.model.ComposedDiscRequiredInconsistent + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscTypeInconsistent.md b/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscTypeInconsistent.md new file mode 100644 index 000000000000..0cdb9b880b9f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscTypeInconsistent.md @@ -0,0 +1,15 @@ +# openapi.model.ComposedDiscTypeInconsistent + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscTypeIncorrect.md b/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscTypeIncorrect.md new file mode 100644 index 000000000000..8000df558df6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/ComposedDiscTypeIncorrect.md @@ -0,0 +1,15 @@ +# openapi.model.ComposedDiscTypeIncorrect + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **int** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/DefaultApi.md b/samples/client/echo_api/dart/dio/built_value/doc/DefaultApi.md new file mode 100644 index 000000000000..27ab9220443c --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/DefaultApi.md @@ -0,0 +1,244 @@ +# openapi.api.DefaultApi + +## Load the API package +```dart +import 'package:openapi/openapi.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fooBasicGet**](DefaultApi.md#foobasicget) | **GET** /foo-basic | +[**list**](DefaultApi.md#list) | **GET** /oneof-primitive | +[**oneofGet**](DefaultApi.md#oneofget) | **GET** /oneof | +[**test**](DefaultApi.md#test) | **PUT** /variant1 | +[**variant1Get**](DefaultApi.md#variant1get) | **GET** /variant1 | +[**variant2Get**](DefaultApi.md#variant2get) | **GET** /variant2 | + + +# **fooBasicGet** +> FooBasicGetDefaultResponse fooBasicGet() + + + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getDefaultApi(); + +try { + final response = api.fooBasicGet(); + print(response); +} catch on DioException (e) { + print('Exception when calling DefaultApi->fooBasicGet: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FooBasicGetDefaultResponse**](FooBasicGetDefaultResponse.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) + +# **list** +> GigaOneOf list() + + + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getDefaultApi(); + +try { + final response = api.list(); + print(response); +} catch on DioException (e) { + print('Exception when calling DefaultApi->list: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**GigaOneOf**](GigaOneOf.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) + +# **oneofGet** +> Fruit oneofGet() + + + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getDefaultApi(); + +try { + final response = api.oneofGet(); + print(response); +} catch on DioException (e) { + print('Exception when calling DefaultApi->oneofGet: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**Fruit**](Fruit.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) + +# **test** +> test(body) + + + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getDefaultApi(); +final JsonObject body = ; // JsonObject | + +try { + api.test(body); +} catch on DioException (e) { + print('Exception when calling DefaultApi->test: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **JsonObject**| | [optional] + +### 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) + +# **variant1Get** +> FruitVariant1 variant1Get() + + + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getDefaultApi(); + +try { + final response = api.variant1Get(); + print(response); +} catch on DioException (e) { + print('Exception when calling DefaultApi->variant1Get: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FruitVariant1**](FruitVariant1.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) + +# **variant2Get** +> FruitAllOfDisc variant2Get() + + + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getDefaultApi(); + +try { + final response = api.variant2Get(); + print(response); +} catch on DioException (e) { + print('Exception when calling DefaultApi->variant2Get: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FruitAllOfDisc**](FruitAllOfDisc.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/client/echo_api/dart/dio/built_value/doc/DeprecatedObject.md b/samples/client/echo_api/dart/dio/built_value/doc/DeprecatedObject.md new file mode 100644 index 000000000000..76215e98669f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/DeprecatedObject.md @@ -0,0 +1,15 @@ +# openapi.model.DeprecatedObject + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**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/client/echo_api/dart/dio/built_value/doc/DiscMissingFromProperties.md b/samples/client/echo_api/dart/dio/built_value/doc/DiscMissingFromProperties.md new file mode 100644 index 000000000000..c38a5c2b5226 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/DiscMissingFromProperties.md @@ -0,0 +1,15 @@ +# openapi.model.DiscMissingFromProperties + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **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/client/echo_api/dart/dio/built_value/doc/DiscOptionalTypeCorrect.md b/samples/client/echo_api/dart/dio/built_value/doc/DiscOptionalTypeCorrect.md new file mode 100644 index 000000000000..38601f552917 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/DiscOptionalTypeCorrect.md @@ -0,0 +1,15 @@ +# openapi.model.DiscOptionalTypeCorrect + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/DiscOptionalTypeIncorrect.md b/samples/client/echo_api/dart/dio/built_value/doc/DiscOptionalTypeIncorrect.md new file mode 100644 index 000000000000..b6787edea47b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/DiscOptionalTypeIncorrect.md @@ -0,0 +1,15 @@ +# openapi.model.DiscOptionalTypeIncorrect + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **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/client/echo_api/dart/dio/built_value/doc/DiscTypeIncorrect.md b/samples/client/echo_api/dart/dio/built_value/doc/DiscTypeIncorrect.md new file mode 100644 index 000000000000..519a8e0333e7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/DiscTypeIncorrect.md @@ -0,0 +1,15 @@ +# openapi.model.DiscTypeIncorrect + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **int** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/Dog.md b/samples/client/echo_api/dart/dio/built_value/doc/Dog.md new file mode 100644 index 000000000000..712ed082eb91 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Dog.md @@ -0,0 +1,17 @@ +# openapi.model.Dog + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/Entity.md b/samples/client/echo_api/dart/dio/built_value/doc/Entity.md new file mode 100644 index 000000000000..ccf43340ed10 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Entity.md @@ -0,0 +1,19 @@ +# openapi.model.Entity + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/built_value/doc/EntityRef.md b/samples/client/echo_api/dart/dio/built_value/doc/EntityRef.md new file mode 100644 index 000000000000..6fad4884910f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/EntityRef.md @@ -0,0 +1,21 @@ +# openapi.model.EntityRef + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Name of the related entity. | [optional] +**atReferredType** | **String** | The actual type of the target instance when needed for disambiguation. | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/built_value/doc/EnumArrays.md b/samples/client/echo_api/dart/dio/built_value/doc/EnumArrays.md new file mode 100644 index 000000000000..7d18f70dbf85 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/EnumArrays.md @@ -0,0 +1,16 @@ +# openapi.model.EnumArrays + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justSymbol** | **String** | | [optional] +**arrayEnum** | **BuiltList<String>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/EnumTest.md b/samples/client/echo_api/dart/dio/built_value/doc/EnumTest.md new file mode 100644 index 000000000000..8dc105ee3146 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/EnumTest.md @@ -0,0 +1,22 @@ +# openapi.model.EnumTest + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/Extensible.md b/samples/client/echo_api/dart/dio/built_value/doc/Extensible.md new file mode 100644 index 000000000000..76e8c3340955 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Extensible.md @@ -0,0 +1,17 @@ +# openapi.model.Extensible + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/built_value/doc/FakeApi.md b/samples/client/echo_api/dart/dio/built_value/doc/FakeApi.md new file mode 100644 index 000000000000..a93c2ba8f348 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FakeApi.md @@ -0,0 +1,816 @@ +# openapi.api.FakeApi + +## Load the API package +```dart +import 'package:openapi/openapi.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 | +[**testBodyWithBinary**](FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | +[**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-parameters | + + +# **fakeHealthGet** +> HealthCheckResult fakeHealthGet() + +Health check endpoint + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getFakeApi(); + +try { + final response = api.fakeHealthGet(); + print(response); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store +final String query1 = query1_example; // String | query parameter +final String header1 = header1_example; // String | header parameter + +try { + api.fakeHttpSignatureTest(pet, query1, header1); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final bool body = true; // bool | Input boolean as post body + +try { + final response = api.fakeOuterBooleanSerialize(body); + print(response); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final OuterComposite outerComposite = ; // OuterComposite | Input composite as post body + +try { + final response = api.fakeOuterCompositeSerialize(outerComposite); + print(response); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final num body = 8.14; // num | Input number as post body + +try { + final response = api.fakeOuterNumberSerialize(body); + print(response); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final String body = body_example; // String | Input string as post body + +try { + final response = api.fakeOuterStringSerialize(body); + print(response); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final OuterObjectWithEnumProperty outerObjectWithEnumProperty = ; // OuterObjectWithEnumProperty | Input enum (int) as post body + +try { + final response = api.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty); + print(response); +} catch on DioException (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) + +# **testBodyWithBinary** +> testBodyWithBinary(body) + + + +For this test, the body has to be a binary file. + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getFakeApi(); +final MultipartFile body = BINARY_DATA_HERE; // MultipartFile | image to upload + +try { + api.testBodyWithBinary(body); +} catch on DioException (e) { + print('Exception when calling FakeApi->testBodyWithBinary: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **MultipartFile**| image to upload | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: image/png + - **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) + +# **testBodyWithFileSchema** +> testBodyWithFileSchema(fileSchemaTestClass) + + + +For this test, the body for this request must reference a schema named `File`. + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getFakeApi(); +final FileSchemaTestClass fileSchemaTestClass = ; // FileSchemaTestClass | + +try { + api.testBodyWithFileSchema(fileSchemaTestClass); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final String query = query_example; // String | +final User user = ; // User | + +try { + api.testBodyWithQueryParams(query, user); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final ModelClient modelClient = ; // ModelClient | client model + +try { + final response = api.testClientModel(modelClient); + print(response); +} catch on DioException (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/openapi.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'; + +final api = Openapi().getFakeApi(); +final num number = 8.14; // num | None +final double double_ = 1.2; // double | None +final String patternWithoutDelimiter = patternWithoutDelimiter_example; // String | None +final String byte = BYTE_ARRAY_DATA_HERE; // String | None +final int integer = 56; // int | None +final int int32 = 56; // int | None +final int int64 = 789; // int | None +final double float = 3.4; // double | None +final String string = string_example; // String | None +final Uint8List binary = BINARY_DATA_HERE; // Uint8List | None +final Date date = 2013-10-20; // Date | None +final DateTime dateTime = 2013-10-20T19:20:30+01:00; // DateTime | None +final String password = password_example; // String | None +final String callback = callback_example; // String | None + +try { + api.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); +} catch on DioException (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** | **Date**| 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, enumQueryModelArray, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getFakeApi(); +final BuiltList enumHeaderStringArray = ; // BuiltList | Header parameter enum test (string array) +final String enumHeaderString = enumHeaderString_example; // String | Header parameter enum test (string) +final BuiltList enumQueryStringArray = ; // BuiltList | Query parameter enum test (string array) +final String enumQueryString = enumQueryString_example; // String | Query parameter enum test (string) +final int enumQueryInteger = 56; // int | Query parameter enum test (double) +final double enumQueryDouble = 1.2; // double | Query parameter enum test (double) +final BuiltList enumQueryModelArray = ; // BuiltList | +final BuiltList enumFormStringArray = ; // BuiltList | Form parameter enum test (string array) +final String enumFormString = enumFormString_example; // String | Form parameter enum test (string) + +try { + api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString); +} catch on DioException (e) { + print('Exception when calling FakeApi->testEnumParameters: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**BuiltList<String>**](String.md)| Header parameter enum test (string array) | [optional] + **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to r'-efg'] + **enumQueryStringArray** | [**BuiltList<String>**](String.md)| Query parameter enum test (string array) | [optional] + **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to r'-efg'] + **enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] + **enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] + **enumQueryModelArray** | [**BuiltList<ModelEnumClass>**](ModelEnumClass.md)| | [optional] + **enumFormStringArray** | [**BuiltList<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to r'$'] + **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to r'-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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final int requiredStringGroup = 56; // int | Required String in group parameters +final bool requiredBooleanGroup = true; // bool | Required Boolean in group parameters +final int requiredInt64Group = 789; // int | Required Integer in group parameters +final int stringGroup = 56; // int | String in group parameters +final bool booleanGroup = true; // bool | Boolean in group parameters +final int int64Group = 789; // int | Integer in group parameters + +try { + api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final BuiltMap requestBody = ; // BuiltMap | request body + +try { + api.testInlineAdditionalProperties(requestBody); +} catch on DioException (e) { + print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**BuiltMap<String, String>**](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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final String param = param_example; // String | field1 +final String param2 = param2_example; // String | field2 + +try { + api.testJsonFormData(param, param2); +} catch on DioException (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, allowEmpty, language) + + + +To test the collection format in query parameters + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getFakeApi(); +final BuiltList pipe = ; // BuiltList | +final BuiltList ioutil = ; // BuiltList | +final BuiltList http = ; // BuiltList | +final BuiltList url = ; // BuiltList | +final BuiltList context = ; // BuiltList | +final String allowEmpty = allowEmpty_example; // String | +final BuiltMap language = ; // BuiltMap | + +try { + api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); +} catch on DioException (e) { + print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pipe** | [**BuiltList<String>**](String.md)| | + **ioutil** | [**BuiltList<String>**](String.md)| | + **http** | [**BuiltList<String>**](String.md)| | + **url** | [**BuiltList<String>**](String.md)| | + **context** | [**BuiltList<String>**](String.md)| | + **allowEmpty** | **String**| | + **language** | [**BuiltMap<String, String>**](String.md)| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/FakeClassnameTags123Api.md b/samples/client/echo_api/dart/dio/built_value/doc/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..663901532d62 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FakeClassnameTags123Api.md @@ -0,0 +1,61 @@ +# openapi.api.FakeClassnameTags123Api + +## Load the API package +```dart +import 'package:openapi/openapi.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/openapi.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'; + +final api = Openapi().getFakeClassnameTags123Api(); +final ModelClient modelClient = ; // ModelClient | client model + +try { + final response = api.testClassname(modelClient); + print(response); +} catch on DioException (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/client/echo_api/dart/dio/built_value/doc/FileSchemaTestClass.md b/samples/client/echo_api/dart/dio/built_value/doc/FileSchemaTestClass.md new file mode 100644 index 000000000000..83d57e45bce5 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FileSchemaTestClass.md @@ -0,0 +1,16 @@ +# openapi.model.FileSchemaTestClass + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**ModelFile**](ModelFile.md) | | [optional] +**files** | [**BuiltList<ModelFile>**](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/client/echo_api/dart/dio/built_value/doc/Foo.md b/samples/client/echo_api/dart/dio/built_value/doc/Foo.md new file mode 100644 index 000000000000..c03233a1b1df --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Foo.md @@ -0,0 +1,21 @@ +# openapi.model.Foo + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fooPropA** | **String** | | [optional] +**fooPropB** | **String** | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/built_value/doc/FooApi.md b/samples/client/echo_api/dart/dio/built_value/doc/FooApi.md new file mode 100644 index 000000000000..463bd59a8a15 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FooApi.md @@ -0,0 +1,93 @@ +# openapi.api.FooApi + +## Load the API package +```dart +import 'package:openapi/openapi.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createFoo**](FooApi.md#createfoo) | **POST** /foo | Create a Foo +[**getAllFoos**](FooApi.md#getallfoos) | **GET** /foo | GET all Foos + + +# **createFoo** +> FooRefOrValue createFoo(foo) + +Create a Foo + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getFooApi(); +final Foo foo = ; // Foo | The Foo to be created + +try { + final response = api.createFoo(foo); + print(response); +} catch on DioException (e) { + print('Exception when calling FooApi->createFoo: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **foo** | [**Foo**](Foo.md)| The Foo to be created | [optional] + +### Return type + +[**FooRefOrValue**](FooRefOrValue.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json;charset=utf-8 + - **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) + +# **getAllFoos** +> BuiltList getAllFoos() + +GET all Foos + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getFooApi(); + +try { + final response = api.getAllFoos(); + print(response); +} catch on DioException (e) { + print('Exception when calling FooApi->getAllFoos: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**BuiltList<FooRefOrValue>**](FooRefOrValue.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json;charset=utf-8 + +[[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/petstore_client_lib_fake/doc/InlineResponseDefault.md b/samples/client/echo_api/dart/dio/built_value/doc/FooBasicGetDefaultResponse.md similarity index 81% rename from samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineResponseDefault.md rename to samples/client/echo_api/dart/dio/built_value/doc/FooBasicGetDefaultResponse.md index c5e61e1162bf..504630ea31a9 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/InlineResponseDefault.md +++ b/samples/client/echo_api/dart/dio/built_value/doc/FooBasicGetDefaultResponse.md @@ -1,8 +1,8 @@ -# openapi.model.InlineResponseDefault +# openapi.model.FooBasicGetDefaultResponse ## Load the model package ```dart -import 'package:openapi/api.dart'; +import 'package:openapi/openapi.dart'; ``` ## Properties diff --git a/samples/client/echo_api/dart/dio/built_value/doc/FooRef.md b/samples/client/echo_api/dart/dio/built_value/doc/FooRef.md new file mode 100644 index 000000000000..d49ad9b8a84f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FooRef.md @@ -0,0 +1,20 @@ +# openapi.model.FooRef + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foorefPropA** | **String** | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/built_value/doc/FooRefOrValue.md b/samples/client/echo_api/dart/dio/built_value/doc/FooRefOrValue.md new file mode 100644 index 000000000000..e79adafd24e7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FooRefOrValue.md @@ -0,0 +1,19 @@ +# openapi.model.FooRefOrValue + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/built_value/doc/FormatTest.md b/samples/client/echo_api/dart/dio/built_value/doc/FormatTest.md new file mode 100644 index 000000000000..cb4c2f81d133 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FormatTest.md @@ -0,0 +1,30 @@ +# openapi.model.FormatTest + +## Load the model package +```dart +import 'package:openapi/openapi.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** | [**Date**](Date.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/client/echo_api/dart/dio/built_value/doc/Fruit.md b/samples/client/echo_api/dart/dio/built_value/doc/Fruit.md new file mode 100644 index 000000000000..fd6be273d730 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Fruit.md @@ -0,0 +1,17 @@ +# openapi.model.Fruit + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**color** | **String** | | [optional] +**kind** | **String** | | [optional] +**count** | **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/client/echo_api/dart/dio/built_value/doc/FruitAllOfDisc.md b/samples/client/echo_api/dart/dio/built_value/doc/FruitAllOfDisc.md new file mode 100644 index 000000000000..f63fe99752c0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FruitAllOfDisc.md @@ -0,0 +1,15 @@ +# openapi.model.FruitAllOfDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/FruitAnyOfDisc.md b/samples/client/echo_api/dart/dio/built_value/doc/FruitAnyOfDisc.md new file mode 100644 index 000000000000..c77b16556c53 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FruitAnyOfDisc.md @@ -0,0 +1,15 @@ +# openapi.model.FruitAnyOfDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/FruitGrandparentDisc.md b/samples/client/echo_api/dart/dio/built_value/doc/FruitGrandparentDisc.md new file mode 100644 index 000000000000..ce9687bf5a6a --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FruitGrandparentDisc.md @@ -0,0 +1,15 @@ +# openapi.model.FruitGrandparentDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineDisc.md b/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineDisc.md new file mode 100644 index 000000000000..634614481813 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineDisc.md @@ -0,0 +1,17 @@ +# openapi.model.FruitInlineDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **int** | | +**fruitType** | **String** | | +**length** | **int** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineDiscOneOf.md b/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineDiscOneOf.md new file mode 100644 index 000000000000..c842f7706c46 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineDiscOneOf.md @@ -0,0 +1,16 @@ +# openapi.model.FruitInlineDiscOneOf + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineDiscOneOf1.md b/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineDiscOneOf1.md new file mode 100644 index 000000000000..2ab55f905a67 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineDiscOneOf1.md @@ -0,0 +1,16 @@ +# openapi.model.FruitInlineDiscOneOf1 + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineInlineDisc.md b/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineInlineDisc.md new file mode 100644 index 000000000000..a94f2de1f3bc --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineInlineDisc.md @@ -0,0 +1,15 @@ +# openapi.model.FruitInlineInlineDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineInlineDiscOneOf.md b/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineInlineDiscOneOf.md new file mode 100644 index 000000000000..511b8519164e --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineInlineDiscOneOf.md @@ -0,0 +1,16 @@ +# openapi.model.FruitInlineInlineDiscOneOf + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineInlineDiscOneOf1.md b/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineInlineDiscOneOf1.md new file mode 100644 index 000000000000..59d09becd314 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineInlineDiscOneOf1.md @@ -0,0 +1,16 @@ +# openapi.model.FruitInlineInlineDiscOneOf1 + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineInlineDiscOneOfOneOf.md b/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineInlineDiscOneOfOneOf.md new file mode 100644 index 000000000000..5267793720af --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FruitInlineInlineDiscOneOfOneOf.md @@ -0,0 +1,15 @@ +# openapi.model.FruitInlineInlineDiscOneOfOneOf + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/FruitOneOfDisc.md b/samples/client/echo_api/dart/dio/built_value/doc/FruitOneOfDisc.md new file mode 100644 index 000000000000..98c529e8c203 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FruitOneOfDisc.md @@ -0,0 +1,15 @@ +# openapi.model.FruitOneOfDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/FruitReqDisc.md b/samples/client/echo_api/dart/dio/built_value/doc/FruitReqDisc.md new file mode 100644 index 000000000000..6ed06ec95a84 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FruitReqDisc.md @@ -0,0 +1,17 @@ +# openapi.model.FruitReqDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **int** | | +**fruitType** | **String** | | +**length** | **int** | | + +[[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/petstore_client_lib_fake/doc/CatAllOf.md b/samples/client/echo_api/dart/dio/built_value/doc/FruitType.md similarity index 75% rename from samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/CatAllOf.md rename to samples/client/echo_api/dart/dio/built_value/doc/FruitType.md index 36b2ae0e8ab3..a5ac48ebfcef 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/CatAllOf.md +++ b/samples/client/echo_api/dart/dio/built_value/doc/FruitType.md @@ -1,14 +1,14 @@ -# openapi.model.CatAllOf +# openapi.model.FruitType ## Load the model package ```dart -import 'package:openapi/api.dart'; +import 'package:openapi/openapi.dart'; ``` ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**declawed** | **bool** | | [optional] +**fruitType** | **String** | | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/echo_api/dart/dio/built_value/doc/FruitVariant1.md b/samples/client/echo_api/dart/dio/built_value/doc/FruitVariant1.md new file mode 100644 index 000000000000..f56649903b0f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/FruitVariant1.md @@ -0,0 +1,16 @@ +# openapi.model.FruitVariant1 + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**color** | **String** | | [optional] +**kind** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/GigaOneOf.md b/samples/client/echo_api/dart/dio/built_value/doc/GigaOneOf.md new file mode 100644 index 000000000000..c4148a9477f6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/GigaOneOf.md @@ -0,0 +1,15 @@ +# openapi.model.GigaOneOf + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**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/client/echo_api/dart/dio/built_value/doc/GrapeVariant1.md b/samples/client/echo_api/dart/dio/built_value/doc/GrapeVariant1.md new file mode 100644 index 000000000000..ac6637c2a1c9 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/GrapeVariant1.md @@ -0,0 +1,15 @@ +# openapi.model.GrapeVariant1 + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**color** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/HasOnlyReadOnly.md b/samples/client/echo_api/dart/dio/built_value/doc/HasOnlyReadOnly.md new file mode 100644 index 000000000000..c0884669d1a6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/HasOnlyReadOnly.md @@ -0,0 +1,16 @@ +# openapi.model.HasOnlyReadOnly + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/HealthCheckResult.md b/samples/client/echo_api/dart/dio/built_value/doc/HealthCheckResult.md new file mode 100644 index 000000000000..30abe9693f7e --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/HealthCheckResult.md @@ -0,0 +1,15 @@ +# openapi.model.HealthCheckResult + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/MapTest.md b/samples/client/echo_api/dart/dio/built_value/doc/MapTest.md new file mode 100644 index 000000000000..0f6c09f04b84 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/MapTest.md @@ -0,0 +1,18 @@ +# openapi.model.MapTest + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapMapOfString** | [**BuiltMap<String, BuiltMap<String, String>>**](BuiltMap.md) | | [optional] +**mapOfEnumString** | **BuiltMap<String, String>** | | [optional] +**directMap** | **BuiltMap<String, bool>** | | [optional] +**indirectMap** | **BuiltMap<String, 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/client/echo_api/dart/dio/built_value/doc/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/echo_api/dart/dio/built_value/doc/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..30967b4a65c2 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,17 @@ +# openapi.model.MixedPropertiesAndAdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **String** | | [optional] +**dateTime** | [**DateTime**](DateTime.md) | | [optional] +**map** | [**BuiltMap<String, Animal>**](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/client/echo_api/dart/dio/built_value/doc/Model200Response.md b/samples/client/echo_api/dart/dio/built_value/doc/Model200Response.md new file mode 100644 index 000000000000..f42d7b1dfe3c --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Model200Response.md @@ -0,0 +1,16 @@ +# openapi.model.Model200Response + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | [optional] +**classField** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/ModelClient.md b/samples/client/echo_api/dart/dio/built_value/doc/ModelClient.md new file mode 100644 index 000000000000..491c2dffa0c3 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/ModelClient.md @@ -0,0 +1,15 @@ +# openapi.model.ModelClient + +## Load the model package +```dart +import 'package:openapi/openapi.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/petstore_client_lib_fake-json_serializable/doc/CatAllOf.md b/samples/client/echo_api/dart/dio/built_value/doc/ModelEnumClass.md similarity index 75% rename from samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/CatAllOf.md rename to samples/client/echo_api/dart/dio/built_value/doc/ModelEnumClass.md index 36b2ae0e8ab3..6346922b80fa 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/CatAllOf.md +++ b/samples/client/echo_api/dart/dio/built_value/doc/ModelEnumClass.md @@ -1,14 +1,13 @@ -# openapi.model.CatAllOf +# openapi.model.ModelEnumClass ## Load the model package ```dart -import 'package:openapi/api.dart'; +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/ModelFile.md b/samples/client/echo_api/dart/dio/built_value/doc/ModelFile.md new file mode 100644 index 000000000000..810d321ec7f0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/ModelFile.md @@ -0,0 +1,15 @@ +# openapi.model.ModelFile + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/ModelList.md b/samples/client/echo_api/dart/dio/built_value/doc/ModelList.md new file mode 100644 index 000000000000..95bbed7bd916 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/ModelList.md @@ -0,0 +1,15 @@ +# openapi.model.ModelList + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/ModelReturn.md b/samples/client/echo_api/dart/dio/built_value/doc/ModelReturn.md new file mode 100644 index 000000000000..49e007d35af6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/ModelReturn.md @@ -0,0 +1,15 @@ +# openapi.model.ModelReturn + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/Name.md b/samples/client/echo_api/dart/dio/built_value/doc/Name.md new file mode 100644 index 000000000000..7f8db15a7c71 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Name.md @@ -0,0 +1,18 @@ +# openapi.model.Name + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/NullableClass.md b/samples/client/echo_api/dart/dio/built_value/doc/NullableClass.md new file mode 100644 index 000000000000..9760a2d6c04d --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/NullableClass.md @@ -0,0 +1,26 @@ +# openapi.model.NullableClass + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integerProp** | **int** | | [optional] +**numberProp** | **num** | | [optional] +**booleanProp** | **bool** | | [optional] +**stringProp** | **String** | | [optional] +**dateProp** | [**Date**](Date.md) | | [optional] +**datetimeProp** | [**DateTime**](DateTime.md) | | [optional] +**arrayNullableProp** | [**BuiltList<JsonObject>**](JsonObject.md) | | [optional] +**arrayAndItemsNullableProp** | [**BuiltList<JsonObject>**](JsonObject.md) | | [optional] +**arrayItemsNullable** | [**BuiltList<JsonObject>**](JsonObject.md) | | [optional] +**objectNullableProp** | [**BuiltMap<String, JsonObject>**](JsonObject.md) | | [optional] +**objectAndItemsNullableProp** | [**BuiltMap<String, JsonObject>**](JsonObject.md) | | [optional] +**objectItemsNullable** | [**BuiltMap<String, JsonObject>**](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/client/echo_api/dart/dio/built_value/doc/NumberOnly.md b/samples/client/echo_api/dart/dio/built_value/doc/NumberOnly.md new file mode 100644 index 000000000000..12d634cfdbbd --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/NumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.NumberOnly + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/ObjectWithDeprecatedFields.md b/samples/client/echo_api/dart/dio/built_value/doc/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..97a6433501e8 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/ObjectWithDeprecatedFields.md @@ -0,0 +1,18 @@ +# openapi.model.ObjectWithDeprecatedFields + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **String** | | [optional] +**id** | **num** | | [optional] +**deprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] +**bars** | [**BuiltList<Bar>**](Bar.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/client/echo_api/dart/dio/built_value/doc/OneOfPrimitiveChild.md b/samples/client/echo_api/dart/dio/built_value/doc/OneOfPrimitiveChild.md new file mode 100644 index 000000000000..cb1eec1c5b7f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/OneOfPrimitiveChild.md @@ -0,0 +1,15 @@ +# openapi.model.OneOfPrimitiveChild + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**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/client/echo_api/dart/dio/built_value/doc/Order.md b/samples/client/echo_api/dart/dio/built_value/doc/Order.md new file mode 100644 index 000000000000..d18d3d8408ad --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Order.md @@ -0,0 +1,20 @@ +# openapi.model.Order + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/OuterComposite.md b/samples/client/echo_api/dart/dio/built_value/doc/OuterComposite.md new file mode 100644 index 000000000000..fab14cb2d17d --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/OuterComposite.md @@ -0,0 +1,17 @@ +# openapi.model.OuterComposite + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/OuterEnum.md b/samples/client/echo_api/dart/dio/built_value/doc/OuterEnum.md new file mode 100644 index 000000000000..77123453e019 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/OuterEnum.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnum + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/OuterEnumDefaultValue.md b/samples/client/echo_api/dart/dio/built_value/doc/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..715afba3433f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/OuterEnumDefaultValue.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumDefaultValue + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/OuterEnumInteger.md b/samples/client/echo_api/dart/dio/built_value/doc/OuterEnumInteger.md new file mode 100644 index 000000000000..98e74cfbc21e --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/OuterEnumInteger.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumInteger + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/OuterEnumIntegerDefaultValue.md b/samples/client/echo_api/dart/dio/built_value/doc/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..14b955ed876f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumIntegerDefaultValue + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/OuterObjectWithEnumProperty.md b/samples/client/echo_api/dart/dio/built_value/doc/OuterObjectWithEnumProperty.md new file mode 100644 index 000000000000..881373f258bb --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/OuterObjectWithEnumProperty.md @@ -0,0 +1,15 @@ +# openapi.model.OuterObjectWithEnumProperty + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/Parent.md b/samples/client/echo_api/dart/dio/built_value/doc/Parent.md new file mode 100644 index 000000000000..cb343a1e4f5a --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Parent.md @@ -0,0 +1,15 @@ +# openapi.model.Parent + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/built_value/doc/Pasta.md b/samples/client/echo_api/dart/dio/built_value/doc/Pasta.md new file mode 100644 index 000000000000..027d4e96abe0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Pasta.md @@ -0,0 +1,20 @@ +# openapi.model.Pasta + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**vendor** | **String** | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/built_value/doc/Pet.md b/samples/client/echo_api/dart/dio/built_value/doc/Pet.md new file mode 100644 index 000000000000..0e84c434698b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Pet.md @@ -0,0 +1,20 @@ +# openapi.model.Pet + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **BuiltSet<String>** | | +**tags** | [**BuiltList<Tag>**](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/client/echo_api/dart/dio/built_value/doc/PetApi.md b/samples/client/echo_api/dart/dio/built_value/doc/PetApi.md new file mode 100644 index 000000000000..5453eed90025 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/PetApi.md @@ -0,0 +1,439 @@ +# openapi.api.PetApi + +## Load the API package +```dart +import 'package:openapi/openapi.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/openapi.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store + +try { + api.addPet(pet); +} catch on DioException (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/openapi.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | Pet id to delete +final String apiKey = apiKey_example; // String | + +try { + api.deletePet(petId, apiKey); +} catch on DioException (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/openapi.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final BuiltList status = ; // BuiltList | Status values that need to be considered for filter + +try { + final response = api.findPetsByStatus(status); + print(response); +} catch on DioException (e) { + print('Exception when calling PetApi->findPetsByStatus: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**BuiltList<String>**](String.md)| Status values that need to be considered for filter | + +### Return type + +[**BuiltList<Pet>**](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/openapi.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final BuiltSet tags = ; // BuiltSet | Tags to filter by + +try { + final response = api.findPetsByTags(tags); + print(response); +} catch on DioException (e) { + print('Exception when calling PetApi->findPetsByTags: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**BuiltSet<String>**](String.md)| Tags to filter by | + +### Return type + +[**BuiltSet<Pet>**](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/openapi.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'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | ID of pet to return + +try { + final response = api.getPetById(petId); + print(response); +} catch on DioException (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/openapi.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store + +try { + api.updatePet(pet); +} catch on DioException (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/openapi.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | ID of pet that needs to be updated +final String name = name_example; // String | Updated name of the pet +final String status = status_example; // String | Updated status of the pet + +try { + api.updatePetWithForm(petId, name, status); +} catch on DioException (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/openapi.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | ID of pet to update +final String additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server +final MultipartFile file = BINARY_DATA_HERE; // MultipartFile | file to upload + +try { + final response = api.uploadFile(petId, additionalMetadata, file); + print(response); +} catch on DioException (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** | **MultipartFile**| 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/openapi.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | ID of pet to update +final MultipartFile requiredFile = BINARY_DATA_HERE; // MultipartFile | file to upload +final String additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server + +try { + final response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + print(response); +} catch on DioException (e) { + print('Exception when calling PetApi->uploadFileWithRequiredFile: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | + **requiredFile** | **MultipartFile**| 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/client/echo_api/dart/dio/built_value/doc/Pizza.md b/samples/client/echo_api/dart/dio/built_value/doc/Pizza.md new file mode 100644 index 000000000000..a9a0163a18e3 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Pizza.md @@ -0,0 +1,20 @@ +# openapi.model.Pizza + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**pizzaSize** | **num** | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/built_value/doc/PizzaSpeziale.md b/samples/client/echo_api/dart/dio/built_value/doc/PizzaSpeziale.md new file mode 100644 index 000000000000..483cc83e301b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/PizzaSpeziale.md @@ -0,0 +1,20 @@ +# openapi.model.PizzaSpeziale + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**toppings** | **String** | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/built_value/doc/ReadOnlyFirst.md b/samples/client/echo_api/dart/dio/built_value/doc/ReadOnlyFirst.md new file mode 100644 index 000000000000..e21d61aa3f20 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/ReadOnlyFirst.md @@ -0,0 +1,16 @@ +# openapi.model.ReadOnlyFirst + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/SingleRefType.md b/samples/client/echo_api/dart/dio/built_value/doc/SingleRefType.md new file mode 100644 index 000000000000..cbcf9ead7e6c --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/SingleRefType.md @@ -0,0 +1,14 @@ +# openapi.model.SingleRefType + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/SpecialModelName.md b/samples/client/echo_api/dart/dio/built_value/doc/SpecialModelName.md new file mode 100644 index 000000000000..8c22491d783c --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/SpecialModelName.md @@ -0,0 +1,15 @@ +# openapi.model.SpecialModelName + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/StoreApi.md b/samples/client/echo_api/dart/dio/built_value/doc/StoreApi.md new file mode 100644 index 000000000000..fdd353d4a164 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/StoreApi.md @@ -0,0 +1,188 @@ +# openapi.api.StoreApi + +## Load the API package +```dart +import 'package:openapi/openapi.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/openapi.dart'; + +final api = Openapi().getStoreApi(); +final String orderId = orderId_example; // String | ID of the order that needs to be deleted + +try { + api.deleteOrder(orderId); +} catch on DioException (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/openapi.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'; + +final api = Openapi().getStoreApi(); + +try { + final response = api.getInventory(); + print(response); +} catch on DioException (e) { + print('Exception when calling StoreApi->getInventory: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**BuiltMap<String, int>** + +### 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 generate exceptions + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getStoreApi(); +final int orderId = 789; // int | ID of pet that needs to be fetched + +try { + final response = api.getOrderById(orderId); + print(response); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getStoreApi(); +final Order order = ; // Order | order placed for purchasing the pet + +try { + final response = api.placeOrder(order); + print(response); +} catch on DioException (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/client/echo_api/dart/dio/built_value/doc/Tag.md b/samples/client/echo_api/dart/dio/built_value/doc/Tag.md new file mode 100644 index 000000000000..1c0ee4595a65 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/Tag.md @@ -0,0 +1,16 @@ +# openapi.model.Tag + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/User.md b/samples/client/echo_api/dart/dio/built_value/doc/User.md new file mode 100644 index 000000000000..c51ef002c6b2 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/User.md @@ -0,0 +1,22 @@ +# openapi.model.User + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/built_value/doc/UserApi.md b/samples/client/echo_api/dart/dio/built_value/doc/UserApi.md new file mode 100644 index 000000000000..ad6f4f2e951c --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/doc/UserApi.md @@ -0,0 +1,359 @@ +# openapi.api.UserApi + +## Load the API package +```dart +import 'package:openapi/openapi.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/openapi.dart'; + +final api = Openapi().getUserApi(); +final User user = ; // User | Created user object + +try { + api.createUser(user); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getUserApi(); +final BuiltList user = ; // BuiltList | List of user object + +try { + api.createUsersWithArrayInput(user); +} catch on DioException (e) { + print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**BuiltList<User>**](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/openapi.dart'; + +final api = Openapi().getUserApi(); +final BuiltList user = ; // BuiltList | List of user object + +try { + api.createUsersWithListInput(user); +} catch on DioException (e) { + print('Exception when calling UserApi->createUsersWithListInput: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**BuiltList<User>**](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/openapi.dart'; + +final api = Openapi().getUserApi(); +final String username = username_example; // String | The name that needs to be deleted + +try { + api.deleteUser(username); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getUserApi(); +final String username = username_example; // String | The name that needs to be fetched. Use user1 for testing. + +try { + final response = api.getUserByName(username); + print(response); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getUserApi(); +final String username = username_example; // String | The user name for login +final String password = password_example; // String | The password for login in clear text + +try { + final response = api.loginUser(username, password); + print(response); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getUserApi(); + +try { + api.logoutUser(); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getUserApi(); +final String username = username_example; // String | name that need to be deleted +final User user = ; // User | Updated user object + +try { + api.updateUser(username, user); +} catch on DioException (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/client/echo_api/dart/dio/built_value/lib/apis.dart b/samples/client/echo_api/dart/dio/built_value/lib/apis.dart new file mode 100644 index 000000000000..4facc7ca3861 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/apis.dart @@ -0,0 +1,10 @@ +export 'package:openapi/src/api_client.dart'; +export 'package:openapi/src/api/another_fake_api.dart'; +export 'package:openapi/src/api/bar_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/foo_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'; diff --git a/samples/client/echo_api/dart/dio/built_value/lib/models.dart b/samples/client/echo_api/dart/dio/built_value/lib/models.dart new file mode 100644 index 000000000000..16d6bf568fe1 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/models.dart @@ -0,0 +1,105 @@ +export 'package:openapi/src/serializers.dart'; +export 'package:openapi/src/date_serializer.dart'; +export 'package:openapi/src/model/date.dart'; +export 'package:openapi/src/repository_base.dart'; +export 'package:openapi/src/repository_impl.dart'; +export 'package:openapi/src/model/additional_properties_class.dart'; +export 'package:openapi/src/model/addressable.dart'; +export 'package:openapi/src/model/all_of_with_single_ref.dart'; +export 'package:openapi/src/model/animal.dart'; +export 'package:openapi/src/model/api_response.dart'; +export 'package:openapi/src/model/apple.dart'; +export 'package:openapi/src/model/apple_all_of_disc.dart'; +export 'package:openapi/src/model/apple_grandparent_disc.dart'; +export 'package:openapi/src/model/apple_one_of_disc.dart'; +export 'package:openapi/src/model/apple_req_disc.dart'; +export 'package:openapi/src/model/apple_variant1.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/banana.dart'; +export 'package:openapi/src/model/banana_all_of_disc.dart'; +export 'package:openapi/src/model/banana_grandparent_disc.dart'; +export 'package:openapi/src/model/banana_one_of_disc.dart'; +export 'package:openapi/src/model/banana_req_disc.dart'; +export 'package:openapi/src/model/bar.dart'; +export 'package:openapi/src/model/bar_create.dart'; +export 'package:openapi/src/model/bar_ref.dart'; +export 'package:openapi/src/model/bar_ref_or_value.dart'; +export 'package:openapi/src/model/capitalization.dart'; +export 'package:openapi/src/model/cat.dart'; +export 'package:openapi/src/model/category.dart'; +export 'package:openapi/src/model/class_model.dart'; +export 'package:openapi/src/model/composed_disc_missing_from_properties.dart'; +export 'package:openapi/src/model/composed_disc_optional_type_correct.dart'; +export 'package:openapi/src/model/composed_disc_optional_type_inconsistent.dart'; +export 'package:openapi/src/model/composed_disc_optional_type_incorrect.dart'; +export 'package:openapi/src/model/composed_disc_required_inconsistent.dart'; +export 'package:openapi/src/model/composed_disc_type_inconsistent.dart'; +export 'package:openapi/src/model/composed_disc_type_incorrect.dart'; +export 'package:openapi/src/model/deprecated_object.dart'; +export 'package:openapi/src/model/disc_missing_from_properties.dart'; +export 'package:openapi/src/model/disc_optional_type_correct.dart'; +export 'package:openapi/src/model/disc_optional_type_incorrect.dart'; +export 'package:openapi/src/model/disc_type_incorrect.dart'; +export 'package:openapi/src/model/dog.dart'; +export 'package:openapi/src/model/entity.dart'; +export 'package:openapi/src/model/entity_ref.dart'; +export 'package:openapi/src/model/enum_arrays.dart'; +export 'package:openapi/src/model/enum_test.dart'; +export 'package:openapi/src/model/extensible.dart'; +export 'package:openapi/src/model/file_schema_test_class.dart'; +export 'package:openapi/src/model/foo.dart'; +export 'package:openapi/src/model/foo_basic_get_default_response.dart'; +export 'package:openapi/src/model/foo_ref.dart'; +export 'package:openapi/src/model/foo_ref_or_value.dart'; +export 'package:openapi/src/model/format_test.dart'; +export 'package:openapi/src/model/fruit.dart'; +export 'package:openapi/src/model/fruit_all_of_disc.dart'; +export 'package:openapi/src/model/fruit_any_of_disc.dart'; +export 'package:openapi/src/model/fruit_grandparent_disc.dart'; +export 'package:openapi/src/model/fruit_inline_disc.dart'; +export 'package:openapi/src/model/fruit_inline_disc_one_of.dart'; +export 'package:openapi/src/model/fruit_inline_disc_one_of1.dart'; +export 'package:openapi/src/model/fruit_inline_inline_disc.dart'; +export 'package:openapi/src/model/fruit_inline_inline_disc_one_of.dart'; +export 'package:openapi/src/model/fruit_inline_inline_disc_one_of1.dart'; +export 'package:openapi/src/model/fruit_inline_inline_disc_one_of_one_of.dart'; +export 'package:openapi/src/model/fruit_one_of_disc.dart'; +export 'package:openapi/src/model/fruit_req_disc.dart'; +export 'package:openapi/src/model/fruit_type.dart'; +export 'package:openapi/src/model/fruit_variant1.dart'; +export 'package:openapi/src/model/giga_one_of.dart'; +export 'package:openapi/src/model/grape_variant1.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/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/object_with_deprecated_fields.dart'; +export 'package:openapi/src/model/one_of_primitive_child.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/parent.dart'; +export 'package:openapi/src/model/pasta.dart'; +export 'package:openapi/src/model/pet.dart'; +export 'package:openapi/src/model/pizza.dart'; +export 'package:openapi/src/model/pizza_speziale.dart'; +export 'package:openapi/src/model/read_only_first.dart'; +export 'package:openapi/src/model/single_ref_type.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/client/echo_api/dart/dio/built_value/lib/openapi.dart b/samples/client/echo_api/dart/dio/built_value/lib/openapi.dart new file mode 100644 index 000000000000..6c3dbb746aa8 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/openapi.dart @@ -0,0 +1,8 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + + +export 'apis.dart'; +export 'models.dart'; +export 'package:openapi/src/auth/_exports.dart'; diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/api/another_fake_api.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/api/another_fake_api.dart new file mode 100644 index 000000000000..6df08905607b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/api/another_fake_api.dart @@ -0,0 +1,162 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'package:dio/dio.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; +import 'package:openapi/src/repository_base.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/models.dart'; +import 'package:openapi/src/model/model_client.dart'; + + +class AnotherFakeApi { + + final AnotherFakeApiRaw rawApi; + final SerializationRepositoryBase _repository; + + const AnotherFakeApi(this.rawApi, this._repository); + + /// To test special tags + /// To test special tags and operation ID starting with number + /// + /// Parameters: + /// * [modelClient] - client model + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ModelClient] as data + /// Throws [DioException] if API call or serialization fails + Future> call123testSpecialTags({ + required ModelClient modelClient, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, modelClient, const TypeInfo( + + + ModelClient + ) + +); + + final _response = await rawApi.call123testSpecialTags( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ModelClient? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + ModelClient + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + +} +class AnotherFakeApiRaw { + + final Dio _dio; + + const AnotherFakeApiRaw(this._dio); + + /// To test special tags + /// To test special tags and operation ID starting with number + /// + /// Parameters: + /// * [modelClient] - client model + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ModelClient] as data + /// Throws [DioException] if API call or serialization fails + Future> call123testSpecialTags({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/api/bar_api.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/api/bar_api.dart new file mode 100644 index 000000000000..4de07ba6196b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/api/bar_api.dart @@ -0,0 +1,163 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'package:dio/dio.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; +import 'package:openapi/src/repository_base.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/models.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:openapi/src/model/bar_create.dart'; + + +class BarApi { + + final BarApiRaw rawApi; + final SerializationRepositoryBase _repository; + + const BarApi(this.rawApi, this._repository); + + /// Create a Bar + /// + /// + /// Parameters: + /// * [barCreate] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Bar] as data + /// Throws [DioException] if API call or serialization fails + Future> createBar({ + required BarCreate barCreate, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, barCreate, const TypeInfo( + + + BarCreate + ) + +); + + final _response = await rawApi.createBar( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Bar? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + Bar + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + +} +class BarApiRaw { + + final Dio _dio; + + const BarApiRaw(this._dio); + + /// Create a Bar + /// + /// + /// Parameters: + /// * [barCreate] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Bar] as data + /// Throws [DioException] if API call or serialization fails + Future> createBar({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/bar'; + final _options = Options( + method: r'POST', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/api/default_api.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/api/default_api.dart new file mode 100644 index 000000000000..a72f9758407b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/api/default_api.dart @@ -0,0 +1,722 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'package:dio/dio.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; +import 'package:openapi/src/repository_base.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/models.dart'; +import 'package:built_value/json_object.dart'; +import 'package:openapi/src/model/foo_basic_get_default_response.dart'; +import 'package:openapi/src/model/fruit.dart'; +import 'package:openapi/src/model/fruit_all_of_disc.dart'; +import 'package:openapi/src/model/fruit_variant1.dart'; +import 'package:openapi/src/model/giga_one_of.dart'; + + +class DefaultApi { + + final DefaultApiRaw rawApi; + final SerializationRepositoryBase _repository; + + const DefaultApi(this.rawApi, this._repository); + + /// fooBasicGet + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FooBasicGetDefaultResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> fooBasicGet({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.fooBasicGet( + + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + FooBasicGetDefaultResponse? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + FooBasicGetDefaultResponse + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + + /// list + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [GigaOneOf] as data + /// Throws [DioException] if API call or serialization fails + Future> list({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.list( + + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + GigaOneOf? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + GigaOneOf + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + + /// oneofGet + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Fruit] as data + /// Throws [DioException] if API call or serialization fails + Future> oneofGet({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.oneofGet( + + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Fruit? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + Fruit + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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 + /// + /// + /// Parameters: + /// * [body] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> test({ + JsonObject? body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, body, const TypeInfo.nullable( + + + JsonObject + ) + +); + + final _response = await rawApi.test( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// variant1Get + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FruitVariant1] as data + /// Throws [DioException] if API call or serialization fails + Future> variant1Get({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.variant1Get( + + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + FruitVariant1? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + FruitVariant1 + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + + /// variant2Get + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FruitAllOfDisc] as data + /// Throws [DioException] if API call or serialization fails + Future> variant2Get({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.variant2Get( + + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + FruitAllOfDisc? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + FruitAllOfDisc + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + +} +class DefaultApiRaw { + + final Dio _dio; + + const DefaultApiRaw(this._dio); + + /// fooBasicGet + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FooBasicGetDefaultResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> fooBasicGet({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/foo-basic'; + final _options = Options( + method: r'GET', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// list + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [GigaOneOf] as data + /// Throws [DioException] if API call or serialization fails + Future> list({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/oneof-primitive'; + final _options = Options( + method: r'GET', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// oneofGet + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Fruit] as data + /// Throws [DioException] if API call or serialization fails + Future> oneofGet({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/oneof'; + final _options = Options( + method: r'GET', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// test + /// + /// + /// Parameters: + /// * [body] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> test({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/variant1'; + final _options = Options( + method: r'PUT', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// variant1Get + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FruitVariant1] as data + /// Throws [DioException] if API call or serialization fails + Future> variant1Get({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/variant1'; + final _options = Options( + method: r'GET', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// variant2Get + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FruitAllOfDisc] as data + /// Throws [DioException] if API call or serialization fails + Future> variant2Get({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/variant2'; + final _options = Options( + method: r'GET', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/api/fake_api.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/api/fake_api.dart new file mode 100644 index 000000000000..0f374540241a --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/api/fake_api.dart @@ -0,0 +1,2640 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'package:dio/dio.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; +import 'package:openapi/src/repository_base.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/models.dart'; +import 'dart:typed_data'; +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/date.dart'; +import 'package:openapi/src/model/file_schema_test_class.dart'; +import 'package:openapi/src/model/health_check_result.dart'; +import 'package:openapi/src/model/model_client.dart'; +import 'package:openapi/src/model/model_enum_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/pet.dart'; +import 'package:openapi/src/model/user.dart'; + +part 'fake_api.g.dart'; + +class FakeApi { + + final FakeApiRaw rawApi; + final SerializationRepositoryBase _repository; + + const FakeApi(this.rawApi, this._repository); + + /// Health check endpoint + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [HealthCheckResult] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeHealthGet({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.fakeHealthGet( + + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + HealthCheckResult? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + HealthCheckResult + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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 + /// + /// + /// Parameters: + /// * [pet] - Pet object that needs to be added to the store + /// * [query1] - query parameter + /// * [header1] - header parameter + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> fakeHttpSignatureTest({ + required Pet pet, + required String query1, + required String header1, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, pet, const TypeInfo( + + + Pet + ) + +); + + final _response = await rawApi.fakeHttpSignatureTest( + + query1: await encodeQueryParameter(_repository, query1, const TypeInfo( + + + String + ) + +, ), + header1: await encodeStringParameter(_repository, header1, const TypeInfo( + + + String + ) + +), + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// fakeOuterBooleanSerialize + /// Test serialization of outer boolean types + /// + /// Parameters: + /// * [body] - Input boolean as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [bool] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterBooleanSerialize({ + required bool body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, body, const TypeInfo( + + + bool + ) + +); + + final _response = await rawApi.fakeOuterBooleanSerialize( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + bool? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + bool + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + + /// fakeOuterCompositeSerialize + /// Test serialization of object with outer number type + /// + /// Parameters: + /// * [outerComposite] - Input composite as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [OuterComposite] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterCompositeSerialize({ + required OuterComposite outerComposite, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, outerComposite, const TypeInfo( + + + OuterComposite + ) + +); + + final _response = await rawApi.fakeOuterCompositeSerialize( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + OuterComposite? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + OuterComposite + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + + /// fakeOuterNumberSerialize + /// Test serialization of outer number types + /// + /// Parameters: + /// * [body] - Input number as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [num] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterNumberSerialize({ + required num body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, body, const TypeInfo( + + + num + ) + +); + + final _response = await rawApi.fakeOuterNumberSerialize( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + num? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + num + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + + /// fakeOuterStringSerialize + /// Test serialization of outer string types + /// + /// Parameters: + /// * [body] - Input string as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [String] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterStringSerialize({ + required String body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, body, const TypeInfo( + + + String + ) + +); + + final _response = await rawApi.fakeOuterStringSerialize( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + String? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + String + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + + /// fakePropertyEnumIntegerSerialize + /// Test serialization of enum (int) properties with examples + /// + /// Parameters: + /// * [outerObjectWithEnumProperty] - Input enum (int) as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [OuterObjectWithEnumProperty] as data + /// Throws [DioException] if API call or serialization fails + Future> fakePropertyEnumIntegerSerialize({ + required OuterObjectWithEnumProperty outerObjectWithEnumProperty, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, outerObjectWithEnumProperty, const TypeInfo( + + + OuterObjectWithEnumProperty + ) + +); + + final _response = await rawApi.fakePropertyEnumIntegerSerialize( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + OuterObjectWithEnumProperty? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + OuterObjectWithEnumProperty + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + + /// testBodyWithBinary + /// For this test, the body has to be a binary file. + /// + /// Parameters: + /// * [body] - image to upload + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testBodyWithBinary({ + required MultipartFile? body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, body, const TypeInfo.nullable( + + + MultipartFile + ) + +); + + final _response = await rawApi.testBodyWithBinary( + + body: _bodyData, + requestContentType: 'image/png', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// testBodyWithFileSchema + /// For this test, the body for this request must reference a schema named `File`. + /// + /// Parameters: + /// * [fileSchemaTestClass] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testBodyWithFileSchema({ + required FileSchemaTestClass fileSchemaTestClass, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, fileSchemaTestClass, const TypeInfo( + + + FileSchemaTestClass + ) + +); + + final _response = await rawApi.testBodyWithFileSchema( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// testBodyWithQueryParams + /// + /// + /// Parameters: + /// * [query] + /// * [user] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testBodyWithQueryParams({ + required String query, + required User user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, user, const TypeInfo( + + + User + ) + +); + + final _response = await rawApi.testBodyWithQueryParams( + + query: await encodeQueryParameter(_repository, query, const TypeInfo( + + + String + ) + +, ), + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// To test \"client\" model + /// To test \"client\" model + /// + /// Parameters: + /// * [modelClient] - client model + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ModelClient] as data + /// Throws [DioException] if API call or serialization fails + Future> testClientModel({ + required ModelClient modelClient, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, modelClient, const TypeInfo( + + + ModelClient + ) + +); + + final _response = await rawApi.testClientModel( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ModelClient? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + ModelClient + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Parameters: + /// * [number] - None + /// * [double_] - None + /// * [patternWithoutDelimiter] - None + /// * [byte] - None + /// * [integer] - None + /// * [int32] - None + /// * [int64] - None + /// * [float] - None + /// * [string] - None + /// * [binary] - None + /// * [date] - None + /// * [dateTime] - None + /// * [password] - None + /// * [callback] - None + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testEndpointParameters({ + required num number, + required double double_, + required String patternWithoutDelimiter, + required String byte, + required int integer, + required int int32, + required int int64, + required double float, + required String string, + required Uint8List binary, + required Date date, + required DateTime dateTime, + required String password, + required String callback, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + final _bodyMap = { + if (integer != null) r'integer': await encodeFormParameter(_repository, integer, const TypeInfo( + + + int + ) + +), + if (int32 != null) r'int32': await encodeFormParameter(_repository, int32, const TypeInfo( + + + int + ) + +), + if (int64 != null) r'int64': await encodeFormParameter(_repository, int64, const TypeInfo( + + + int + ) + +), + r'number': await encodeFormParameter(_repository, number, const TypeInfo( + + + num + ) + +), + if (float != null) r'float': await encodeFormParameter(_repository, float, const TypeInfo( + + + double + ) + +), + r'double': await encodeFormParameter(_repository, double_, const TypeInfo( + + + double + ) + +), + if (string != null) r'string': await encodeFormParameter(_repository, string, const TypeInfo( + + + String + ) + +), + r'pattern_without_delimiter': await encodeFormParameter(_repository, patternWithoutDelimiter, const TypeInfo( + + + String + ) + +), + r'byte': await encodeFormParameter(_repository, byte, const TypeInfo( + + + String + ) + +), + if (binary != null) r'binary': await encodeFormParameter(_repository, binary, const TypeInfo( + + + Uint8List + ) + +), + if (date != null) r'date': await encodeFormParameter(_repository, date, const TypeInfo( + + + Date + ) + +), + if (dateTime != null) r'dateTime': await encodeFormParameter(_repository, dateTime, const TypeInfo( + + + DateTime + ) + +), + if (password != null) r'password': await encodeFormParameter(_repository, password, const TypeInfo( + + + String + ) + +), + if (callback != null) r'callback': await encodeFormParameter(_repository, callback, const TypeInfo( + + + String + ) + +), + }; + _bodyData = _bodyMap; + + final _response = await rawApi.testEndpointParameters( + + body: _bodyData, + requestContentType: 'application/x-www-form-urlencoded', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// To test enum parameters + /// To test enum parameters + /// + /// Parameters: + /// * [enumHeaderStringArray] - Header parameter enum test (string array) + /// * [enumHeaderString] - Header parameter enum test (string) (Default: r'-efg') + /// * [enumQueryStringArray] - Query parameter enum test (string array) + /// * [enumQueryString] - Query parameter enum test (string) (Default: r'-efg') + /// * [enumQueryInteger] - Query parameter enum test (double) + /// * [enumQueryDouble] - Query parameter enum test (double) + /// * [enumQueryModelArray] + /// * [enumFormStringArray] - Form parameter enum test (string array) (Default: r'$') + /// * [enumFormString] - Form parameter enum test (string) (Default: r'-efg') + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testEnumParameters({ + required BuiltList enumHeaderStringArray, + EnumHeaderStringEnum enumHeaderString = r'-efg', + required BuiltList enumQueryStringArray, + EnumQueryStringEnum enumQueryString = r'-efg', + required EnumQueryIntegerEnum enumQueryInteger, + required EnumQueryDoubleEnum enumQueryDouble, + required BuiltList enumQueryModelArray, + BuiltList enumFormStringArray = r'$', + EnumFormStringEnum enumFormString = r'-efg', + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + final _bodyMap = { + if (enumFormStringArray != null) r'enum_form_string_array': await encodeFormParameter(_repository, enumFormStringArray, const TypeInfo( + BuiltList, [ + + const TypeInfo( + + InnerEnum + + ) + +, + ]) + +), + if (enumFormString != null) r'enum_form_string': await encodeFormParameter(_repository, enumFormString, const TypeInfo( + + EnumFormStringEnum + + ) + +), + }; + _bodyData = _bodyMap; + + final _response = await rawApi.testEnumParameters( + + enumHeaderStringArray: await encodeStringParameter(_repository, enumHeaderStringArray, const TypeInfo( + BuiltList, [ + + const TypeInfo( + + EnumHeaderStringArrayEnum + + ) + +, + ]) + +), + enumHeaderString: await encodeStringParameter(_repository, enumHeaderString, const TypeInfo( + + EnumHeaderStringEnum + + ) + +), + enumQueryStringArray: await encodeQueryParameter(_repository, enumQueryStringArray, const TypeInfo( + BuiltList, [ + + const TypeInfo( + + EnumQueryStringArrayEnum + + ) + +, + ]) + +, format: ListFormat.multi,), + enumQueryString: await encodeQueryParameter(_repository, enumQueryString, const TypeInfo( + + EnumQueryStringEnum + + ) + +, ), + enumQueryInteger: await encodeQueryParameter(_repository, enumQueryInteger, const TypeInfo( + + EnumQueryIntegerEnum + + ) + +, ), + enumQueryDouble: await encodeQueryParameter(_repository, enumQueryDouble, const TypeInfo( + + EnumQueryDoubleEnum + + ) + +, ), + enumQueryModelArray: await encodeQueryParameter(_repository, enumQueryModelArray, const TypeInfo( + BuiltList, [ + + const TypeInfo( + + ModelEnumClass + + ) + +, + ]) + +, format: ListFormat.multi,), + body: _bodyData, + requestContentType: 'application/x-www-form-urlencoded', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Fake endpoint to test group parameters (optional) + /// Fake endpoint to test group parameters (optional) + /// + /// Parameters: + /// * [requiredStringGroup] - Required String in group parameters + /// * [requiredBooleanGroup] - Required Boolean in group parameters + /// * [requiredInt64Group] - Required Integer in group parameters + /// * [stringGroup] - String in group parameters + /// * [booleanGroup] - Boolean in group parameters + /// * [int64Group] - Integer in group parameters + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testGroupParameters({ + required int requiredStringGroup, + required bool requiredBooleanGroup, + required int requiredInt64Group, + required int stringGroup, + required bool booleanGroup, + required int int64Group, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.testGroupParameters( + + requiredStringGroup: await encodeQueryParameter(_repository, requiredStringGroup, const TypeInfo( + + + int + ) + +, ), + requiredBooleanGroup: await encodeStringParameter(_repository, requiredBooleanGroup, const TypeInfo( + + + bool + ) + +), + requiredInt64Group: await encodeQueryParameter(_repository, requiredInt64Group, const TypeInfo( + + + int + ) + +, ), + stringGroup: await encodeQueryParameter(_repository, stringGroup, const TypeInfo( + + + int + ) + +, ), + booleanGroup: await encodeStringParameter(_repository, booleanGroup, const TypeInfo( + + + bool + ) + +), + int64Group: await encodeQueryParameter(_repository, int64Group, const TypeInfo( + + + int + ) + +, ), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test inline additionalProperties + /// + /// + /// Parameters: + /// * [requestBody] - request body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testInlineAdditionalProperties({ + required BuiltMap requestBody, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, requestBody, const TypeInfo( + BuiltMap, [ + TypeInfo(String), + const TypeInfo( + + String + + ) + +, + ]) + +); + + final _response = await rawApi.testInlineAdditionalProperties( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test json serialization of form data + /// + /// + /// Parameters: + /// * [param] - field1 + /// * [param2] - field2 + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testJsonFormData({ + required String param, + required String param2, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + final _bodyMap = { + r'param': await encodeFormParameter(_repository, param, const TypeInfo( + + + String + ) + +), + r'param2': await encodeFormParameter(_repository, param2, const TypeInfo( + + + String + ) + +), + }; + _bodyData = _bodyMap; + + final _response = await rawApi.testJsonFormData( + + body: _bodyData, + requestContentType: 'application/x-www-form-urlencoded', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// testQueryParameterCollectionFormat + /// To test the collection format in query parameters + /// + /// Parameters: + /// * [pipe] + /// * [ioutil] + /// * [http] + /// * [url] + /// * [context] + /// * [allowEmpty] + /// * [language] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testQueryParameterCollectionFormat({ + required BuiltList pipe, + required BuiltList ioutil, + required BuiltList http, + required BuiltList url, + required BuiltList context, + required String allowEmpty, + required BuiltMap language, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.testQueryParameterCollectionFormat( + + pipe: await encodeQueryParameter(_repository, pipe, const TypeInfo( + BuiltList, [ + + const TypeInfo( + + String + + ) + +, + ]) + +, format: ListFormat.pipes,), + ioutil: await encodeQueryParameter(_repository, ioutil, const TypeInfo( + BuiltList, [ + + const TypeInfo( + + String + + ) + +, + ]) + +, format: ListFormat.csv,), + http: await encodeQueryParameter(_repository, http, const TypeInfo( + BuiltList, [ + + const TypeInfo( + + String + + ) + +, + ]) + +, format: ListFormat.ssv,), + url: await encodeQueryParameter(_repository, url, const TypeInfo( + BuiltList, [ + + const TypeInfo( + + String + + ) + +, + ]) + +, format: ListFormat.csv,), + context: await encodeQueryParameter(_repository, context, const TypeInfo( + BuiltList, [ + + const TypeInfo( + + String + + ) + +, + ]) + +, format: ListFormat.multi,), + allowEmpty: await encodeQueryParameter(_repository, allowEmpty, const TypeInfo( + + + String + ) + +, ), + language: await encodeQueryParameter(_repository, language, const TypeInfo( + BuiltMap, [ + TypeInfo(String), + const TypeInfo( + + String + + ) + +, + ]) + +, ), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + +} +class FakeApiRaw { + + final Dio _dio; + + const FakeApiRaw(this._dio); + + /// Health check endpoint + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [HealthCheckResult] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeHealthGet({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// test http signature authentication + /// + /// + /// Parameters: + /// * [pet] - Pet object that needs to be added to the store + /// * [query1] - query parameter + /// * [header1] - header parameter + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> fakeHttpSignatureTest({ + Object? query1, + String? header1, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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, + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'signature', + 'name': 'http_signature_test', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (query1 != null) r'query_1': query1, + }; + + return await _dio.request( + _path, + data: body, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// fakeOuterBooleanSerialize + /// Test serialization of outer boolean types + /// + /// Parameters: + /// * [body] - Input boolean as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [bool] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterBooleanSerialize({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// fakeOuterCompositeSerialize + /// Test serialization of object with outer number type + /// + /// Parameters: + /// * [outerComposite] - Input composite as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [OuterComposite] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterCompositeSerialize({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// fakeOuterNumberSerialize + /// Test serialization of outer number types + /// + /// Parameters: + /// * [body] - Input number as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [num] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterNumberSerialize({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// fakeOuterStringSerialize + /// Test serialization of outer string types + /// + /// Parameters: + /// * [body] - Input string as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [String] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterStringSerialize({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// fakePropertyEnumIntegerSerialize + /// Test serialization of enum (int) properties with examples + /// + /// Parameters: + /// * [outerObjectWithEnumProperty] - Input enum (int) as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [OuterObjectWithEnumProperty] as data + /// Throws [DioException] if API call or serialization fails + Future> fakePropertyEnumIntegerSerialize({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// testBodyWithBinary + /// For this test, the body has to be a binary file. + /// + /// Parameters: + /// * [body] - image to upload + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testBodyWithBinary({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/body-with-binary'; + final _options = Options( + method: r'PUT', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// testBodyWithFileSchema + /// For this test, the body for this request must reference a schema named `File`. + /// + /// Parameters: + /// * [fileSchemaTestClass] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testBodyWithFileSchema({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// testBodyWithQueryParams + /// + /// + /// Parameters: + /// * [query] + /// * [user] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testBodyWithQueryParams({ + required Object query, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'query': query, + }; + + return await _dio.request( + _path, + data: body, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// To test \"client\" model + /// To test \"client\" model + /// + /// Parameters: + /// * [modelClient] - client model + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ModelClient] as data + /// Throws [DioException] if API call or serialization fails + Future> testClientModel({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'PATCH', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Parameters: + /// * [number] - None + /// * [double_] - None + /// * [patternWithoutDelimiter] - None + /// * [byte] - None + /// * [integer] - None + /// * [int32] - None + /// * [int64] - None + /// * [float] - None + /// * [string] - None + /// * [binary] - None + /// * [date] - None + /// * [dateTime] - None + /// * [password] - None + /// * [callback] - None + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testEndpointParameters({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'POST', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'basic', + 'name': 'http_basic_test', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// To test enum parameters + /// To test enum parameters + /// + /// Parameters: + /// * [enumHeaderStringArray] - Header parameter enum test (string array) + /// * [enumHeaderString] - Header parameter enum test (string) (Default: r'-efg') + /// * [enumQueryStringArray] - Query parameter enum test (string array) + /// * [enumQueryString] - Query parameter enum test (string) (Default: r'-efg') + /// * [enumQueryInteger] - Query parameter enum test (double) + /// * [enumQueryDouble] - Query parameter enum test (double) + /// * [enumQueryModelArray] + /// * [enumFormStringArray] - Form parameter enum test (string array) (Default: r'$') + /// * [enumFormString] - Form parameter enum test (string) (Default: r'-efg') + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testEnumParameters({ + String? enumHeaderStringArray, + String? enumHeaderString, + Object? enumQueryStringArray, + Object? enumQueryString, + Object? enumQueryInteger, + Object? enumQueryDouble, + Object? enumQueryModelArray, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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, + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + 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, + if (enumQueryModelArray != null) r'enum_query_model_array': enumQueryModelArray, + }; + + return await _dio.request( + _path, + data: body, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Fake endpoint to test group parameters (optional) + /// Fake endpoint to test group parameters (optional) + /// + /// Parameters: + /// * [requiredStringGroup] - Required String in group parameters + /// * [requiredBooleanGroup] - Required Boolean in group parameters + /// * [requiredInt64Group] - Required Integer in group parameters + /// * [stringGroup] - String in group parameters + /// * [booleanGroup] - Boolean in group parameters + /// * [int64Group] - Integer in group parameters + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testGroupParameters({ + required Object requiredStringGroup, + required String requiredBooleanGroup, + required Object requiredInt64Group, + Object? stringGroup, + String? booleanGroup, + Object? int64Group, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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, + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'bearer_test', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + 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, + }; + + return await _dio.request( + _path, + data: body, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// test inline additionalProperties + /// + /// + /// Parameters: + /// * [requestBody] - request body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testInlineAdditionalProperties({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// test json serialization of form data + /// + /// + /// Parameters: + /// * [param] - field1 + /// * [param2] - field2 + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testJsonFormData({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// testQueryParameterCollectionFormat + /// To test the collection format in query parameters + /// + /// Parameters: + /// * [pipe] + /// * [ioutil] + /// * [http] + /// * [url] + /// * [context] + /// * [allowEmpty] + /// * [language] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testQueryParameterCollectionFormat({ + required Object pipe, + required Object ioutil, + required Object http, + required Object url, + required Object context, + required Object allowEmpty, + Object? language, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/test-query-parameters'; + final _options = Options( + method: r'PUT', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'pipe': pipe, + r'ioutil': ioutil, + r'http': http, + r'url': url, + r'context': context, + if (language != null) r'language': language, + r'allowEmpty': allowEmpty, + }; + + return await _dio.request( + _path, + data: body, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + +class EnumHeaderStringArrayEnum extends EnumClass { + + @BuiltValueEnumConst(wireName: r'>') + static const EnumHeaderStringArrayEnum greaterThan = _$enumHeaderStringArrayEnum_greaterThan; + @BuiltValueEnumConst(wireName: r'$') + static const EnumHeaderStringArrayEnum dollar = _$enumHeaderStringArrayEnum_dollar; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumHeaderStringArrayEnum unknownDefaultOpenApi = _$enumHeaderStringArrayEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$enumHeaderStringArrayEnumSerializer; + + const EnumHeaderStringArrayEnum._(String name): super(name); + + static BuiltSet get values => _$enumHeaderStringArrayEnumValues; + static EnumHeaderStringArrayEnum valueOf(String name) => _$enumHeaderStringArrayEnumValueOf(name); +} + + +class EnumHeaderStringEnum extends EnumClass { + + /// Header parameter enum test (string) + @BuiltValueEnumConst(wireName: r'_abc') + static const EnumHeaderStringEnum abc = _$enumHeaderStringEnum_abc; + /// Header parameter enum test (string) + @BuiltValueEnumConst(wireName: r'-efg') + static const EnumHeaderStringEnum efg = _$enumHeaderStringEnum_efg; + /// Header parameter enum test (string) + @BuiltValueEnumConst(wireName: r'(xyz)') + static const EnumHeaderStringEnum leftParenthesisXyzRightParenthesis = _$enumHeaderStringEnum_leftParenthesisXyzRightParenthesis; + /// Header parameter enum test (string) + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumHeaderStringEnum unknownDefaultOpenApi = _$enumHeaderStringEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$enumHeaderStringEnumSerializer; + + const EnumHeaderStringEnum._(String name): super(name); + + static BuiltSet get values => _$enumHeaderStringEnumValues; + static EnumHeaderStringEnum valueOf(String name) => _$enumHeaderStringEnumValueOf(name); +} + +class EnumQueryStringArrayEnum extends EnumClass { + + @BuiltValueEnumConst(wireName: r'>') + static const EnumQueryStringArrayEnum greaterThan = _$enumQueryStringArrayEnum_greaterThan; + @BuiltValueEnumConst(wireName: r'$') + static const EnumQueryStringArrayEnum dollar = _$enumQueryStringArrayEnum_dollar; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumQueryStringArrayEnum unknownDefaultOpenApi = _$enumQueryStringArrayEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$enumQueryStringArrayEnumSerializer; + + const EnumQueryStringArrayEnum._(String name): super(name); + + static BuiltSet get values => _$enumQueryStringArrayEnumValues; + static EnumQueryStringArrayEnum valueOf(String name) => _$enumQueryStringArrayEnumValueOf(name); +} + + +class EnumQueryStringEnum extends EnumClass { + + /// Query parameter enum test (string) + @BuiltValueEnumConst(wireName: r'_abc') + static const EnumQueryStringEnum abc = _$enumQueryStringEnum_abc; + /// Query parameter enum test (string) + @BuiltValueEnumConst(wireName: r'-efg') + static const EnumQueryStringEnum efg = _$enumQueryStringEnum_efg; + /// Query parameter enum test (string) + @BuiltValueEnumConst(wireName: r'(xyz)') + static const EnumQueryStringEnum leftParenthesisXyzRightParenthesis = _$enumQueryStringEnum_leftParenthesisXyzRightParenthesis; + /// Query parameter enum test (string) + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumQueryStringEnum unknownDefaultOpenApi = _$enumQueryStringEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$enumQueryStringEnumSerializer; + + const EnumQueryStringEnum._(String name): super(name); + + static BuiltSet get values => _$enumQueryStringEnumValues; + static EnumQueryStringEnum valueOf(String name) => _$enumQueryStringEnumValueOf(name); +} + +class EnumQueryIntegerEnum extends EnumClass { + + /// Query parameter enum test (double) + @BuiltValueEnumConst(wireNumber: 1) + static const EnumQueryIntegerEnum number1 = _$enumQueryIntegerEnum_number1; + /// Query parameter enum test (double) + @BuiltValueEnumConst(wireNumber: -2) + static const EnumQueryIntegerEnum numberNegative2 = _$enumQueryIntegerEnum_numberNegative2; + /// Query parameter enum test (double) + @BuiltValueEnumConst(wireNumber: 11184809, fallback: true) + static const EnumQueryIntegerEnum unknownDefaultOpenApi = _$enumQueryIntegerEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$enumQueryIntegerEnumSerializer; + + const EnumQueryIntegerEnum._(String name): super(name); + + static BuiltSet get values => _$enumQueryIntegerEnumValues; + static EnumQueryIntegerEnum valueOf(String name) => _$enumQueryIntegerEnumValueOf(name); +} + +class EnumQueryDoubleEnum extends EnumClass { + + /// Query parameter enum test (double) + @BuiltValueEnumConst(wireName: r'1.1') + static const EnumQueryDoubleEnum number1Period1 = _$enumQueryDoubleEnum_number1Period1; + /// Query parameter enum test (double) + @BuiltValueEnumConst(wireName: r'-1.2') + static const EnumQueryDoubleEnum numberNegative1Period2 = _$enumQueryDoubleEnum_numberNegative1Period2; + /// Query parameter enum test (double) + @BuiltValueEnumConst(wireName: r'11184809', fallback: true) + static const EnumQueryDoubleEnum unknownDefaultOpenApi = _$enumQueryDoubleEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$enumQueryDoubleEnumSerializer; + + const EnumQueryDoubleEnum._(String name): super(name); + + static BuiltSet get values => _$enumQueryDoubleEnumValues; + static EnumQueryDoubleEnum valueOf(String name) => _$enumQueryDoubleEnumValueOf(name); +} + + +class InnerEnum extends EnumClass { + + + static Serializer get serializer => _$innerEnumSerializer; + + const InnerEnum._(String name): super(name); + + static BuiltSet get values => _$innerEnumValues; + static InnerEnum valueOf(String name) => _$innerEnumValueOf(name); +} + + +class EnumFormStringEnum extends EnumClass { + + /// Form parameter enum test (string) + @BuiltValueEnumConst(wireName: r'_abc') + static const EnumFormStringEnum abc = _$enumFormStringEnum_abc; + /// Form parameter enum test (string) + @BuiltValueEnumConst(wireName: r'-efg') + static const EnumFormStringEnum efg = _$enumFormStringEnum_efg; + /// Form parameter enum test (string) + @BuiltValueEnumConst(wireName: r'(xyz)') + static const EnumFormStringEnum leftParenthesisXyzRightParenthesis = _$enumFormStringEnum_leftParenthesisXyzRightParenthesis; + /// Form parameter enum test (string) + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumFormStringEnum unknownDefaultOpenApi = _$enumFormStringEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$enumFormStringEnumSerializer; + + const EnumFormStringEnum._(String name): super(name); + + static BuiltSet get values => _$enumFormStringEnumValues; + static EnumFormStringEnum valueOf(String name) => _$enumFormStringEnumValueOf(name); +} + + + + + + + + + + + + + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/api/fake_classname_tags123_api.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/api/fake_classname_tags123_api.dart new file mode 100644 index 000000000000..9562e3ef0516 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/api/fake_classname_tags123_api.dart @@ -0,0 +1,169 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'package:dio/dio.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; +import 'package:openapi/src/repository_base.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/models.dart'; +import 'package:openapi/src/model/model_client.dart'; + + +class FakeClassnameTags123Api { + + final FakeClassnameTags123ApiRaw rawApi; + final SerializationRepositoryBase _repository; + + const FakeClassnameTags123Api(this.rawApi, this._repository); + + /// To test class name in snake case + /// To test class name in snake case + /// + /// Parameters: + /// * [modelClient] - client model + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ModelClient] as data + /// Throws [DioException] if API call or serialization fails + Future> testClassname({ + required ModelClient modelClient, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, modelClient, const TypeInfo( + + + ModelClient + ) + +); + + final _response = await rawApi.testClassname( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ModelClient? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + ModelClient + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + +} +class FakeClassnameTags123ApiRaw { + + final Dio _dio; + + const FakeClassnameTags123ApiRaw(this._dio); + + /// To test class name in snake case + /// To test class name in snake case + /// + /// Parameters: + /// * [modelClient] - client model + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ModelClient] as data + /// Throws [DioException] if API call or serialization fails + Future> testClassname({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'apiKey', + 'name': 'api_key_query', + 'keyName': 'api_key_query', + 'where': 'query', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/api/foo_api.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/api/foo_api.dart new file mode 100644 index 000000000000..3d46f23a463b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/api/foo_api.dart @@ -0,0 +1,287 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'package:dio/dio.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; +import 'package:openapi/src/repository_base.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/models.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/foo_ref_or_value.dart'; + + +class FooApi { + + final FooApiRaw rawApi; + final SerializationRepositoryBase _repository; + + const FooApi(this.rawApi, this._repository); + + /// Create a Foo + /// + /// + /// Parameters: + /// * [foo] - The Foo to be created + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FooRefOrValue] as data + /// Throws [DioException] if API call or serialization fails + Future> createFoo({ + required Foo foo, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, foo, const TypeInfo( + + + Foo + ) + +); + + final _response = await rawApi.createFoo( + + body: _bodyData, + requestContentType: 'application/json;charset=utf-8', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + FooRefOrValue? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + FooRefOrValue + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + + /// GET all Foos + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [BuiltList] as data + /// Throws [DioException] if API call or serialization fails + Future>> getAllFoos({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.getAllFoos( + + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + BuiltList? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + BuiltList, [ + + const TypeInfo( + + FooRefOrValue + + ) + +, + ]) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + +} +class FooApiRaw { + + final Dio _dio; + + const FooApiRaw(this._dio); + + /// Create a Foo + /// + /// + /// Parameters: + /// * [foo] - The Foo to be created + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FooRefOrValue] as data + /// Throws [DioException] if API call or serialization fails + Future> createFoo({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/foo'; + final _options = Options( + method: r'POST', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// GET all Foos + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [BuiltList] as data + /// Throws [DioException] if API call or serialization fails + Future> getAllFoos({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/foo'; + final _options = Options( + method: r'GET', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/api/pet_api.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/api/pet_api.dart new file mode 100644 index 000000000000..435aa41e2c3b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/api/pet_api.dart @@ -0,0 +1,1275 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'package:dio/dio.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; +import 'package:openapi/src/repository_base.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/models.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/api_response.dart'; +import 'package:openapi/src/model/pet.dart'; + +part 'pet_api.g.dart'; + +class PetApi { + + final PetApiRaw rawApi; + final SerializationRepositoryBase _repository; + + const PetApi(this.rawApi, this._repository); + + /// Add a new pet to the store + /// + /// + /// Parameters: + /// * [pet] - Pet object that needs to be added to the store + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> addPet({ + required Pet pet, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, pet, const TypeInfo( + + + Pet + ) + +); + + final _response = await rawApi.addPet( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Deletes a pet + /// + /// + /// Parameters: + /// * [petId] - Pet id to delete + /// * [apiKey] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> deletePet({ + required int petId, + required String apiKey, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.deletePet( + + petId: await encodeStringParameter(_repository, petId, const TypeInfo( + + + int + ) + +), + apiKey: await encodeStringParameter(_repository, apiKey, const TypeInfo( + + + String + ) + +), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Finds Pets by status + /// Multiple status values can be provided with comma separated strings + /// + /// Parameters: + /// * [status] - Status values that need to be considered for filter + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [BuiltList] as data + /// Throws [DioException] if API call or serialization fails + Future>> findPetsByStatus({ + @Deprecated('status is deprecated') required BuiltList status, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.findPetsByStatus( + + status: await encodeQueryParameter(_repository, status, const TypeInfo( + BuiltList, [ + + const TypeInfo( + + StatusEnum + + ) + +, + ]) + +, format: ListFormat.csv,), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + BuiltList? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + BuiltList, [ + + const TypeInfo( + + Pet + + ) + +, + ]) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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. + /// + /// Parameters: + /// * [tags] - Tags to filter by + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [BuiltSet] as data + /// Throws [DioException] if API call or serialization fails + @Deprecated('This operation has been deprecated') + Future>> findPetsByTags({ + required BuiltSet tags, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.findPetsByTags( + + tags: await encodeQueryParameter(_repository, tags, const TypeInfo( + BuiltSet, [ + + const TypeInfo( + + String + + ) + +, + ]) + +, format: ListFormat.csv,), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + BuiltSet? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + BuiltSet, [ + + const TypeInfo( + + Pet + + ) + +, + ]) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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 + /// + /// Parameters: + /// * [petId] - ID of pet to return + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Pet] as data + /// Throws [DioException] if API call or serialization fails + Future> getPetById({ + required int petId, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.getPetById( + + petId: await encodeStringParameter(_repository, petId, const TypeInfo( + + + int + ) + +), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Pet? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + Pet + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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 + /// + /// + /// Parameters: + /// * [pet] - Pet object that needs to be added to the store + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> updatePet({ + required Pet pet, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, pet, const TypeInfo( + + + Pet + ) + +); + + final _response = await rawApi.updatePet( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Updates a pet in the store with form data + /// + /// + /// Parameters: + /// * [petId] - ID of pet that needs to be updated + /// * [name] - Updated name of the pet + /// * [status] - Updated status of the pet + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> updatePetWithForm({ + required int petId, + required String name, + required String status, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + final _bodyMap = { + if (name != null) r'name': await encodeFormParameter(_repository, name, const TypeInfo( + + + String + ) + +), + if (status != null) r'status': await encodeFormParameter(_repository, status, const TypeInfo( + + + String + ) + +), + }; + _bodyData = _bodyMap; + + final _response = await rawApi.updatePetWithForm( + + petId: await encodeStringParameter(_repository, petId, const TypeInfo( + + + int + ) + +), + body: _bodyData, + requestContentType: 'application/x-www-form-urlencoded', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// uploads an image + /// + /// + /// Parameters: + /// * [petId] - ID of pet to update + /// * [additionalMetadata] - Additional data to pass to server + /// * [file] - file to upload + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ApiResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> uploadFile({ + required int petId, + required String additionalMetadata, + required MultipartFile file, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + final _bodyMap = { + if (additionalMetadata != null) r'additionalMetadata': await encodeFormParameter(_repository, additionalMetadata, const TypeInfo( + + + String + ) + +), + if (file != null) r'file': await encodeFormParameter(_repository, file, const TypeInfo( + + + MultipartFile + ) + +), + }; + _bodyData = FormData.fromMap(_bodyMap); + + final _response = await rawApi.uploadFile( + + petId: await encodeStringParameter(_repository, petId, const TypeInfo( + + + int + ) + +), + body: _bodyData, + requestContentType: 'multipart/form-data', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ApiResponse? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + ApiResponse + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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) + /// + /// + /// Parameters: + /// * [petId] - ID of pet to update + /// * [requiredFile] - file to upload + /// * [additionalMetadata] - Additional data to pass to server + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ApiResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> uploadFileWithRequiredFile({ + required int petId, + required MultipartFile requiredFile, + required String additionalMetadata, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + final _bodyMap = { + if (additionalMetadata != null) r'additionalMetadata': await encodeFormParameter(_repository, additionalMetadata, const TypeInfo( + + + String + ) + +), + r'requiredFile': await encodeFormParameter(_repository, requiredFile, const TypeInfo( + + + MultipartFile + ) + +), + }; + _bodyData = FormData.fromMap(_bodyMap); + + final _response = await rawApi.uploadFileWithRequiredFile( + + petId: await encodeStringParameter(_repository, petId, const TypeInfo( + + + int + ) + +), + body: _bodyData, + requestContentType: 'multipart/form-data', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ApiResponse? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + ApiResponse + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + +} +class PetApiRaw { + + final Dio _dio; + + const PetApiRaw(this._dio); + + /// Add a new pet to the store + /// + /// + /// Parameters: + /// * [pet] - Pet object that needs to be added to the store + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> addPet({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet'; + final _options = Options( + method: r'POST', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Deletes a pet + /// + /// + /// Parameters: + /// * [petId] - Pet id to delete + /// * [apiKey] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> deletePet({ + required String petId, + String? apiKey, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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, + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Finds Pets by status + /// Multiple status values can be provided with comma separated strings + /// + /// Parameters: + /// * [status] - Status values that need to be considered for filter + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [BuiltList] as data + /// Throws [DioException] if API call or serialization fails + Future> findPetsByStatus({ + @Deprecated('status is deprecated') required Object status, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'status': status, + }; + + return await _dio.request( + _path, + data: body, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Finds Pets by tags + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Parameters: + /// * [tags] - Tags to filter by + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [BuiltSet] as data + /// Throws [DioException] if API call or serialization fails + @Deprecated('This operation has been deprecated') + Future> findPetsByTags({ + required Object tags, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'tags': tags, + }; + + return await _dio.request( + _path, + data: body, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Find pet by ID + /// Returns a single pet + /// + /// Parameters: + /// * [petId] - ID of pet to return + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Pet] as data + /// Throws [DioException] if API call or serialization fails + Future> getPetById({ + required String petId, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'apiKey', + 'name': 'api_key', + 'keyName': 'api_key', + 'where': 'header', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Update an existing pet + /// + /// + /// Parameters: + /// * [pet] - Pet object that needs to be added to the store + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> updatePet({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet'; + final _options = Options( + method: r'PUT', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Updates a pet in the store with form data + /// + /// + /// Parameters: + /// * [petId] - ID of pet that needs to be updated + /// * [name] - Updated name of the pet + /// * [status] - Updated status of the pet + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> updatePetWithForm({ + required String petId, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// uploads an image + /// + /// + /// Parameters: + /// * [petId] - ID of pet to update + /// * [additionalMetadata] - Additional data to pass to server + /// * [file] - file to upload + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ApiResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> uploadFile({ + required String petId, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// uploads an image (required) + /// + /// + /// Parameters: + /// * [petId] - ID of pet to update + /// * [requiredFile] - file to upload + /// * [additionalMetadata] - Additional data to pass to server + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ApiResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> uploadFileWithRequiredFile({ + required String petId, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + +} + + + + +@Deprecated('StatusEnum has been deprecated') +class StatusEnum extends EnumClass { + + @BuiltValueEnumConst(wireName: r'available') + static const StatusEnum available = _$statusEnum_available; + @BuiltValueEnumConst(wireName: r'pending') + static const StatusEnum pending = _$statusEnum_pending; + @BuiltValueEnumConst(wireName: r'sold') + static const StatusEnum sold = _$statusEnum_sold; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const StatusEnum unknownDefaultOpenApi = _$statusEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$statusEnumSerializer; + + const StatusEnum._(String name): super(name); + + static BuiltSet get values => _$statusEnumValues; + static StatusEnum valueOf(String name) => _$statusEnumValueOf(name); +} + + + + + + + + + + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/api/store_api.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/api/store_api.dart new file mode 100644 index 000000000000..be557dc64816 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/api/store_api.dart @@ -0,0 +1,521 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'package:dio/dio.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; +import 'package:openapi/src/repository_base.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/models.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/order.dart'; + + +class StoreApi { + + final StoreApiRaw rawApi; + final SerializationRepositoryBase _repository; + + const StoreApi(this.rawApi, this._repository); + + /// Delete purchase order by ID + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Parameters: + /// * [orderId] - ID of the order that needs to be deleted + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> deleteOrder({ + required String orderId, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.deleteOrder( + + orderId: await encodeStringParameter(_repository, orderId, const TypeInfo( + + + String + ) + +), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Returns pet inventories by status + /// Returns a map of status codes to quantities + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [BuiltMap] as data + /// Throws [DioException] if API call or serialization fails + Future>> getInventory({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.getInventory( + + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + BuiltMap? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + BuiltMap, [ + TypeInfo(String), + const TypeInfo( + + int + + ) + +, + ]) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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 generate exceptions + /// + /// Parameters: + /// * [orderId] - ID of pet that needs to be fetched + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Order] as data + /// Throws [DioException] if API call or serialization fails + Future> getOrderById({ + required int orderId, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.getOrderById( + + orderId: await encodeStringParameter(_repository, orderId, const TypeInfo( + + + int + ) + +), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Order? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + Order + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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 + /// + /// + /// Parameters: + /// * [order] - order placed for purchasing the pet + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Order] as data + /// Throws [DioException] if API call or serialization fails + Future> placeOrder({ + required Order order, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, order, const TypeInfo( + + + Order + ) + +); + + final _response = await rawApi.placeOrder( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Order? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + Order + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + +} +class StoreApiRaw { + + final Dio _dio; + + const StoreApiRaw(this._dio); + + /// Delete purchase order by ID + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Parameters: + /// * [orderId] - ID of the order that needs to be deleted + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> deleteOrder({ + required String orderId, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Returns pet inventories by status + /// Returns a map of status codes to quantities + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [BuiltMap] as data + /// Throws [DioException] if API call or serialization fails + Future> getInventory({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'apiKey', + 'name': 'api_key', + 'keyName': 'api_key', + 'where': 'header', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Find purchase order by ID + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Parameters: + /// * [orderId] - ID of pet that needs to be fetched + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Order] as data + /// Throws [DioException] if API call or serialization fails + Future> getOrderById({ + required String orderId, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Place an order for a pet + /// + /// + /// Parameters: + /// * [order] - order placed for purchasing the pet + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Order] as data + /// Throws [DioException] if API call or serialization fails + Future> placeOrder({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + +} + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/api/user_api.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/api/user_api.dart new file mode 100644 index 000000000000..caeb7be4f811 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/api/user_api.dart @@ -0,0 +1,919 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'package:dio/dio.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; +import 'package:openapi/src/repository_base.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/models.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/user.dart'; + + +class UserApi { + + final UserApiRaw rawApi; + final SerializationRepositoryBase _repository; + + const UserApi(this.rawApi, this._repository); + + /// Create user + /// This can only be done by the logged in user. + /// + /// Parameters: + /// * [user] - Created user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> createUser({ + required User user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, user, const TypeInfo( + + + User + ) + +); + + final _response = await rawApi.createUser( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Creates list of users with given input array + /// + /// + /// Parameters: + /// * [user] - List of user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> createUsersWithArrayInput({ + required BuiltList user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, user, const TypeInfo( + BuiltList, [ + + const TypeInfo( + + User + + ) + +, + ]) + +); + + final _response = await rawApi.createUsersWithArrayInput( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Creates list of users with given input array + /// + /// + /// Parameters: + /// * [user] - List of user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> createUsersWithListInput({ + required BuiltList user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, user, const TypeInfo( + BuiltList, [ + + const TypeInfo( + + User + + ) + +, + ]) + +); + + final _response = await rawApi.createUsersWithListInput( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Delete user + /// This can only be done by the logged in user. + /// + /// Parameters: + /// * [username] - The name that needs to be deleted + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> deleteUser({ + required String username, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.deleteUser( + + username: await encodeStringParameter(_repository, username, const TypeInfo( + + + String + ) + +), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Get user by user name + /// + /// + /// Parameters: + /// * [username] - The name that needs to be fetched. Use user1 for testing. + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [User] as data + /// Throws [DioException] if API call or serialization fails + Future> getUserByName({ + required String username, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.getUserByName( + + username: await encodeStringParameter(_repository, username, const TypeInfo( + + + String + ) + +), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + User? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + User + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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 + /// + /// + /// Parameters: + /// * [username] - The user name for login + /// * [password] - The password for login in clear text + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [String] as data + /// Throws [DioException] if API call or serialization fails + Future> loginUser({ + required String username, + required String password, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.loginUser( + + username: await encodeQueryParameter(_repository, username, const TypeInfo( + + + String + ) + +, ), + password: await encodeQueryParameter(_repository, password, const TypeInfo( + + + String + ) + +, ), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + String? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : await decodeResponse(_repository, rawResponse, const TypeInfo( + + String + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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 + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> logoutUser({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.logoutUser( + + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Updated user + /// This can only be done by the logged in user. + /// + /// Parameters: + /// * [username] - name that need to be deleted + /// * [user] - Updated user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> updateUser({ + required String username, + required User user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = await encodeBodyParameter(_repository, user, const TypeInfo( + + + User + ) + +); + + final _response = await rawApi.updateUser( + + username: await encodeStringParameter(_repository, username, const TypeInfo( + + + String + ) + +), + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + +} +class UserApiRaw { + + final Dio _dio; + + const UserApiRaw(this._dio); + + /// Create user + /// This can only be done by the logged in user. + /// + /// Parameters: + /// * [user] - Created user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> createUser({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user'; + final _options = Options( + method: r'POST', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Creates list of users with given input array + /// + /// + /// Parameters: + /// * [user] - List of user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> createUsersWithArrayInput({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Creates list of users with given input array + /// + /// + /// Parameters: + /// * [user] - List of user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> createUsersWithListInput({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Delete user + /// This can only be done by the logged in user. + /// + /// Parameters: + /// * [username] - The name that needs to be deleted + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> deleteUser({ + required String username, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Get user by user name + /// + /// + /// Parameters: + /// * [username] - The name that needs to be fetched. Use user1 for testing. + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [User] as data + /// Throws [DioException] if API call or serialization fails + Future> getUserByName({ + required String username, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Logs user into the system + /// + /// + /// Parameters: + /// * [username] - The user name for login + /// * [password] - The password for login in clear text + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [String] as data + /// Throws [DioException] if API call or serialization fails + Future> loginUser({ + required Object username, + required Object password, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'username': username, + r'password': password, + }; + + return await _dio.request( + _path, + data: body, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Logs out current logged in user session + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> logoutUser({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Updated user + /// This can only be done by the logged in user. + /// + /// Parameters: + /// * [username] - name that need to be deleted + /// * [user] - Updated user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> updateUser({ + required String username, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + +} + + + + + + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/api_client.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/api_client.dart new file mode 100644 index 000000000000..bc683f074d55 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/api_client.dart @@ -0,0 +1,119 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'repository_base.dart'; +import 'repository_impl.dart'; +import 'package:openapi/apis.dart'; +import 'package:openapi/models.dart'; +import 'package:openapi/src/auth/_exports.dart'; + +class Openapi { + static const String basePath = r'http://petstore.swagger.io:80/v2'; + + final Dio dio; + final SerializationRepositoryBase serializationRepository; + + + Openapi({ + Dio? dio, + SerializationRepositoryBase? serializationRepositoryOverride, + String? basePathOverride, + List? interceptors, + }) : this.dio = dio ?? + Dio(BaseOptions( + baseUrl: basePathOverride ?? basePath, + connectTimeout: const Duration(milliseconds: 5000), + receiveTimeout: const Duration(milliseconds: 3000), + )), this.serializationRepository = serializationRepositoryOverride ?? BuiltValueJsonRepository(standardSerializers) { + if (interceptors == null) { + this.dio.interceptors.addAll([ + OAuthInterceptor(), + BasicAuthInterceptor(), + BearerAuthInterceptor(), + 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 setBearerAuth(String name, String token) { + if (this.dio.interceptors.any((i) => i is BearerAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is BearerAuthInterceptor) as BearerAuthInterceptor).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(AnotherFakeApiRaw(dio), serializationRepository); + } + + /// Get BarApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + BarApi getBarApi() { + return BarApi(BarApiRaw(dio), serializationRepository); + } + + /// 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(DefaultApiRaw(dio), serializationRepository); + } + + /// 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(FakeApiRaw(dio), serializationRepository); + } + + /// 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(FakeClassnameTags123ApiRaw(dio), serializationRepository); + } + + /// Get FooApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + FooApi getFooApi() { + return FooApi(FooApiRaw(dio), serializationRepository); + } + + /// 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(PetApiRaw(dio), serializationRepository); + } + + /// 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(StoreApiRaw(dio), serializationRepository); + } + + /// 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(UserApiRaw(dio), serializationRepository); + } +} diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/api_util.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/api_util.dart new file mode 100644 index 000000000000..e6357fd191b6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/api_util.dart @@ -0,0 +1,82 @@ +import 'package:dio/dio.dart'; +import 'dart:async'; +import 'dart:convert'; +import 'package:openapi/models.dart'; +import 'dart:typed_data'; + +/// Format the given form parameter object into something that Dio can handle. +Future encodeFormParameter( + SerializationRepositoryBase repository, + T value, + TypeInfo type, +) async { + return repository.serialize( + value, + type, + ); +} + +Future encodeStringParameter( + SerializationRepositoryBase repository, + T value, + TypeInfo type, +) async { + return (await repository.serialize(value, type)).toString(); +} + +Future encodeBodyParameter( + SerializationRepositoryBase repository, + T value, + TypeInfo type, +) async { + return await repository.serialize( + value, + type, + ); +} + +Future encodeQueryParameter( + SerializationRepositoryBase repository, + T value, + TypeInfo type, { + ListFormat format = ListFormat.multi, +}) async { + if (value == null) { + return null; + } + if (value is String || value is num || value is bool) { + return value; + } + if (value is Uint8List) { + // Currently not sure how to serialize this + return value; + } + final serialized = repository.serialize( + value, + type, + ); + return serialized; +} + +Future> encodeCollectionQueryParameter( + SerializationRepositoryBase repository, + Iterable value, + TypeInfo type, { + ListFormat format = ListFormat.multi, +}) async { + final serialized = await repository.serialize( + value, + type, + ); + if (serialized == null) { + return ListParam([], format); + } + if (serialized is Iterable) { + return ListParam(serialized.toList(), format); + } + throw ArgumentError('Invalid value passed to encodeCollectionQueryParameter'); +} + +Future decodeResponse(SerializationRepositoryBase repository, TInput value, TypeInfo type) async { + return await repository.deserialize(value, type); +} \ No newline at end of file diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/auth/_exports.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/auth/_exports.dart new file mode 100644 index 000000000000..f038e92358ef --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/auth/_exports.dart @@ -0,0 +1,5 @@ +export 'api_key_auth.dart'; +export 'basic_auth.dart'; +export 'oauth.dart'; +export 'bearer_auth.dart'; +export 'auth.dart'; \ No newline at end of file diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/auth/api_key_auth.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/auth/api_key_auth.dart new file mode 100644 index 000000000000..ee16e3f0f92f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/auth/api_key_auth.dart @@ -0,0 +1,30 @@ +// +// 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, (secure) => secure['type'] == '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/client/echo_api/dart/dio/built_value/lib/src/auth/auth.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/auth/auth.dart new file mode 100644 index 000000000000..f7ae9bf3f11e --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/auth/auth.dart @@ -0,0 +1,18 @@ +// +// 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, bool Function(Map secure) handles) { + if (route.extra.containsKey('secure')) { + final auth = route.extra['secure'] as List>; + return auth.where((secure) => handles(secure)).toList(); + } + return []; + } +} diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/auth/basic_auth.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/auth/basic_auth.dart new file mode 100644 index 000000000000..b6e6dce04f9c --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/auth/basic_auth.dart @@ -0,0 +1,37 @@ +// +// 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, (secure) => (secure['type'] == 'http' && secure['scheme'] == 'basic') || secure['type'] == '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/client/echo_api/dart/dio/built_value/lib/src/auth/bearer_auth.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/auth/bearer_auth.dart new file mode 100644 index 000000000000..1d4402b376c0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/auth/bearer_auth.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/auth.dart'; + +class BearerAuthInterceptor extends AuthInterceptor { + final Map tokens = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'http' && secure['scheme'] == 'bearer'); + 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/client/echo_api/dart/dio/built_value/lib/src/auth/oauth.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/auth/oauth.dart new file mode 100644 index 000000000000..337cf762b0ce --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/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, (secure) => secure['type'] == 'oauth' || secure['type'] == 'oauth2'); + 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/client/echo_api/dart/dio/built_value/lib/src/date_serializer.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/date_serializer.dart new file mode 100644 index 000000000000..06e023d91be5 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/date_serializer.dart @@ -0,0 +1,31 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; +import 'model/date.dart'; + +class DateSerializer implements PrimitiveSerializer { + + const DateSerializer(); + + @override + Iterable get types => BuiltList.of([Date]); + + @override + String get wireName => 'Date'; + + @override + Date deserialize(Serializers serializers, Object serialized, + {FullType specifiedType = FullType.unspecified}) { + final parsed = DateTime.parse(serialized as String); + return Date(parsed.year, parsed.month, parsed.day); + } + + @override + Object serialize(Serializers serializers, Date date, + {FullType specifiedType = FullType.unspecified}) { + return date.toString(); + } +} diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/additional_properties_class.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/additional_properties_class.dart new file mode 100644 index 000000000000..a5194f1d0c48 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/additional_properties_class.dart @@ -0,0 +1,129 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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'; + +/// AdditionalPropertiesClass +/// +/// Properties: +/// * [mapProperty] +/// * [mapOfMapProperty] +@BuiltValue() +abstract class AdditionalPropertiesClass implements Built { + @BuiltValueField(wireName: r'map_property') + BuiltMap? get mapProperty; + + @BuiltValueField(wireName: r'map_of_map_property') + BuiltMap>? get mapOfMapProperty; + + AdditionalPropertiesClass._(); + + factory AdditionalPropertiesClass([void updates(AdditionalPropertiesClassBuilder b)]) = _$AdditionalPropertiesClass; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(AdditionalPropertiesClassBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$AdditionalPropertiesClassSerializer(); +} + +class _$AdditionalPropertiesClassSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [AdditionalPropertiesClass, _$AdditionalPropertiesClass]; + + @override + final String wireName = r'AdditionalPropertiesClass'; + + Iterable _serializeProperties( + Serializers serializers, + AdditionalPropertiesClass object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.mapProperty != null) { + yield r'map_property'; + yield serializers.serialize( + object.mapProperty, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(String)]), + ); + } + if (object.mapOfMapProperty != null) { + yield r'map_of_map_property'; + yield serializers.serialize( + object.mapOfMapProperty, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(BuiltMap, [FullType(String), FullType(String)])]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + AdditionalPropertiesClass object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AdditionalPropertiesClassBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'map_property': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(String)]), + ) as BuiltMap; + result.mapProperty.replace(valueDes); + break; + case r'map_of_map_property': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(BuiltMap, [FullType(String), FullType(String)])]), + ) as BuiltMap>; + result.mapOfMapProperty.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + AdditionalPropertiesClass deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = AdditionalPropertiesClassBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/addressable.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/addressable.dart new file mode 100644 index 000000000000..20ed539904b1 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/addressable.dart @@ -0,0 +1,163 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'addressable.g.dart'; + +/// Base schema for addressable entities +/// +/// Properties: +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +@BuiltValue(instantiable: false) +abstract class Addressable { + /// Hyperlink reference + @BuiltValueField(wireName: r'href') + String? get href; + + /// unique identifier + @BuiltValueField(wireName: r'id') + String? get id; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$AddressableSerializer(); +} + +class _$AddressableSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Addressable]; + + @override + final String wireName = r'Addressable'; + + Iterable _serializeProperties( + Serializers serializers, + Addressable object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Addressable object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + @override + Addressable deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.deserialize(serialized, specifiedType: FullType($Addressable)) as $Addressable; + } +} + +/// a concrete implementation of [Addressable], since [Addressable] is not instantiable +@BuiltValue(instantiable: true) +abstract class $Addressable implements Addressable, Built<$Addressable, $AddressableBuilder> { + $Addressable._(); + + factory $Addressable([void Function($AddressableBuilder)? updates]) = _$$Addressable; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($AddressableBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$Addressable> get serializer => _$$AddressableSerializer(); +} + +class _$$AddressableSerializer implements PrimitiveSerializer<$Addressable> { + @override + final Iterable types = const [$Addressable, _$$Addressable]; + + @override + final String wireName = r'$Addressable'; + + @override + Object serialize( + Serializers serializers, + $Addressable object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(Addressable))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AddressableBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $Addressable deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $AddressableBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/all_of_with_single_ref.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/all_of_with_single_ref.dart new file mode 100644 index 000000000000..a305a71e08d1 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/all_of_with_single_ref.dart @@ -0,0 +1,130 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/single_ref_type.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'all_of_with_single_ref.g.dart'; + +/// AllOfWithSingleRef +/// +/// Properties: +/// * [username] +/// * [singleRefType] +@BuiltValue() +abstract class AllOfWithSingleRef implements Built { + @BuiltValueField(wireName: r'username') + String? get username; + + @BuiltValueField(wireName: r'SingleRefType') + SingleRefType? get singleRefType; + // enum singleRefTypeEnum { admin, user, }; + + AllOfWithSingleRef._(); + + factory AllOfWithSingleRef([void updates(AllOfWithSingleRefBuilder b)]) = _$AllOfWithSingleRef; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(AllOfWithSingleRefBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$AllOfWithSingleRefSerializer(); +} + +class _$AllOfWithSingleRefSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [AllOfWithSingleRef, _$AllOfWithSingleRef]; + + @override + final String wireName = r'AllOfWithSingleRef'; + + Iterable _serializeProperties( + Serializers serializers, + AllOfWithSingleRef object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.username != null) { + yield r'username'; + yield serializers.serialize( + object.username, + specifiedType: const FullType(String), + ); + } + if (object.singleRefType != null) { + yield r'SingleRefType'; + yield serializers.serialize( + object.singleRefType, + specifiedType: const FullType(SingleRefType), + ); + } + } + + @override + Object serialize( + Serializers serializers, + AllOfWithSingleRef object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AllOfWithSingleRefBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'username': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.username = valueDes; + break; + case r'SingleRefType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(SingleRefType), + ) as SingleRefType; + result.singleRefType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + AllOfWithSingleRef deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = AllOfWithSingleRefBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/animal.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/animal.dart new file mode 100644 index 000000000000..fffd873218c9 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/animal.dart @@ -0,0 +1,207 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/dog.dart'; +import 'package:openapi/src/model/cat.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'animal.g.dart'; + +/// Animal +/// +/// Properties: +/// * [className] +/// * [color] +@BuiltValue(instantiable: false) +abstract class Animal { + @BuiltValueField(wireName: r'className') + String get className; + + @BuiltValueField(wireName: r'color') + String? get color; + + static const String discriminatorFieldName = r'className'; + + static const Map discriminatorMapping = { + r'CAT': Cat, + r'DOG': Dog, + }; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$AnimalSerializer(); +} + +extension AnimalDiscriminatorExt on Animal { + String? get discriminatorValue { + if (this is Cat) { + return r'CAT'; + } + if (this is Dog) { + return r'DOG'; + } + return null; + } +} +extension AnimalBuilderDiscriminatorExt on AnimalBuilder { + String? get discriminatorValue { + if (this is CatBuilder) { + return r'CAT'; + } + if (this is DogBuilder) { + return r'DOG'; + } + return null; + } +} + +class _$AnimalSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Animal]; + + @override + final String wireName = r'Animal'; + + Iterable _serializeProperties( + Serializers serializers, + Animal object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'className'; + yield serializers.serialize( + object.className, + specifiedType: const FullType(String), + ); + if (object.color != null) { + yield r'color'; + yield serializers.serialize( + object.color, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Animal object, { + FullType specifiedType = FullType.unspecified, + }) { + if (object is Cat) { + return serializers.serialize(object, specifiedType: FullType(Cat))!; + } + if (object is Dog) { + return serializers.serialize(object, specifiedType: FullType(Dog))!; + } + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + @override + Animal deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(Animal.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + switch (discValue) { + case r'CAT': + return serializers.deserialize(serialized, specifiedType: FullType(Cat)) as Cat; + case r'DOG': + return serializers.deserialize(serialized, specifiedType: FullType(Dog)) as Dog; + default: + return serializers.deserialize(serialized, specifiedType: FullType($Animal)) as $Animal; + } + } +} + +/// a concrete implementation of [Animal], since [Animal] is not instantiable +@BuiltValue(instantiable: true) +abstract class $Animal implements Animal, Built<$Animal, $AnimalBuilder> { + $Animal._(); + + factory $Animal([void Function($AnimalBuilder)? updates]) = _$$Animal; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($AnimalBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$Animal> get serializer => _$$AnimalSerializer(); +} + +class _$$AnimalSerializer implements PrimitiveSerializer<$Animal> { + @override + final Iterable types = const [$Animal, _$$Animal]; + + @override + final String wireName = r'$Animal'; + + @override + Object serialize( + Serializers serializers, + $Animal object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(Animal))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AnimalBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'className': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.className = valueDes; + break; + case r'color': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.color = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $Animal deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $AnimalBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/api_response.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/api_response.dart new file mode 100644 index 000000000000..3c65365a2614 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/api_response.dart @@ -0,0 +1,147 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'api_response.g.dart'; + +/// ApiResponse +/// +/// Properties: +/// * [code] +/// * [type] +/// * [message] +@BuiltValue() +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._(); + + factory ApiResponse([void updates(ApiResponseBuilder b)]) = _$ApiResponse; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ApiResponseBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ApiResponseSerializer(); +} + +class _$ApiResponseSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ApiResponse, _$ApiResponse]; + + @override + final String wireName = r'ApiResponse'; + + Iterable _serializeProperties( + Serializers serializers, + ApiResponse object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.code != null) { + yield r'code'; + yield serializers.serialize( + object.code, + specifiedType: const FullType(int), + ); + } + if (object.type != null) { + yield r'type'; + yield serializers.serialize( + object.type, + specifiedType: const FullType(String), + ); + } + if (object.message != null) { + yield r'message'; + yield serializers.serialize( + object.message, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ApiResponse object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ApiResponseBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'code': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.code = valueDes; + break; + case r'type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.type = valueDes; + break; + case r'message': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.message = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ApiResponse deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ApiResponseBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/apple.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/apple.dart new file mode 100644 index 000000000000..c6ae23d72363 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/apple.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'apple.g.dart'; + +/// Apple +/// +/// Properties: +/// * [kind] +@BuiltValue() +abstract class Apple implements Built { + @BuiltValueField(wireName: r'kind') + String? get kind; + + Apple._(); + + factory Apple([void updates(AppleBuilder b)]) = _$Apple; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(AppleBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$AppleSerializer(); +} + +class _$AppleSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Apple, _$Apple]; + + @override + final String wireName = r'Apple'; + + Iterable _serializeProperties( + Serializers serializers, + Apple object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.kind != null) { + yield r'kind'; + yield serializers.serialize( + object.kind, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Apple object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AppleBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'kind': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.kind = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Apple deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = AppleBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/apple_all_of_disc.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/apple_all_of_disc.dart new file mode 100644 index 000000000000..deb40a48bb1b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/apple_all_of_disc.dart @@ -0,0 +1,122 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_type.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'apple_all_of_disc.g.dart'; + +/// AppleAllOfDisc +/// +/// Properties: +/// * [seeds] +/// * [fruitType] +@BuiltValue() +abstract class AppleAllOfDisc implements FruitType, Built { + @BuiltValueField(wireName: r'seeds') + int get seeds; + + AppleAllOfDisc._(); + + factory AppleAllOfDisc([void updates(AppleAllOfDiscBuilder b)]) = _$AppleAllOfDisc; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(AppleAllOfDiscBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$AppleAllOfDiscSerializer(); +} + +class _$AppleAllOfDiscSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [AppleAllOfDisc, _$AppleAllOfDisc]; + + @override + final String wireName = r'AppleAllOfDisc'; + + Iterable _serializeProperties( + Serializers serializers, + AppleAllOfDisc object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'fruitType'; + yield serializers.serialize( + object.fruitType, + specifiedType: const FullType(String), + ); + yield r'seeds'; + yield serializers.serialize( + object.seeds, + specifiedType: const FullType(int), + ); + } + + @override + Object serialize( + Serializers serializers, + AppleAllOfDisc object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AppleAllOfDiscBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'fruitType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.fruitType = valueDes; + break; + case r'seeds': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.seeds = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + AppleAllOfDisc deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = AppleAllOfDiscBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/apple_grandparent_disc.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/apple_grandparent_disc.dart new file mode 100644 index 000000000000..2ec1ff48ada0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/apple_grandparent_disc.dart @@ -0,0 +1,122 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/parent.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'apple_grandparent_disc.g.dart'; + +/// AppleGrandparentDisc +/// +/// Properties: +/// * [seeds] +/// * [fruitType] +@BuiltValue() +abstract class AppleGrandparentDisc implements Parent, Built { + @BuiltValueField(wireName: r'seeds') + int get seeds; + + AppleGrandparentDisc._(); + + factory AppleGrandparentDisc([void updates(AppleGrandparentDiscBuilder b)]) = _$AppleGrandparentDisc; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(AppleGrandparentDiscBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$AppleGrandparentDiscSerializer(); +} + +class _$AppleGrandparentDiscSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [AppleGrandparentDisc, _$AppleGrandparentDisc]; + + @override + final String wireName = r'AppleGrandparentDisc'; + + Iterable _serializeProperties( + Serializers serializers, + AppleGrandparentDisc object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'fruitType'; + yield serializers.serialize( + object.fruitType, + specifiedType: const FullType(String), + ); + yield r'seeds'; + yield serializers.serialize( + object.seeds, + specifiedType: const FullType(int), + ); + } + + @override + Object serialize( + Serializers serializers, + AppleGrandparentDisc object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AppleGrandparentDiscBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'fruitType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.fruitType = valueDes; + break; + case r'seeds': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.seeds = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + AppleGrandparentDisc deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = AppleGrandparentDiscBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/apple_one_of_disc.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/apple_one_of_disc.dart new file mode 100644 index 000000000000..a8513ff3fe73 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/apple_one_of_disc.dart @@ -0,0 +1,121 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_type.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'apple_one_of_disc.g.dart'; + +/// AppleOneOfDisc +/// +/// Properties: +/// * [seeds] +/// * [fruitType] +@BuiltValue() +abstract class AppleOneOfDisc implements Built { + @BuiltValueField(wireName: r'seeds') + int get seeds; + + /// One Of [FruitType] + OneOf get oneOf; + + AppleOneOfDisc._(); + + factory AppleOneOfDisc([void updates(AppleOneOfDiscBuilder b)]) = _$AppleOneOfDisc; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(AppleOneOfDiscBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$AppleOneOfDiscSerializer(); +} + +class _$AppleOneOfDiscSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [AppleOneOfDisc, _$AppleOneOfDisc]; + + @override + final String wireName = r'AppleOneOfDisc'; + + Iterable _serializeProperties( + Serializers serializers, + AppleOneOfDisc object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'seeds'; + yield serializers.serialize( + object.seeds, + specifiedType: const FullType(int), + ); + } + + @override + Object serialize( + Serializers serializers, + AppleOneOfDisc object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + final result = _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + result.addAll(serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType)) as Iterable); + return result; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AppleOneOfDiscBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'seeds': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.seeds = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + AppleOneOfDisc deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = AppleOneOfDiscBuilder(); + Object? oneOfDataSrc; + final targetType = const FullType(OneOf, [FullType(FruitType), ]); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + oneOfDataSrc = unhandled; + result.oneOf = serializers.deserialize(oneOfDataSrc, specifiedType: targetType) as OneOf; + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/apple_req_disc.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/apple_req_disc.dart new file mode 100644 index 000000000000..59215a68be6e --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/apple_req_disc.dart @@ -0,0 +1,124 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'apple_req_disc.g.dart'; + +/// AppleReqDisc +/// +/// Properties: +/// * [seeds] +/// * [fruitType] +@BuiltValue() +abstract class AppleReqDisc implements Built { + @BuiltValueField(wireName: r'seeds') + int get seeds; + + @BuiltValueField(wireName: r'fruitType') + String get fruitType; + + AppleReqDisc._(); + + factory AppleReqDisc([void updates(AppleReqDiscBuilder b)]) = _$AppleReqDisc; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(AppleReqDiscBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$AppleReqDiscSerializer(); +} + +class _$AppleReqDiscSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [AppleReqDisc, _$AppleReqDisc]; + + @override + final String wireName = r'AppleReqDisc'; + + Iterable _serializeProperties( + Serializers serializers, + AppleReqDisc object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'seeds'; + yield serializers.serialize( + object.seeds, + specifiedType: const FullType(int), + ); + yield r'fruitType'; + yield serializers.serialize( + object.fruitType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + AppleReqDisc object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AppleReqDiscBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'seeds': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.seeds = valueDes; + break; + case r'fruitType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.fruitType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + AppleReqDisc deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = AppleReqDiscBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/apple_variant1.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/apple_variant1.dart new file mode 100644 index 000000000000..45bd9d65b160 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/apple_variant1.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'apple_variant1.g.dart'; + +/// AppleVariant1 +/// +/// Properties: +/// * [kind] +@BuiltValue() +abstract class AppleVariant1 implements Built { + @BuiltValueField(wireName: r'kind') + String? get kind; + + AppleVariant1._(); + + factory AppleVariant1([void updates(AppleVariant1Builder b)]) = _$AppleVariant1; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(AppleVariant1Builder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$AppleVariant1Serializer(); +} + +class _$AppleVariant1Serializer implements PrimitiveSerializer { + @override + final Iterable types = const [AppleVariant1, _$AppleVariant1]; + + @override + final String wireName = r'AppleVariant1'; + + Iterable _serializeProperties( + Serializers serializers, + AppleVariant1 object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.kind != null) { + yield r'kind'; + yield serializers.serialize( + object.kind, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + AppleVariant1 object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AppleVariant1Builder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'kind': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.kind = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + AppleVariant1 deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = AppleVariant1Builder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/array_of_array_of_number_only.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/array_of_array_of_number_only.dart new file mode 100644 index 000000000000..44ebbd8534a5 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/array_of_array_of_number_only.dart @@ -0,0 +1,110 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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'; + +/// ArrayOfArrayOfNumberOnly +/// +/// Properties: +/// * [arrayArrayNumber] +@BuiltValue() +abstract class ArrayOfArrayOfNumberOnly implements Built { + @BuiltValueField(wireName: r'ArrayArrayNumber') + BuiltList>? get arrayArrayNumber; + + ArrayOfArrayOfNumberOnly._(); + + factory ArrayOfArrayOfNumberOnly([void updates(ArrayOfArrayOfNumberOnlyBuilder b)]) = _$ArrayOfArrayOfNumberOnly; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ArrayOfArrayOfNumberOnlyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ArrayOfArrayOfNumberOnlySerializer(); +} + +class _$ArrayOfArrayOfNumberOnlySerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ArrayOfArrayOfNumberOnly, _$ArrayOfArrayOfNumberOnly]; + + @override + final String wireName = r'ArrayOfArrayOfNumberOnly'; + + Iterable _serializeProperties( + Serializers serializers, + ArrayOfArrayOfNumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.arrayArrayNumber != null) { + yield r'ArrayArrayNumber'; + yield serializers.serialize( + object.arrayArrayNumber, + specifiedType: const FullType(BuiltList, [FullType(BuiltList, [FullType(num)])]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ArrayOfArrayOfNumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ArrayOfArrayOfNumberOnlyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'ArrayArrayNumber': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(BuiltList, [FullType(num)])]), + ) as BuiltList>; + result.arrayArrayNumber.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ArrayOfArrayOfNumberOnly deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ArrayOfArrayOfNumberOnlyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/array_of_number_only.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/array_of_number_only.dart new file mode 100644 index 000000000000..2d514a03780e --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/array_of_number_only.dart @@ -0,0 +1,110 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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'; + +/// ArrayOfNumberOnly +/// +/// Properties: +/// * [arrayNumber] +@BuiltValue() +abstract class ArrayOfNumberOnly implements Built { + @BuiltValueField(wireName: r'ArrayNumber') + BuiltList? get arrayNumber; + + ArrayOfNumberOnly._(); + + factory ArrayOfNumberOnly([void updates(ArrayOfNumberOnlyBuilder b)]) = _$ArrayOfNumberOnly; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ArrayOfNumberOnlyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ArrayOfNumberOnlySerializer(); +} + +class _$ArrayOfNumberOnlySerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ArrayOfNumberOnly, _$ArrayOfNumberOnly]; + + @override + final String wireName = r'ArrayOfNumberOnly'; + + Iterable _serializeProperties( + Serializers serializers, + ArrayOfNumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.arrayNumber != null) { + yield r'ArrayNumber'; + yield serializers.serialize( + object.arrayNumber, + specifiedType: const FullType(BuiltList, [FullType(num)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ArrayOfNumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ArrayOfNumberOnlyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'ArrayNumber': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(num)]), + ) as BuiltList; + result.arrayNumber.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ArrayOfNumberOnly deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ArrayOfNumberOnlyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/array_test.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/array_test.dart new file mode 100644 index 000000000000..aeb7af9ca8bd --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/array_test.dart @@ -0,0 +1,149 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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'; + +/// ArrayTest +/// +/// Properties: +/// * [arrayOfString] +/// * [arrayArrayOfInteger] +/// * [arrayArrayOfModel] +@BuiltValue() +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._(); + + factory ArrayTest([void updates(ArrayTestBuilder b)]) = _$ArrayTest; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ArrayTestBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ArrayTestSerializer(); +} + +class _$ArrayTestSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ArrayTest, _$ArrayTest]; + + @override + final String wireName = r'ArrayTest'; + + Iterable _serializeProperties( + Serializers serializers, + ArrayTest object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.arrayOfString != null) { + yield r'array_of_string'; + yield serializers.serialize( + object.arrayOfString, + specifiedType: const FullType(BuiltList, [FullType(String)]), + ); + } + if (object.arrayArrayOfInteger != null) { + yield r'array_array_of_integer'; + yield serializers.serialize( + object.arrayArrayOfInteger, + specifiedType: const FullType(BuiltList, [FullType(BuiltList, [FullType(int)])]), + ); + } + if (object.arrayArrayOfModel != null) { + yield r'array_array_of_model'; + yield serializers.serialize( + object.arrayArrayOfModel, + specifiedType: const FullType(BuiltList, [FullType(BuiltList, [FullType(ReadOnlyFirst)])]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ArrayTest object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ArrayTestBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'array_of_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(String)]), + ) as BuiltList; + result.arrayOfString.replace(valueDes); + break; + case r'array_array_of_integer': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(BuiltList, [FullType(int)])]), + ) as BuiltList>; + result.arrayArrayOfInteger.replace(valueDes); + break; + case r'array_array_of_model': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(BuiltList, [FullType(ReadOnlyFirst)])]), + ) as BuiltList>; + result.arrayArrayOfModel.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ArrayTest deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ArrayTestBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/banana.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/banana.dart new file mode 100644 index 000000000000..c688570da180 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/banana.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'banana.g.dart'; + +/// Banana +/// +/// Properties: +/// * [count] +@BuiltValue() +abstract class Banana implements Built { + @BuiltValueField(wireName: r'count') + num? get count; + + Banana._(); + + factory Banana([void updates(BananaBuilder b)]) = _$Banana; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(BananaBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$BananaSerializer(); +} + +class _$BananaSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Banana, _$Banana]; + + @override + final String wireName = r'Banana'; + + Iterable _serializeProperties( + Serializers serializers, + Banana object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.count != null) { + yield r'count'; + yield serializers.serialize( + object.count, + specifiedType: const FullType(num), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Banana object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required BananaBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'count': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.count = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Banana deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = BananaBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/banana_all_of_disc.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/banana_all_of_disc.dart new file mode 100644 index 000000000000..2839c4adbef2 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/banana_all_of_disc.dart @@ -0,0 +1,122 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_type.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'banana_all_of_disc.g.dart'; + +/// BananaAllOfDisc +/// +/// Properties: +/// * [length] +/// * [fruitType] +@BuiltValue() +abstract class BananaAllOfDisc implements FruitType, Built { + @BuiltValueField(wireName: r'length') + int get length; + + BananaAllOfDisc._(); + + factory BananaAllOfDisc([void updates(BananaAllOfDiscBuilder b)]) = _$BananaAllOfDisc; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(BananaAllOfDiscBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$BananaAllOfDiscSerializer(); +} + +class _$BananaAllOfDiscSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [BananaAllOfDisc, _$BananaAllOfDisc]; + + @override + final String wireName = r'BananaAllOfDisc'; + + Iterable _serializeProperties( + Serializers serializers, + BananaAllOfDisc object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'length'; + yield serializers.serialize( + object.length, + specifiedType: const FullType(int), + ); + yield r'fruitType'; + yield serializers.serialize( + object.fruitType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + BananaAllOfDisc object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required BananaAllOfDiscBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'length': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.length = valueDes; + break; + case r'fruitType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.fruitType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + BananaAllOfDisc deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = BananaAllOfDiscBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/banana_grandparent_disc.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/banana_grandparent_disc.dart new file mode 100644 index 000000000000..1298bf5d0e1f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/banana_grandparent_disc.dart @@ -0,0 +1,122 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/parent.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'banana_grandparent_disc.g.dart'; + +/// BananaGrandparentDisc +/// +/// Properties: +/// * [length] +/// * [fruitType] +@BuiltValue() +abstract class BananaGrandparentDisc implements Parent, Built { + @BuiltValueField(wireName: r'length') + int get length; + + BananaGrandparentDisc._(); + + factory BananaGrandparentDisc([void updates(BananaGrandparentDiscBuilder b)]) = _$BananaGrandparentDisc; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(BananaGrandparentDiscBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$BananaGrandparentDiscSerializer(); +} + +class _$BananaGrandparentDiscSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [BananaGrandparentDisc, _$BananaGrandparentDisc]; + + @override + final String wireName = r'BananaGrandparentDisc'; + + Iterable _serializeProperties( + Serializers serializers, + BananaGrandparentDisc object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'length'; + yield serializers.serialize( + object.length, + specifiedType: const FullType(int), + ); + yield r'fruitType'; + yield serializers.serialize( + object.fruitType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + BananaGrandparentDisc object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required BananaGrandparentDiscBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'length': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.length = valueDes; + break; + case r'fruitType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.fruitType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + BananaGrandparentDisc deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = BananaGrandparentDiscBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/banana_one_of_disc.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/banana_one_of_disc.dart new file mode 100644 index 000000000000..8c02260d910d --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/banana_one_of_disc.dart @@ -0,0 +1,121 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_type.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'banana_one_of_disc.g.dart'; + +/// BananaOneOfDisc +/// +/// Properties: +/// * [length] +/// * [fruitType] +@BuiltValue() +abstract class BananaOneOfDisc implements Built { + @BuiltValueField(wireName: r'length') + int get length; + + /// One Of [FruitType] + OneOf get oneOf; + + BananaOneOfDisc._(); + + factory BananaOneOfDisc([void updates(BananaOneOfDiscBuilder b)]) = _$BananaOneOfDisc; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(BananaOneOfDiscBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$BananaOneOfDiscSerializer(); +} + +class _$BananaOneOfDiscSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [BananaOneOfDisc, _$BananaOneOfDisc]; + + @override + final String wireName = r'BananaOneOfDisc'; + + Iterable _serializeProperties( + Serializers serializers, + BananaOneOfDisc object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'length'; + yield serializers.serialize( + object.length, + specifiedType: const FullType(int), + ); + } + + @override + Object serialize( + Serializers serializers, + BananaOneOfDisc object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + final result = _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + result.addAll(serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType)) as Iterable); + return result; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required BananaOneOfDiscBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'length': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.length = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + BananaOneOfDisc deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = BananaOneOfDiscBuilder(); + Object? oneOfDataSrc; + final targetType = const FullType(OneOf, [FullType(FruitType), ]); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + oneOfDataSrc = unhandled; + result.oneOf = serializers.deserialize(oneOfDataSrc, specifiedType: targetType) as OneOf; + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/banana_req_disc.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/banana_req_disc.dart new file mode 100644 index 000000000000..e44930d39738 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/banana_req_disc.dart @@ -0,0 +1,124 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'banana_req_disc.g.dart'; + +/// BananaReqDisc +/// +/// Properties: +/// * [length] +/// * [fruitType] +@BuiltValue() +abstract class BananaReqDisc implements Built { + @BuiltValueField(wireName: r'length') + int get length; + + @BuiltValueField(wireName: r'fruitType') + String get fruitType; + + BananaReqDisc._(); + + factory BananaReqDisc([void updates(BananaReqDiscBuilder b)]) = _$BananaReqDisc; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(BananaReqDiscBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$BananaReqDiscSerializer(); +} + +class _$BananaReqDiscSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [BananaReqDisc, _$BananaReqDisc]; + + @override + final String wireName = r'BananaReqDisc'; + + Iterable _serializeProperties( + Serializers serializers, + BananaReqDisc object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'length'; + yield serializers.serialize( + object.length, + specifiedType: const FullType(int), + ); + yield r'fruitType'; + yield serializers.serialize( + object.fruitType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + BananaReqDisc object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required BananaReqDiscBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'length': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.length = valueDes; + break; + case r'fruitType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.fruitType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + BananaReqDisc deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = BananaReqDiscBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/bar.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/bar.dart new file mode 100644 index 000000000000..986656f37487 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/bar.dart @@ -0,0 +1,227 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/foo_ref_or_value.dart'; +import 'package:openapi/src/model/entity.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'bar.g.dart'; + +/// Bar +/// +/// Properties: +/// * [id] +/// * [barPropA] +/// * [fooPropB] +/// * [foo] +/// * [href] - Hyperlink reference +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue() +abstract class Bar implements Entity, Built { + @BuiltValueField(wireName: r'foo') + FooRefOrValue? get foo; + + @BuiltValueField(wireName: r'fooPropB') + String? get fooPropB; + + @BuiltValueField(wireName: r'barPropA') + String? get barPropA; + + Bar._(); + + factory Bar([void updates(BarBuilder b)]) = _$Bar; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(BarBuilder b) => b..atType=b.discriminatorValue; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$BarSerializer(); +} + +class _$BarSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Bar, _$Bar]; + + @override + final String wireName = r'Bar'; + + Iterable _serializeProperties( + Serializers serializers, + Bar object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.foo != null) { + yield r'foo'; + yield serializers.serialize( + object.foo, + specifiedType: const FullType(FooRefOrValue), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.fooPropB != null) { + yield r'fooPropB'; + yield serializers.serialize( + object.fooPropB, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + if (object.barPropA != null) { + yield r'barPropA'; + yield serializers.serialize( + object.barPropA, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Bar object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required BarBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'foo': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(FooRefOrValue), + ) as FooRefOrValue; + result.foo.replace(valueDes); + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'fooPropB': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.fooPropB = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + case r'barPropA': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.barPropA = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Bar deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = BarBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/bar_create.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/bar_create.dart new file mode 100644 index 000000000000..2782abd4f02c --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/bar_create.dart @@ -0,0 +1,227 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/foo_ref_or_value.dart'; +import 'package:openapi/src/model/entity.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'bar_create.g.dart'; + +/// BarCreate +/// +/// Properties: +/// * [barPropA] +/// * [fooPropB] +/// * [foo] +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue() +abstract class BarCreate implements Entity, Built { + @BuiltValueField(wireName: r'foo') + FooRefOrValue? get foo; + + @BuiltValueField(wireName: r'fooPropB') + String? get fooPropB; + + @BuiltValueField(wireName: r'barPropA') + String? get barPropA; + + BarCreate._(); + + factory BarCreate([void updates(BarCreateBuilder b)]) = _$BarCreate; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(BarCreateBuilder b) => b..atType=b.discriminatorValue; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$BarCreateSerializer(); +} + +class _$BarCreateSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [BarCreate, _$BarCreate]; + + @override + final String wireName = r'BarCreate'; + + Iterable _serializeProperties( + Serializers serializers, + BarCreate object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.foo != null) { + yield r'foo'; + yield serializers.serialize( + object.foo, + specifiedType: const FullType(FooRefOrValue), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.fooPropB != null) { + yield r'fooPropB'; + yield serializers.serialize( + object.fooPropB, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + if (object.barPropA != null) { + yield r'barPropA'; + yield serializers.serialize( + object.barPropA, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + BarCreate object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required BarCreateBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'foo': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(FooRefOrValue), + ) as FooRefOrValue; + result.foo.replace(valueDes); + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'fooPropB': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.fooPropB = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + case r'barPropA': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.barPropA = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + BarCreate deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = BarCreateBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/bar_ref.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/bar_ref.dart new file mode 100644 index 000000000000..f110362c6250 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/bar_ref.dart @@ -0,0 +1,197 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity_ref.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'bar_ref.g.dart'; + +/// BarRef +/// +/// Properties: +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue() +abstract class BarRef implements EntityRef, Built { + BarRef._(); + + factory BarRef([void updates(BarRefBuilder b)]) = _$BarRef; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(BarRefBuilder b) => b..atType=b.discriminatorValue; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$BarRefSerializer(); +} + +class _$BarRefSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [BarRef, _$BarRef]; + + @override + final String wireName = r'BarRef'; + + Iterable _serializeProperties( + Serializers serializers, + BarRef object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.atReferredType != null) { + yield r'@referredType'; + yield serializers.serialize( + object.atReferredType, + specifiedType: const FullType(String), + ); + } + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + BarRef object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required BarRefBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'@referredType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atReferredType = valueDes; + break; + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + BarRef deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = BarRefBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/bar_ref_or_value.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/bar_ref_or_value.dart new file mode 100644 index 000000000000..8155a455a2c3 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/bar_ref_or_value.dart @@ -0,0 +1,134 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/bar_ref.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'bar_ref_or_value.g.dart'; + +/// BarRefOrValue +/// +/// Properties: +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue() +abstract class BarRefOrValue implements Built { + /// One Of [Bar], [BarRef] + OneOf get oneOf; + + static const String discriminatorFieldName = r'@type'; + + static const Map discriminatorMapping = { + r'Bar': Bar, + r'BarRef': BarRef, + }; + + BarRefOrValue._(); + + factory BarRefOrValue([void updates(BarRefOrValueBuilder b)]) = _$BarRefOrValue; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(BarRefOrValueBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$BarRefOrValueSerializer(); +} + +extension BarRefOrValueDiscriminatorExt on BarRefOrValue { + String? get discriminatorValue { + if (this is Bar) { + return r'Bar'; + } + if (this is BarRef) { + return r'BarRef'; + } + return null; + } +} +extension BarRefOrValueBuilderDiscriminatorExt on BarRefOrValueBuilder { + String? get discriminatorValue { + if (this is BarBuilder) { + return r'Bar'; + } + if (this is BarRefBuilder) { + return r'BarRef'; + } + return null; + } +} + +class _$BarRefOrValueSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [BarRefOrValue, _$BarRefOrValue]; + + @override + final String wireName = r'BarRefOrValue'; + + Iterable _serializeProperties( + Serializers serializers, + BarRefOrValue object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + } + + @override + Object serialize( + Serializers serializers, + BarRefOrValue object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + } + + @override + BarRefOrValue deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = BarRefOrValueBuilder(); + Object? oneOfDataSrc; + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(BarRefOrValue.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + oneOfDataSrc = serialized; + final oneOfTypes = [Bar, BarRef, ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'Bar': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(Bar), + ) as Bar; + oneOfType = Bar; + break; + case r'BarRef': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(BarRef), + ) as BarRef; + oneOfType = BarRef; + break; + default: + throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + return result.build(); + } +} + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/capitalization.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/capitalization.dart new file mode 100644 index 000000000000..b0f8cff09ea4 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/capitalization.dart @@ -0,0 +1,205 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'capitalization.g.dart'; + +/// Capitalization +/// +/// Properties: +/// * [smallCamel] +/// * [capitalCamel] +/// * [smallSnake] +/// * [capitalSnake] +/// * [sCAETHFlowPoints] +/// * [ATT_NAME] - Name of the pet +@BuiltValue() +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._(); + + factory Capitalization([void updates(CapitalizationBuilder b)]) = _$Capitalization; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(CapitalizationBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$CapitalizationSerializer(); +} + +class _$CapitalizationSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Capitalization, _$Capitalization]; + + @override + final String wireName = r'Capitalization'; + + Iterable _serializeProperties( + Serializers serializers, + Capitalization object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.smallCamel != null) { + yield r'smallCamel'; + yield serializers.serialize( + object.smallCamel, + specifiedType: const FullType(String), + ); + } + if (object.capitalCamel != null) { + yield r'CapitalCamel'; + yield serializers.serialize( + object.capitalCamel, + specifiedType: const FullType(String), + ); + } + if (object.smallSnake != null) { + yield r'small_Snake'; + yield serializers.serialize( + object.smallSnake, + specifiedType: const FullType(String), + ); + } + if (object.capitalSnake != null) { + yield r'Capital_Snake'; + yield serializers.serialize( + object.capitalSnake, + specifiedType: const FullType(String), + ); + } + if (object.sCAETHFlowPoints != null) { + yield r'SCA_ETH_Flow_Points'; + yield serializers.serialize( + object.sCAETHFlowPoints, + specifiedType: const FullType(String), + ); + } + if (object.ATT_NAME != null) { + yield r'ATT_NAME'; + yield serializers.serialize( + object.ATT_NAME, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Capitalization object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required CapitalizationBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'smallCamel': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.smallCamel = valueDes; + break; + case r'CapitalCamel': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.capitalCamel = valueDes; + break; + case r'small_Snake': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.smallSnake = valueDes; + break; + case r'Capital_Snake': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.capitalSnake = valueDes; + break; + case r'SCA_ETH_Flow_Points': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.sCAETHFlowPoints = valueDes; + break; + case r'ATT_NAME': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.ATT_NAME = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Capitalization deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = CapitalizationBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/cat.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/cat.dart new file mode 100644 index 000000000000..0b824a6aa2f9 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/cat.dart @@ -0,0 +1,141 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/animal.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'cat.g.dart'; + +/// Cat +/// +/// Properties: +/// * [className] +/// * [color] +/// * [declawed] +@BuiltValue() +abstract class Cat implements Animal, Built { + @BuiltValueField(wireName: r'declawed') + bool? get declawed; + + Cat._(); + + factory Cat([void updates(CatBuilder b)]) = _$Cat; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(CatBuilder b) => b..className=b.discriminatorValue + ..color = 'red'; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$CatSerializer(); +} + +class _$CatSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Cat, _$Cat]; + + @override + final String wireName = r'Cat'; + + Iterable _serializeProperties( + Serializers serializers, + Cat object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.color != null) { + yield r'color'; + yield serializers.serialize( + object.color, + specifiedType: const FullType(String), + ); + } + if (object.declawed != null) { + yield r'declawed'; + yield serializers.serialize( + object.declawed, + specifiedType: const FullType(bool), + ); + } + yield r'className'; + yield serializers.serialize( + object.className, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + Cat object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required CatBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'color': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.color = valueDes; + break; + case r'declawed': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) as bool; + result.declawed = valueDes; + break; + case r'className': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.className = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Cat deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = CatBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/category.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/category.dart new file mode 100644 index 000000000000..9d5449029f87 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/category.dart @@ -0,0 +1,127 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'category.g.dart'; + +/// Category +/// +/// Properties: +/// * [id] +/// * [name] +@BuiltValue() +abstract class Category implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'name') + String get name; + + Category._(); + + factory Category([void updates(CategoryBuilder b)]) = _$Category; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(CategoryBuilder b) => b + ..name = 'default-name'; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$CategorySerializer(); +} + +class _$CategorySerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Category, _$Category]; + + @override + final String wireName = r'Category'; + + Iterable _serializeProperties( + Serializers serializers, + Category object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + Category object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required CategoryBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Category deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = CategoryBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/class_model.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/class_model.dart new file mode 100644 index 000000000000..052af6bbd403 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/class_model.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'class_model.g.dart'; + +/// Model for testing model with \"_class\" property +/// +/// Properties: +/// * [classField] +@BuiltValue() +abstract class ClassModel implements Built { + @BuiltValueField(wireName: r'_class') + String? get classField; + + ClassModel._(); + + factory ClassModel([void updates(ClassModelBuilder b)]) = _$ClassModel; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ClassModelBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ClassModelSerializer(); +} + +class _$ClassModelSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ClassModel, _$ClassModel]; + + @override + final String wireName = r'ClassModel'; + + Iterable _serializeProperties( + Serializers serializers, + ClassModel object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.classField != null) { + yield r'_class'; + yield serializers.serialize( + object.classField, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ClassModel object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ClassModelBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'_class': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.classField = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ClassModel deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ClassModelBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_missing_from_properties.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_missing_from_properties.dart new file mode 100644 index 000000000000..a1d262bbd1e6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_missing_from_properties.dart @@ -0,0 +1,111 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/disc_missing_from_properties.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'composed_disc_missing_from_properties.g.dart'; + +/// ComposedDiscMissingFromProperties +/// +/// Properties: +/// * [length] +@BuiltValue() +abstract class ComposedDiscMissingFromProperties implements Built { + /// One Of [DiscMissingFromProperties] + OneOf get oneOf; + + static const String discriminatorFieldName = r'fruitType'; + + static const Map discriminatorMapping = { + r'DiscMissingFromProperties': DiscMissingFromProperties, + }; + + ComposedDiscMissingFromProperties._(); + + factory ComposedDiscMissingFromProperties([void updates(ComposedDiscMissingFromPropertiesBuilder b)]) = _$ComposedDiscMissingFromProperties; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ComposedDiscMissingFromPropertiesBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ComposedDiscMissingFromPropertiesSerializer(); +} + +extension ComposedDiscMissingFromPropertiesDiscriminatorExt on ComposedDiscMissingFromProperties { + String? get discriminatorValue { + if (this is DiscMissingFromProperties) { + return r'DiscMissingFromProperties'; + } + return null; + } +} +extension ComposedDiscMissingFromPropertiesBuilderDiscriminatorExt on ComposedDiscMissingFromPropertiesBuilder { + String? get discriminatorValue { + if (this is DiscMissingFromPropertiesBuilder) { + return r'DiscMissingFromProperties'; + } + return null; + } +} + +class _$ComposedDiscMissingFromPropertiesSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ComposedDiscMissingFromProperties, _$ComposedDiscMissingFromProperties]; + + @override + final String wireName = r'ComposedDiscMissingFromProperties'; + + Iterable _serializeProperties( + Serializers serializers, + ComposedDiscMissingFromProperties object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + } + + @override + Object serialize( + Serializers serializers, + ComposedDiscMissingFromProperties object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + } + + @override + ComposedDiscMissingFromProperties deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ComposedDiscMissingFromPropertiesBuilder(); + Object? oneOfDataSrc; + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(ComposedDiscMissingFromProperties.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + oneOfDataSrc = serialized; + final oneOfTypes = [DiscMissingFromProperties, ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'DiscMissingFromProperties': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(DiscMissingFromProperties), + ) as DiscMissingFromProperties; + oneOfType = DiscMissingFromProperties; + break; + default: + throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_optional_type_correct.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_optional_type_correct.dart new file mode 100644 index 000000000000..18b7006591ee --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_optional_type_correct.dart @@ -0,0 +1,111 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/disc_optional_type_correct.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'composed_disc_optional_type_correct.g.dart'; + +/// ComposedDiscOptionalTypeCorrect +/// +/// Properties: +/// * [fruitType] +@BuiltValue() +abstract class ComposedDiscOptionalTypeCorrect implements Built { + /// One Of [DiscOptionalTypeCorrect] + OneOf get oneOf; + + static const String discriminatorFieldName = r'fruitType'; + + static const Map discriminatorMapping = { + r'DiscOptionalTypeCorrect': DiscOptionalTypeCorrect, + }; + + ComposedDiscOptionalTypeCorrect._(); + + factory ComposedDiscOptionalTypeCorrect([void updates(ComposedDiscOptionalTypeCorrectBuilder b)]) = _$ComposedDiscOptionalTypeCorrect; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ComposedDiscOptionalTypeCorrectBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ComposedDiscOptionalTypeCorrectSerializer(); +} + +extension ComposedDiscOptionalTypeCorrectDiscriminatorExt on ComposedDiscOptionalTypeCorrect { + String? get discriminatorValue { + if (this is DiscOptionalTypeCorrect) { + return r'DiscOptionalTypeCorrect'; + } + return null; + } +} +extension ComposedDiscOptionalTypeCorrectBuilderDiscriminatorExt on ComposedDiscOptionalTypeCorrectBuilder { + String? get discriminatorValue { + if (this is DiscOptionalTypeCorrectBuilder) { + return r'DiscOptionalTypeCorrect'; + } + return null; + } +} + +class _$ComposedDiscOptionalTypeCorrectSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ComposedDiscOptionalTypeCorrect, _$ComposedDiscOptionalTypeCorrect]; + + @override + final String wireName = r'ComposedDiscOptionalTypeCorrect'; + + Iterable _serializeProperties( + Serializers serializers, + ComposedDiscOptionalTypeCorrect object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + } + + @override + Object serialize( + Serializers serializers, + ComposedDiscOptionalTypeCorrect object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + } + + @override + ComposedDiscOptionalTypeCorrect deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ComposedDiscOptionalTypeCorrectBuilder(); + Object? oneOfDataSrc; + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(ComposedDiscOptionalTypeCorrect.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + oneOfDataSrc = serialized; + final oneOfTypes = [DiscOptionalTypeCorrect, ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'DiscOptionalTypeCorrect': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(DiscOptionalTypeCorrect), + ) as DiscOptionalTypeCorrect; + oneOfType = DiscOptionalTypeCorrect; + break; + default: + throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_optional_type_inconsistent.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_optional_type_inconsistent.dart new file mode 100644 index 000000000000..920bfbb7a38a --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_optional_type_inconsistent.dart @@ -0,0 +1,126 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/disc_optional_type_incorrect.dart'; +import 'package:openapi/src/model/disc_optional_type_correct.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'composed_disc_optional_type_inconsistent.g.dart'; + +/// ComposedDiscOptionalTypeInconsistent +/// +/// Properties: +/// * [fruitType] +@BuiltValue() +abstract class ComposedDiscOptionalTypeInconsistent implements Built { + /// One Of [DiscOptionalTypeCorrect], [DiscOptionalTypeIncorrect] + OneOf get oneOf; + + static const String discriminatorFieldName = r'fruitType'; + + static const Map discriminatorMapping = { + r'DiscOptionalTypeCorrect': DiscOptionalTypeCorrect, + r'DiscOptionalTypeIncorrect': DiscOptionalTypeIncorrect, + }; + + ComposedDiscOptionalTypeInconsistent._(); + + factory ComposedDiscOptionalTypeInconsistent([void updates(ComposedDiscOptionalTypeInconsistentBuilder b)]) = _$ComposedDiscOptionalTypeInconsistent; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ComposedDiscOptionalTypeInconsistentBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ComposedDiscOptionalTypeInconsistentSerializer(); +} + +extension ComposedDiscOptionalTypeInconsistentDiscriminatorExt on ComposedDiscOptionalTypeInconsistent { + String? get discriminatorValue { + if (this is DiscOptionalTypeCorrect) { + return r'DiscOptionalTypeCorrect'; + } + if (this is DiscOptionalTypeIncorrect) { + return r'DiscOptionalTypeIncorrect'; + } + return null; + } +} +extension ComposedDiscOptionalTypeInconsistentBuilderDiscriminatorExt on ComposedDiscOptionalTypeInconsistentBuilder { + String? get discriminatorValue { + if (this is DiscOptionalTypeCorrectBuilder) { + return r'DiscOptionalTypeCorrect'; + } + if (this is DiscOptionalTypeIncorrectBuilder) { + return r'DiscOptionalTypeIncorrect'; + } + return null; + } +} + +class _$ComposedDiscOptionalTypeInconsistentSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ComposedDiscOptionalTypeInconsistent, _$ComposedDiscOptionalTypeInconsistent]; + + @override + final String wireName = r'ComposedDiscOptionalTypeInconsistent'; + + Iterable _serializeProperties( + Serializers serializers, + ComposedDiscOptionalTypeInconsistent object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + } + + @override + Object serialize( + Serializers serializers, + ComposedDiscOptionalTypeInconsistent object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + } + + @override + ComposedDiscOptionalTypeInconsistent deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ComposedDiscOptionalTypeInconsistentBuilder(); + Object? oneOfDataSrc; + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(ComposedDiscOptionalTypeInconsistent.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + oneOfDataSrc = serialized; + final oneOfTypes = [DiscOptionalTypeCorrect, DiscOptionalTypeIncorrect, ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'DiscOptionalTypeCorrect': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(DiscOptionalTypeCorrect), + ) as DiscOptionalTypeCorrect; + oneOfType = DiscOptionalTypeCorrect; + break; + case r'DiscOptionalTypeIncorrect': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(DiscOptionalTypeIncorrect), + ) as DiscOptionalTypeIncorrect; + oneOfType = DiscOptionalTypeIncorrect; + break; + default: + throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_optional_type_incorrect.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_optional_type_incorrect.dart new file mode 100644 index 000000000000..677acaa61f00 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_optional_type_incorrect.dart @@ -0,0 +1,111 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/disc_optional_type_incorrect.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'composed_disc_optional_type_incorrect.g.dart'; + +/// ComposedDiscOptionalTypeIncorrect +/// +/// Properties: +/// * [fruitType] +@BuiltValue() +abstract class ComposedDiscOptionalTypeIncorrect implements Built { + /// One Of [DiscOptionalTypeIncorrect] + OneOf get oneOf; + + static const String discriminatorFieldName = r'fruitType'; + + static const Map discriminatorMapping = { + r'DiscOptionalTypeIncorrect': DiscOptionalTypeIncorrect, + }; + + ComposedDiscOptionalTypeIncorrect._(); + + factory ComposedDiscOptionalTypeIncorrect([void updates(ComposedDiscOptionalTypeIncorrectBuilder b)]) = _$ComposedDiscOptionalTypeIncorrect; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ComposedDiscOptionalTypeIncorrectBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ComposedDiscOptionalTypeIncorrectSerializer(); +} + +extension ComposedDiscOptionalTypeIncorrectDiscriminatorExt on ComposedDiscOptionalTypeIncorrect { + String? get discriminatorValue { + if (this is DiscOptionalTypeIncorrect) { + return r'DiscOptionalTypeIncorrect'; + } + return null; + } +} +extension ComposedDiscOptionalTypeIncorrectBuilderDiscriminatorExt on ComposedDiscOptionalTypeIncorrectBuilder { + String? get discriminatorValue { + if (this is DiscOptionalTypeIncorrectBuilder) { + return r'DiscOptionalTypeIncorrect'; + } + return null; + } +} + +class _$ComposedDiscOptionalTypeIncorrectSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ComposedDiscOptionalTypeIncorrect, _$ComposedDiscOptionalTypeIncorrect]; + + @override + final String wireName = r'ComposedDiscOptionalTypeIncorrect'; + + Iterable _serializeProperties( + Serializers serializers, + ComposedDiscOptionalTypeIncorrect object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + } + + @override + Object serialize( + Serializers serializers, + ComposedDiscOptionalTypeIncorrect object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + } + + @override + ComposedDiscOptionalTypeIncorrect deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ComposedDiscOptionalTypeIncorrectBuilder(); + Object? oneOfDataSrc; + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(ComposedDiscOptionalTypeIncorrect.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + oneOfDataSrc = serialized; + final oneOfTypes = [DiscOptionalTypeIncorrect, ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'DiscOptionalTypeIncorrect': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(DiscOptionalTypeIncorrect), + ) as DiscOptionalTypeIncorrect; + oneOfType = DiscOptionalTypeIncorrect; + break; + default: + throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_required_inconsistent.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_required_inconsistent.dart new file mode 100644 index 000000000000..8e78115eb210 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_required_inconsistent.dart @@ -0,0 +1,126 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_type.dart'; +import 'package:openapi/src/model/disc_optional_type_correct.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'composed_disc_required_inconsistent.g.dart'; + +/// ComposedDiscRequiredInconsistent +/// +/// Properties: +/// * [fruitType] +@BuiltValue() +abstract class ComposedDiscRequiredInconsistent implements Built { + /// One Of [DiscOptionalTypeCorrect], [FruitType] + OneOf get oneOf; + + static const String discriminatorFieldName = r'fruitType'; + + static const Map discriminatorMapping = { + r'DiscOptionalTypeCorrect': DiscOptionalTypeCorrect, + r'FruitType': FruitType, + }; + + ComposedDiscRequiredInconsistent._(); + + factory ComposedDiscRequiredInconsistent([void updates(ComposedDiscRequiredInconsistentBuilder b)]) = _$ComposedDiscRequiredInconsistent; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ComposedDiscRequiredInconsistentBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ComposedDiscRequiredInconsistentSerializer(); +} + +extension ComposedDiscRequiredInconsistentDiscriminatorExt on ComposedDiscRequiredInconsistent { + String? get discriminatorValue { + if (this is DiscOptionalTypeCorrect) { + return r'DiscOptionalTypeCorrect'; + } + if (this is FruitType) { + return r'FruitType'; + } + return null; + } +} +extension ComposedDiscRequiredInconsistentBuilderDiscriminatorExt on ComposedDiscRequiredInconsistentBuilder { + String? get discriminatorValue { + if (this is DiscOptionalTypeCorrectBuilder) { + return r'DiscOptionalTypeCorrect'; + } + if (this is FruitTypeBuilder) { + return r'FruitType'; + } + return null; + } +} + +class _$ComposedDiscRequiredInconsistentSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ComposedDiscRequiredInconsistent, _$ComposedDiscRequiredInconsistent]; + + @override + final String wireName = r'ComposedDiscRequiredInconsistent'; + + Iterable _serializeProperties( + Serializers serializers, + ComposedDiscRequiredInconsistent object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + } + + @override + Object serialize( + Serializers serializers, + ComposedDiscRequiredInconsistent object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + } + + @override + ComposedDiscRequiredInconsistent deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ComposedDiscRequiredInconsistentBuilder(); + Object? oneOfDataSrc; + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(ComposedDiscRequiredInconsistent.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + oneOfDataSrc = serialized; + final oneOfTypes = [DiscOptionalTypeCorrect, FruitType, ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'DiscOptionalTypeCorrect': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(DiscOptionalTypeCorrect), + ) as DiscOptionalTypeCorrect; + oneOfType = DiscOptionalTypeCorrect; + break; + case r'FruitType': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(FruitType), + ) as FruitType; + oneOfType = FruitType; + break; + default: + throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_type_inconsistent.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_type_inconsistent.dart new file mode 100644 index 000000000000..8840b659b8bf --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_type_inconsistent.dart @@ -0,0 +1,126 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/disc_type_incorrect.dart'; +import 'package:openapi/src/model/fruit_type.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'composed_disc_type_inconsistent.g.dart'; + +/// ComposedDiscTypeInconsistent +/// +/// Properties: +/// * [fruitType] +@BuiltValue() +abstract class ComposedDiscTypeInconsistent implements Built { + /// One Of [DiscTypeIncorrect], [FruitType] + OneOf get oneOf; + + static const String discriminatorFieldName = r'fruitType'; + + static const Map discriminatorMapping = { + r'DiscTypeIncorrect': DiscTypeIncorrect, + r'FruitType': FruitType, + }; + + ComposedDiscTypeInconsistent._(); + + factory ComposedDiscTypeInconsistent([void updates(ComposedDiscTypeInconsistentBuilder b)]) = _$ComposedDiscTypeInconsistent; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ComposedDiscTypeInconsistentBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ComposedDiscTypeInconsistentSerializer(); +} + +extension ComposedDiscTypeInconsistentDiscriminatorExt on ComposedDiscTypeInconsistent { + String? get discriminatorValue { + if (this is DiscTypeIncorrect) { + return r'DiscTypeIncorrect'; + } + if (this is FruitType) { + return r'FruitType'; + } + return null; + } +} +extension ComposedDiscTypeInconsistentBuilderDiscriminatorExt on ComposedDiscTypeInconsistentBuilder { + String? get discriminatorValue { + if (this is DiscTypeIncorrectBuilder) { + return r'DiscTypeIncorrect'; + } + if (this is FruitTypeBuilder) { + return r'FruitType'; + } + return null; + } +} + +class _$ComposedDiscTypeInconsistentSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ComposedDiscTypeInconsistent, _$ComposedDiscTypeInconsistent]; + + @override + final String wireName = r'ComposedDiscTypeInconsistent'; + + Iterable _serializeProperties( + Serializers serializers, + ComposedDiscTypeInconsistent object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + } + + @override + Object serialize( + Serializers serializers, + ComposedDiscTypeInconsistent object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + } + + @override + ComposedDiscTypeInconsistent deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ComposedDiscTypeInconsistentBuilder(); + Object? oneOfDataSrc; + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(ComposedDiscTypeInconsistent.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + oneOfDataSrc = serialized; + final oneOfTypes = [DiscTypeIncorrect, FruitType, ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'DiscTypeIncorrect': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(DiscTypeIncorrect), + ) as DiscTypeIncorrect; + oneOfType = DiscTypeIncorrect; + break; + case r'FruitType': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(FruitType), + ) as FruitType; + oneOfType = FruitType; + break; + default: + throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_type_incorrect.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_type_incorrect.dart new file mode 100644 index 000000000000..537c8ac2af6b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/composed_disc_type_incorrect.dart @@ -0,0 +1,111 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/disc_type_incorrect.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'composed_disc_type_incorrect.g.dart'; + +/// ComposedDiscTypeIncorrect +/// +/// Properties: +/// * [fruitType] +@BuiltValue() +abstract class ComposedDiscTypeIncorrect implements Built { + /// One Of [DiscTypeIncorrect] + OneOf get oneOf; + + static const String discriminatorFieldName = r'fruitType'; + + static const Map discriminatorMapping = { + r'DiscTypeIncorrect': DiscTypeIncorrect, + }; + + ComposedDiscTypeIncorrect._(); + + factory ComposedDiscTypeIncorrect([void updates(ComposedDiscTypeIncorrectBuilder b)]) = _$ComposedDiscTypeIncorrect; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ComposedDiscTypeIncorrectBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ComposedDiscTypeIncorrectSerializer(); +} + +extension ComposedDiscTypeIncorrectDiscriminatorExt on ComposedDiscTypeIncorrect { + String? get discriminatorValue { + if (this is DiscTypeIncorrect) { + return r'DiscTypeIncorrect'; + } + return null; + } +} +extension ComposedDiscTypeIncorrectBuilderDiscriminatorExt on ComposedDiscTypeIncorrectBuilder { + String? get discriminatorValue { + if (this is DiscTypeIncorrectBuilder) { + return r'DiscTypeIncorrect'; + } + return null; + } +} + +class _$ComposedDiscTypeIncorrectSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ComposedDiscTypeIncorrect, _$ComposedDiscTypeIncorrect]; + + @override + final String wireName = r'ComposedDiscTypeIncorrect'; + + Iterable _serializeProperties( + Serializers serializers, + ComposedDiscTypeIncorrect object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + } + + @override + Object serialize( + Serializers serializers, + ComposedDiscTypeIncorrect object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + } + + @override + ComposedDiscTypeIncorrect deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ComposedDiscTypeIncorrectBuilder(); + Object? oneOfDataSrc; + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(ComposedDiscTypeIncorrect.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + oneOfDataSrc = serialized; + final oneOfTypes = [DiscTypeIncorrect, ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'DiscTypeIncorrect': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(DiscTypeIncorrect), + ) as DiscTypeIncorrect; + oneOfType = DiscTypeIncorrect; + break; + default: + throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/date.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/date.dart new file mode 100644 index 000000000000..b21c7f544bee --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/date.dart @@ -0,0 +1,70 @@ +/// A gregorian calendar date generated by +/// OpenAPI generator to differentiate +/// between [DateTime] and [Date] formats. +class Date implements Comparable { + final int year; + + /// January is 1. + final int month; + + /// First day is 1. + final int day; + + Date(this.year, this.month, this.day); + + /// The current date + static Date now({bool utc = false}) { + var now = DateTime.now(); + if (utc) { + now = now.toUtc(); + } + return now.toDate(); + } + + /// Convert to a [DateTime]. + DateTime toDateTime({bool utc = false}) { + if (utc) { + return DateTime.utc(year, month, day); + } else { + return DateTime(year, month, day); + } + } + + @override + int compareTo(Date other) { + int d = year.compareTo(other.year); + if (d != 0) { + return d; + } + d = month.compareTo(other.month); + if (d != 0) { + return d; + } + return day.compareTo(other.day); + } + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Date && + runtimeType == other.runtimeType && + year == other.year && + month == other.month && + day == other.day; + + @override + int get hashCode => year.hashCode ^ month.hashCode ^ day.hashCode; + + @override + String toString() { + final yyyy = year.toString(); + final mm = month.toString().padLeft(2, '0'); + final dd = day.toString().padLeft(2, '0'); + + return '$yyyy-$mm-$dd'; + } +} + +extension DateTimeToDate on DateTime { + Date toDate() => Date(year, month, day); +} diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/deprecated_object.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/deprecated_object.dart new file mode 100644 index 000000000000..26316746daae --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/deprecated_object.dart @@ -0,0 +1,110 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'deprecated_object.g.dart'; + +/// DeprecatedObject +/// +/// Properties: +/// * [name] +@Deprecated('DeprecatedObject has been deprecated') +@BuiltValue() +abstract class DeprecatedObject implements Built { + @BuiltValueField(wireName: r'name') + String? get name; + + DeprecatedObject._(); + + factory DeprecatedObject([void updates(DeprecatedObjectBuilder b)]) = _$DeprecatedObject; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(DeprecatedObjectBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$DeprecatedObjectSerializer(); +} + +class _$DeprecatedObjectSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [DeprecatedObject, _$DeprecatedObject]; + + @override + final String wireName = r'DeprecatedObject'; + + Iterable _serializeProperties( + Serializers serializers, + DeprecatedObject object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + DeprecatedObject object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required DeprecatedObjectBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + DeprecatedObject deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = DeprecatedObjectBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/disc_missing_from_properties.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/disc_missing_from_properties.dart new file mode 100644 index 000000000000..7a87bdc60bc9 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/disc_missing_from_properties.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'disc_missing_from_properties.g.dart'; + +/// DiscMissingFromProperties +/// +/// Properties: +/// * [length] +@BuiltValue() +abstract class DiscMissingFromProperties implements Built { + @BuiltValueField(wireName: r'length') + int? get length; + + DiscMissingFromProperties._(); + + factory DiscMissingFromProperties([void updates(DiscMissingFromPropertiesBuilder b)]) = _$DiscMissingFromProperties; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(DiscMissingFromPropertiesBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$DiscMissingFromPropertiesSerializer(); +} + +class _$DiscMissingFromPropertiesSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [DiscMissingFromProperties, _$DiscMissingFromProperties]; + + @override + final String wireName = r'DiscMissingFromProperties'; + + Iterable _serializeProperties( + Serializers serializers, + DiscMissingFromProperties object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.length != null) { + yield r'length'; + yield serializers.serialize( + object.length, + specifiedType: const FullType(int), + ); + } + } + + @override + Object serialize( + Serializers serializers, + DiscMissingFromProperties object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required DiscMissingFromPropertiesBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'length': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.length = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + DiscMissingFromProperties deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = DiscMissingFromPropertiesBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/disc_optional_type_correct.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/disc_optional_type_correct.dart new file mode 100644 index 000000000000..aa7c73972a47 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/disc_optional_type_correct.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'disc_optional_type_correct.g.dart'; + +/// DiscOptionalTypeCorrect +/// +/// Properties: +/// * [fruitType] +@BuiltValue() +abstract class DiscOptionalTypeCorrect implements Built { + @BuiltValueField(wireName: r'fruitType') + String? get fruitType; + + DiscOptionalTypeCorrect._(); + + factory DiscOptionalTypeCorrect([void updates(DiscOptionalTypeCorrectBuilder b)]) = _$DiscOptionalTypeCorrect; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(DiscOptionalTypeCorrectBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$DiscOptionalTypeCorrectSerializer(); +} + +class _$DiscOptionalTypeCorrectSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [DiscOptionalTypeCorrect, _$DiscOptionalTypeCorrect]; + + @override + final String wireName = r'DiscOptionalTypeCorrect'; + + Iterable _serializeProperties( + Serializers serializers, + DiscOptionalTypeCorrect object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.fruitType != null) { + yield r'fruitType'; + yield serializers.serialize( + object.fruitType, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + DiscOptionalTypeCorrect object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required DiscOptionalTypeCorrectBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'fruitType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.fruitType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + DiscOptionalTypeCorrect deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = DiscOptionalTypeCorrectBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/disc_optional_type_incorrect.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/disc_optional_type_incorrect.dart new file mode 100644 index 000000000000..9853fb88ebb8 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/disc_optional_type_incorrect.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'disc_optional_type_incorrect.g.dart'; + +/// DiscOptionalTypeIncorrect +/// +/// Properties: +/// * [fruitType] +@BuiltValue() +abstract class DiscOptionalTypeIncorrect implements Built { + @BuiltValueField(wireName: r'fruitType') + int? get fruitType; + + DiscOptionalTypeIncorrect._(); + + factory DiscOptionalTypeIncorrect([void updates(DiscOptionalTypeIncorrectBuilder b)]) = _$DiscOptionalTypeIncorrect; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(DiscOptionalTypeIncorrectBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$DiscOptionalTypeIncorrectSerializer(); +} + +class _$DiscOptionalTypeIncorrectSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [DiscOptionalTypeIncorrect, _$DiscOptionalTypeIncorrect]; + + @override + final String wireName = r'DiscOptionalTypeIncorrect'; + + Iterable _serializeProperties( + Serializers serializers, + DiscOptionalTypeIncorrect object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.fruitType != null) { + yield r'fruitType'; + yield serializers.serialize( + object.fruitType, + specifiedType: const FullType(int), + ); + } + } + + @override + Object serialize( + Serializers serializers, + DiscOptionalTypeIncorrect object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required DiscOptionalTypeIncorrectBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'fruitType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.fruitType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + DiscOptionalTypeIncorrect deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = DiscOptionalTypeIncorrectBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/disc_type_incorrect.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/disc_type_incorrect.dart new file mode 100644 index 000000000000..5662e401cc17 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/disc_type_incorrect.dart @@ -0,0 +1,107 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'disc_type_incorrect.g.dart'; + +/// DiscTypeIncorrect +/// +/// Properties: +/// * [fruitType] +@BuiltValue() +abstract class DiscTypeIncorrect implements Built { + @BuiltValueField(wireName: r'fruitType') + int get fruitType; + + DiscTypeIncorrect._(); + + factory DiscTypeIncorrect([void updates(DiscTypeIncorrectBuilder b)]) = _$DiscTypeIncorrect; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(DiscTypeIncorrectBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$DiscTypeIncorrectSerializer(); +} + +class _$DiscTypeIncorrectSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [DiscTypeIncorrect, _$DiscTypeIncorrect]; + + @override + final String wireName = r'DiscTypeIncorrect'; + + Iterable _serializeProperties( + Serializers serializers, + DiscTypeIncorrect object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'fruitType'; + yield serializers.serialize( + object.fruitType, + specifiedType: const FullType(int), + ); + } + + @override + Object serialize( + Serializers serializers, + DiscTypeIncorrect object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required DiscTypeIncorrectBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'fruitType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.fruitType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + DiscTypeIncorrect deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = DiscTypeIncorrectBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/dog.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/dog.dart new file mode 100644 index 000000000000..fb05604d6bd4 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/dog.dart @@ -0,0 +1,141 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/animal.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'dog.g.dart'; + +/// Dog +/// +/// Properties: +/// * [className] +/// * [color] +/// * [breed] +@BuiltValue() +abstract class Dog implements Animal, Built { + @BuiltValueField(wireName: r'breed') + String? get breed; + + Dog._(); + + factory Dog([void updates(DogBuilder b)]) = _$Dog; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(DogBuilder b) => b..className=b.discriminatorValue + ..color = 'red'; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$DogSerializer(); +} + +class _$DogSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Dog, _$Dog]; + + @override + final String wireName = r'Dog'; + + Iterable _serializeProperties( + Serializers serializers, + Dog object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.color != null) { + yield r'color'; + yield serializers.serialize( + object.color, + specifiedType: const FullType(String), + ); + } + if (object.breed != null) { + yield r'breed'; + yield serializers.serialize( + object.breed, + specifiedType: const FullType(String), + ); + } + yield r'className'; + yield serializers.serialize( + object.className, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + Dog object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required DogBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'color': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.color = valueDes; + break; + case r'breed': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.breed = valueDes; + break; + case r'className': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.className = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Dog deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = DogBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/entity.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/entity.dart new file mode 100644 index 000000000000..64252003bc51 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/entity.dart @@ -0,0 +1,303 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/extensible.dart'; +import 'package:openapi/src/model/pizza_speziale.dart'; +import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/pizza.dart'; +import 'package:openapi/src/model/addressable.dart'; +import 'package:openapi/src/model/pasta.dart'; +import 'package:openapi/src/model/bar_create.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'entity.g.dart'; + +/// Entity +/// +/// Properties: +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue(instantiable: false) +abstract class Entity implements Addressable, Extensible { + static const String discriminatorFieldName = r'@type'; + + static const Map discriminatorMapping = { + r'Bar': Bar, + r'Bar_Create': BarCreate, + r'Foo': Foo, + r'Pasta': Pasta, + r'Pizza': Pizza, + r'PizzaSpeziale': PizzaSpeziale, + }; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$EntitySerializer(); +} + +extension EntityDiscriminatorExt on Entity { + String? get discriminatorValue { + if (this is Bar) { + return r'Bar'; + } + if (this is BarCreate) { + return r'Bar_Create'; + } + if (this is Foo) { + return r'Foo'; + } + if (this is Pasta) { + return r'Pasta'; + } + if (this is Pizza) { + return r'Pizza'; + } + if (this is PizzaSpeziale) { + return r'PizzaSpeziale'; + } + return null; + } +} +extension EntityBuilderDiscriminatorExt on EntityBuilder { + String? get discriminatorValue { + if (this is BarBuilder) { + return r'Bar'; + } + if (this is BarCreateBuilder) { + return r'Bar_Create'; + } + if (this is FooBuilder) { + return r'Foo'; + } + if (this is PastaBuilder) { + return r'Pasta'; + } + if (this is PizzaBuilder) { + return r'Pizza'; + } + if (this is PizzaSpezialeBuilder) { + return r'PizzaSpeziale'; + } + return null; + } +} + +class _$EntitySerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Entity]; + + @override + final String wireName = r'Entity'; + + Iterable _serializeProperties( + Serializers serializers, + Entity object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + Entity object, { + FullType specifiedType = FullType.unspecified, + }) { + if (object is Bar) { + return serializers.serialize(object, specifiedType: FullType(Bar))!; + } + if (object is BarCreate) { + return serializers.serialize(object, specifiedType: FullType(BarCreate))!; + } + if (object is Foo) { + return serializers.serialize(object, specifiedType: FullType(Foo))!; + } + if (object is Pasta) { + return serializers.serialize(object, specifiedType: FullType(Pasta))!; + } + if (object is Pizza) { + return serializers.serialize(object, specifiedType: FullType(Pizza))!; + } + if (object is PizzaSpeziale) { + return serializers.serialize(object, specifiedType: FullType(PizzaSpeziale))!; + } + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + @override + Entity deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(Entity.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + switch (discValue) { + case r'Bar': + return serializers.deserialize(serialized, specifiedType: FullType(Bar)) as Bar; + case r'Bar_Create': + return serializers.deserialize(serialized, specifiedType: FullType(BarCreate)) as BarCreate; + case r'Foo': + return serializers.deserialize(serialized, specifiedType: FullType(Foo)) as Foo; + case r'Pasta': + return serializers.deserialize(serialized, specifiedType: FullType(Pasta)) as Pasta; + case r'Pizza': + return serializers.deserialize(serialized, specifiedType: FullType(Pizza)) as Pizza; + case r'PizzaSpeziale': + return serializers.deserialize(serialized, specifiedType: FullType(PizzaSpeziale)) as PizzaSpeziale; + default: + return serializers.deserialize(serialized, specifiedType: FullType($Entity)) as $Entity; + } + } +} + +/// a concrete implementation of [Entity], since [Entity] is not instantiable +@BuiltValue(instantiable: true) +abstract class $Entity implements Entity, Built<$Entity, $EntityBuilder> { + $Entity._(); + + factory $Entity([void Function($EntityBuilder)? updates]) = _$$Entity; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($EntityBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$Entity> get serializer => _$$EntitySerializer(); +} + +class _$$EntitySerializer implements PrimitiveSerializer<$Entity> { + @override + final Iterable types = const [$Entity, _$$Entity]; + + @override + final String wireName = r'$Entity'; + + @override + Object serialize( + Serializers serializers, + $Entity object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(Entity))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required EntityBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $Entity deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $EntityBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/entity_ref.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/entity_ref.dart new file mode 100644 index 000000000000..114a7781a664 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/entity_ref.dart @@ -0,0 +1,291 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/extensible.dart'; +import 'package:openapi/src/model/bar_ref.dart'; +import 'package:openapi/src/model/addressable.dart'; +import 'package:openapi/src/model/foo_ref.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'entity_ref.g.dart'; + +/// Entity reference schema to be use for all entityRef class. +/// +/// Properties: +/// * [name] - Name of the related entity. +/// * [atReferredType] - The actual type of the target instance when needed for disambiguation. +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue(instantiable: false) +abstract class EntityRef implements Addressable, Extensible { + /// The actual type of the target instance when needed for disambiguation. + @BuiltValueField(wireName: r'@referredType') + String? get atReferredType; + + /// Name of the related entity. + @BuiltValueField(wireName: r'name') + String? get name; + + static const String discriminatorFieldName = r'@type'; + + static const Map discriminatorMapping = { + r'BarRef': BarRef, + r'FooRef': FooRef, + }; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$EntityRefSerializer(); +} + +extension EntityRefDiscriminatorExt on EntityRef { + String? get discriminatorValue { + if (this is BarRef) { + return r'BarRef'; + } + if (this is FooRef) { + return r'FooRef'; + } + return null; + } +} +extension EntityRefBuilderDiscriminatorExt on EntityRefBuilder { + String? get discriminatorValue { + if (this is BarRefBuilder) { + return r'BarRef'; + } + if (this is FooRefBuilder) { + return r'FooRef'; + } + return null; + } +} + +class _$EntityRefSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [EntityRef]; + + @override + final String wireName = r'EntityRef'; + + Iterable _serializeProperties( + Serializers serializers, + EntityRef object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.atReferredType != null) { + yield r'@referredType'; + yield serializers.serialize( + object.atReferredType, + specifiedType: const FullType(String), + ); + } + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + EntityRef object, { + FullType specifiedType = FullType.unspecified, + }) { + if (object is BarRef) { + return serializers.serialize(object, specifiedType: FullType(BarRef))!; + } + if (object is FooRef) { + return serializers.serialize(object, specifiedType: FullType(FooRef))!; + } + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + @override + EntityRef deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(EntityRef.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + switch (discValue) { + case r'BarRef': + return serializers.deserialize(serialized, specifiedType: FullType(BarRef)) as BarRef; + case r'FooRef': + return serializers.deserialize(serialized, specifiedType: FullType(FooRef)) as FooRef; + default: + return serializers.deserialize(serialized, specifiedType: FullType($EntityRef)) as $EntityRef; + } + } +} + +/// a concrete implementation of [EntityRef], since [EntityRef] is not instantiable +@BuiltValue(instantiable: true) +abstract class $EntityRef implements EntityRef, Built<$EntityRef, $EntityRefBuilder> { + $EntityRef._(); + + factory $EntityRef([void Function($EntityRefBuilder)? updates]) = _$$EntityRef; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($EntityRefBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$EntityRef> get serializer => _$$EntityRefSerializer(); +} + +class _$$EntityRefSerializer implements PrimitiveSerializer<$EntityRef> { + @override + final Iterable types = const [$EntityRef, _$$EntityRef]; + + @override + final String wireName = r'$EntityRef'; + + @override + Object serialize( + Serializers serializers, + $EntityRef object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(EntityRef))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required EntityRefBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'@referredType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atReferredType = valueDes; + break; + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $EntityRef deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $EntityRefBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/enum_arrays.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/enum_arrays.dart new file mode 100644 index 000000000000..643510da5bad --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/enum_arrays.dart @@ -0,0 +1,164 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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'; + +/// EnumArrays +/// +/// Properties: +/// * [justSymbol] +/// * [arrayEnum] +@BuiltValue() +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._(); + + factory EnumArrays([void updates(EnumArraysBuilder b)]) = _$EnumArrays; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(EnumArraysBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$EnumArraysSerializer(); +} + +class _$EnumArraysSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [EnumArrays, _$EnumArrays]; + + @override + final String wireName = r'EnumArrays'; + + Iterable _serializeProperties( + Serializers serializers, + EnumArrays object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.justSymbol != null) { + yield r'just_symbol'; + yield serializers.serialize( + object.justSymbol, + specifiedType: const FullType(EnumArraysJustSymbolEnum), + ); + } + if (object.arrayEnum != null) { + yield r'array_enum'; + yield serializers.serialize( + object.arrayEnum, + specifiedType: const FullType(BuiltList, [FullType(EnumArraysArrayEnumEnum)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + EnumArrays object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required EnumArraysBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'just_symbol': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumArraysJustSymbolEnum), + ) as EnumArraysJustSymbolEnum; + result.justSymbol = valueDes; + break; + case r'array_enum': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(EnumArraysArrayEnumEnum)]), + ) as BuiltList; + result.arrayEnum.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + EnumArrays deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = EnumArraysBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + 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; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumArraysJustSymbolEnum unknownDefaultOpenApi = _$enumArraysJustSymbolEnum_unknownDefaultOpenApi; + + 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; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumArraysArrayEnumEnum unknownDefaultOpenApi = _$enumArraysArrayEnumEnum_unknownDefaultOpenApi; + + 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/client/echo_api/dart/dio/built_value/lib/src/model/enum_test.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/enum_test.dart new file mode 100644 index 000000000000..545f877da71b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/enum_test.dart @@ -0,0 +1,322 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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'; + +/// EnumTest +/// +/// Properties: +/// * [enumString] +/// * [enumStringRequired] +/// * [enumInteger] +/// * [enumNumber] +/// * [outerEnum] +/// * [outerEnumInteger] +/// * [outerEnumDefaultValue] +/// * [outerEnumIntegerDefaultValue] +@BuiltValue() +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._(); + + factory EnumTest([void updates(EnumTestBuilder b)]) = _$EnumTest; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(EnumTestBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$EnumTestSerializer(); +} + +class _$EnumTestSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [EnumTest, _$EnumTest]; + + @override + final String wireName = r'EnumTest'; + + Iterable _serializeProperties( + Serializers serializers, + EnumTest object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.enumString != null) { + yield r'enum_string'; + yield serializers.serialize( + object.enumString, + specifiedType: const FullType(EnumTestEnumStringEnum), + ); + } + yield r'enum_string_required'; + yield serializers.serialize( + object.enumStringRequired, + specifiedType: const FullType(EnumTestEnumStringRequiredEnum), + ); + if (object.enumInteger != null) { + yield r'enum_integer'; + yield serializers.serialize( + object.enumInteger, + specifiedType: const FullType(EnumTestEnumIntegerEnum), + ); + } + if (object.enumNumber != null) { + yield r'enum_number'; + yield serializers.serialize( + object.enumNumber, + specifiedType: const FullType(EnumTestEnumNumberEnum), + ); + } + if (object.outerEnum != null) { + yield r'outerEnum'; + yield serializers.serialize( + object.outerEnum, + specifiedType: const FullType.nullable(OuterEnum), + ); + } + if (object.outerEnumInteger != null) { + yield r'outerEnumInteger'; + yield serializers.serialize( + object.outerEnumInteger, + specifiedType: const FullType(OuterEnumInteger), + ); + } + if (object.outerEnumDefaultValue != null) { + yield r'outerEnumDefaultValue'; + yield serializers.serialize( + object.outerEnumDefaultValue, + specifiedType: const FullType(OuterEnumDefaultValue), + ); + } + if (object.outerEnumIntegerDefaultValue != null) { + yield r'outerEnumIntegerDefaultValue'; + yield serializers.serialize( + object.outerEnumIntegerDefaultValue, + specifiedType: const FullType(OuterEnumIntegerDefaultValue), + ); + } + } + + @override + Object serialize( + Serializers serializers, + EnumTest object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required EnumTestBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'enum_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumTestEnumStringEnum), + ) as EnumTestEnumStringEnum; + result.enumString = valueDes; + break; + case r'enum_string_required': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumTestEnumStringRequiredEnum), + ) as EnumTestEnumStringRequiredEnum; + result.enumStringRequired = valueDes; + break; + case r'enum_integer': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumTestEnumIntegerEnum), + ) as EnumTestEnumIntegerEnum; + result.enumInteger = valueDes; + break; + case r'enum_number': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumTestEnumNumberEnum), + ) as EnumTestEnumNumberEnum; + result.enumNumber = valueDes; + break; + case r'outerEnum': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(OuterEnum), + ) as OuterEnum?; + if (valueDes == null) continue; + result.outerEnum = valueDes; + break; + case r'outerEnumInteger': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OuterEnumInteger), + ) as OuterEnumInteger; + result.outerEnumInteger = valueDes; + break; + case r'outerEnumDefaultValue': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OuterEnumDefaultValue), + ) as OuterEnumDefaultValue; + result.outerEnumDefaultValue = valueDes; + break; + case r'outerEnumIntegerDefaultValue': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OuterEnumIntegerDefaultValue), + ) as OuterEnumIntegerDefaultValue; + result.outerEnumIntegerDefaultValue = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + EnumTest deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = EnumTestBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + 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; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumTestEnumStringEnum unknownDefaultOpenApi = _$enumTestEnumStringEnum_unknownDefaultOpenApi; + + 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; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumTestEnumStringRequiredEnum unknownDefaultOpenApi = _$enumTestEnumStringRequiredEnum_unknownDefaultOpenApi; + + 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; + @BuiltValueEnumConst(wireNumber: 11184809, fallback: true) + static const EnumTestEnumIntegerEnum unknownDefaultOpenApi = _$enumTestEnumIntegerEnum_unknownDefaultOpenApi; + + 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; + @BuiltValueEnumConst(wireName: r'11184809', fallback: true) + static const EnumTestEnumNumberEnum unknownDefaultOpenApi = _$enumTestEnumNumberEnum_unknownDefaultOpenApi; + + 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/client/echo_api/dart/dio/built_value/lib/src/model/extensible.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/extensible.dart new file mode 100644 index 000000000000..f59fce5acc86 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/extensible.dart @@ -0,0 +1,181 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'extensible.g.dart'; + +/// Extensible +/// +/// Properties: +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue(instantiable: false) +abstract class Extensible { + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @BuiltValueField(wireName: r'@schemaLocation') + String? get atSchemaLocation; + + /// When sub-classing, this defines the super-class + @BuiltValueField(wireName: r'@baseType') + String? get atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @BuiltValueField(wireName: r'@type') + String get atType; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ExtensibleSerializer(); +} + +class _$ExtensibleSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Extensible]; + + @override + final String wireName = r'Extensible'; + + Iterable _serializeProperties( + Serializers serializers, + Extensible object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + Extensible object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + @override + Extensible deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.deserialize(serialized, specifiedType: FullType($Extensible)) as $Extensible; + } +} + +/// a concrete implementation of [Extensible], since [Extensible] is not instantiable +@BuiltValue(instantiable: true) +abstract class $Extensible implements Extensible, Built<$Extensible, $ExtensibleBuilder> { + $Extensible._(); + + factory $Extensible([void Function($ExtensibleBuilder)? updates]) = _$$Extensible; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($ExtensibleBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$Extensible> get serializer => _$$ExtensibleSerializer(); +} + +class _$$ExtensibleSerializer implements PrimitiveSerializer<$Extensible> { + @override + final Iterable types = const [$Extensible, _$$Extensible]; + + @override + final String wireName = r'$Extensible'; + + @override + Object serialize( + Serializers serializers, + $Extensible object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(Extensible))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ExtensibleBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $Extensible deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $ExtensibleBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/file_schema_test_class.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/file_schema_test_class.dart new file mode 100644 index 000000000000..407904d642dd --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/file_schema_test_class.dart @@ -0,0 +1,130 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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'; + +/// FileSchemaTestClass +/// +/// Properties: +/// * [file] +/// * [files] +@BuiltValue() +abstract class FileSchemaTestClass implements Built { + @BuiltValueField(wireName: r'file') + ModelFile? get file; + + @BuiltValueField(wireName: r'files') + BuiltList? get files; + + FileSchemaTestClass._(); + + factory FileSchemaTestClass([void updates(FileSchemaTestClassBuilder b)]) = _$FileSchemaTestClass; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FileSchemaTestClassBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FileSchemaTestClassSerializer(); +} + +class _$FileSchemaTestClassSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FileSchemaTestClass, _$FileSchemaTestClass]; + + @override + final String wireName = r'FileSchemaTestClass'; + + Iterable _serializeProperties( + Serializers serializers, + FileSchemaTestClass object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.file != null) { + yield r'file'; + yield serializers.serialize( + object.file, + specifiedType: const FullType(ModelFile), + ); + } + if (object.files != null) { + yield r'files'; + yield serializers.serialize( + object.files, + specifiedType: const FullType(BuiltList, [FullType(ModelFile)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + FileSchemaTestClass object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FileSchemaTestClassBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'file': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(ModelFile), + ) as ModelFile; + result.file.replace(valueDes); + break; + case r'files': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(ModelFile)]), + ) as BuiltList; + result.files.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FileSchemaTestClass deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FileSchemaTestClassBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/foo.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/foo.dart new file mode 100644 index 000000000000..e8526dc76f6f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/foo.dart @@ -0,0 +1,207 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'foo.g.dart'; + +/// Foo +/// +/// Properties: +/// * [fooPropA] +/// * [fooPropB] +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue() +abstract class Foo implements Entity, Built { + @BuiltValueField(wireName: r'fooPropA') + String? get fooPropA; + + @BuiltValueField(wireName: r'fooPropB') + String? get fooPropB; + + Foo._(); + + factory Foo([void updates(FooBuilder b)]) = _$Foo; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FooBuilder b) => b..atType=b.discriminatorValue; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FooSerializer(); +} + +class _$FooSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Foo, _$Foo]; + + @override + final String wireName = r'Foo'; + + Iterable _serializeProperties( + Serializers serializers, + Foo object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.fooPropA != null) { + yield r'fooPropA'; + yield serializers.serialize( + object.fooPropA, + specifiedType: const FullType(String), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.fooPropB != null) { + yield r'fooPropB'; + yield serializers.serialize( + object.fooPropB, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + Foo object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FooBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'fooPropA': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.fooPropA = valueDes; + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'fooPropB': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.fooPropB = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Foo deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FooBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/foo_basic_get_default_response.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/foo_basic_get_default_response.dart new file mode 100644 index 000000000000..3def44899a7a --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/foo_basic_get_default_response.dart @@ -0,0 +1,110 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/foo.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'foo_basic_get_default_response.g.dart'; + +/// FooBasicGetDefaultResponse +/// +/// Properties: +/// * [string] +@BuiltValue() +abstract class FooBasicGetDefaultResponse implements Built { + @BuiltValueField(wireName: r'string') + Foo? get string; + + FooBasicGetDefaultResponse._(); + + factory FooBasicGetDefaultResponse([void updates(FooBasicGetDefaultResponseBuilder b)]) = _$FooBasicGetDefaultResponse; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FooBasicGetDefaultResponseBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FooBasicGetDefaultResponseSerializer(); +} + +class _$FooBasicGetDefaultResponseSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FooBasicGetDefaultResponse, _$FooBasicGetDefaultResponse]; + + @override + final String wireName = r'FooBasicGetDefaultResponse'; + + Iterable _serializeProperties( + Serializers serializers, + FooBasicGetDefaultResponse object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.string != null) { + yield r'string'; + yield serializers.serialize( + object.string, + specifiedType: const FullType(Foo), + ); + } + } + + @override + Object serialize( + Serializers serializers, + FooBasicGetDefaultResponse object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FooBasicGetDefaultResponseBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(Foo), + ) as Foo; + result.string.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FooBasicGetDefaultResponse deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FooBasicGetDefaultResponseBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/foo_ref.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/foo_ref.dart new file mode 100644 index 000000000000..a745a070b3b6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/foo_ref.dart @@ -0,0 +1,216 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity_ref.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'foo_ref.g.dart'; + +/// FooRef +/// +/// Properties: +/// * [foorefPropA] +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue() +abstract class FooRef implements EntityRef, Built { + @BuiltValueField(wireName: r'foorefPropA') + String? get foorefPropA; + + FooRef._(); + + factory FooRef([void updates(FooRefBuilder b)]) = _$FooRef; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FooRefBuilder b) => b..atType=b.discriminatorValue; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FooRefSerializer(); +} + +class _$FooRefSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FooRef, _$FooRef]; + + @override + final String wireName = r'FooRef'; + + Iterable _serializeProperties( + Serializers serializers, + FooRef object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.atReferredType != null) { + yield r'@referredType'; + yield serializers.serialize( + object.atReferredType, + specifiedType: const FullType(String), + ); + } + if (object.foorefPropA != null) { + yield r'foorefPropA'; + yield serializers.serialize( + object.foorefPropA, + specifiedType: const FullType(String), + ); + } + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + FooRef object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FooRefBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'@referredType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atReferredType = valueDes; + break; + case r'foorefPropA': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.foorefPropA = valueDes; + break; + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FooRef deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FooRefBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/foo_ref_or_value.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/foo_ref_or_value.dart new file mode 100644 index 000000000000..811b97904247 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/foo_ref_or_value.dart @@ -0,0 +1,134 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/foo_ref.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'foo_ref_or_value.g.dart'; + +/// FooRefOrValue +/// +/// Properties: +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue() +abstract class FooRefOrValue implements Built { + /// One Of [Foo], [FooRef] + OneOf get oneOf; + + static const String discriminatorFieldName = r'@type'; + + static const Map discriminatorMapping = { + r'Foo': Foo, + r'FooRef': FooRef, + }; + + FooRefOrValue._(); + + factory FooRefOrValue([void updates(FooRefOrValueBuilder b)]) = _$FooRefOrValue; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FooRefOrValueBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FooRefOrValueSerializer(); +} + +extension FooRefOrValueDiscriminatorExt on FooRefOrValue { + String? get discriminatorValue { + if (this is Foo) { + return r'Foo'; + } + if (this is FooRef) { + return r'FooRef'; + } + return null; + } +} +extension FooRefOrValueBuilderDiscriminatorExt on FooRefOrValueBuilder { + String? get discriminatorValue { + if (this is FooBuilder) { + return r'Foo'; + } + if (this is FooRefBuilder) { + return r'FooRef'; + } + return null; + } +} + +class _$FooRefOrValueSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FooRefOrValue, _$FooRefOrValue]; + + @override + final String wireName = r'FooRefOrValue'; + + Iterable _serializeProperties( + Serializers serializers, + FooRefOrValue object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + } + + @override + Object serialize( + Serializers serializers, + FooRefOrValue object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + } + + @override + FooRefOrValue deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FooRefOrValueBuilder(); + Object? oneOfDataSrc; + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(FooRefOrValue.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + oneOfDataSrc = serialized; + final oneOfTypes = [Foo, FooRef, ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'Foo': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(Foo), + ) as Foo; + oneOfType = Foo; + break; + case r'FooRef': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(FooRef), + ) as FooRef; + oneOfType = FooRef; + break; + default: + throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + return result.build(); + } +} + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/format_test.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/format_test.dart new file mode 100644 index 000000000000..9d3aa3411749 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/format_test.dart @@ -0,0 +1,390 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'dart:typed_data'; +import 'package:openapi/src/model/date.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'format_test.g.dart'; + +/// FormatTest +/// +/// Properties: +/// * [integer] +/// * [int32] +/// * [int64] +/// * [number] +/// * [float] +/// * [double_] +/// * [decimal] +/// * [string] +/// * [byte] +/// * [binary] +/// * [date] +/// * [dateTime] +/// * [uuid] +/// * [password] +/// * [patternWithDigits] - A string that is a 10 digit number. Can have leading zeros. +/// * [patternWithDigitsAndDelimiter] - A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. +@BuiltValue() +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') + Date 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._(); + + factory FormatTest([void updates(FormatTestBuilder b)]) = _$FormatTest; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FormatTestBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FormatTestSerializer(); +} + +class _$FormatTestSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FormatTest, _$FormatTest]; + + @override + final String wireName = r'FormatTest'; + + Iterable _serializeProperties( + Serializers serializers, + FormatTest object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.integer != null) { + yield r'integer'; + yield serializers.serialize( + object.integer, + specifiedType: const FullType(int), + ); + } + if (object.int32 != null) { + yield r'int32'; + yield serializers.serialize( + object.int32, + specifiedType: const FullType(int), + ); + } + if (object.int64 != null) { + yield r'int64'; + yield serializers.serialize( + object.int64, + specifiedType: const FullType(int), + ); + } + yield r'number'; + yield serializers.serialize( + object.number, + specifiedType: const FullType(num), + ); + if (object.float != null) { + yield r'float'; + yield serializers.serialize( + object.float, + specifiedType: const FullType(double), + ); + } + if (object.double_ != null) { + yield r'double'; + yield serializers.serialize( + object.double_, + specifiedType: const FullType(double), + ); + } + if (object.decimal != null) { + yield r'decimal'; + yield serializers.serialize( + object.decimal, + specifiedType: const FullType(double), + ); + } + if (object.string != null) { + yield r'string'; + yield serializers.serialize( + object.string, + specifiedType: const FullType(String), + ); + } + yield r'byte'; + yield serializers.serialize( + object.byte, + specifiedType: const FullType(String), + ); + if (object.binary != null) { + yield r'binary'; + yield serializers.serialize( + object.binary, + specifiedType: const FullType(Uint8List), + ); + } + yield r'date'; + yield serializers.serialize( + object.date, + specifiedType: const FullType(Date), + ); + if (object.dateTime != null) { + yield r'dateTime'; + yield serializers.serialize( + object.dateTime, + specifiedType: const FullType(DateTime), + ); + } + if (object.uuid != null) { + yield r'uuid'; + yield serializers.serialize( + object.uuid, + specifiedType: const FullType(String), + ); + } + yield r'password'; + yield serializers.serialize( + object.password, + specifiedType: const FullType(String), + ); + if (object.patternWithDigits != null) { + yield r'pattern_with_digits'; + yield serializers.serialize( + object.patternWithDigits, + specifiedType: const FullType(String), + ); + } + if (object.patternWithDigitsAndDelimiter != null) { + yield r'pattern_with_digits_and_delimiter'; + yield serializers.serialize( + object.patternWithDigitsAndDelimiter, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + FormatTest object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FormatTestBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'integer': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.integer = valueDes; + break; + case r'int32': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.int32 = valueDes; + break; + case r'int64': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.int64 = valueDes; + break; + case r'number': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.number = valueDes; + break; + case r'float': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(double), + ) as double; + result.float = valueDes; + break; + case r'double': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(double), + ) as double; + result.double_ = valueDes; + break; + case r'decimal': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(double), + ) as double; + result.decimal = valueDes; + break; + case r'string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.string = valueDes; + break; + case r'byte': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.byte = valueDes; + break; + case r'binary': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(Uint8List), + ) as Uint8List; + result.binary = valueDes; + break; + case r'date': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(Date), + ) as Date; + result.date = valueDes; + break; + case r'dateTime': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(DateTime), + ) as DateTime; + result.dateTime = valueDes; + break; + case r'uuid': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.uuid = valueDes; + break; + case r'password': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.password = valueDes; + break; + case r'pattern_with_digits': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.patternWithDigits = valueDes; + break; + case r'pattern_with_digits_and_delimiter': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.patternWithDigitsAndDelimiter = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FormatTest deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FormatTestBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + + + + + + + + + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit.dart new file mode 100644 index 000000000000..1dbab1cda8c6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit.dart @@ -0,0 +1,126 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/apple.dart'; +import 'package:openapi/src/model/banana.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'fruit.g.dart'; + +/// Fruit +/// +/// Properties: +/// * [color] +/// * [kind] +/// * [count] +@BuiltValue() +abstract class Fruit implements Built { + @BuiltValueField(wireName: r'color') + String? get color; + + /// One Of [Apple], [Banana] + OneOf get oneOf; + + Fruit._(); + + factory Fruit([void updates(FruitBuilder b)]) = _$Fruit; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FruitBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FruitSerializer(); +} + +class _$FruitSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Fruit, _$Fruit]; + + @override + final String wireName = r'Fruit'; + + Iterable _serializeProperties( + Serializers serializers, + Fruit object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.color != null) { + yield r'color'; + yield serializers.serialize( + object.color, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Fruit object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + final result = _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + result.addAll(serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType)) as Iterable); + return result; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FruitBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'color': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.color = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Fruit deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FruitBuilder(); + Object? oneOfDataSrc; + final targetType = const FullType(OneOf, [FullType(Apple), FullType(Banana), ]); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + oneOfDataSrc = unhandled; + result.oneOf = serializers.deserialize(oneOfDataSrc, specifiedType: targetType) as OneOf; + return result.build(); + } +} + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_all_of_disc.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_all_of_disc.dart new file mode 100644 index 000000000000..544c68d2d289 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_all_of_disc.dart @@ -0,0 +1,126 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/banana_all_of_disc.dart'; +import 'package:openapi/src/model/apple_all_of_disc.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'fruit_all_of_disc.g.dart'; + +/// FruitAllOfDisc +/// +/// Properties: +/// * [fruitType] +@BuiltValue() +abstract class FruitAllOfDisc implements Built { + /// One Of [AppleAllOfDisc], [BananaAllOfDisc] + OneOf get oneOf; + + static const String discriminatorFieldName = r'fruitType'; + + static const Map discriminatorMapping = { + r'AppleAllOfDisc': AppleAllOfDisc, + r'BananaAllOfDisc': BananaAllOfDisc, + }; + + FruitAllOfDisc._(); + + factory FruitAllOfDisc([void updates(FruitAllOfDiscBuilder b)]) = _$FruitAllOfDisc; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FruitAllOfDiscBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FruitAllOfDiscSerializer(); +} + +extension FruitAllOfDiscDiscriminatorExt on FruitAllOfDisc { + String? get discriminatorValue { + if (this is AppleAllOfDisc) { + return r'AppleAllOfDisc'; + } + if (this is BananaAllOfDisc) { + return r'BananaAllOfDisc'; + } + return null; + } +} +extension FruitAllOfDiscBuilderDiscriminatorExt on FruitAllOfDiscBuilder { + String? get discriminatorValue { + if (this is AppleAllOfDiscBuilder) { + return r'AppleAllOfDisc'; + } + if (this is BananaAllOfDiscBuilder) { + return r'BananaAllOfDisc'; + } + return null; + } +} + +class _$FruitAllOfDiscSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FruitAllOfDisc, _$FruitAllOfDisc]; + + @override + final String wireName = r'FruitAllOfDisc'; + + Iterable _serializeProperties( + Serializers serializers, + FruitAllOfDisc object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + } + + @override + Object serialize( + Serializers serializers, + FruitAllOfDisc object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + } + + @override + FruitAllOfDisc deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FruitAllOfDiscBuilder(); + Object? oneOfDataSrc; + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(FruitAllOfDisc.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + oneOfDataSrc = serialized; + final oneOfTypes = [AppleAllOfDisc, BananaAllOfDisc, ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'AppleAllOfDisc': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(AppleAllOfDisc), + ) as AppleAllOfDisc; + oneOfType = AppleAllOfDisc; + break; + case r'BananaAllOfDisc': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(BananaAllOfDisc), + ) as BananaAllOfDisc; + oneOfType = BananaAllOfDisc; + break; + default: + throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_any_of_disc.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_any_of_disc.dart new file mode 100644 index 000000000000..7510a7493413 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_any_of_disc.dart @@ -0,0 +1,71 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_type.dart'; +import 'package:openapi/src/model/apple_any_of_disc.dart'; +import 'package:openapi/src/model/banana_any_of_disc.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/any_of.dart'; + +part 'fruit_any_of_disc.g.dart'; + +/// FruitAnyOfDisc +/// +/// Properties: +/// * [fruitType] +@BuiltValue() +abstract class FruitAnyOfDisc implements Built { + /// Any Of [FruitType] + AnyOf get anyOf; + + FruitAnyOfDisc._(); + + factory FruitAnyOfDisc([void updates(FruitAnyOfDiscBuilder b)]) = _$FruitAnyOfDisc; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FruitAnyOfDiscBuilder b) => b..fruitType=b.discriminatorValue; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FruitAnyOfDiscSerializer(); +} + +class _$FruitAnyOfDiscSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FruitAnyOfDisc, _$FruitAnyOfDisc]; + + @override + final String wireName = r'FruitAnyOfDisc'; + + Iterable _serializeProperties( + Serializers serializers, + FruitAnyOfDisc object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + } + + @override + Object serialize( + Serializers serializers, + FruitAnyOfDisc object, { + FullType specifiedType = FullType.unspecified, + }) { + final anyOf = object.anyOf; + return serializers.serialize(anyOf, specifiedType: FullType(AnyOf, anyOf.valueTypes.map((type) => FullType(type)).toList()))!; + } + + @override + FruitAnyOfDisc deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FruitAnyOfDiscBuilder(); + Object? anyOfDataSrc; + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_grandparent_disc.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_grandparent_disc.dart new file mode 100644 index 000000000000..87c150bae757 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_grandparent_disc.dart @@ -0,0 +1,126 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/banana_grandparent_disc.dart'; +import 'package:openapi/src/model/apple_grandparent_disc.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'fruit_grandparent_disc.g.dart'; + +/// FruitGrandparentDisc +/// +/// Properties: +/// * [fruitType] +@BuiltValue() +abstract class FruitGrandparentDisc implements Built { + /// One Of [AppleGrandparentDisc], [BananaGrandparentDisc] + OneOf get oneOf; + + static const String discriminatorFieldName = r'fruitType'; + + static const Map discriminatorMapping = { + r'AppleGrandparentDisc': AppleGrandparentDisc, + r'BananaGrandparentDisc': BananaGrandparentDisc, + }; + + FruitGrandparentDisc._(); + + factory FruitGrandparentDisc([void updates(FruitGrandparentDiscBuilder b)]) = _$FruitGrandparentDisc; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FruitGrandparentDiscBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FruitGrandparentDiscSerializer(); +} + +extension FruitGrandparentDiscDiscriminatorExt on FruitGrandparentDisc { + String? get discriminatorValue { + if (this is AppleGrandparentDisc) { + return r'AppleGrandparentDisc'; + } + if (this is BananaGrandparentDisc) { + return r'BananaGrandparentDisc'; + } + return null; + } +} +extension FruitGrandparentDiscBuilderDiscriminatorExt on FruitGrandparentDiscBuilder { + String? get discriminatorValue { + if (this is AppleGrandparentDiscBuilder) { + return r'AppleGrandparentDisc'; + } + if (this is BananaGrandparentDiscBuilder) { + return r'BananaGrandparentDisc'; + } + return null; + } +} + +class _$FruitGrandparentDiscSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FruitGrandparentDisc, _$FruitGrandparentDisc]; + + @override + final String wireName = r'FruitGrandparentDisc'; + + Iterable _serializeProperties( + Serializers serializers, + FruitGrandparentDisc object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + } + + @override + Object serialize( + Serializers serializers, + FruitGrandparentDisc object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + } + + @override + FruitGrandparentDisc deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FruitGrandparentDiscBuilder(); + Object? oneOfDataSrc; + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(FruitGrandparentDisc.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + oneOfDataSrc = serialized; + final oneOfTypes = [AppleGrandparentDisc, BananaGrandparentDisc, ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'AppleGrandparentDisc': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(AppleGrandparentDisc), + ) as AppleGrandparentDisc; + oneOfType = AppleGrandparentDisc; + break; + case r'BananaGrandparentDisc': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(BananaGrandparentDisc), + ) as BananaGrandparentDisc; + oneOfType = BananaGrandparentDisc; + break; + default: + throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_disc.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_disc.dart new file mode 100644 index 000000000000..b7828faadc07 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_disc.dart @@ -0,0 +1,130 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_inline_disc_one_of.dart'; +import 'package:openapi/src/model/fruit_inline_disc_one_of1.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'fruit_inline_disc.g.dart'; + +/// FruitInlineDisc +/// +/// Properties: +/// * [seeds] +/// * [fruitType] +/// * [length] +@BuiltValue() +abstract class FruitInlineDisc implements Built { + /// One Of [FruitInlineDiscOneOf], [FruitInlineDiscOneOf1] + OneOf get oneOf; + + static const String discriminatorFieldName = r'fruitType'; + + static const Map discriminatorMapping = { + r'FruitInlineDisc_oneOf': FruitInlineDiscOneOf, + r'FruitInlineDisc_oneOf_1': FruitInlineDiscOneOf1, + }; + + FruitInlineDisc._(); + + factory FruitInlineDisc([void updates(FruitInlineDiscBuilder b)]) = _$FruitInlineDisc; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FruitInlineDiscBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FruitInlineDiscSerializer(); +} + +extension FruitInlineDiscDiscriminatorExt on FruitInlineDisc { + String? get discriminatorValue { + if (this is FruitInlineDiscOneOf) { + return r'FruitInlineDisc_oneOf'; + } + if (this is FruitInlineDiscOneOf1) { + return r'FruitInlineDisc_oneOf_1'; + } + return null; + } +} +extension FruitInlineDiscBuilderDiscriminatorExt on FruitInlineDiscBuilder { + String? get discriminatorValue { + if (this is FruitInlineDiscOneOfBuilder) { + return r'FruitInlineDisc_oneOf'; + } + if (this is FruitInlineDiscOneOf1Builder) { + return r'FruitInlineDisc_oneOf_1'; + } + return null; + } +} + +class _$FruitInlineDiscSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FruitInlineDisc, _$FruitInlineDisc]; + + @override + final String wireName = r'FruitInlineDisc'; + + Iterable _serializeProperties( + Serializers serializers, + FruitInlineDisc object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + } + + @override + Object serialize( + Serializers serializers, + FruitInlineDisc object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + } + + @override + FruitInlineDisc deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FruitInlineDiscBuilder(); + Object? oneOfDataSrc; + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(FruitInlineDisc.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + oneOfDataSrc = serialized; + final oneOfTypes = [FruitInlineDiscOneOf, FruitInlineDiscOneOf1, ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'FruitInlineDisc_oneOf': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(FruitInlineDiscOneOf), + ) as FruitInlineDiscOneOf; + oneOfType = FruitInlineDiscOneOf; + break; + case r'FruitInlineDisc_oneOf_1': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(FruitInlineDiscOneOf1), + ) as FruitInlineDiscOneOf1; + oneOfType = FruitInlineDiscOneOf1; + break; + default: + throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + return result.build(); + } +} + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_disc_one_of.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_disc_one_of.dart new file mode 100644 index 000000000000..f0260fccbd7d --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_disc_one_of.dart @@ -0,0 +1,124 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'fruit_inline_disc_one_of.g.dart'; + +/// FruitInlineDiscOneOf +/// +/// Properties: +/// * [seeds] +/// * [fruitType] +@BuiltValue() +abstract class FruitInlineDiscOneOf implements Built { + @BuiltValueField(wireName: r'seeds') + int get seeds; + + @BuiltValueField(wireName: r'fruitType') + String get fruitType; + + FruitInlineDiscOneOf._(); + + factory FruitInlineDiscOneOf([void updates(FruitInlineDiscOneOfBuilder b)]) = _$FruitInlineDiscOneOf; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FruitInlineDiscOneOfBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FruitInlineDiscOneOfSerializer(); +} + +class _$FruitInlineDiscOneOfSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FruitInlineDiscOneOf, _$FruitInlineDiscOneOf]; + + @override + final String wireName = r'FruitInlineDiscOneOf'; + + Iterable _serializeProperties( + Serializers serializers, + FruitInlineDiscOneOf object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'seeds'; + yield serializers.serialize( + object.seeds, + specifiedType: const FullType(int), + ); + yield r'fruitType'; + yield serializers.serialize( + object.fruitType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + FruitInlineDiscOneOf object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FruitInlineDiscOneOfBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'seeds': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.seeds = valueDes; + break; + case r'fruitType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.fruitType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FruitInlineDiscOneOf deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FruitInlineDiscOneOfBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_disc_one_of1.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_disc_one_of1.dart new file mode 100644 index 000000000000..fee7ad8da946 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_disc_one_of1.dart @@ -0,0 +1,124 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'fruit_inline_disc_one_of1.g.dart'; + +/// FruitInlineDiscOneOf1 +/// +/// Properties: +/// * [length] +/// * [fruitType] +@BuiltValue() +abstract class FruitInlineDiscOneOf1 implements Built { + @BuiltValueField(wireName: r'length') + int get length; + + @BuiltValueField(wireName: r'fruitType') + String get fruitType; + + FruitInlineDiscOneOf1._(); + + factory FruitInlineDiscOneOf1([void updates(FruitInlineDiscOneOf1Builder b)]) = _$FruitInlineDiscOneOf1; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FruitInlineDiscOneOf1Builder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FruitInlineDiscOneOf1Serializer(); +} + +class _$FruitInlineDiscOneOf1Serializer implements PrimitiveSerializer { + @override + final Iterable types = const [FruitInlineDiscOneOf1, _$FruitInlineDiscOneOf1]; + + @override + final String wireName = r'FruitInlineDiscOneOf1'; + + Iterable _serializeProperties( + Serializers serializers, + FruitInlineDiscOneOf1 object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'length'; + yield serializers.serialize( + object.length, + specifiedType: const FullType(int), + ); + yield r'fruitType'; + yield serializers.serialize( + object.fruitType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + FruitInlineDiscOneOf1 object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FruitInlineDiscOneOf1Builder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'length': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.length = valueDes; + break; + case r'fruitType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.fruitType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FruitInlineDiscOneOf1 deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FruitInlineDiscOneOf1Builder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_inline_disc.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_inline_disc.dart new file mode 100644 index 000000000000..2f12ea520928 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_inline_disc.dart @@ -0,0 +1,126 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_inline_inline_disc_one_of.dart'; +import 'package:openapi/src/model/fruit_inline_inline_disc_one_of1.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'fruit_inline_inline_disc.g.dart'; + +/// FruitInlineInlineDisc +/// +/// Properties: +/// * [fruitType] +@BuiltValue() +abstract class FruitInlineInlineDisc implements Built { + /// One Of [FruitInlineInlineDiscOneOf], [FruitInlineInlineDiscOneOf1] + OneOf get oneOf; + + static const String discriminatorFieldName = r'fruitType'; + + static const Map discriminatorMapping = { + r'FruitInlineInlineDisc_oneOf': FruitInlineInlineDiscOneOf, + r'FruitInlineInlineDisc_oneOf_1': FruitInlineInlineDiscOneOf1, + }; + + FruitInlineInlineDisc._(); + + factory FruitInlineInlineDisc([void updates(FruitInlineInlineDiscBuilder b)]) = _$FruitInlineInlineDisc; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FruitInlineInlineDiscBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FruitInlineInlineDiscSerializer(); +} + +extension FruitInlineInlineDiscDiscriminatorExt on FruitInlineInlineDisc { + String? get discriminatorValue { + if (this is FruitInlineInlineDiscOneOf) { + return r'FruitInlineInlineDisc_oneOf'; + } + if (this is FruitInlineInlineDiscOneOf1) { + return r'FruitInlineInlineDisc_oneOf_1'; + } + return null; + } +} +extension FruitInlineInlineDiscBuilderDiscriminatorExt on FruitInlineInlineDiscBuilder { + String? get discriminatorValue { + if (this is FruitInlineInlineDiscOneOfBuilder) { + return r'FruitInlineInlineDisc_oneOf'; + } + if (this is FruitInlineInlineDiscOneOf1Builder) { + return r'FruitInlineInlineDisc_oneOf_1'; + } + return null; + } +} + +class _$FruitInlineInlineDiscSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FruitInlineInlineDisc, _$FruitInlineInlineDisc]; + + @override + final String wireName = r'FruitInlineInlineDisc'; + + Iterable _serializeProperties( + Serializers serializers, + FruitInlineInlineDisc object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + } + + @override + Object serialize( + Serializers serializers, + FruitInlineInlineDisc object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + } + + @override + FruitInlineInlineDisc deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FruitInlineInlineDiscBuilder(); + Object? oneOfDataSrc; + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(FruitInlineInlineDisc.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + oneOfDataSrc = serialized; + final oneOfTypes = [FruitInlineInlineDiscOneOf, FruitInlineInlineDiscOneOf1, ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'FruitInlineInlineDisc_oneOf': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(FruitInlineInlineDiscOneOf), + ) as FruitInlineInlineDiscOneOf; + oneOfType = FruitInlineInlineDiscOneOf; + break; + case r'FruitInlineInlineDisc_oneOf_1': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(FruitInlineInlineDiscOneOf1), + ) as FruitInlineInlineDiscOneOf1; + oneOfType = FruitInlineInlineDiscOneOf1; + break; + default: + throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_inline_disc_one_of.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_inline_disc_one_of.dart new file mode 100644 index 000000000000..556c0b9e747c --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_inline_disc_one_of.dart @@ -0,0 +1,121 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_inline_inline_disc_one_of_one_of.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'fruit_inline_inline_disc_one_of.g.dart'; + +/// FruitInlineInlineDiscOneOf +/// +/// Properties: +/// * [seeds] +/// * [fruitType] +@BuiltValue() +abstract class FruitInlineInlineDiscOneOf implements Built { + @BuiltValueField(wireName: r'seeds') + int get seeds; + + /// One Of [FruitInlineInlineDiscOneOfOneOf] + OneOf get oneOf; + + FruitInlineInlineDiscOneOf._(); + + factory FruitInlineInlineDiscOneOf([void updates(FruitInlineInlineDiscOneOfBuilder b)]) = _$FruitInlineInlineDiscOneOf; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FruitInlineInlineDiscOneOfBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FruitInlineInlineDiscOneOfSerializer(); +} + +class _$FruitInlineInlineDiscOneOfSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FruitInlineInlineDiscOneOf, _$FruitInlineInlineDiscOneOf]; + + @override + final String wireName = r'FruitInlineInlineDiscOneOf'; + + Iterable _serializeProperties( + Serializers serializers, + FruitInlineInlineDiscOneOf object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'seeds'; + yield serializers.serialize( + object.seeds, + specifiedType: const FullType(int), + ); + } + + @override + Object serialize( + Serializers serializers, + FruitInlineInlineDiscOneOf object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + final result = _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + result.addAll(serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType)) as Iterable); + return result; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FruitInlineInlineDiscOneOfBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'seeds': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.seeds = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FruitInlineInlineDiscOneOf deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FruitInlineInlineDiscOneOfBuilder(); + Object? oneOfDataSrc; + final targetType = const FullType(OneOf, [FullType(FruitInlineInlineDiscOneOfOneOf), ]); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + oneOfDataSrc = unhandled; + result.oneOf = serializers.deserialize(oneOfDataSrc, specifiedType: targetType) as OneOf; + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_inline_disc_one_of1.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_inline_disc_one_of1.dart new file mode 100644 index 000000000000..5b82ccc5676b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_inline_disc_one_of1.dart @@ -0,0 +1,121 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_inline_inline_disc_one_of_one_of.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'fruit_inline_inline_disc_one_of1.g.dart'; + +/// FruitInlineInlineDiscOneOf1 +/// +/// Properties: +/// * [length] +/// * [fruitType] +@BuiltValue() +abstract class FruitInlineInlineDiscOneOf1 implements Built { + @BuiltValueField(wireName: r'length') + int get length; + + /// One Of [FruitInlineInlineDiscOneOfOneOf] + OneOf get oneOf; + + FruitInlineInlineDiscOneOf1._(); + + factory FruitInlineInlineDiscOneOf1([void updates(FruitInlineInlineDiscOneOf1Builder b)]) = _$FruitInlineInlineDiscOneOf1; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FruitInlineInlineDiscOneOf1Builder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FruitInlineInlineDiscOneOf1Serializer(); +} + +class _$FruitInlineInlineDiscOneOf1Serializer implements PrimitiveSerializer { + @override + final Iterable types = const [FruitInlineInlineDiscOneOf1, _$FruitInlineInlineDiscOneOf1]; + + @override + final String wireName = r'FruitInlineInlineDiscOneOf1'; + + Iterable _serializeProperties( + Serializers serializers, + FruitInlineInlineDiscOneOf1 object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'length'; + yield serializers.serialize( + object.length, + specifiedType: const FullType(int), + ); + } + + @override + Object serialize( + Serializers serializers, + FruitInlineInlineDiscOneOf1 object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + final result = _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + result.addAll(serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType)) as Iterable); + return result; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FruitInlineInlineDiscOneOf1Builder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'length': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.length = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FruitInlineInlineDiscOneOf1 deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FruitInlineInlineDiscOneOf1Builder(); + Object? oneOfDataSrc; + final targetType = const FullType(OneOf, [FullType(FruitInlineInlineDiscOneOfOneOf), ]); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + oneOfDataSrc = unhandled; + result.oneOf = serializers.deserialize(oneOfDataSrc, specifiedType: targetType) as OneOf; + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_inline_disc_one_of_one_of.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_inline_disc_one_of_one_of.dart new file mode 100644 index 000000000000..e5b074034ee1 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_inline_inline_disc_one_of_one_of.dart @@ -0,0 +1,107 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'fruit_inline_inline_disc_one_of_one_of.g.dart'; + +/// FruitInlineInlineDiscOneOfOneOf +/// +/// Properties: +/// * [fruitType] +@BuiltValue() +abstract class FruitInlineInlineDiscOneOfOneOf implements Built { + @BuiltValueField(wireName: r'fruitType') + String get fruitType; + + FruitInlineInlineDiscOneOfOneOf._(); + + factory FruitInlineInlineDiscOneOfOneOf([void updates(FruitInlineInlineDiscOneOfOneOfBuilder b)]) = _$FruitInlineInlineDiscOneOfOneOf; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FruitInlineInlineDiscOneOfOneOfBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FruitInlineInlineDiscOneOfOneOfSerializer(); +} + +class _$FruitInlineInlineDiscOneOfOneOfSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FruitInlineInlineDiscOneOfOneOf, _$FruitInlineInlineDiscOneOfOneOf]; + + @override + final String wireName = r'FruitInlineInlineDiscOneOfOneOf'; + + Iterable _serializeProperties( + Serializers serializers, + FruitInlineInlineDiscOneOfOneOf object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'fruitType'; + yield serializers.serialize( + object.fruitType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + FruitInlineInlineDiscOneOfOneOf object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FruitInlineInlineDiscOneOfOneOfBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'fruitType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.fruitType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FruitInlineInlineDiscOneOfOneOf deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FruitInlineInlineDiscOneOfOneOfBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_one_of_disc.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_one_of_disc.dart new file mode 100644 index 000000000000..38bb339f0ba7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_one_of_disc.dart @@ -0,0 +1,126 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/banana_one_of_disc.dart'; +import 'package:openapi/src/model/apple_one_of_disc.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'fruit_one_of_disc.g.dart'; + +/// FruitOneOfDisc +/// +/// Properties: +/// * [fruitType] +@BuiltValue() +abstract class FruitOneOfDisc implements Built { + /// One Of [AppleOneOfDisc], [BananaOneOfDisc] + OneOf get oneOf; + + static const String discriminatorFieldName = r'fruitType'; + + static const Map discriminatorMapping = { + r'AppleOneOfDisc': AppleOneOfDisc, + r'BananaOneOfDisc': BananaOneOfDisc, + }; + + FruitOneOfDisc._(); + + factory FruitOneOfDisc([void updates(FruitOneOfDiscBuilder b)]) = _$FruitOneOfDisc; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FruitOneOfDiscBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FruitOneOfDiscSerializer(); +} + +extension FruitOneOfDiscDiscriminatorExt on FruitOneOfDisc { + String? get discriminatorValue { + if (this is AppleOneOfDisc) { + return r'AppleOneOfDisc'; + } + if (this is BananaOneOfDisc) { + return r'BananaOneOfDisc'; + } + return null; + } +} +extension FruitOneOfDiscBuilderDiscriminatorExt on FruitOneOfDiscBuilder { + String? get discriminatorValue { + if (this is AppleOneOfDiscBuilder) { + return r'AppleOneOfDisc'; + } + if (this is BananaOneOfDiscBuilder) { + return r'BananaOneOfDisc'; + } + return null; + } +} + +class _$FruitOneOfDiscSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FruitOneOfDisc, _$FruitOneOfDisc]; + + @override + final String wireName = r'FruitOneOfDisc'; + + Iterable _serializeProperties( + Serializers serializers, + FruitOneOfDisc object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + } + + @override + Object serialize( + Serializers serializers, + FruitOneOfDisc object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + } + + @override + FruitOneOfDisc deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FruitOneOfDiscBuilder(); + Object? oneOfDataSrc; + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(FruitOneOfDisc.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + oneOfDataSrc = serialized; + final oneOfTypes = [AppleOneOfDisc, BananaOneOfDisc, ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'AppleOneOfDisc': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(AppleOneOfDisc), + ) as AppleOneOfDisc; + oneOfType = AppleOneOfDisc; + break; + case r'BananaOneOfDisc': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(BananaOneOfDisc), + ) as BananaOneOfDisc; + oneOfType = BananaOneOfDisc; + break; + default: + throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_req_disc.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_req_disc.dart new file mode 100644 index 000000000000..2aaf0bda91c6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_req_disc.dart @@ -0,0 +1,130 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/banana_req_disc.dart'; +import 'package:openapi/src/model/apple_req_disc.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'fruit_req_disc.g.dart'; + +/// FruitReqDisc +/// +/// Properties: +/// * [seeds] +/// * [fruitType] +/// * [length] +@BuiltValue() +abstract class FruitReqDisc implements Built { + /// One Of [AppleReqDisc], [BananaReqDisc] + OneOf get oneOf; + + static const String discriminatorFieldName = r'fruitType'; + + static const Map discriminatorMapping = { + r'AppleReqDisc': AppleReqDisc, + r'BananaReqDisc': BananaReqDisc, + }; + + FruitReqDisc._(); + + factory FruitReqDisc([void updates(FruitReqDiscBuilder b)]) = _$FruitReqDisc; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FruitReqDiscBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FruitReqDiscSerializer(); +} + +extension FruitReqDiscDiscriminatorExt on FruitReqDisc { + String? get discriminatorValue { + if (this is AppleReqDisc) { + return r'AppleReqDisc'; + } + if (this is BananaReqDisc) { + return r'BananaReqDisc'; + } + return null; + } +} +extension FruitReqDiscBuilderDiscriminatorExt on FruitReqDiscBuilder { + String? get discriminatorValue { + if (this is AppleReqDiscBuilder) { + return r'AppleReqDisc'; + } + if (this is BananaReqDiscBuilder) { + return r'BananaReqDisc'; + } + return null; + } +} + +class _$FruitReqDiscSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FruitReqDisc, _$FruitReqDisc]; + + @override + final String wireName = r'FruitReqDisc'; + + Iterable _serializeProperties( + Serializers serializers, + FruitReqDisc object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + } + + @override + Object serialize( + Serializers serializers, + FruitReqDisc object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + } + + @override + FruitReqDisc deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FruitReqDiscBuilder(); + Object? oneOfDataSrc; + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(FruitReqDisc.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + oneOfDataSrc = serialized; + final oneOfTypes = [AppleReqDisc, BananaReqDisc, ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'AppleReqDisc': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(AppleReqDisc), + ) as AppleReqDisc; + oneOfType = AppleReqDisc; + break; + case r'BananaReqDisc': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(BananaReqDisc), + ) as BananaReqDisc; + oneOfType = BananaReqDisc; + break; + default: + throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + return result.build(); + } +} + + + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/cat_all_of.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_type.dart similarity index 60% rename from samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/cat_all_of.dart rename to samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_type.dart index 02d9cce0cae1..5240009b81f0 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/cat_all_of.dart +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_type.dart @@ -6,89 +6,87 @@ import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; -part 'cat_all_of.g.dart'; +part 'fruit_type.g.dart'; -/// CatAllOf +/// FruitType /// /// Properties: -/// * [declawed] +/// * [fruitType] @BuiltValue(instantiable: false) -abstract class CatAllOf { - @BuiltValueField(wireName: r'declawed') - bool? get declawed; +abstract class FruitType { + @BuiltValueField(wireName: r'fruitType') + String get fruitType; @BuiltValueSerializer(custom: true) - static Serializer get serializer => _$CatAllOfSerializer(); + static Serializer get serializer => _$FruitTypeSerializer(); } -class _$CatAllOfSerializer implements PrimitiveSerializer { +class _$FruitTypeSerializer implements PrimitiveSerializer { @override - final Iterable types = const [CatAllOf]; + final Iterable types = const [FruitType]; @override - final String wireName = r'CatAllOf'; + final String wireName = r'FruitType'; Iterable _serializeProperties( Serializers serializers, - CatAllOf object, { + FruitType object, { FullType specifiedType = FullType.unspecified, }) sync* { - if (object.declawed != null) { - yield r'declawed'; - yield serializers.serialize( - object.declawed, - specifiedType: const FullType(bool), - ); - } + yield r'fruitType'; + yield serializers.serialize( + object.fruitType, + specifiedType: const FullType(String), + ); } @override Object serialize( Serializers serializers, - CatAllOf object, { + FruitType object, { FullType specifiedType = FullType.unspecified, }) { return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); } @override - CatAllOf deserialize( + FruitType deserialize( Serializers serializers, Object serialized, { FullType specifiedType = FullType.unspecified, }) { - return serializers.deserialize(serialized, specifiedType: FullType($CatAllOf)) as $CatAllOf; + return serializers.deserialize(serialized, specifiedType: FullType($FruitType)) as $FruitType; } } -/// a concrete implementation of [CatAllOf], since [CatAllOf] is not instantiable +/// a concrete implementation of [FruitType], since [FruitType] is not instantiable @BuiltValue(instantiable: true) -abstract class $CatAllOf implements CatAllOf, Built<$CatAllOf, $CatAllOfBuilder> { - $CatAllOf._(); +abstract class $FruitType implements FruitType, Built<$FruitType, $FruitTypeBuilder> { + $FruitType._(); - factory $CatAllOf([void Function($CatAllOfBuilder)? updates]) = _$$CatAllOf; + factory $FruitType([void Function($FruitTypeBuilder)? updates]) = _$$FruitType; @BuiltValueHook(initializeBuilder: true) - static void _defaults($CatAllOfBuilder b) => b; + static void _defaults($FruitTypeBuilder b) => b; @BuiltValueSerializer(custom: true) - static Serializer<$CatAllOf> get serializer => _$$CatAllOfSerializer(); + static Serializer<$FruitType> get serializer => _$$FruitTypeSerializer(); } -class _$$CatAllOfSerializer implements PrimitiveSerializer<$CatAllOf> { +class _$$FruitTypeSerializer implements PrimitiveSerializer<$FruitType> { @override - final Iterable types = const [$CatAllOf, _$$CatAllOf]; + final Iterable types = const [$FruitType, _$$FruitType]; @override - final String wireName = r'$CatAllOf'; + final String wireName = r'$FruitType'; @override Object serialize( Serializers serializers, - $CatAllOf object, { + $FruitType object, { FullType specifiedType = FullType.unspecified, }) { - return serializers.serialize(object, specifiedType: FullType(CatAllOf))!; + return serializers.serialize(object, specifiedType: FullType(FruitType))!; } void _deserializeProperties( @@ -96,19 +94,19 @@ class _$$CatAllOfSerializer implements PrimitiveSerializer<$CatAllOf> { Object serialized, { FullType specifiedType = FullType.unspecified, required List serializedList, - required CatAllOfBuilder result, + required FruitTypeBuilder result, required List unhandled, }) { for (var i = 0; i < serializedList.length; i += 2) { final key = serializedList[i] as String; final value = serializedList[i + 1]; switch (key) { - case r'declawed': + case r'fruitType': final valueDes = serializers.deserialize( value, - specifiedType: const FullType(bool), - ) as bool; - result.declawed = valueDes; + specifiedType: const FullType(String), + ) as String; + result.fruitType = valueDes; break; default: unhandled.add(key); @@ -119,12 +117,12 @@ class _$$CatAllOfSerializer implements PrimitiveSerializer<$CatAllOf> { } @override - $CatAllOf deserialize( + $FruitType deserialize( Serializers serializers, Object serialized, { FullType specifiedType = FullType.unspecified, }) { - final result = $CatAllOfBuilder(); + final result = $FruitTypeBuilder(); final serializedList = (serialized as Iterable).toList(); final unhandled = []; _deserializeProperties( @@ -138,4 +136,5 @@ class _$$CatAllOfSerializer implements PrimitiveSerializer<$CatAllOf> { return result.build(); } } + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_variant1.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_variant1.dart new file mode 100644 index 000000000000..a5058096b386 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/fruit_variant1.dart @@ -0,0 +1,125 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/apple_variant1.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/grape_variant1.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'fruit_variant1.g.dart'; + +/// FruitVariant1 +/// +/// Properties: +/// * [color] +/// * [kind] +@BuiltValue() +abstract class FruitVariant1 implements Built { + @BuiltValueField(wireName: r'color') + String? get color; + + /// One Of [AppleVariant1], [BuiltList] + OneOf get oneOf; + + FruitVariant1._(); + + factory FruitVariant1([void updates(FruitVariant1Builder b)]) = _$FruitVariant1; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FruitVariant1Builder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FruitVariant1Serializer(); +} + +class _$FruitVariant1Serializer implements PrimitiveSerializer { + @override + final Iterable types = const [FruitVariant1, _$FruitVariant1]; + + @override + final String wireName = r'FruitVariant1'; + + Iterable _serializeProperties( + Serializers serializers, + FruitVariant1 object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.color != null) { + yield r'color'; + yield serializers.serialize( + object.color, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + FruitVariant1 object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + final result = _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + result.addAll(serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType)) as Iterable); + return result; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FruitVariant1Builder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'color': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.color = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FruitVariant1 deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FruitVariant1Builder(); + Object? oneOfDataSrc; + final targetType = const FullType(OneOf, [FullType(AppleVariant1), FullType(BuiltList, [FullType(GrapeVariant1)]), ]); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + oneOfDataSrc = unhandled; + result.oneOf = serializers.deserialize(oneOfDataSrc, specifiedType: targetType) as OneOf; + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/giga_one_of.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/giga_one_of.dart new file mode 100644 index 000000000000..87ba38ca7c29 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/giga_one_of.dart @@ -0,0 +1,73 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/one_of_primitive_child.dart'; +import 'dart:core'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'giga_one_of.g.dart'; + +/// GigaOneOf +/// +/// Properties: +/// * [name] +@BuiltValue() +abstract class GigaOneOf implements Built { + /// One Of [DateTime], [OneOfPrimitiveChild], [String], [int], [num] + OneOf get oneOf; + + GigaOneOf._(); + + factory GigaOneOf([void updates(GigaOneOfBuilder b)]) = _$GigaOneOf; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(GigaOneOfBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$GigaOneOfSerializer(); +} + +class _$GigaOneOfSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [GigaOneOf, _$GigaOneOf]; + + @override + final String wireName = r'GigaOneOf'; + + Iterable _serializeProperties( + Serializers serializers, + GigaOneOf object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + } + + @override + Object serialize( + Serializers serializers, + GigaOneOf object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + } + + @override + GigaOneOf deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = GigaOneOfBuilder(); + Object? oneOfDataSrc; + final targetType = const FullType(OneOf, [FullType(String), FullType(DateTime), FullType(int), FullType(num), FullType(OneOfPrimitiveChild), FullType(int), ]); + oneOfDataSrc = serialized; + result.oneOf = serializers.deserialize(oneOfDataSrc, specifiedType: targetType) as OneOf; + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/grape_variant1.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/grape_variant1.dart new file mode 100644 index 000000000000..e75a73572bc8 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/grape_variant1.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'grape_variant1.g.dart'; + +/// GrapeVariant1 +/// +/// Properties: +/// * [color] +@BuiltValue() +abstract class GrapeVariant1 implements Built { + @BuiltValueField(wireName: r'color') + String? get color; + + GrapeVariant1._(); + + factory GrapeVariant1([void updates(GrapeVariant1Builder b)]) = _$GrapeVariant1; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(GrapeVariant1Builder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$GrapeVariant1Serializer(); +} + +class _$GrapeVariant1Serializer implements PrimitiveSerializer { + @override + final Iterable types = const [GrapeVariant1, _$GrapeVariant1]; + + @override + final String wireName = r'GrapeVariant1'; + + Iterable _serializeProperties( + Serializers serializers, + GrapeVariant1 object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.color != null) { + yield r'color'; + yield serializers.serialize( + object.color, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + GrapeVariant1 object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required GrapeVariant1Builder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'color': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.color = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + GrapeVariant1 deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = GrapeVariant1Builder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/has_only_read_only.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/has_only_read_only.dart new file mode 100644 index 000000000000..c0b5d927bf78 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/has_only_read_only.dart @@ -0,0 +1,128 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'has_only_read_only.g.dart'; + +/// HasOnlyReadOnly +/// +/// Properties: +/// * [bar] +/// * [foo] +@BuiltValue() +abstract class HasOnlyReadOnly implements Built { + @BuiltValueField(wireName: r'bar') + String? get bar; + + @BuiltValueField(wireName: r'foo') + String? get foo; + + HasOnlyReadOnly._(); + + factory HasOnlyReadOnly([void updates(HasOnlyReadOnlyBuilder b)]) = _$HasOnlyReadOnly; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(HasOnlyReadOnlyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$HasOnlyReadOnlySerializer(); +} + +class _$HasOnlyReadOnlySerializer implements PrimitiveSerializer { + @override + final Iterable types = const [HasOnlyReadOnly, _$HasOnlyReadOnly]; + + @override + final String wireName = r'HasOnlyReadOnly'; + + Iterable _serializeProperties( + Serializers serializers, + HasOnlyReadOnly object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.bar != null) { + yield r'bar'; + yield serializers.serialize( + object.bar, + specifiedType: const FullType(String), + ); + } + if (object.foo != null) { + yield r'foo'; + yield serializers.serialize( + object.foo, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + HasOnlyReadOnly object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required HasOnlyReadOnlyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'bar': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.bar = valueDes; + break; + case r'foo': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.foo = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + HasOnlyReadOnly deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = HasOnlyReadOnlyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/health_check_result.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/health_check_result.dart new file mode 100644 index 000000000000..0b21191e2416 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/health_check_result.dart @@ -0,0 +1,110 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'health_check_result.g.dart'; + +/// Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. +/// +/// Properties: +/// * [nullableMessage] +@BuiltValue() +abstract class HealthCheckResult implements Built { + @BuiltValueField(wireName: r'NullableMessage') + String? get nullableMessage; + + HealthCheckResult._(); + + factory HealthCheckResult([void updates(HealthCheckResultBuilder b)]) = _$HealthCheckResult; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(HealthCheckResultBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$HealthCheckResultSerializer(); +} + +class _$HealthCheckResultSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [HealthCheckResult, _$HealthCheckResult]; + + @override + final String wireName = r'HealthCheckResult'; + + Iterable _serializeProperties( + Serializers serializers, + HealthCheckResult object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.nullableMessage != null) { + yield r'NullableMessage'; + yield serializers.serialize( + object.nullableMessage, + specifiedType: const FullType.nullable(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + HealthCheckResult object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required HealthCheckResultBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'NullableMessage': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(String), + ) as String?; + if (valueDes == null) continue; + result.nullableMessage = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + HealthCheckResult deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = HealthCheckResultBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/map_test.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/map_test.dart new file mode 100644 index 000000000000..307b5df2a205 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/map_test.dart @@ -0,0 +1,185 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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'; + +/// MapTest +/// +/// Properties: +/// * [mapMapOfString] +/// * [mapOfEnumString] +/// * [directMap] +/// * [indirectMap] +@BuiltValue() +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._(); + + factory MapTest([void updates(MapTestBuilder b)]) = _$MapTest; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(MapTestBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$MapTestSerializer(); +} + +class _$MapTestSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [MapTest, _$MapTest]; + + @override + final String wireName = r'MapTest'; + + Iterable _serializeProperties( + Serializers serializers, + MapTest object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.mapMapOfString != null) { + yield r'map_map_of_string'; + yield serializers.serialize( + object.mapMapOfString, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(BuiltMap, [FullType(String), FullType(String)])]), + ); + } + if (object.mapOfEnumString != null) { + yield r'map_of_enum_string'; + yield serializers.serialize( + object.mapOfEnumString, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(MapTestMapOfEnumStringEnum)]), + ); + } + if (object.directMap != null) { + yield r'direct_map'; + yield serializers.serialize( + object.directMap, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(bool)]), + ); + } + if (object.indirectMap != null) { + yield r'indirect_map'; + yield serializers.serialize( + object.indirectMap, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(bool)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + MapTest object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required MapTestBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'map_map_of_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(BuiltMap, [FullType(String), FullType(String)])]), + ) as BuiltMap>; + result.mapMapOfString.replace(valueDes); + break; + case r'map_of_enum_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(MapTestMapOfEnumStringEnum)]), + ) as BuiltMap; + result.mapOfEnumString.replace(valueDes); + break; + case r'direct_map': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(bool)]), + ) as BuiltMap; + result.directMap.replace(valueDes); + break; + case r'indirect_map': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(bool)]), + ) as BuiltMap; + result.indirectMap.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + MapTest deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = MapTestBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + 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; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const MapTestMapOfEnumStringEnum unknownDefaultOpenApi = _$mapTestMapOfEnumStringEnum_unknownDefaultOpenApi; + + 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/client/echo_api/dart/dio/built_value/lib/src/model/mixed_properties_and_additional_properties_class.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/mixed_properties_and_additional_properties_class.dart new file mode 100644 index 000000000000..031907774ea1 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/mixed_properties_and_additional_properties_class.dart @@ -0,0 +1,149 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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'; + +/// MixedPropertiesAndAdditionalPropertiesClass +/// +/// Properties: +/// * [uuid] +/// * [dateTime] +/// * [map] +@BuiltValue() +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._(); + + factory MixedPropertiesAndAdditionalPropertiesClass([void updates(MixedPropertiesAndAdditionalPropertiesClassBuilder b)]) = _$MixedPropertiesAndAdditionalPropertiesClass; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(MixedPropertiesAndAdditionalPropertiesClassBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$MixedPropertiesAndAdditionalPropertiesClassSerializer(); +} + +class _$MixedPropertiesAndAdditionalPropertiesClassSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [MixedPropertiesAndAdditionalPropertiesClass, _$MixedPropertiesAndAdditionalPropertiesClass]; + + @override + final String wireName = r'MixedPropertiesAndAdditionalPropertiesClass'; + + Iterable _serializeProperties( + Serializers serializers, + MixedPropertiesAndAdditionalPropertiesClass object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.uuid != null) { + yield r'uuid'; + yield serializers.serialize( + object.uuid, + specifiedType: const FullType(String), + ); + } + if (object.dateTime != null) { + yield r'dateTime'; + yield serializers.serialize( + object.dateTime, + specifiedType: const FullType(DateTime), + ); + } + if (object.map != null) { + yield r'map'; + yield serializers.serialize( + object.map, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(Animal)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + MixedPropertiesAndAdditionalPropertiesClass object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required MixedPropertiesAndAdditionalPropertiesClassBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'uuid': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.uuid = valueDes; + break; + case r'dateTime': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(DateTime), + ) as DateTime; + result.dateTime = valueDes; + break; + case r'map': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(Animal)]), + ) as BuiltMap; + result.map.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + MixedPropertiesAndAdditionalPropertiesClass deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = MixedPropertiesAndAdditionalPropertiesClassBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/model200_response.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/model200_response.dart new file mode 100644 index 000000000000..2dd4b3eb6de7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/model200_response.dart @@ -0,0 +1,128 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model200_response.g.dart'; + +/// Model for testing model name starting with number +/// +/// Properties: +/// * [name] +/// * [classField] +@BuiltValue() +abstract class Model200Response implements Built { + @BuiltValueField(wireName: r'name') + int? get name; + + @BuiltValueField(wireName: r'class') + String? get classField; + + Model200Response._(); + + factory Model200Response([void updates(Model200ResponseBuilder b)]) = _$Model200Response; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(Model200ResponseBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$Model200ResponseSerializer(); +} + +class _$Model200ResponseSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Model200Response, _$Model200Response]; + + @override + final String wireName = r'Model200Response'; + + Iterable _serializeProperties( + Serializers serializers, + Model200Response object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(int), + ); + } + if (object.classField != null) { + yield r'class'; + yield serializers.serialize( + object.classField, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Model200Response object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required Model200ResponseBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.name = valueDes; + break; + case r'class': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.classField = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Model200Response deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = Model200ResponseBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/model_client.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/model_client.dart new file mode 100644 index 000000000000..d8bde0d4efc7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/model_client.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_client.g.dart'; + +/// ModelClient +/// +/// Properties: +/// * [client] +@BuiltValue() +abstract class ModelClient implements Built { + @BuiltValueField(wireName: r'client') + String? get client; + + ModelClient._(); + + factory ModelClient([void updates(ModelClientBuilder b)]) = _$ModelClient; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ModelClientBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelClientSerializer(); +} + +class _$ModelClientSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ModelClient, _$ModelClient]; + + @override + final String wireName = r'ModelClient'; + + Iterable _serializeProperties( + Serializers serializers, + ModelClient object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.client != null) { + yield r'client'; + yield serializers.serialize( + object.client, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ModelClient object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ModelClientBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'client': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.client = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ModelClient deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ModelClientBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/model_enum_class.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/model_enum_class.dart new file mode 100644 index 000000000000..b5aa8fa6450f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/model_enum_class.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const ModelEnumClass unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + 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. +typedef ModelEnumClassMixin = _$ModelEnumClassMixin; + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/model_file.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/model_file.dart new file mode 100644 index 000000000000..bd481392e48e --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/model_file.dart @@ -0,0 +1,110 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_file.g.dart'; + +/// Must be named `File` for test. +/// +/// Properties: +/// * [sourceURI] - Test capitalization +@BuiltValue() +abstract class ModelFile implements Built { + /// Test capitalization + @BuiltValueField(wireName: r'sourceURI') + String? get sourceURI; + + ModelFile._(); + + factory ModelFile([void updates(ModelFileBuilder b)]) = _$ModelFile; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ModelFileBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelFileSerializer(); +} + +class _$ModelFileSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ModelFile, _$ModelFile]; + + @override + final String wireName = r'ModelFile'; + + Iterable _serializeProperties( + Serializers serializers, + ModelFile object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.sourceURI != null) { + yield r'sourceURI'; + yield serializers.serialize( + object.sourceURI, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ModelFile object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ModelFileBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'sourceURI': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.sourceURI = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ModelFile deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ModelFileBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/model_list.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/model_list.dart new file mode 100644 index 000000000000..e412aa5570e4 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/model_list.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_list.g.dart'; + +/// ModelList +/// +/// Properties: +/// * [n123list] +@BuiltValue() +abstract class ModelList implements Built { + @BuiltValueField(wireName: r'123-list') + String? get n123list; + + ModelList._(); + + factory ModelList([void updates(ModelListBuilder b)]) = _$ModelList; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ModelListBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelListSerializer(); +} + +class _$ModelListSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ModelList, _$ModelList]; + + @override + final String wireName = r'ModelList'; + + Iterable _serializeProperties( + Serializers serializers, + ModelList object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.n123list != null) { + yield r'123-list'; + yield serializers.serialize( + object.n123list, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ModelList object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ModelListBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'123-list': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.n123list = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ModelList deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ModelListBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/model_return.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/model_return.dart new file mode 100644 index 000000000000..8ef153e32ec5 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/model_return.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_return.g.dart'; + +/// Model for testing reserved words +/// +/// Properties: +/// * [return_] +@BuiltValue() +abstract class ModelReturn implements Built { + @BuiltValueField(wireName: r'return') + int? get return_; + + ModelReturn._(); + + factory ModelReturn([void updates(ModelReturnBuilder b)]) = _$ModelReturn; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ModelReturnBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelReturnSerializer(); +} + +class _$ModelReturnSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ModelReturn, _$ModelReturn]; + + @override + final String wireName = r'ModelReturn'; + + Iterable _serializeProperties( + Serializers serializers, + ModelReturn object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.return_ != null) { + yield r'return'; + yield serializers.serialize( + object.return_, + specifiedType: const FullType(int), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ModelReturn object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ModelReturnBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'return': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.return_ = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ModelReturn deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ModelReturnBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/name.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/name.dart new file mode 100644 index 000000000000..b17971910f2b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/name.dart @@ -0,0 +1,164 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'name.g.dart'; + +/// Model for testing model name same as property name +/// +/// Properties: +/// * [name] +/// * [snakeCase] +/// * [property] +/// * [n123number] +@BuiltValue() +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._(); + + factory Name([void updates(NameBuilder b)]) = _$Name; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(NameBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$NameSerializer(); +} + +class _$NameSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Name, _$Name]; + + @override + final String wireName = r'Name'; + + Iterable _serializeProperties( + Serializers serializers, + Name object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(int), + ); + if (object.snakeCase != null) { + yield r'snake_case'; + yield serializers.serialize( + object.snakeCase, + specifiedType: const FullType(int), + ); + } + if (object.property != null) { + yield r'property'; + yield serializers.serialize( + object.property, + specifiedType: const FullType(String), + ); + } + if (object.n123number != null) { + yield r'123Number'; + yield serializers.serialize( + object.n123number, + specifiedType: const FullType(int), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Name object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required NameBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.name = valueDes; + break; + case r'snake_case': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.snakeCase = valueDes; + break; + case r'property': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.property = valueDes; + break; + case r'123Number': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.n123number = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Name deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = NameBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/nullable_class.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/nullable_class.dart new file mode 100644 index 000000000000..a92dbd749da4 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/nullable_class.dart @@ -0,0 +1,331 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/date.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'; + +/// NullableClass +/// +/// Properties: +/// * [integerProp] +/// * [numberProp] +/// * [booleanProp] +/// * [stringProp] +/// * [dateProp] +/// * [datetimeProp] +/// * [arrayNullableProp] +/// * [arrayAndItemsNullableProp] +/// * [arrayItemsNullable] +/// * [objectNullableProp] +/// * [objectAndItemsNullableProp] +/// * [objectItemsNullable] +@BuiltValue() +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') + Date? 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._(); + + factory NullableClass([void updates(NullableClassBuilder b)]) = _$NullableClass; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(NullableClassBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$NullableClassSerializer(); +} + +class _$NullableClassSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [NullableClass, _$NullableClass]; + + @override + final String wireName = r'NullableClass'; + + Iterable _serializeProperties( + Serializers serializers, + NullableClass object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.integerProp != null) { + yield r'integer_prop'; + yield serializers.serialize( + object.integerProp, + specifiedType: const FullType.nullable(int), + ); + } + if (object.numberProp != null) { + yield r'number_prop'; + yield serializers.serialize( + object.numberProp, + specifiedType: const FullType.nullable(num), + ); + } + if (object.booleanProp != null) { + yield r'boolean_prop'; + yield serializers.serialize( + object.booleanProp, + specifiedType: const FullType.nullable(bool), + ); + } + if (object.stringProp != null) { + yield r'string_prop'; + yield serializers.serialize( + object.stringProp, + specifiedType: const FullType.nullable(String), + ); + } + if (object.dateProp != null) { + yield r'date_prop'; + yield serializers.serialize( + object.dateProp, + specifiedType: const FullType.nullable(Date), + ); + } + if (object.datetimeProp != null) { + yield r'datetime_prop'; + yield serializers.serialize( + object.datetimeProp, + specifiedType: const FullType.nullable(DateTime), + ); + } + if (object.arrayNullableProp != null) { + yield r'array_nullable_prop'; + yield serializers.serialize( + object.arrayNullableProp, + specifiedType: const FullType.nullable(BuiltList, [FullType(JsonObject)]), + ); + } + if (object.arrayAndItemsNullableProp != null) { + yield r'array_and_items_nullable_prop'; + yield serializers.serialize( + object.arrayAndItemsNullableProp, + specifiedType: const FullType.nullable(BuiltList, [FullType.nullable(JsonObject)]), + ); + } + if (object.arrayItemsNullable != null) { + yield r'array_items_nullable'; + yield serializers.serialize( + object.arrayItemsNullable, + specifiedType: const FullType(BuiltList, [FullType.nullable(JsonObject)]), + ); + } + if (object.objectNullableProp != null) { + yield r'object_nullable_prop'; + yield serializers.serialize( + object.objectNullableProp, + specifiedType: const FullType.nullable(BuiltMap, [FullType(String), FullType(JsonObject)]), + ); + } + if (object.objectAndItemsNullableProp != null) { + yield r'object_and_items_nullable_prop'; + yield serializers.serialize( + object.objectAndItemsNullableProp, + specifiedType: const FullType.nullable(BuiltMap, [FullType(String), FullType.nullable(JsonObject)]), + ); + } + if (object.objectItemsNullable != null) { + yield r'object_items_nullable'; + yield serializers.serialize( + object.objectItemsNullable, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType.nullable(JsonObject)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + NullableClass object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required NullableClassBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'integer_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(int), + ) as int?; + if (valueDes == null) continue; + result.integerProp = valueDes; + break; + case r'number_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(num), + ) as num?; + if (valueDes == null) continue; + result.numberProp = valueDes; + break; + case r'boolean_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(bool), + ) as bool?; + if (valueDes == null) continue; + result.booleanProp = valueDes; + break; + case r'string_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(String), + ) as String?; + if (valueDes == null) continue; + result.stringProp = valueDes; + break; + case r'date_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(Date), + ) as Date?; + if (valueDes == null) continue; + result.dateProp = valueDes; + break; + case r'datetime_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(DateTime), + ) as DateTime?; + if (valueDes == null) continue; + result.datetimeProp = valueDes; + break; + case r'array_nullable_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(BuiltList, [FullType(JsonObject)]), + ) as BuiltList?; + if (valueDes == null) continue; + result.arrayNullableProp.replace(valueDes); + break; + case r'array_and_items_nullable_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(BuiltList, [FullType.nullable(JsonObject)]), + ) as BuiltList?; + if (valueDes == null) continue; + result.arrayAndItemsNullableProp.replace(valueDes); + break; + case r'array_items_nullable': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType.nullable(JsonObject)]), + ) as BuiltList; + result.arrayItemsNullable.replace(valueDes); + break; + case r'object_nullable_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(BuiltMap, [FullType(String), FullType(JsonObject)]), + ) as BuiltMap?; + if (valueDes == null) continue; + result.objectNullableProp.replace(valueDes); + break; + case r'object_and_items_nullable_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(BuiltMap, [FullType(String), FullType.nullable(JsonObject)]), + ) as BuiltMap?; + if (valueDes == null) continue; + result.objectAndItemsNullableProp.replace(valueDes); + break; + case r'object_items_nullable': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType.nullable(JsonObject)]), + ) as BuiltMap; + result.objectItemsNullable.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + NullableClass deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = NullableClassBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + + + + + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/number_only.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/number_only.dart new file mode 100644 index 000000000000..c1f2ba2a2a95 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/number_only.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'number_only.g.dart'; + +/// NumberOnly +/// +/// Properties: +/// * [justNumber] +@BuiltValue() +abstract class NumberOnly implements Built { + @BuiltValueField(wireName: r'JustNumber') + num? get justNumber; + + NumberOnly._(); + + factory NumberOnly([void updates(NumberOnlyBuilder b)]) = _$NumberOnly; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(NumberOnlyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$NumberOnlySerializer(); +} + +class _$NumberOnlySerializer implements PrimitiveSerializer { + @override + final Iterable types = const [NumberOnly, _$NumberOnly]; + + @override + final String wireName = r'NumberOnly'; + + Iterable _serializeProperties( + Serializers serializers, + NumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.justNumber != null) { + yield r'JustNumber'; + yield serializers.serialize( + object.justNumber, + specifiedType: const FullType(num), + ); + } + } + + @override + Object serialize( + Serializers serializers, + NumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required NumberOnlyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'JustNumber': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.justNumber = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + NumberOnly deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = NumberOnlyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/object_with_deprecated_fields.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/object_with_deprecated_fields.dart new file mode 100644 index 000000000000..42730dee5c1b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/object_with_deprecated_fields.dart @@ -0,0 +1,172 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/deprecated_object.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'object_with_deprecated_fields.g.dart'; + +/// ObjectWithDeprecatedFields +/// +/// Properties: +/// * [uuid] +/// * [id] +/// * [deprecatedRef] +/// * [bars] +@BuiltValue() +abstract class ObjectWithDeprecatedFields implements Built { + @BuiltValueField(wireName: r'uuid') + String? get uuid; + + @Deprecated('id has been deprecated') + @BuiltValueField(wireName: r'id') + num? get id; + + @Deprecated('deprecatedRef has been deprecated') + @BuiltValueField(wireName: r'deprecatedRef') + DeprecatedObject? get deprecatedRef; + + @Deprecated('bars has been deprecated') + @BuiltValueField(wireName: r'bars') + BuiltList? get bars; + + ObjectWithDeprecatedFields._(); + + factory ObjectWithDeprecatedFields([void updates(ObjectWithDeprecatedFieldsBuilder b)]) = _$ObjectWithDeprecatedFields; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ObjectWithDeprecatedFieldsBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ObjectWithDeprecatedFieldsSerializer(); +} + +class _$ObjectWithDeprecatedFieldsSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ObjectWithDeprecatedFields, _$ObjectWithDeprecatedFields]; + + @override + final String wireName = r'ObjectWithDeprecatedFields'; + + Iterable _serializeProperties( + Serializers serializers, + ObjectWithDeprecatedFields object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.uuid != null) { + yield r'uuid'; + yield serializers.serialize( + object.uuid, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(num), + ); + } + if (object.deprecatedRef != null) { + yield r'deprecatedRef'; + yield serializers.serialize( + object.deprecatedRef, + specifiedType: const FullType(DeprecatedObject), + ); + } + if (object.bars != null) { + yield r'bars'; + yield serializers.serialize( + object.bars, + specifiedType: const FullType(BuiltList, [FullType(Bar)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ObjectWithDeprecatedFields object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ObjectWithDeprecatedFieldsBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'uuid': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.uuid = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.id = valueDes; + break; + case r'deprecatedRef': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(DeprecatedObject), + ) as DeprecatedObject; + result.deprecatedRef.replace(valueDes); + break; + case r'bars': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(Bar)]), + ) as BuiltList; + result.bars.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ObjectWithDeprecatedFields deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ObjectWithDeprecatedFieldsBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/one_of_primitive_child.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/one_of_primitive_child.dart new file mode 100644 index 000000000000..b7ba74e0d081 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/one_of_primitive_child.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'one_of_primitive_child.g.dart'; + +/// OneOfPrimitiveChild +/// +/// Properties: +/// * [name] +@BuiltValue() +abstract class OneOfPrimitiveChild implements Built { + @BuiltValueField(wireName: r'name') + String? get name; + + OneOfPrimitiveChild._(); + + factory OneOfPrimitiveChild([void updates(OneOfPrimitiveChildBuilder b)]) = _$OneOfPrimitiveChild; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(OneOfPrimitiveChildBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$OneOfPrimitiveChildSerializer(); +} + +class _$OneOfPrimitiveChildSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [OneOfPrimitiveChild, _$OneOfPrimitiveChild]; + + @override + final String wireName = r'OneOfPrimitiveChild'; + + Iterable _serializeProperties( + Serializers serializers, + OneOfPrimitiveChild object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + OneOfPrimitiveChild object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required OneOfPrimitiveChildBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + OneOfPrimitiveChild deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = OneOfPrimitiveChildBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/order.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/order.dart new file mode 100644 index 000000000000..bdd5b3d51251 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/order.dart @@ -0,0 +1,230 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'order.g.dart'; + +/// Order +/// +/// Properties: +/// * [id] +/// * [petId] +/// * [quantity] +/// * [shipDate] +/// * [status] - Order Status +/// * [complete] +@BuiltValue() +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._(); + + factory Order([void updates(OrderBuilder b)]) = _$Order; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(OrderBuilder b) => b + ..complete = false; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$OrderSerializer(); +} + +class _$OrderSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Order, _$Order]; + + @override + final String wireName = r'Order'; + + Iterable _serializeProperties( + Serializers serializers, + Order object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + if (object.petId != null) { + yield r'petId'; + yield serializers.serialize( + object.petId, + specifiedType: const FullType(int), + ); + } + if (object.quantity != null) { + yield r'quantity'; + yield serializers.serialize( + object.quantity, + specifiedType: const FullType(int), + ); + } + if (object.shipDate != null) { + yield r'shipDate'; + yield serializers.serialize( + object.shipDate, + specifiedType: const FullType(DateTime), + ); + } + if (object.status != null) { + yield r'status'; + yield serializers.serialize( + object.status, + specifiedType: const FullType(OrderStatusEnum), + ); + } + if (object.complete != null) { + yield r'complete'; + yield serializers.serialize( + object.complete, + specifiedType: const FullType(bool), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Order object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required OrderBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'petId': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.petId = valueDes; + break; + case r'quantity': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.quantity = valueDes; + break; + case r'shipDate': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(DateTime), + ) as DateTime; + result.shipDate = valueDes; + break; + case r'status': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OrderStatusEnum), + ) as OrderStatusEnum; + result.status = valueDes; + break; + case r'complete': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) as bool; + result.complete = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Order deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = OrderBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + 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; + /// Order Status + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const OrderStatusEnum unknownDefaultOpenApi = _$orderStatusEnum_unknownDefaultOpenApi; + + 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/client/echo_api/dart/dio/built_value/lib/src/model/outer_composite.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/outer_composite.dart new file mode 100644 index 000000000000..4017ac055a11 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/outer_composite.dart @@ -0,0 +1,147 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_composite.g.dart'; + +/// OuterComposite +/// +/// Properties: +/// * [myNumber] +/// * [myString] +/// * [myBoolean] +@BuiltValue() +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._(); + + factory OuterComposite([void updates(OuterCompositeBuilder b)]) = _$OuterComposite; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(OuterCompositeBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$OuterCompositeSerializer(); +} + +class _$OuterCompositeSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [OuterComposite, _$OuterComposite]; + + @override + final String wireName = r'OuterComposite'; + + Iterable _serializeProperties( + Serializers serializers, + OuterComposite object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.myNumber != null) { + yield r'my_number'; + yield serializers.serialize( + object.myNumber, + specifiedType: const FullType(num), + ); + } + if (object.myString != null) { + yield r'my_string'; + yield serializers.serialize( + object.myString, + specifiedType: const FullType(String), + ); + } + if (object.myBoolean != null) { + yield r'my_boolean'; + yield serializers.serialize( + object.myBoolean, + specifiedType: const FullType(bool), + ); + } + } + + @override + Object serialize( + Serializers serializers, + OuterComposite object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required OuterCompositeBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'my_number': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.myNumber = valueDes; + break; + case r'my_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.myString = valueDes; + break; + case r'my_boolean': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) as bool; + result.myBoolean = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + OuterComposite deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = OuterCompositeBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/outer_enum.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/outer_enum.dart new file mode 100644 index 000000000000..dcec6f1a87f7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/outer_enum.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const OuterEnum unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + 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. +typedef OuterEnumMixin = _$OuterEnumMixin; + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/outer_enum_default_value.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/outer_enum_default_value.dart new file mode 100644 index 000000000000..be6714943f80 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/outer_enum_default_value.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const OuterEnumDefaultValue unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + 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. +typedef OuterEnumDefaultValueMixin = _$OuterEnumDefaultValueMixin; + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/outer_enum_integer.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/outer_enum_integer.dart new file mode 100644 index 000000000000..a248f0743663 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/outer_enum_integer.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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; + @BuiltValueEnumConst(wireNumber: 11184809, fallback: true) + static const OuterEnumInteger unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + 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. +typedef OuterEnumIntegerMixin = _$OuterEnumIntegerMixin; + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/outer_enum_integer_default_value.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/outer_enum_integer_default_value.dart new file mode 100644 index 000000000000..edf4506d90d7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/outer_enum_integer_default_value.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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; + @BuiltValueEnumConst(wireNumber: 11184809, fallback: true) + static const OuterEnumIntegerDefaultValue unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + 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. +typedef OuterEnumIntegerDefaultValueMixin = _$OuterEnumIntegerDefaultValueMixin; + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/outer_object_with_enum_property.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/outer_object_with_enum_property.dart new file mode 100644 index 000000000000..d2438f77f167 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/outer_object_with_enum_property.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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'; + +/// OuterObjectWithEnumProperty +/// +/// Properties: +/// * [value] +@BuiltValue() +abstract class OuterObjectWithEnumProperty implements Built { + @BuiltValueField(wireName: r'value') + OuterEnumInteger get value; + // enum valueEnum { 0, 1, 2, }; + + OuterObjectWithEnumProperty._(); + + factory OuterObjectWithEnumProperty([void updates(OuterObjectWithEnumPropertyBuilder b)]) = _$OuterObjectWithEnumProperty; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(OuterObjectWithEnumPropertyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$OuterObjectWithEnumPropertySerializer(); +} + +class _$OuterObjectWithEnumPropertySerializer implements PrimitiveSerializer { + @override + final Iterable types = const [OuterObjectWithEnumProperty, _$OuterObjectWithEnumProperty]; + + @override + final String wireName = r'OuterObjectWithEnumProperty'; + + Iterable _serializeProperties( + Serializers serializers, + OuterObjectWithEnumProperty object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'value'; + yield serializers.serialize( + object.value, + specifiedType: const FullType(OuterEnumInteger), + ); + } + + @override + Object serialize( + Serializers serializers, + OuterObjectWithEnumProperty object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required OuterObjectWithEnumPropertyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'value': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OuterEnumInteger), + ) as OuterEnumInteger; + result.value = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + OuterObjectWithEnumProperty deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = OuterObjectWithEnumPropertyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/dog_all_of.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/parent.dart similarity index 62% rename from samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/dog_all_of.dart rename to samples/client/echo_api/dart/dio/built_value/lib/src/model/parent.dart index bd52567fa60a..7f8684221419 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/dog_all_of.dart +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/parent.dart @@ -3,92 +3,88 @@ // // ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_type.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; -part 'dog_all_of.g.dart'; +part 'parent.g.dart'; -/// DogAllOf +/// Parent /// /// Properties: -/// * [breed] +/// * [fruitType] @BuiltValue(instantiable: false) -abstract class DogAllOf { - @BuiltValueField(wireName: r'breed') - String? get breed; - +abstract class Parent implements FruitType { @BuiltValueSerializer(custom: true) - static Serializer get serializer => _$DogAllOfSerializer(); + static Serializer get serializer => _$ParentSerializer(); } -class _$DogAllOfSerializer implements PrimitiveSerializer { +class _$ParentSerializer implements PrimitiveSerializer { @override - final Iterable types = const [DogAllOf]; + final Iterable types = const [Parent]; @override - final String wireName = r'DogAllOf'; + final String wireName = r'Parent'; Iterable _serializeProperties( Serializers serializers, - DogAllOf object, { + Parent object, { FullType specifiedType = FullType.unspecified, }) sync* { - if (object.breed != null) { - yield r'breed'; - yield serializers.serialize( - object.breed, - specifiedType: const FullType(String), - ); - } + yield r'fruitType'; + yield serializers.serialize( + object.fruitType, + specifiedType: const FullType(String), + ); } @override Object serialize( Serializers serializers, - DogAllOf object, { + Parent object, { FullType specifiedType = FullType.unspecified, }) { return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); } @override - DogAllOf deserialize( + Parent deserialize( Serializers serializers, Object serialized, { FullType specifiedType = FullType.unspecified, }) { - return serializers.deserialize(serialized, specifiedType: FullType($DogAllOf)) as $DogAllOf; + return serializers.deserialize(serialized, specifiedType: FullType($Parent)) as $Parent; } } -/// a concrete implementation of [DogAllOf], since [DogAllOf] is not instantiable +/// a concrete implementation of [Parent], since [Parent] is not instantiable @BuiltValue(instantiable: true) -abstract class $DogAllOf implements DogAllOf, Built<$DogAllOf, $DogAllOfBuilder> { - $DogAllOf._(); +abstract class $Parent implements Parent, Built<$Parent, $ParentBuilder> { + $Parent._(); - factory $DogAllOf([void Function($DogAllOfBuilder)? updates]) = _$$DogAllOf; + factory $Parent([void Function($ParentBuilder)? updates]) = _$$Parent; @BuiltValueHook(initializeBuilder: true) - static void _defaults($DogAllOfBuilder b) => b; + static void _defaults($ParentBuilder b) => b; @BuiltValueSerializer(custom: true) - static Serializer<$DogAllOf> get serializer => _$$DogAllOfSerializer(); + static Serializer<$Parent> get serializer => _$$ParentSerializer(); } -class _$$DogAllOfSerializer implements PrimitiveSerializer<$DogAllOf> { +class _$$ParentSerializer implements PrimitiveSerializer<$Parent> { @override - final Iterable types = const [$DogAllOf, _$$DogAllOf]; + final Iterable types = const [$Parent, _$$Parent]; @override - final String wireName = r'$DogAllOf'; + final String wireName = r'$Parent'; @override Object serialize( Serializers serializers, - $DogAllOf object, { + $Parent object, { FullType specifiedType = FullType.unspecified, }) { - return serializers.serialize(object, specifiedType: FullType(DogAllOf))!; + return serializers.serialize(object, specifiedType: FullType(Parent))!; } void _deserializeProperties( @@ -96,19 +92,19 @@ class _$$DogAllOfSerializer implements PrimitiveSerializer<$DogAllOf> { Object serialized, { FullType specifiedType = FullType.unspecified, required List serializedList, - required DogAllOfBuilder result, + required ParentBuilder result, required List unhandled, }) { for (var i = 0; i < serializedList.length; i += 2) { final key = serializedList[i] as String; final value = serializedList[i + 1]; switch (key) { - case r'breed': + case r'fruitType': final valueDes = serializers.deserialize( value, specifiedType: const FullType(String), ) as String; - result.breed = valueDes; + result.fruitType = valueDes; break; default: unhandled.add(key); @@ -119,12 +115,12 @@ class _$$DogAllOfSerializer implements PrimitiveSerializer<$DogAllOf> { } @override - $DogAllOf deserialize( + $Parent deserialize( Serializers serializers, Object serialized, { FullType specifiedType = FullType.unspecified, }) { - final result = $DogAllOfBuilder(); + final result = $ParentBuilder(); final serializedList = (serialized as Iterable).toList(); final unhandled = []; _deserializeProperties( @@ -138,4 +134,5 @@ class _$$DogAllOfSerializer implements PrimitiveSerializer<$DogAllOf> { return result.build(); } } + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/pasta.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/pasta.dart new file mode 100644 index 000000000000..eadbe2a7c706 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/pasta.dart @@ -0,0 +1,188 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'pasta.g.dart'; + +/// Pasta +/// +/// Properties: +/// * [vendor] +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue() +abstract class Pasta implements Entity, Built { + @BuiltValueField(wireName: r'vendor') + String? get vendor; + + Pasta._(); + + factory Pasta([void updates(PastaBuilder b)]) = _$Pasta; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(PastaBuilder b) => b..atType=b.discriminatorValue; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$PastaSerializer(); +} + +class _$PastaSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Pasta, _$Pasta]; + + @override + final String wireName = r'Pasta'; + + Iterable _serializeProperties( + Serializers serializers, + Pasta object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + if (object.vendor != null) { + yield r'vendor'; + yield serializers.serialize( + object.vendor, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Pasta object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required PastaBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + case r'vendor': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.vendor = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Pasta deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = PastaBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/pet.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/pet.dart new file mode 100644 index 000000000000..c0bdacea72bb --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/pet.dart @@ -0,0 +1,227 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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'; + +/// Pet +/// +/// Properties: +/// * [id] +/// * [category] +/// * [name] +/// * [photoUrls] +/// * [tags] +/// * [status] - pet status in the store +@BuiltValue() +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._(); + + factory Pet([void updates(PetBuilder b)]) = _$Pet; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(PetBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$PetSerializer(); +} + +class _$PetSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Pet, _$Pet]; + + @override + final String wireName = r'Pet'; + + Iterable _serializeProperties( + Serializers serializers, + Pet object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + if (object.category != null) { + yield r'category'; + yield serializers.serialize( + object.category, + specifiedType: const FullType(Category), + ); + } + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + yield r'photoUrls'; + yield serializers.serialize( + object.photoUrls, + specifiedType: const FullType(BuiltSet, [FullType(String)]), + ); + if (object.tags != null) { + yield r'tags'; + yield serializers.serialize( + object.tags, + specifiedType: const FullType(BuiltList, [FullType(Tag)]), + ); + } + if (object.status != null) { + yield r'status'; + yield serializers.serialize( + object.status, + specifiedType: const FullType(PetStatusEnum), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Pet object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required PetBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'category': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(Category), + ) as Category; + result.category.replace(valueDes); + break; + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + case r'photoUrls': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltSet, [FullType(String)]), + ) as BuiltSet; + result.photoUrls.replace(valueDes); + break; + case r'tags': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(Tag)]), + ) as BuiltList; + result.tags.replace(valueDes); + break; + case r'status': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(PetStatusEnum), + ) as PetStatusEnum; + result.status = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Pet deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = PetBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + 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; + /// pet status in the store + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const PetStatusEnum unknownDefaultOpenApi = _$petStatusEnum_unknownDefaultOpenApi; + + 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/client/echo_api/dart/dio/built_value/lib/src/model/pizza.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/pizza.dart new file mode 100644 index 000000000000..1ef6be87a4a1 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/pizza.dart @@ -0,0 +1,256 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/pizza_speziale.dart'; +import 'package:openapi/src/model/entity.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'pizza.g.dart'; + +/// Pizza +/// +/// Properties: +/// * [pizzaSize] +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue(instantiable: false) +abstract class Pizza implements Entity { + @BuiltValueField(wireName: r'pizzaSize') + num? get pizzaSize; + + static const String discriminatorFieldName = r'@type'; + + static const Map discriminatorMapping = { + r'PizzaSpeziale': PizzaSpeziale, + }; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$PizzaSerializer(); +} + +extension PizzaDiscriminatorExt on Pizza { + String? get discriminatorValue { + if (this is PizzaSpeziale) { + return r'PizzaSpeziale'; + } + return null; + } +} +extension PizzaBuilderDiscriminatorExt on PizzaBuilder { + String? get discriminatorValue { + if (this is PizzaSpezialeBuilder) { + return r'PizzaSpeziale'; + } + return null; + } +} + +class _$PizzaSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Pizza]; + + @override + final String wireName = r'Pizza'; + + Iterable _serializeProperties( + Serializers serializers, + Pizza object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.pizzaSize != null) { + yield r'pizzaSize'; + yield serializers.serialize( + object.pizzaSize, + specifiedType: const FullType(num), + ); + } + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + Pizza object, { + FullType specifiedType = FullType.unspecified, + }) { + if (object is PizzaSpeziale) { + return serializers.serialize(object, specifiedType: FullType(PizzaSpeziale))!; + } + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + @override + Pizza deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(Pizza.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + switch (discValue) { + case r'PizzaSpeziale': + return serializers.deserialize(serialized, specifiedType: FullType(PizzaSpeziale)) as PizzaSpeziale; + default: + return serializers.deserialize(serialized, specifiedType: FullType($Pizza)) as $Pizza; + } + } +} + +/// a concrete implementation of [Pizza], since [Pizza] is not instantiable +@BuiltValue(instantiable: true) +abstract class $Pizza implements Pizza, Built<$Pizza, $PizzaBuilder> { + $Pizza._(); + + factory $Pizza([void Function($PizzaBuilder)? updates]) = _$$Pizza; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($PizzaBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$Pizza> get serializer => _$$PizzaSerializer(); +} + +class _$$PizzaSerializer implements PrimitiveSerializer<$Pizza> { + @override + final Iterable types = const [$Pizza, _$$Pizza]; + + @override + final String wireName = r'$Pizza'; + + @override + Object serialize( + Serializers serializers, + $Pizza object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(Pizza))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required PizzaBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'pizzaSize': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.pizzaSize = valueDes; + break; + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $Pizza deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $PizzaBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/pizza_speziale.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/pizza_speziale.dart new file mode 100644 index 000000000000..e09185593425 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/pizza_speziale.dart @@ -0,0 +1,202 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/pizza.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'pizza_speziale.g.dart'; + +/// PizzaSpeziale +/// +/// Properties: +/// * [toppings] +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue() +abstract class PizzaSpeziale implements Pizza, Built { + @BuiltValueField(wireName: r'toppings') + String? get toppings; + + PizzaSpeziale._(); + + factory PizzaSpeziale([void updates(PizzaSpezialeBuilder b)]) = _$PizzaSpeziale; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(PizzaSpezialeBuilder b) => b..atType=b.discriminatorValue; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$PizzaSpezialeSerializer(); +} + +class _$PizzaSpezialeSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [PizzaSpeziale, _$PizzaSpeziale]; + + @override + final String wireName = r'PizzaSpeziale'; + + Iterable _serializeProperties( + Serializers serializers, + PizzaSpeziale object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.pizzaSize != null) { + yield r'pizzaSize'; + yield serializers.serialize( + object.pizzaSize, + specifiedType: const FullType(num), + ); + } + if (object.toppings != null) { + yield r'toppings'; + yield serializers.serialize( + object.toppings, + specifiedType: const FullType(String), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + PizzaSpeziale object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required PizzaSpezialeBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'pizzaSize': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.pizzaSize = valueDes; + break; + case r'toppings': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.toppings = valueDes; + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + PizzaSpeziale deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = PizzaSpezialeBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/read_only_first.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/read_only_first.dart new file mode 100644 index 000000000000..ad34b7e028bc --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/read_only_first.dart @@ -0,0 +1,128 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'read_only_first.g.dart'; + +/// ReadOnlyFirst +/// +/// Properties: +/// * [bar] +/// * [baz] +@BuiltValue() +abstract class ReadOnlyFirst implements Built { + @BuiltValueField(wireName: r'bar') + String? get bar; + + @BuiltValueField(wireName: r'baz') + String? get baz; + + ReadOnlyFirst._(); + + factory ReadOnlyFirst([void updates(ReadOnlyFirstBuilder b)]) = _$ReadOnlyFirst; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ReadOnlyFirstBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ReadOnlyFirstSerializer(); +} + +class _$ReadOnlyFirstSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ReadOnlyFirst, _$ReadOnlyFirst]; + + @override + final String wireName = r'ReadOnlyFirst'; + + Iterable _serializeProperties( + Serializers serializers, + ReadOnlyFirst object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.bar != null) { + yield r'bar'; + yield serializers.serialize( + object.bar, + specifiedType: const FullType(String), + ); + } + if (object.baz != null) { + yield r'baz'; + yield serializers.serialize( + object.baz, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ReadOnlyFirst object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ReadOnlyFirstBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'bar': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.bar = valueDes; + break; + case r'baz': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.baz = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ReadOnlyFirst deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ReadOnlyFirstBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/single_ref_type.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/single_ref_type.dart new file mode 100644 index 000000000000..a133275a06c2 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/single_ref_type.dart @@ -0,0 +1,36 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'single_ref_type.g.dart'; + +class SingleRefType extends EnumClass { + + @BuiltValueEnumConst(wireName: r'admin') + static const SingleRefType admin = _$admin; + @BuiltValueEnumConst(wireName: r'user') + static const SingleRefType user = _$user; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const SingleRefType unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + static Serializer get serializer => _$singleRefTypeSerializer; + + const SingleRefType._(String name): super(name); + + static BuiltSet get values => _$values; + static SingleRefType 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. +typedef SingleRefTypeMixin = _$SingleRefTypeMixin; + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/special_model_name.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/special_model_name.dart new file mode 100644 index 000000000000..43a4d95c5a95 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/special_model_name.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'special_model_name.g.dart'; + +/// SpecialModelName +/// +/// Properties: +/// * [dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket] +@BuiltValue() +abstract class SpecialModelName implements Built { + @BuiltValueField(wireName: r'$special[property.name]') + int? get dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + + SpecialModelName._(); + + factory SpecialModelName([void updates(SpecialModelNameBuilder b)]) = _$SpecialModelName; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(SpecialModelNameBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$SpecialModelNameSerializer(); +} + +class _$SpecialModelNameSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [SpecialModelName, _$SpecialModelName]; + + @override + final String wireName = r'SpecialModelName'; + + Iterable _serializeProperties( + Serializers serializers, + SpecialModelName object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket != null) { + yield r'$special[property.name]'; + yield serializers.serialize( + object.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket, + specifiedType: const FullType(int), + ); + } + } + + @override + Object serialize( + Serializers serializers, + SpecialModelName object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required SpecialModelNameBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'$special[property.name]': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + SpecialModelName deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = SpecialModelNameBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/tag.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/tag.dart new file mode 100644 index 000000000000..a431de33e0f1 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/tag.dart @@ -0,0 +1,128 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'tag.g.dart'; + +/// Tag +/// +/// Properties: +/// * [id] +/// * [name] +@BuiltValue() +abstract class Tag implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'name') + String? get name; + + Tag._(); + + factory Tag([void updates(TagBuilder b)]) = _$Tag; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(TagBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$TagSerializer(); +} + +class _$TagSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Tag, _$Tag]; + + @override + final String wireName = r'Tag'; + + Iterable _serializeProperties( + Serializers serializers, + Tag object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Tag object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required TagBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Tag deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = TagBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/model/user.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/model/user.dart new file mode 100644 index 000000000000..dd2d58fee1b5 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/model/user.dart @@ -0,0 +1,243 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'user.g.dart'; + +/// User +/// +/// Properties: +/// * [id] +/// * [username] +/// * [firstName] +/// * [lastName] +/// * [email] +/// * [password] +/// * [phone] +/// * [userStatus] - User Status +@BuiltValue() +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._(); + + factory User([void updates(UserBuilder b)]) = _$User; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(UserBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$UserSerializer(); +} + +class _$UserSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [User, _$User]; + + @override + final String wireName = r'User'; + + Iterable _serializeProperties( + Serializers serializers, + User object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + if (object.username != null) { + yield r'username'; + yield serializers.serialize( + object.username, + specifiedType: const FullType(String), + ); + } + if (object.firstName != null) { + yield r'firstName'; + yield serializers.serialize( + object.firstName, + specifiedType: const FullType(String), + ); + } + if (object.lastName != null) { + yield r'lastName'; + yield serializers.serialize( + object.lastName, + specifiedType: const FullType(String), + ); + } + if (object.email != null) { + yield r'email'; + yield serializers.serialize( + object.email, + specifiedType: const FullType(String), + ); + } + if (object.password != null) { + yield r'password'; + yield serializers.serialize( + object.password, + specifiedType: const FullType(String), + ); + } + if (object.phone != null) { + yield r'phone'; + yield serializers.serialize( + object.phone, + specifiedType: const FullType(String), + ); + } + if (object.userStatus != null) { + yield r'userStatus'; + yield serializers.serialize( + object.userStatus, + specifiedType: const FullType(int), + ); + } + } + + @override + Object serialize( + Serializers serializers, + User object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required UserBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'username': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.username = valueDes; + break; + case r'firstName': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.firstName = valueDes; + break; + case r'lastName': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.lastName = valueDes; + break; + case r'email': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.email = valueDes; + break; + case r'password': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.password = valueDes; + break; + case r'phone': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.phone = valueDes; + break; + case r'userStatus': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.userStatus = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + User deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = UserBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + + + + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/repository_base.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/repository_base.dart new file mode 100644 index 000000000000..fa1f81f13c5b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/repository_base.dart @@ -0,0 +1,60 @@ +import 'dart:async'; + +/// The general rule for implementing this class is +/// json == serialize(deserialize(json)) +/// object == deserialize(serialize(object)) +/// Where json in this context means a dart primitive +/// JSON = String | num | bool | null | Uint8List | List | Map +abstract class SerializationRepositoryBase { + const SerializationRepositoryBase(); + + FutureOr serialize(T src, TypeInfo inputTypeInfo, {Object? context,}); + FutureOr deserialize(Object? value, TypeInfo targetTypeInfo, {Object? context,}); +} + +/// A modified version of `built_value`'s `FullType` class, found here +/// https://github.com/google/built_value.dart/blob/ee22d400a69c673330481a6da1f0796b90bb369b/built_value/lib/serializer.dart +/// It holds type information known by the spec (including generic type parameters) +class TypeInfo { + final Type root; + final bool nullable; + final List parameters; + + /// The [Object] type. + static const TypeInfo object = TypeInfo(Object); + + const TypeInfo(this.root, [this.parameters = const []]) : nullable = false; + const TypeInfo.nullable(this.root, [this.parameters = const []]) : nullable = true; + + @override + bool operator ==(dynamic other) { + if (identical(other, this)) return true; + if (other is! TypeInfo) return false; + if (root != other.root) return false; + if (nullable != other.nullable) return false; + if (parameters.length != other.parameters.length) return false; + for (var i = 0; i != parameters.length; ++i) { + if (parameters[i] != other.parameters[i]) return false; + } + return true; + } + + @override + int get hashCode { + return Object.hash(root, Object.hashAll(parameters), nullable); + } + + @override + String toString() => (parameters.isEmpty + ? _getRawName(root) + : '${_getRawName(root)}<${parameters.join(", ")}>') + + _nullabilitySuffix; + + String get _nullabilitySuffix => nullable ? '?' : ''; + + static String _getRawName(Type? type) { + var name = type.toString(); + var genericsStart = name.indexOf('<'); + return genericsStart == -1 ? name : name.substring(0, genericsStart); + } +} diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/repository_impl.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/repository_impl.dart new file mode 100644 index 000000000000..5d7c14063a21 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/repository_impl.dart @@ -0,0 +1,51 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; +import 'repository_base.dart'; +import 'serializers.dart'; + +/// Converts our `TypeInfo` to `built_value`'s `FullType` +FullType typeInfoToFullType(TypeInfo info) { + if (info.nullable) { + return FullType.nullable( + info.root, info.parameters.map(typeInfoToFullType).toList(),); + } else { + return FullType( + info.root, info.parameters.map(typeInfoToFullType).toList(),); + } +} + +class BuiltValueJsonRepository extends SerializationRepositoryBase { + final Serializers serializers; + const BuiltValueJsonRepository(this.serializers); + + @override + FutureOr deserialize(Object? value, TypeInfo targetTypeInfo, {Object? context}) { + if (value is T) { + return value; + } + return serializers.deserialize( + value, + specifiedType: typeInfoToFullType(targetTypeInfo), + ) as T; + } + + @override + FutureOr serialize(T src, TypeInfo inputTypeInfo, {Object? context}) { + if (src == null) { + return null; + } + return serializers.serialize( + src, + specifiedType: typeInfoToFullType(inputTypeInfo), + ) as Object; + } +} diff --git a/samples/client/echo_api/dart/dio/built_value/lib/src/serializers.dart b/samples/client/echo_api/dart/dio/built_value/lib/src/serializers.dart new file mode 100644 index 000000000000..f93ac8d59cec --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/lib/src/serializers.dart @@ -0,0 +1,193 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_import + +import 'package:one_of_serializer/any_of_serializer.dart'; +import 'package:one_of_serializer/one_of_serializer.dart'; +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:openapi/apis.dart'; +import 'package:built_value/iso_8601_date_time_serializer.dart'; + +import 'package:openapi/models.dart'; +part 'serializers.g.dart'; + +@SerializersFor([ + AdditionalPropertiesClass, + Addressable,$Addressable, + AllOfWithSingleRef, + Animal,$Animal, + ApiResponse, + Apple, + AppleAllOfDisc, + AppleGrandparentDisc, + AppleOneOfDisc, + AppleReqDisc, + AppleVariant1, + ArrayOfArrayOfNumberOnly, + ArrayOfNumberOnly, + ArrayTest, + Banana, + BananaAllOfDisc, + BananaGrandparentDisc, + BananaOneOfDisc, + BananaReqDisc, + Bar, + BarCreate, + BarRef, + BarRefOrValue, + Capitalization, + Cat, + Category, + ClassModel, + ComposedDiscMissingFromProperties, + ComposedDiscOptionalTypeCorrect, + ComposedDiscOptionalTypeInconsistent, + ComposedDiscOptionalTypeIncorrect, + ComposedDiscRequiredInconsistent, + ComposedDiscTypeInconsistent, + ComposedDiscTypeIncorrect, + DeprecatedObject, + DiscMissingFromProperties, + DiscOptionalTypeCorrect, + DiscOptionalTypeIncorrect, + DiscTypeIncorrect, + Dog, + Entity,$Entity, + EntityRef,$EntityRef, + EnumArrays, + EnumTest, + Extensible,$Extensible, + FileSchemaTestClass, + Foo, + FooBasicGetDefaultResponse, + FooRef, + FooRefOrValue, + FormatTest, + Fruit, + FruitAllOfDisc, + FruitAnyOfDisc, + FruitGrandparentDisc, + FruitInlineDisc, + FruitInlineDiscOneOf, + FruitInlineDiscOneOf1, + FruitInlineInlineDisc, + FruitInlineInlineDiscOneOf, + FruitInlineInlineDiscOneOf1, + FruitInlineInlineDiscOneOfOneOf, + FruitOneOfDisc, + FruitReqDisc, + FruitType,$FruitType, + FruitVariant1, + GigaOneOf, + GrapeVariant1, + HasOnlyReadOnly, + HealthCheckResult, + MapTest, + MixedPropertiesAndAdditionalPropertiesClass, + Model200Response, + ModelClient, + ModelEnumClass, + ModelFile, + ModelList, + ModelReturn, + Name, + NullableClass, + NumberOnly, + ObjectWithDeprecatedFields, + OneOfPrimitiveChild, + Order, + OuterComposite, + OuterEnum, + OuterEnumDefaultValue, + OuterEnumInteger, + OuterEnumIntegerDefaultValue, + OuterObjectWithEnumProperty, + Parent,$Parent, + Pasta, + Pet, + Pizza,$Pizza, + PizzaSpeziale, + ReadOnlyFirst, + SingleRefType, + SpecialModelName, + Tag, + User, +]) +Serializers serializers = (_$serializers.toBuilder() + ..addBuilderFactory( + const FullType(BuiltList, [FullType(EnumQueryStringArrayEnum)]), + () => ListBuilder, + ) + ..addBuilderFactory( + const FullType(BuiltList, [FullType(EnumHeaderStringArrayEnum)]), + () => ListBuilder, + ) + ..addBuilderFactory( + const FullType(BuiltList, [FullType(InnerEnum)]), + () => ListBuilder, + ) + ..addBuilderFactory( + const FullType(BuiltMap, [FullType(String), FullType(String)]), + () => MapBuilder, + ) + ..addBuilderFactory( + const FullType(BuiltList, [FullType(ModelEnumClass)]), + () => ListBuilder, + ) + ..addBuilderFactory( + const FullType(BuiltList, [FullType(FooRefOrValue)]), + () => ListBuilder, + ) + ..addBuilderFactory( + const FullType(BuiltList, [FullType(StatusEnum)]), + () => ListBuilder, + ) + ..addBuilderFactory( + const FullType(BuiltMap, [FullType(String), FullType(int)]), + () => MapBuilder, + ) + ..addBuilderFactory( + const FullType(BuiltSet, [FullType(String)]), + () => SetBuilder, + ) + ..addBuilderFactory( + const FullType(BuiltList, [FullType(User)]), + () => ListBuilder, + ) + ..addBuilderFactory( + const FullType(BuiltList, [FullType(Pet)]), + () => ListBuilder, + ) + ..addBuilderFactory( + const FullType(BuiltList, [FullType(String)]), + () => ListBuilder, + ) + ..addBuilderFactory( + const FullType(BuiltSet, [FullType(Pet)]), + () => SetBuilder, + ) + ..addBuilderFactory( + const FullType(BuiltMap, [FullType(String), FullType(String)]), + () => MapBuilder, + ) + ..add(Addressable.serializer) + ..add(Animal.serializer) + ..add(Entity.serializer) + ..add(EntityRef.serializer) + ..add(Extensible.serializer) + ..add(FruitType.serializer) + ..add(Parent.serializer) + ..add(Pizza.serializer) + ..add(const OneOfSerializer()) + ..add(const AnyOfSerializer()) + ..add(const DateSerializer()) + ..add(Iso8601DateTimeSerializer())) + .build(); + +Serializers standardSerializers = + (serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build(); diff --git a/samples/client/echo_api/dart/dio/built_value/pom.xml b/samples/client/echo_api/dart/dio/built_value/pom.xml new file mode 100644 index 000000000000..26b922ed34e8 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/pom.xml @@ -0,0 +1,149 @@ + + 4.0.0 + org.openapitools + DartNextDioBuiltValueSample + pom + 1.0.0-SNAPSHOT + Dart Echo API Sample (dio/built_value) + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + + + pub-get + pre-integration-test + + exec + + + dart + + pub + get + + + + + pub-run-build-runner + pre-integration-test + + exec + + + dart + + pub + run + build_runner + build + + + + + dart-analyze + integration-test + + exec + + + dart + + analyze + --fatal-infos + + + + + dart-test + integration-test + + exec + + + + test + + + + + tests-pub-get + pre-integration-test + + exec + + + ../built_value_tests + dart + + pub + get + + + + + tests-dart-format + pre-integration-test + + exec + + + ../built_value_tests + dart + + format + --set-exit-if-changed + --output=none + . + + + + + tests-dart-analyze + integration-test + + exec + + + ../built_value_tests + dart + + analyze + --fatal-infos + + + + + tests-dart-test + integration-test + + exec + + + ../built_value_tests + dart + + test + + + + + + + + diff --git a/samples/client/echo_api/dart/dio/built_value/pubspec.yaml b/samples/client/echo_api/dart/dio/built_value/pubspec.yaml new file mode 100644 index 000000000000..de93663746d0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/pubspec.yaml @@ -0,0 +1,19 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client +homepage: homepage + +environment: + sdk: '>=2.15.0 <3.0.0' + +dependencies: + dio: '^5.2.0' + one_of: '>=1.5.0 <2.0.0' + one_of_serializer: '>=1.5.0 <2.0.0' + built_value: '>=8.4.0 <9.0.0' + built_collection: '>=5.1.1 <6.0.0' + +dev_dependencies: + built_value_generator: '>=8.4.0 <9.0.0' + build_runner: any + test: ^1.16.0 diff --git a/samples/client/echo_api/dart/dio/built_value/test/additional_properties_class_test.dart b/samples/client/echo_api/dart/dio/built_value/test/additional_properties_class_test.dart new file mode 100644 index 000000000000..40e022fed3e9 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/additional_properties_class_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AdditionalPropertiesClass +void main() { + final instance = AdditionalPropertiesClassBuilder(); + // add properties to the builder and call build() + + group(AdditionalPropertiesClass, () { + // BuiltMap mapProperty + test('to test the property `mapProperty`', () async { + + }); + + // BuiltMap> mapOfMapProperty + test('to test the property `mapOfMapProperty`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/addressable_test.dart b/samples/client/echo_api/dart/dio/built_value/test/addressable_test.dart new file mode 100644 index 000000000000..c4a77a1cf650 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/addressable_test.dart @@ -0,0 +1,23 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Addressable +void main() { + //final instance = AddressableBuilder(); + // add properties to the builder and call build() + + group(Addressable, () { + // Hyperlink reference + // String href + test('to test the property `href`', () async { + + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/all_of_with_single_ref_test.dart b/samples/client/echo_api/dart/dio/built_value/test/all_of_with_single_ref_test.dart new file mode 100644 index 000000000000..490f494682ae --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/all_of_with_single_ref_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AllOfWithSingleRef +void main() { + final instance = AllOfWithSingleRefBuilder(); + // add properties to the builder and call build() + + group(AllOfWithSingleRef, () { + // String username + test('to test the property `username`', () async { + + }); + + // SingleRefType singleRefType + test('to test the property `singleRefType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/animal_test.dart b/samples/client/echo_api/dart/dio/built_value/test/animal_test.dart new file mode 100644 index 000000000000..0aa21d74dfcd --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/animal_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Animal +void main() { + //final instance = AnimalBuilder(); + // add properties to the builder and call build() + + group(Animal, () { + // String className + test('to test the property `className`', () async { + + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/another_fake_api_test.dart b/samples/client/echo_api/dart/dio/built_value/test/another_fake_api_test.dart new file mode 100644 index 000000000000..0757e851b3a6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/another_fake_api_test.dart @@ -0,0 +1,20 @@ +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 { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/api_response_test.dart b/samples/client/echo_api/dart/dio/built_value/test/api_response_test.dart new file mode 100644 index 000000000000..59c1e9c586a0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/api_response_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ApiResponse +void main() { + final instance = ApiResponseBuilder(); + // add properties to the builder and call build() + + group(ApiResponse, () { + // int code + test('to test the property `code`', () async { + + }); + + // String type + test('to test the property `type`', () async { + + }); + + // String message + test('to test the property `message`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/apple_all_of_disc_test.dart b/samples/client/echo_api/dart/dio/built_value/test/apple_all_of_disc_test.dart new file mode 100644 index 000000000000..67dd9dde51f9 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/apple_all_of_disc_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AppleAllOfDisc +void main() { + final instance = AppleAllOfDiscBuilder(); + // add properties to the builder and call build() + + group(AppleAllOfDisc, () { + // int seeds + test('to test the property `seeds`', () async { + + }); + + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/apple_grandparent_disc_test.dart b/samples/client/echo_api/dart/dio/built_value/test/apple_grandparent_disc_test.dart new file mode 100644 index 000000000000..85880e3d6b86 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/apple_grandparent_disc_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AppleGrandparentDisc +void main() { + final instance = AppleGrandparentDiscBuilder(); + // add properties to the builder and call build() + + group(AppleGrandparentDisc, () { + // int seeds + test('to test the property `seeds`', () async { + + }); + + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/apple_one_of_disc_test.dart b/samples/client/echo_api/dart/dio/built_value/test/apple_one_of_disc_test.dart new file mode 100644 index 000000000000..2ccf5b7eb6f8 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/apple_one_of_disc_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AppleOneOfDisc +void main() { + final instance = AppleOneOfDiscBuilder(); + // add properties to the builder and call build() + + group(AppleOneOfDisc, () { + // int seeds + test('to test the property `seeds`', () async { + + }); + + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/apple_req_disc_test.dart b/samples/client/echo_api/dart/dio/built_value/test/apple_req_disc_test.dart new file mode 100644 index 000000000000..0ac1e13b40ed --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/apple_req_disc_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AppleReqDisc +void main() { + final instance = AppleReqDiscBuilder(); + // add properties to the builder and call build() + + group(AppleReqDisc, () { + // int seeds + test('to test the property `seeds`', () async { + + }); + + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/apple_test.dart b/samples/client/echo_api/dart/dio/built_value/test/apple_test.dart new file mode 100644 index 000000000000..22b482545d13 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/apple_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Apple +void main() { + final instance = AppleBuilder(); + // add properties to the builder and call build() + + group(Apple, () { + // String kind + test('to test the property `kind`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/apple_variant1_test.dart b/samples/client/echo_api/dart/dio/built_value/test/apple_variant1_test.dart new file mode 100644 index 000000000000..0151ca4c20a5 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/apple_variant1_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AppleVariant1 +void main() { + final instance = AppleVariant1Builder(); + // add properties to the builder and call build() + + group(AppleVariant1, () { + // String kind + test('to test the property `kind`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/array_of_array_of_number_only_test.dart b/samples/client/echo_api/dart/dio/built_value/test/array_of_array_of_number_only_test.dart new file mode 100644 index 000000000000..02602681bdbe --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/array_of_array_of_number_only_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayOfArrayOfNumberOnly +void main() { + final instance = ArrayOfArrayOfNumberOnlyBuilder(); + // add properties to the builder and call build() + + group(ArrayOfArrayOfNumberOnly, () { + // BuiltList> arrayArrayNumber + test('to test the property `arrayArrayNumber`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/array_of_number_only_test.dart b/samples/client/echo_api/dart/dio/built_value/test/array_of_number_only_test.dart new file mode 100644 index 000000000000..edb8aa49e919 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/array_of_number_only_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayOfNumberOnly +void main() { + final instance = ArrayOfNumberOnlyBuilder(); + // add properties to the builder and call build() + + group(ArrayOfNumberOnly, () { + // BuiltList arrayNumber + test('to test the property `arrayNumber`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/array_test_test.dart b/samples/client/echo_api/dart/dio/built_value/test/array_test_test.dart new file mode 100644 index 000000000000..2a1a3f6d05c2 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/array_test_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayTest +void main() { + final instance = ArrayTestBuilder(); + // add properties to the builder and call build() + + group(ArrayTest, () { + // BuiltList arrayOfString + test('to test the property `arrayOfString`', () async { + + }); + + // BuiltList> arrayArrayOfInteger + test('to test the property `arrayArrayOfInteger`', () async { + + }); + + // BuiltList> arrayArrayOfModel + test('to test the property `arrayArrayOfModel`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/banana_all_of_disc_test.dart b/samples/client/echo_api/dart/dio/built_value/test/banana_all_of_disc_test.dart new file mode 100644 index 000000000000..76cca6a7f004 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/banana_all_of_disc_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BananaAllOfDisc +void main() { + final instance = BananaAllOfDiscBuilder(); + // add properties to the builder and call build() + + group(BananaAllOfDisc, () { + // int length + test('to test the property `length`', () async { + + }); + + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/banana_grandparent_disc_test.dart b/samples/client/echo_api/dart/dio/built_value/test/banana_grandparent_disc_test.dart new file mode 100644 index 000000000000..1e661c1bd49f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/banana_grandparent_disc_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BananaGrandparentDisc +void main() { + final instance = BananaGrandparentDiscBuilder(); + // add properties to the builder and call build() + + group(BananaGrandparentDisc, () { + // int length + test('to test the property `length`', () async { + + }); + + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/banana_one_of_disc_test.dart b/samples/client/echo_api/dart/dio/built_value/test/banana_one_of_disc_test.dart new file mode 100644 index 000000000000..486de1e22edb --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/banana_one_of_disc_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BananaOneOfDisc +void main() { + final instance = BananaOneOfDiscBuilder(); + // add properties to the builder and call build() + + group(BananaOneOfDisc, () { + // int length + test('to test the property `length`', () async { + + }); + + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/banana_req_disc_test.dart b/samples/client/echo_api/dart/dio/built_value/test/banana_req_disc_test.dart new file mode 100644 index 000000000000..4ab55caa6802 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/banana_req_disc_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BananaReqDisc +void main() { + final instance = BananaReqDiscBuilder(); + // add properties to the builder and call build() + + group(BananaReqDisc, () { + // int length + test('to test the property `length`', () async { + + }); + + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/banana_test.dart b/samples/client/echo_api/dart/dio/built_value/test/banana_test.dart new file mode 100644 index 000000000000..4f894091034a --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/banana_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Banana +void main() { + final instance = BananaBuilder(); + // add properties to the builder and call build() + + group(Banana, () { + // num count + test('to test the property `count`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/bar_api_test.dart b/samples/client/echo_api/dart/dio/built_value/test/bar_api_test.dart new file mode 100644 index 000000000000..58c9cede8213 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/bar_api_test.dart @@ -0,0 +1,18 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + + +/// tests for BarApi +void main() { + final instance = Openapi().getBarApi(); + + group(BarApi, () { + // Create a Bar + // + //Future createBar(BarCreate barCreate) async + test('test createBar', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/bar_create_test.dart b/samples/client/echo_api/dart/dio/built_value/test/bar_create_test.dart new file mode 100644 index 000000000000..a33ea27b37e4 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/bar_create_test.dart @@ -0,0 +1,56 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BarCreate +void main() { + final instance = BarCreateBuilder(); + // add properties to the builder and call build() + + group(BarCreate, () { + // String barPropA + test('to test the property `barPropA`', () async { + + }); + + // String fooPropB + test('to test the property `fooPropB`', () async { + + }); + + // FooRefOrValue foo + test('to test the property `foo`', () async { + + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/bar_ref_or_value_test.dart b/samples/client/echo_api/dart/dio/built_value/test/bar_ref_or_value_test.dart new file mode 100644 index 000000000000..b87ff202d239 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/bar_ref_or_value_test.dart @@ -0,0 +1,41 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BarRefOrValue +void main() { + final instance = BarRefOrValueBuilder(); + // add properties to the builder and call build() + + group(BarRefOrValue, () { + // Hyperlink reference + // String href + test('to test the property `href`', () async { + + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/bar_ref_test.dart b/samples/client/echo_api/dart/dio/built_value/test/bar_ref_test.dart new file mode 100644 index 000000000000..9487e640203f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/bar_ref_test.dart @@ -0,0 +1,41 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BarRef +void main() { + final instance = BarRefBuilder(); + // add properties to the builder and call build() + + group(BarRef, () { + // Hyperlink reference + // String href + test('to test the property `href`', () async { + + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/bar_test.dart b/samples/client/echo_api/dart/dio/built_value/test/bar_test.dart new file mode 100644 index 000000000000..5c2c67f5ae76 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/bar_test.dart @@ -0,0 +1,55 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Bar +void main() { + final instance = BarBuilder(); + // add properties to the builder and call build() + + group(Bar, () { + // String id + test('to test the property `id`', () async { + + }); + + // String barPropA + test('to test the property `barPropA`', () async { + + }); + + // String fooPropB + test('to test the property `fooPropB`', () async { + + }); + + // FooRefOrValue foo + test('to test the property `foo`', () async { + + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/capitalization_test.dart b/samples/client/echo_api/dart/dio/built_value/test/capitalization_test.dart new file mode 100644 index 000000000000..151fda310a24 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/capitalization_test.dart @@ -0,0 +1,42 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Capitalization +void main() { + final instance = CapitalizationBuilder(); + // add properties to the builder and call build() + + group(Capitalization, () { + // String smallCamel + test('to test the property `smallCamel`', () async { + + }); + + // String capitalCamel + test('to test the property `capitalCamel`', () async { + + }); + + // String smallSnake + test('to test the property `smallSnake`', () async { + + }); + + // String capitalSnake + test('to test the property `capitalSnake`', () async { + + }); + + // String sCAETHFlowPoints + test('to test the property `sCAETHFlowPoints`', () async { + + }); + + // Name of the pet + // String ATT_NAME + test('to test the property `ATT_NAME`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/cat_test.dart b/samples/client/echo_api/dart/dio/built_value/test/cat_test.dart new file mode 100644 index 000000000000..898a27283f66 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/cat_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Cat +void main() { + final instance = CatBuilder(); + // add properties to the builder and call build() + + group(Cat, () { + // String className + test('to test the property `className`', () async { + + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + + }); + + // bool declawed + test('to test the property `declawed`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/category_test.dart b/samples/client/echo_api/dart/dio/built_value/test/category_test.dart new file mode 100644 index 000000000000..126f133c887f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/category_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Category +void main() { + final instance = CategoryBuilder(); + // add properties to the builder and call build() + + group(Category, () { + // int id + test('to test the property `id`', () async { + + }); + + // String name (default value: 'default-name') + test('to test the property `name`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/class_model_test.dart b/samples/client/echo_api/dart/dio/built_value/test/class_model_test.dart new file mode 100644 index 000000000000..14bed24b5a34 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/class_model_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ClassModel +void main() { + final instance = ClassModelBuilder(); + // add properties to the builder and call build() + + group(ClassModel, () { + // String classField + test('to test the property `classField`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/composed_disc_missing_from_properties_test.dart b/samples/client/echo_api/dart/dio/built_value/test/composed_disc_missing_from_properties_test.dart new file mode 100644 index 000000000000..bea72d8d3874 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/composed_disc_missing_from_properties_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ComposedDiscMissingFromProperties +void main() { + final instance = ComposedDiscMissingFromPropertiesBuilder(); + // add properties to the builder and call build() + + group(ComposedDiscMissingFromProperties, () { + // int length + test('to test the property `length`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/composed_disc_optional_type_correct_test.dart b/samples/client/echo_api/dart/dio/built_value/test/composed_disc_optional_type_correct_test.dart new file mode 100644 index 000000000000..cb269e29feda --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/composed_disc_optional_type_correct_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ComposedDiscOptionalTypeCorrect +void main() { + final instance = ComposedDiscOptionalTypeCorrectBuilder(); + // add properties to the builder and call build() + + group(ComposedDiscOptionalTypeCorrect, () { + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/composed_disc_optional_type_inconsistent_test.dart b/samples/client/echo_api/dart/dio/built_value/test/composed_disc_optional_type_inconsistent_test.dart new file mode 100644 index 000000000000..47e6c8eb1b96 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/composed_disc_optional_type_inconsistent_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ComposedDiscOptionalTypeInconsistent +void main() { + final instance = ComposedDiscOptionalTypeInconsistentBuilder(); + // add properties to the builder and call build() + + group(ComposedDiscOptionalTypeInconsistent, () { + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/composed_disc_optional_type_incorrect_test.dart b/samples/client/echo_api/dart/dio/built_value/test/composed_disc_optional_type_incorrect_test.dart new file mode 100644 index 000000000000..6a6e5fe5856d --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/composed_disc_optional_type_incorrect_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ComposedDiscOptionalTypeIncorrect +void main() { + final instance = ComposedDiscOptionalTypeIncorrectBuilder(); + // add properties to the builder and call build() + + group(ComposedDiscOptionalTypeIncorrect, () { + // int fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/composed_disc_required_inconsistent_test.dart b/samples/client/echo_api/dart/dio/built_value/test/composed_disc_required_inconsistent_test.dart new file mode 100644 index 000000000000..78826cc59f3d --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/composed_disc_required_inconsistent_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ComposedDiscRequiredInconsistent +void main() { + final instance = ComposedDiscRequiredInconsistentBuilder(); + // add properties to the builder and call build() + + group(ComposedDiscRequiredInconsistent, () { + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/composed_disc_type_inconsistent_test.dart b/samples/client/echo_api/dart/dio/built_value/test/composed_disc_type_inconsistent_test.dart new file mode 100644 index 000000000000..63f54c3f2f3e --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/composed_disc_type_inconsistent_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ComposedDiscTypeInconsistent +void main() { + final instance = ComposedDiscTypeInconsistentBuilder(); + // add properties to the builder and call build() + + group(ComposedDiscTypeInconsistent, () { + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/composed_disc_type_incorrect_test.dart b/samples/client/echo_api/dart/dio/built_value/test/composed_disc_type_incorrect_test.dart new file mode 100644 index 000000000000..f173a14b00f6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/composed_disc_type_incorrect_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ComposedDiscTypeIncorrect +void main() { + final instance = ComposedDiscTypeIncorrectBuilder(); + // add properties to the builder and call build() + + group(ComposedDiscTypeIncorrect, () { + // int fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/default_api_test.dart b/samples/client/echo_api/dart/dio/built_value/test/default_api_test.dart new file mode 100644 index 000000000000..d6284b93034d --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/default_api_test.dart @@ -0,0 +1,41 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + + +/// tests for DefaultApi +void main() { + final instance = Openapi().getDefaultApi(); + + group(DefaultApi, () { + //Future fooBasicGet() async + test('test fooBasicGet', () async { + + }); + + //Future list() async + test('test list', () async { + + }); + + //Future oneofGet() async + test('test oneofGet', () async { + + }); + + //Future test({ JsonObject body }) async + test('test test', () async { + + }); + + //Future variant1Get() async + test('test variant1Get', () async { + + }); + + //Future variant2Get() async + test('test variant2Get', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/deprecated_object_test.dart b/samples/client/echo_api/dart/dio/built_value/test/deprecated_object_test.dart new file mode 100644 index 000000000000..3bdc8aea4c5d --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/deprecated_object_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DeprecatedObject +void main() { + final instance = DeprecatedObjectBuilder(); + // add properties to the builder and call build() + + group(DeprecatedObject, () { + // String name + test('to test the property `name`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/disc_missing_from_properties_test.dart b/samples/client/echo_api/dart/dio/built_value/test/disc_missing_from_properties_test.dart new file mode 100644 index 000000000000..bb18991d6968 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/disc_missing_from_properties_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DiscMissingFromProperties +void main() { + final instance = DiscMissingFromPropertiesBuilder(); + // add properties to the builder and call build() + + group(DiscMissingFromProperties, () { + // int length + test('to test the property `length`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/disc_optional_type_correct_test.dart b/samples/client/echo_api/dart/dio/built_value/test/disc_optional_type_correct_test.dart new file mode 100644 index 000000000000..44b2c350eb91 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/disc_optional_type_correct_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DiscOptionalTypeCorrect +void main() { + final instance = DiscOptionalTypeCorrectBuilder(); + // add properties to the builder and call build() + + group(DiscOptionalTypeCorrect, () { + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/disc_optional_type_incorrect_test.dart b/samples/client/echo_api/dart/dio/built_value/test/disc_optional_type_incorrect_test.dart new file mode 100644 index 000000000000..6e73d4e6bb40 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/disc_optional_type_incorrect_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DiscOptionalTypeIncorrect +void main() { + final instance = DiscOptionalTypeIncorrectBuilder(); + // add properties to the builder and call build() + + group(DiscOptionalTypeIncorrect, () { + // int fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/disc_type_incorrect_test.dart b/samples/client/echo_api/dart/dio/built_value/test/disc_type_incorrect_test.dart new file mode 100644 index 000000000000..d5ab15bcff73 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/disc_type_incorrect_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DiscTypeIncorrect +void main() { + final instance = DiscTypeIncorrectBuilder(); + // add properties to the builder and call build() + + group(DiscTypeIncorrect, () { + // int fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/dog_test.dart b/samples/client/echo_api/dart/dio/built_value/test/dog_test.dart new file mode 100644 index 000000000000..f8d6c721171a --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/dog_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Dog +void main() { + final instance = DogBuilder(); + // add properties to the builder and call build() + + group(Dog, () { + // String className + test('to test the property `className`', () async { + + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + + }); + + // String breed + test('to test the property `breed`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/entity_ref_test.dart b/samples/client/echo_api/dart/dio/built_value/test/entity_ref_test.dart new file mode 100644 index 000000000000..7610daf76a74 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/entity_ref_test.dart @@ -0,0 +1,53 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EntityRef +void main() { + //final instance = EntityRefBuilder(); + // add properties to the builder and call build() + + group(EntityRef, () { + // Name of the related entity. + // String name + test('to test the property `name`', () async { + + }); + + // The actual type of the target instance when needed for disambiguation. + // String atReferredType + test('to test the property `atReferredType`', () async { + + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/entity_test.dart b/samples/client/echo_api/dart/dio/built_value/test/entity_test.dart new file mode 100644 index 000000000000..6d6c818f265b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/entity_test.dart @@ -0,0 +1,41 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Entity +void main() { + //final instance = EntityBuilder(); + // add properties to the builder and call build() + + group(Entity, () { + // Hyperlink reference + // String href + test('to test the property `href`', () async { + + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/enum_arrays_test.dart b/samples/client/echo_api/dart/dio/built_value/test/enum_arrays_test.dart new file mode 100644 index 000000000000..509ceb91e36e --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/enum_arrays_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EnumArrays +void main() { + final instance = EnumArraysBuilder(); + // add properties to the builder and call build() + + group(EnumArrays, () { + // String justSymbol + test('to test the property `justSymbol`', () async { + + }); + + // BuiltList arrayEnum + test('to test the property `arrayEnum`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/enum_test_test.dart b/samples/client/echo_api/dart/dio/built_value/test/enum_test_test.dart new file mode 100644 index 000000000000..90598431361b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/enum_test_test.dart @@ -0,0 +1,51 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EnumTest +void main() { + final instance = EnumTestBuilder(); + // add properties to the builder and call build() + + group(EnumTest, () { + // String enumString + test('to test the property `enumString`', () async { + + }); + + // String enumStringRequired + test('to test the property `enumStringRequired`', () async { + + }); + + // int enumInteger + test('to test the property `enumInteger`', () async { + + }); + + // double enumNumber + test('to test the property `enumNumber`', () async { + + }); + + // OuterEnum outerEnum + test('to test the property `outerEnum`', () async { + + }); + + // OuterEnumInteger outerEnumInteger + test('to test the property `outerEnumInteger`', () async { + + }); + + // OuterEnumDefaultValue outerEnumDefaultValue + test('to test the property `outerEnumDefaultValue`', () async { + + }); + + // OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue + test('to test the property `outerEnumIntegerDefaultValue`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/extensible_test.dart b/samples/client/echo_api/dart/dio/built_value/test/extensible_test.dart new file mode 100644 index 000000000000..34ef96c21cd3 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/extensible_test.dart @@ -0,0 +1,29 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Extensible +void main() { + //final instance = ExtensibleBuilder(); + // add properties to the builder and call build() + + group(Extensible, () { + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/fake_api_test.dart b/samples/client/echo_api/dart/dio/built_value/test/fake_api_test.dart new file mode 100644 index 000000000000..61d46be0cd9f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/fake_api_test.dart @@ -0,0 +1,140 @@ +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 { + + }); + + // test http signature authentication + // + //Future fakeHttpSignatureTest(Pet pet, { String query1, String header1 }) async + test('test fakeHttpSignatureTest', () async { + + }); + + // Test serialization of outer boolean types + // + //Future fakeOuterBooleanSerialize({ bool body }) async + test('test fakeOuterBooleanSerialize', () async { + + }); + + // Test serialization of object with outer number type + // + //Future fakeOuterCompositeSerialize({ OuterComposite outerComposite }) async + test('test fakeOuterCompositeSerialize', () async { + + }); + + // Test serialization of outer number types + // + //Future fakeOuterNumberSerialize({ num body }) async + test('test fakeOuterNumberSerialize', () async { + + }); + + // Test serialization of outer string types + // + //Future fakeOuterStringSerialize({ String body }) async + test('test fakeOuterStringSerialize', () async { + + }); + + // Test serialization of enum (int) properties with examples + // + //Future fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty) async + test('test fakePropertyEnumIntegerSerialize', () async { + + }); + + // For this test, the body has to be a binary file. + // + //Future testBodyWithBinary(MultipartFile body) async + test('test testBodyWithBinary', () async { + + }); + + // For this test, the body for this request must reference a schema named `File`. + // + //Future testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) async + test('test testBodyWithFileSchema', () async { + + }); + + //Future testBodyWithQueryParams(String query, User user) async + test('test testBodyWithQueryParams', () async { + + }); + + // To test \"client\" model + // + // To test \"client\" model + // + //Future testClientModel(ModelClient modelClient) async + test('test testClientModel', () async { + + }); + + // 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, Date date, DateTime dateTime, String password, String callback }) async + test('test testEndpointParameters', () async { + + }); + + // To test enum parameters + // + // To test enum parameters + // + //Future testEnumParameters({ BuiltList enumHeaderStringArray, String enumHeaderString, BuiltList enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, BuiltList enumQueryModelArray, BuiltList enumFormStringArray, String enumFormString }) async + test('test testEnumParameters', () async { + + }); + + // 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 { + + }); + + // test inline additionalProperties + // + // + // + //Future testInlineAdditionalProperties(BuiltMap requestBody) async + test('test testInlineAdditionalProperties', () async { + + }); + + // test json serialization of form data + // + // + // + //Future testJsonFormData(String param, String param2) async + test('test testJsonFormData', () async { + + }); + + // To test the collection format in query parameters + // + //Future testQueryParameterCollectionFormat(BuiltList pipe, BuiltList ioutil, BuiltList http, BuiltList url, BuiltList context, String allowEmpty, { BuiltMap language }) async + test('test testQueryParameterCollectionFormat', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/fake_classname_tags123_api_test.dart b/samples/client/echo_api/dart/dio/built_value/test/fake_classname_tags123_api_test.dart new file mode 100644 index 000000000000..d07b8ee850bf --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/fake_classname_tags123_api_test.dart @@ -0,0 +1,20 @@ +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 { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/file_schema_test_class_test.dart b/samples/client/echo_api/dart/dio/built_value/test/file_schema_test_class_test.dart new file mode 100644 index 000000000000..09fd67587633 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/file_schema_test_class_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FileSchemaTestClass +void main() { + final instance = FileSchemaTestClassBuilder(); + // add properties to the builder and call build() + + group(FileSchemaTestClass, () { + // ModelFile file + test('to test the property `file`', () async { + + }); + + // BuiltList files + test('to test the property `files`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/foo_api_test.dart b/samples/client/echo_api/dart/dio/built_value/test/foo_api_test.dart new file mode 100644 index 000000000000..d10dabe192bd --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/foo_api_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + + +/// tests for FooApi +void main() { + final instance = Openapi().getFooApi(); + + group(FooApi, () { + // Create a Foo + // + //Future createFoo({ Foo foo }) async + test('test createFoo', () async { + + }); + + // GET all Foos + // + //Future> getAllFoos() async + test('test getAllFoos', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/foo_basic_get_default_response_test.dart b/samples/client/echo_api/dart/dio/built_value/test/foo_basic_get_default_response_test.dart new file mode 100644 index 000000000000..2355d28d6e9e --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/foo_basic_get_default_response_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FooBasicGetDefaultResponse +void main() { + final instance = FooBasicGetDefaultResponseBuilder(); + // add properties to the builder and call build() + + group(FooBasicGetDefaultResponse, () { + // Foo string + test('to test the property `string`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/foo_ref_or_value_test.dart b/samples/client/echo_api/dart/dio/built_value/test/foo_ref_or_value_test.dart new file mode 100644 index 000000000000..fd0493074f0a --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/foo_ref_or_value_test.dart @@ -0,0 +1,41 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FooRefOrValue +void main() { + final instance = FooRefOrValueBuilder(); + // add properties to the builder and call build() + + group(FooRefOrValue, () { + // Hyperlink reference + // String href + test('to test the property `href`', () async { + + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/foo_ref_test.dart b/samples/client/echo_api/dart/dio/built_value/test/foo_ref_test.dart new file mode 100644 index 000000000000..b54542e7773b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/foo_ref_test.dart @@ -0,0 +1,46 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FooRef +void main() { + final instance = FooRefBuilder(); + // add properties to the builder and call build() + + group(FooRef, () { + // String foorefPropA + test('to test the property `foorefPropA`', () async { + + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/foo_test.dart b/samples/client/echo_api/dart/dio/built_value/test/foo_test.dart new file mode 100644 index 000000000000..d6888100f6bd --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/foo_test.dart @@ -0,0 +1,51 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Foo +void main() { + final instance = FooBuilder(); + // add properties to the builder and call build() + + group(Foo, () { + // String fooPropA + test('to test the property `fooPropA`', () async { + + }); + + // String fooPropB + test('to test the property `fooPropB`', () async { + + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/format_test_test.dart b/samples/client/echo_api/dart/dio/built_value/test/format_test_test.dart new file mode 100644 index 000000000000..1aae302fe6e6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/format_test_test.dart @@ -0,0 +1,93 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FormatTest +void main() { + final instance = FormatTestBuilder(); + // add properties to the builder and call build() + + group(FormatTest, () { + // int integer + test('to test the property `integer`', () async { + + }); + + // int int32 + test('to test the property `int32`', () async { + + }); + + // int int64 + test('to test the property `int64`', () async { + + }); + + // num number + test('to test the property `number`', () async { + + }); + + // double float + test('to test the property `float`', () async { + + }); + + // double double_ + test('to test the property `double_`', () async { + + }); + + // double decimal + test('to test the property `decimal`', () async { + + }); + + // String string + test('to test the property `string`', () async { + + }); + + // String byte + test('to test the property `byte`', () async { + + }); + + // Uint8List binary + test('to test the property `binary`', () async { + + }); + + // Date date + test('to test the property `date`', () async { + + }); + + // DateTime dateTime + test('to test the property `dateTime`', () async { + + }); + + // String uuid + test('to test the property `uuid`', () async { + + }); + + // String password + test('to test the property `password`', () async { + + }); + + // A string that is a 10 digit number. Can have leading zeros. + // String patternWithDigits + test('to test the property `patternWithDigits`', () async { + + }); + + // 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 { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/fruit_all_of_disc_test.dart b/samples/client/echo_api/dart/dio/built_value/test/fruit_all_of_disc_test.dart new file mode 100644 index 000000000000..0c5a0c94b5a2 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/fruit_all_of_disc_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitAllOfDisc +void main() { + final instance = FruitAllOfDiscBuilder(); + // add properties to the builder and call build() + + group(FruitAllOfDisc, () { + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/fruit_any_of_disc_test.dart b/samples/client/echo_api/dart/dio/built_value/test/fruit_any_of_disc_test.dart new file mode 100644 index 000000000000..d681791cf233 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/fruit_any_of_disc_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitAnyOfDisc +void main() { + final instance = FruitAnyOfDiscBuilder(); + // add properties to the builder and call build() + + group(FruitAnyOfDisc, () { + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/fruit_grandparent_disc_test.dart b/samples/client/echo_api/dart/dio/built_value/test/fruit_grandparent_disc_test.dart new file mode 100644 index 000000000000..2c846c4f0fbf --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/fruit_grandparent_disc_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitGrandparentDisc +void main() { + final instance = FruitGrandparentDiscBuilder(); + // add properties to the builder and call build() + + group(FruitGrandparentDisc, () { + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_disc_one_of1_test.dart b/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_disc_one_of1_test.dart new file mode 100644 index 000000000000..89e960a80e12 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_disc_one_of1_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitInlineDiscOneOf1 +void main() { + final instance = FruitInlineDiscOneOf1Builder(); + // add properties to the builder and call build() + + group(FruitInlineDiscOneOf1, () { + // int length + test('to test the property `length`', () async { + + }); + + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_disc_one_of_test.dart b/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_disc_one_of_test.dart new file mode 100644 index 000000000000..ecb67890a553 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_disc_one_of_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitInlineDiscOneOf +void main() { + final instance = FruitInlineDiscOneOfBuilder(); + // add properties to the builder and call build() + + group(FruitInlineDiscOneOf, () { + // int seeds + test('to test the property `seeds`', () async { + + }); + + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_disc_test.dart b/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_disc_test.dart new file mode 100644 index 000000000000..d30e8a372635 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_disc_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitInlineDisc +void main() { + final instance = FruitInlineDiscBuilder(); + // add properties to the builder and call build() + + group(FruitInlineDisc, () { + // int seeds + test('to test the property `seeds`', () async { + + }); + + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + // int length + test('to test the property `length`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_inline_disc_one_of1_test.dart b/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_inline_disc_one_of1_test.dart new file mode 100644 index 000000000000..8c68ea279329 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_inline_disc_one_of1_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitInlineInlineDiscOneOf1 +void main() { + final instance = FruitInlineInlineDiscOneOf1Builder(); + // add properties to the builder and call build() + + group(FruitInlineInlineDiscOneOf1, () { + // int length + test('to test the property `length`', () async { + + }); + + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_inline_disc_one_of_one_of_test.dart b/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_inline_disc_one_of_one_of_test.dart new file mode 100644 index 000000000000..763900f0b417 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_inline_disc_one_of_one_of_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitInlineInlineDiscOneOfOneOf +void main() { + final instance = FruitInlineInlineDiscOneOfOneOfBuilder(); + // add properties to the builder and call build() + + group(FruitInlineInlineDiscOneOfOneOf, () { + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_inline_disc_one_of_test.dart b/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_inline_disc_one_of_test.dart new file mode 100644 index 000000000000..481e0ef28d3b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_inline_disc_one_of_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitInlineInlineDiscOneOf +void main() { + final instance = FruitInlineInlineDiscOneOfBuilder(); + // add properties to the builder and call build() + + group(FruitInlineInlineDiscOneOf, () { + // int seeds + test('to test the property `seeds`', () async { + + }); + + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_inline_disc_test.dart b/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_inline_disc_test.dart new file mode 100644 index 000000000000..c8c31be34fff --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/fruit_inline_inline_disc_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitInlineInlineDisc +void main() { + final instance = FruitInlineInlineDiscBuilder(); + // add properties to the builder and call build() + + group(FruitInlineInlineDisc, () { + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/fruit_one_of_disc_test.dart b/samples/client/echo_api/dart/dio/built_value/test/fruit_one_of_disc_test.dart new file mode 100644 index 000000000000..ea556220176d --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/fruit_one_of_disc_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitOneOfDisc +void main() { + final instance = FruitOneOfDiscBuilder(); + // add properties to the builder and call build() + + group(FruitOneOfDisc, () { + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/fruit_req_disc_test.dart b/samples/client/echo_api/dart/dio/built_value/test/fruit_req_disc_test.dart new file mode 100644 index 000000000000..800d81b06bdf --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/fruit_req_disc_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitReqDisc +void main() { + final instance = FruitReqDiscBuilder(); + // add properties to the builder and call build() + + group(FruitReqDisc, () { + // int seeds + test('to test the property `seeds`', () async { + + }); + + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + // int length + test('to test the property `length`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/fruit_test.dart b/samples/client/echo_api/dart/dio/built_value/test/fruit_test.dart new file mode 100644 index 000000000000..754264134074 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/fruit_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Fruit +void main() { + final instance = FruitBuilder(); + // add properties to the builder and call build() + + group(Fruit, () { + // String color + test('to test the property `color`', () async { + + }); + + // String kind + test('to test the property `kind`', () async { + + }); + + // num count + test('to test the property `count`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/fruit_type_test.dart b/samples/client/echo_api/dart/dio/built_value/test/fruit_type_test.dart new file mode 100644 index 000000000000..4b6b0c7aaf51 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/fruit_type_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitType +void main() { + //final instance = FruitTypeBuilder(); + // add properties to the builder and call build() + + group(FruitType, () { + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/fruit_variant1_test.dart b/samples/client/echo_api/dart/dio/built_value/test/fruit_variant1_test.dart new file mode 100644 index 000000000000..f96a78ae85b7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/fruit_variant1_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitVariant1 +void main() { + final instance = FruitVariant1Builder(); + // add properties to the builder and call build() + + group(FruitVariant1, () { + // String color + test('to test the property `color`', () async { + + }); + + // String kind + test('to test the property `kind`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/giga_one_of_test.dart b/samples/client/echo_api/dart/dio/built_value/test/giga_one_of_test.dart new file mode 100644 index 000000000000..c29bd533837b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/giga_one_of_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for GigaOneOf +void main() { + final instance = GigaOneOfBuilder(); + // add properties to the builder and call build() + + group(GigaOneOf, () { + // String name + test('to test the property `name`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/grape_variant1_test.dart b/samples/client/echo_api/dart/dio/built_value/test/grape_variant1_test.dart new file mode 100644 index 000000000000..952375bc2b0f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/grape_variant1_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for GrapeVariant1 +void main() { + final instance = GrapeVariant1Builder(); + // add properties to the builder and call build() + + group(GrapeVariant1, () { + // String color + test('to test the property `color`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/has_only_read_only_test.dart b/samples/client/echo_api/dart/dio/built_value/test/has_only_read_only_test.dart new file mode 100644 index 000000000000..fe29de48575c --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/has_only_read_only_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for HasOnlyReadOnly +void main() { + final instance = HasOnlyReadOnlyBuilder(); + // add properties to the builder and call build() + + group(HasOnlyReadOnly, () { + // String bar + test('to test the property `bar`', () async { + + }); + + // String foo + test('to test the property `foo`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/health_check_result_test.dart b/samples/client/echo_api/dart/dio/built_value/test/health_check_result_test.dart new file mode 100644 index 000000000000..1d59d8a8d112 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/health_check_result_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for HealthCheckResult +void main() { + final instance = HealthCheckResultBuilder(); + // add properties to the builder and call build() + + group(HealthCheckResult, () { + // String nullableMessage + test('to test the property `nullableMessage`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/map_test_test.dart b/samples/client/echo_api/dart/dio/built_value/test/map_test_test.dart new file mode 100644 index 000000000000..2fb8db875105 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/map_test_test.dart @@ -0,0 +1,31 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for MapTest +void main() { + final instance = MapTestBuilder(); + // add properties to the builder and call build() + + group(MapTest, () { + // BuiltMap> mapMapOfString + test('to test the property `mapMapOfString`', () async { + + }); + + // BuiltMap mapOfEnumString + test('to test the property `mapOfEnumString`', () async { + + }); + + // BuiltMap directMap + test('to test the property `directMap`', () async { + + }); + + // BuiltMap indirectMap + test('to test the property `indirectMap`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/mixed_properties_and_additional_properties_class_test.dart b/samples/client/echo_api/dart/dio/built_value/test/mixed_properties_and_additional_properties_class_test.dart new file mode 100644 index 000000000000..dafafae5b472 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/mixed_properties_and_additional_properties_class_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for MixedPropertiesAndAdditionalPropertiesClass +void main() { + final instance = MixedPropertiesAndAdditionalPropertiesClassBuilder(); + // add properties to the builder and call build() + + group(MixedPropertiesAndAdditionalPropertiesClass, () { + // String uuid + test('to test the property `uuid`', () async { + + }); + + // DateTime dateTime + test('to test the property `dateTime`', () async { + + }); + + // BuiltMap map + test('to test the property `map`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/model200_response_test.dart b/samples/client/echo_api/dart/dio/built_value/test/model200_response_test.dart new file mode 100644 index 000000000000..d7d724ce997e --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/model200_response_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Model200Response +void main() { + final instance = Model200ResponseBuilder(); + // add properties to the builder and call build() + + group(Model200Response, () { + // int name + test('to test the property `name`', () async { + + }); + + // String classField + test('to test the property `classField`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/model_client_test.dart b/samples/client/echo_api/dart/dio/built_value/test/model_client_test.dart new file mode 100644 index 000000000000..72ea87cc0a64 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/model_client_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelClient +void main() { + final instance = ModelClientBuilder(); + // add properties to the builder and call build() + + group(ModelClient, () { + // String client + test('to test the property `client`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/model_enum_class_test.dart b/samples/client/echo_api/dart/dio/built_value/test/model_enum_class_test.dart new file mode 100644 index 000000000000..03e5855bf004 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/model_enum_class_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelEnumClass +void main() { + + group(ModelEnumClass, () { + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/model_file_test.dart b/samples/client/echo_api/dart/dio/built_value/test/model_file_test.dart new file mode 100644 index 000000000000..bc7069a89bd4 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/model_file_test.dart @@ -0,0 +1,17 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelFile +void main() { + final instance = ModelFileBuilder(); + // add properties to the builder and call build() + + group(ModelFile, () { + // Test capitalization + // String sourceURI + test('to test the property `sourceURI`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/model_list_test.dart b/samples/client/echo_api/dart/dio/built_value/test/model_list_test.dart new file mode 100644 index 000000000000..1e5f472f3d61 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/model_list_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelList +void main() { + final instance = ModelListBuilder(); + // add properties to the builder and call build() + + group(ModelList, () { + // String n123list + test('to test the property `n123list`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/model_return_test.dart b/samples/client/echo_api/dart/dio/built_value/test/model_return_test.dart new file mode 100644 index 000000000000..45d6463bcde7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/model_return_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelReturn +void main() { + final instance = ModelReturnBuilder(); + // add properties to the builder and call build() + + group(ModelReturn, () { + // int return_ + test('to test the property `return_`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/name_test.dart b/samples/client/echo_api/dart/dio/built_value/test/name_test.dart new file mode 100644 index 000000000000..455d8a0b9bad --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/name_test.dart @@ -0,0 +1,31 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Name +void main() { + final instance = NameBuilder(); + // add properties to the builder and call build() + + group(Name, () { + // int name + test('to test the property `name`', () async { + + }); + + // int snakeCase + test('to test the property `snakeCase`', () async { + + }); + + // String property + test('to test the property `property`', () async { + + }); + + // int n123number + test('to test the property `n123number`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/nullable_class_test.dart b/samples/client/echo_api/dart/dio/built_value/test/nullable_class_test.dart new file mode 100644 index 000000000000..e8bbd567bb14 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/nullable_class_test.dart @@ -0,0 +1,71 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for NullableClass +void main() { + final instance = NullableClassBuilder(); + // add properties to the builder and call build() + + group(NullableClass, () { + // int integerProp + test('to test the property `integerProp`', () async { + + }); + + // num numberProp + test('to test the property `numberProp`', () async { + + }); + + // bool booleanProp + test('to test the property `booleanProp`', () async { + + }); + + // String stringProp + test('to test the property `stringProp`', () async { + + }); + + // Date dateProp + test('to test the property `dateProp`', () async { + + }); + + // DateTime datetimeProp + test('to test the property `datetimeProp`', () async { + + }); + + // BuiltList arrayNullableProp + test('to test the property `arrayNullableProp`', () async { + + }); + + // BuiltList arrayAndItemsNullableProp + test('to test the property `arrayAndItemsNullableProp`', () async { + + }); + + // BuiltList arrayItemsNullable + test('to test the property `arrayItemsNullable`', () async { + + }); + + // BuiltMap objectNullableProp + test('to test the property `objectNullableProp`', () async { + + }); + + // BuiltMap objectAndItemsNullableProp + test('to test the property `objectAndItemsNullableProp`', () async { + + }); + + // BuiltMap objectItemsNullable + test('to test the property `objectItemsNullable`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/number_only_test.dart b/samples/client/echo_api/dart/dio/built_value/test/number_only_test.dart new file mode 100644 index 000000000000..a3144be404d4 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/number_only_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for NumberOnly +void main() { + final instance = NumberOnlyBuilder(); + // add properties to the builder and call build() + + group(NumberOnly, () { + // num justNumber + test('to test the property `justNumber`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/object_with_deprecated_fields_test.dart b/samples/client/echo_api/dart/dio/built_value/test/object_with_deprecated_fields_test.dart new file mode 100644 index 000000000000..d22575d850f0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/object_with_deprecated_fields_test.dart @@ -0,0 +1,31 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ObjectWithDeprecatedFields +void main() { + final instance = ObjectWithDeprecatedFieldsBuilder(); + // add properties to the builder and call build() + + group(ObjectWithDeprecatedFields, () { + // String uuid + test('to test the property `uuid`', () async { + + }); + + // num id + test('to test the property `id`', () async { + + }); + + // DeprecatedObject deprecatedRef + test('to test the property `deprecatedRef`', () async { + + }); + + // BuiltList bars + test('to test the property `bars`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/one_of_primitive_child_test.dart b/samples/client/echo_api/dart/dio/built_value/test/one_of_primitive_child_test.dart new file mode 100644 index 000000000000..c398b53088f0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/one_of_primitive_child_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OneOfPrimitiveChild +void main() { + final instance = OneOfPrimitiveChildBuilder(); + // add properties to the builder and call build() + + group(OneOfPrimitiveChild, () { + // String name + test('to test the property `name`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/order_test.dart b/samples/client/echo_api/dart/dio/built_value/test/order_test.dart new file mode 100644 index 000000000000..2737c4bb6d6b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/order_test.dart @@ -0,0 +1,42 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Order +void main() { + final instance = OrderBuilder(); + // add properties to the builder and call build() + + group(Order, () { + // int id + test('to test the property `id`', () async { + + }); + + // int petId + test('to test the property `petId`', () async { + + }); + + // int quantity + test('to test the property `quantity`', () async { + + }); + + // DateTime shipDate + test('to test the property `shipDate`', () async { + + }); + + // Order Status + // String status + test('to test the property `status`', () async { + + }); + + // bool complete (default value: false) + test('to test the property `complete`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/outer_composite_test.dart b/samples/client/echo_api/dart/dio/built_value/test/outer_composite_test.dart new file mode 100644 index 000000000000..609209a6adff --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/outer_composite_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterComposite +void main() { + final instance = OuterCompositeBuilder(); + // add properties to the builder and call build() + + group(OuterComposite, () { + // num myNumber + test('to test the property `myNumber`', () async { + + }); + + // String myString + test('to test the property `myString`', () async { + + }); + + // bool myBoolean + test('to test the property `myBoolean`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/outer_enum_default_value_test.dart b/samples/client/echo_api/dart/dio/built_value/test/outer_enum_default_value_test.dart new file mode 100644 index 000000000000..502c8326be58 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/outer_enum_default_value_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumDefaultValue +void main() { + + group(OuterEnumDefaultValue, () { + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/outer_enum_integer_default_value_test.dart b/samples/client/echo_api/dart/dio/built_value/test/outer_enum_integer_default_value_test.dart new file mode 100644 index 000000000000..c535fe8ac354 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/outer_enum_integer_default_value_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumIntegerDefaultValue +void main() { + + group(OuterEnumIntegerDefaultValue, () { + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/outer_enum_integer_test.dart b/samples/client/echo_api/dart/dio/built_value/test/outer_enum_integer_test.dart new file mode 100644 index 000000000000..d945bc8c489d --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/outer_enum_integer_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumInteger +void main() { + + group(OuterEnumInteger, () { + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/outer_enum_test.dart b/samples/client/echo_api/dart/dio/built_value/test/outer_enum_test.dart new file mode 100644 index 000000000000..8e11eb02fb8a --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/outer_enum_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnum +void main() { + + group(OuterEnum, () { + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/outer_object_with_enum_property_test.dart b/samples/client/echo_api/dart/dio/built_value/test/outer_object_with_enum_property_test.dart new file mode 100644 index 000000000000..53532aae9c75 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/outer_object_with_enum_property_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterObjectWithEnumProperty +void main() { + final instance = OuterObjectWithEnumPropertyBuilder(); + // add properties to the builder and call build() + + group(OuterObjectWithEnumProperty, () { + // OuterEnumInteger value + test('to test the property `value`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/parent_test.dart b/samples/client/echo_api/dart/dio/built_value/test/parent_test.dart new file mode 100644 index 000000000000..656e58714ae0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/parent_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Parent +void main() { + //final instance = ParentBuilder(); + // add properties to the builder and call build() + + group(Parent, () { + // String fruitType + test('to test the property `fruitType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/pasta_test.dart b/samples/client/echo_api/dart/dio/built_value/test/pasta_test.dart new file mode 100644 index 000000000000..21fd7d2af32a --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/pasta_test.dart @@ -0,0 +1,46 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Pasta +void main() { + final instance = PastaBuilder(); + // add properties to the builder and call build() + + group(Pasta, () { + // String vendor + test('to test the property `vendor`', () async { + + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/pet_api_test.dart b/samples/client/echo_api/dart/dio/built_value/test/pet_api_test.dart new file mode 100644 index 000000000000..a23dda20c185 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/pet_api_test.dart @@ -0,0 +1,92 @@ +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 { + + }); + + // Deletes a pet + // + // + // + //Future deletePet(int petId, { String apiKey }) async + test('test deletePet', () async { + + }); + + // Finds Pets by status + // + // Multiple status values can be provided with comma separated strings + // + //Future> findPetsByStatus(BuiltList status) async + test('test findPetsByStatus', () async { + + }); + + // 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 { + + }); + + // Find pet by ID + // + // Returns a single pet + // + //Future getPetById(int petId) async + test('test getPetById', () async { + + }); + + // Update an existing pet + // + // + // + //Future updatePet(Pet pet) async + test('test updatePet', () async { + + }); + + // Updates a pet in the store with form data + // + // + // + //Future updatePetWithForm(int petId, { String name, String status }) async + test('test updatePetWithForm', () async { + + }); + + // uploads an image + // + // + // + //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async + test('test uploadFile', () async { + + }); + + // uploads an image (required) + // + // + // + //Future uploadFileWithRequiredFile(int petId, MultipartFile requiredFile, { String additionalMetadata }) async + test('test uploadFileWithRequiredFile', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/pet_test.dart b/samples/client/echo_api/dart/dio/built_value/test/pet_test.dart new file mode 100644 index 000000000000..e1f81f3f947e --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/pet_test.dart @@ -0,0 +1,42 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Pet +void main() { + final instance = PetBuilder(); + // add properties to the builder and call build() + + group(Pet, () { + // int id + test('to test the property `id`', () async { + + }); + + // Category category + test('to test the property `category`', () async { + + }); + + // String name + test('to test the property `name`', () async { + + }); + + // BuiltSet photoUrls + test('to test the property `photoUrls`', () async { + + }); + + // BuiltList tags + test('to test the property `tags`', () async { + + }); + + // pet status in the store + // String status + test('to test the property `status`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/pizza_speziale_test.dart b/samples/client/echo_api/dart/dio/built_value/test/pizza_speziale_test.dart new file mode 100644 index 000000000000..9a49ca408907 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/pizza_speziale_test.dart @@ -0,0 +1,46 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for PizzaSpeziale +void main() { + final instance = PizzaSpezialeBuilder(); + // add properties to the builder and call build() + + group(PizzaSpeziale, () { + // String toppings + test('to test the property `toppings`', () async { + + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/pizza_test.dart b/samples/client/echo_api/dart/dio/built_value/test/pizza_test.dart new file mode 100644 index 000000000000..f14838fbb0e9 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/pizza_test.dart @@ -0,0 +1,46 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Pizza +void main() { + //final instance = PizzaBuilder(); + // add properties to the builder and call build() + + group(Pizza, () { + // num pizzaSize + test('to test the property `pizzaSize`', () async { + + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/read_only_first_test.dart b/samples/client/echo_api/dart/dio/built_value/test/read_only_first_test.dart new file mode 100644 index 000000000000..7e5e43c6f1d5 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/read_only_first_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ReadOnlyFirst +void main() { + final instance = ReadOnlyFirstBuilder(); + // add properties to the builder and call build() + + group(ReadOnlyFirst, () { + // String bar + test('to test the property `bar`', () async { + + }); + + // String baz + test('to test the property `baz`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/single_ref_type_test.dart b/samples/client/echo_api/dart/dio/built_value/test/single_ref_type_test.dart new file mode 100644 index 000000000000..5cd85add393e --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/single_ref_type_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for SingleRefType +void main() { + + group(SingleRefType, () { + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/special_model_name_test.dart b/samples/client/echo_api/dart/dio/built_value/test/special_model_name_test.dart new file mode 100644 index 000000000000..15f2b00fd3fe --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/special_model_name_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for SpecialModelName +void main() { + final instance = SpecialModelNameBuilder(); + // add properties to the builder and call build() + + group(SpecialModelName, () { + // int dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket + test('to test the property `dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/store_api_test.dart b/samples/client/echo_api/dart/dio/built_value/test/store_api_test.dart new file mode 100644 index 000000000000..c43f648131e8 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/store_api_test.dart @@ -0,0 +1,47 @@ +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 { + + }); + + // Returns pet inventories by status + // + // Returns a map of status codes to quantities + // + //Future> getInventory() async + test('test getInventory', () async { + + }); + + // Find purchase order by ID + // + // For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + // + //Future getOrderById(int orderId) async + test('test getOrderById', () async { + + }); + + // Place an order for a pet + // + // + // + //Future placeOrder(Order order) async + test('test placeOrder', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/tag_test.dart b/samples/client/echo_api/dart/dio/built_value/test/tag_test.dart new file mode 100644 index 000000000000..012a5ef8d957 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/tag_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Tag +void main() { + final instance = TagBuilder(); + // add properties to the builder and call build() + + group(Tag, () { + // int id + test('to test the property `id`', () async { + + }); + + // String name + test('to test the property `name`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/user_api_test.dart b/samples/client/echo_api/dart/dio/built_value/test/user_api_test.dart new file mode 100644 index 000000000000..1843b2d2200b --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/user_api_test.dart @@ -0,0 +1,83 @@ +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 { + + }); + + // Creates list of users with given input array + // + // + // + //Future createUsersWithArrayInput(BuiltList user) async + test('test createUsersWithArrayInput', () async { + + }); + + // Creates list of users with given input array + // + // + // + //Future createUsersWithListInput(BuiltList user) async + test('test createUsersWithListInput', () async { + + }); + + // Delete user + // + // This can only be done by the logged in user. + // + //Future deleteUser(String username) async + test('test deleteUser', () async { + + }); + + // Get user by user name + // + // + // + //Future getUserByName(String username) async + test('test getUserByName', () async { + + }); + + // Logs user into the system + // + // + // + //Future loginUser(String username, String password) async + test('test loginUser', () async { + + }); + + // Logs out current logged in user session + // + // + // + //Future logoutUser() async + test('test logoutUser', () async { + + }); + + // Updated user + // + // This can only be done by the logged in user. + // + //Future updateUser(String username, User user) async + test('test updateUser', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value/test/user_test.dart b/samples/client/echo_api/dart/dio/built_value/test/user_test.dart new file mode 100644 index 000000000000..a396d8769c1f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value/test/user_test.dart @@ -0,0 +1,52 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for User +void main() { + final instance = UserBuilder(); + // add properties to the builder and call build() + + group(User, () { + // int id + test('to test the property `id`', () async { + + }); + + // String username + test('to test the property `username`', () async { + + }); + + // String firstName + test('to test the property `firstName`', () async { + + }); + + // String lastName + test('to test the property `lastName`', () async { + + }); + + // String email + test('to test the property `email`', () async { + + }); + + // String password + test('to test the property `password`', () async { + + }); + + // String phone + test('to test the property `phone`', () async { + + }); + + // User Status + // int userStatus + test('to test the property `userStatus`', () async { + + }); + + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value_tests/.gitignore b/samples/client/echo_api/dart/dio/built_value_tests/.gitignore new file mode 100644 index 000000000000..378eac25d311 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value_tests/.gitignore @@ -0,0 +1 @@ +build diff --git a/samples/client/echo_api/dart/dio/built_value_tests/README.md b/samples/client/echo_api/dart/dio/built_value_tests/README.md new file mode 100644 index 000000000000..231f1b1ae97c --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value_tests/README.md @@ -0,0 +1,6 @@ +# Manual tests for Dart-Next (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/client/echo_api/dart/dio/built_value_tests/analysis_options.yaml b/samples/client/echo_api/dart/dio/built_value_tests/analysis_options.yaml new file mode 100644 index 000000000000..4fbcc289dd3f --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value_tests/analysis_options.yaml @@ -0,0 +1,5 @@ +analyzer: + language: + strict-inference: true + strict-raw-types: true + strict-casts: true \ No newline at end of file diff --git a/samples/client/echo_api/dart/dio/built_value_tests/pubspec.yaml b/samples/client/echo_api/dart/dio/built_value_tests/pubspec.yaml new file mode 100644 index 000000000000..f362824c092c --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value_tests/pubspec.yaml @@ -0,0 +1,18 @@ +name: built_value_tests +version: 1.0.0 +description: OpenAPI API Dart DIO client tests for petstore_client_lib_fake + +publish_to: none + +environment: + sdk: '>=2.15.0 <3.0.0' + +dev_dependencies: + built_collection: ^5.1.1 + built_value: ^8.4.3 + dio: ^5.0.0 + http_mock_adapter: ^0.4.2 + mockito: ^5.2.0 + openapi: + path: ../built_value + test: ^1.21.0 diff --git a/samples/client/echo_api/dart/dio/built_value_tests/puby.yaml b/samples/client/echo_api/dart/dio/built_value_tests/puby.yaml new file mode 100644 index 000000000000..64080c7e80a2 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value_tests/puby.yaml @@ -0,0 +1,3 @@ +exclude: + - test + - pub run build_runner \ No newline at end of file diff --git a/samples/client/echo_api/dart/dio/built_value_tests/test/api/authentication_test.dart b/samples/client/echo_api/dart/dio/built_value_tests/test/api/authentication_test.dart new file mode 100644 index 000000000000..5ecf0a91cee7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value_tests/test/api/authentication_test.dart @@ -0,0 +1,92 @@ +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() { + late Openapi client; + late DioAdapter tester; + + setUp(() { + client = Openapi(dio: Dio()); + tester = DioAdapter(dio: client.dio); + }); + + tearDown(() { + tester.close(); + }); + + group('Authentication', () { + test('http_basic', () async { + client.setBasicAuth('http_basic_test', 'foo', 'bar'); + + tester.onPost( + '/fake', + (server) => server.reply(200, null), + data: { + 'number': '1', + 'double': '1.1', + 'pattern_without_delimiter': 'pattern', + 'byte': '1', + }, + headers: { + 'content-type': 'application/x-www-form-urlencoded', + 'content-length': Matchers.integer, + 'authorization': Matchers.string, + }, + ); + + final response = await client.getFakeApi().testEndpointParameters( + number: 1, + double_: 1.1, + patternWithoutDelimiter: 'pattern', + byte: '1', + ); + + expect(response.statusCode, 200); + }); + + test('bearer', () async { + client.setBearerAuth('bearer_test', 'foobar'); + + tester.onDelete( + '/fake', + (server) => server.reply(200, null), + headers: { + 'required_boolean_group': 'false', + 'authorization': Matchers.pattern('Bearer foobar'), + }, + queryParameters: { + 'required_string_group': 1, + 'required_int64_group': 2, + }, + ); + + final response = await client.getFakeApi().testGroupParameters( + requiredStringGroup: 1, + requiredBooleanGroup: false, + requiredInt64Group: 2, + ); + + expect(response.statusCode, 200); + }); + + test('api_key', () async { + client.setApiKey('api_key', 'SECRET_API_KEY'); + + tester.onGet( + '/store/inventory', + (server) => server.reply(200, { + 'foo': 999, + }), + headers: { + 'api_key': 'SECRET_API_KEY', + }, + ); + + final response = await client.getStoreApi().getInventory(); + + expect(response.statusCode, 200); + }); + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value_tests/test/api/fake_api_test.dart b/samples/client/echo_api/dart/dio/built_value_tests/test/api/fake_api_test.dart new file mode 100644 index 000000000000..ece30683b581 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value_tests/test/api/fake_api_test.dart @@ -0,0 +1,193 @@ +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() { + late Openapi client; + late DioAdapter tester; + + setUp(() { + client = Openapi(dio: Dio()); + tester = DioAdapter(dio: client.dio); + }); + + tearDown(() { + tester.close(); + }); + + group(FakeApi, () { + group('testEndpointParameters', () { + test('complete', () async { + tester.onPost( + '/fake', + (server) => server.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-11', + 'dateTime': '2020-08-11T12:30:55.123Z', + 'binary': '[0, 1, 2, 3, 4, 5]', + }, + 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: Date(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 { + tester.onPost( + '/fake', + (server) => server.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 + tester.onGet( + '/fake', + (server) => server.reply(200, null), + data: { + 'enum_form_string': 'formString', + 'enum_form_string_array': Matchers.listParam( + ListParam( + ['foo', 'bar'], + ListFormat.csv, + ), + ), + }, + queryParameters: { + 'enum_query_string': '-efg', + }, + headers: { + 'enum_header_string': '-efg', + 'content-type': 'application/x-www-form-urlencoded', + 'content-length': Matchers.integer, + }, + ); + + final response = await client.getFakeApi().testEnumParameters( + enumFormString: 'formString', + enumFormStringArray: ListBuilder( + ['foo', 'bar'], + ).build(), + ); + + expect(response.statusCode, 200); + }); + + test('in query parameters', () async { + tester.onGet( + '/fake', + (server) => server.reply(200, null), + queryParameters: { + 'enum_query_string_array': Matchers.listParam( + ListParam( + ['a', 'b', 'c'], + ListFormat.multi, + ), + ), + 'enum_query_model_array': Matchers.listParam( + ListParam( + ['_abc', '-efg'], + ListFormat.multi, + ), + ), + 'enum_query_string': 'foo', + 'enum_query_double': 1.23, + 'enum_query_integer': 42, + }, + headers: { + 'enum_header_string': '-efg', + 'content-type': 'application/x-www-form-urlencoded', + }, + data: {}, + ); + + final response = await client.getFakeApi().testEnumParameters( + enumQueryStringArray: ListBuilder( + ['a', 'b', 'c'], + ).build(), + enumQueryModelArray: ListBuilder( + [ModelEnumClass.abc, ModelEnumClass.efg], + ).build(), + enumQueryString: 'foo', + enumQueryDouble: 1.23, + enumQueryInteger: 42, + ); + + expect(response.statusCode, 200); + }); + + test('in header parameters', () async { + tester.onGet( + '/fake', + (server) => server.reply(200, null), + headers: { + 'enum_header_string': 'foo', + 'enum_header_string_array': '[a, b, c]', + 'content-type': 'application/x-www-form-urlencoded', + }, + data: {}, + ); + + final response = await client.getFakeApi().testEnumParameters( + enumHeaderStringArray: ListBuilder( + ['a', 'b', 'c'], + ).build(), + enumHeaderString: 'foo', + ); + + expect(response.statusCode, 200); + }); + }); + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value_tests/test/api/pet_api_test.dart b/samples/client/echo_api/dart/dio/built_value_tests/test/api/pet_api_test.dart new file mode 100644 index 000000000000..74a3a319ac6e --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value_tests/test/api/pet_api_test.dart @@ -0,0 +1,298 @@ +import 'package:built_collection/built_collection.dart'; +import 'package:dio/dio.dart'; +import 'package:http_mock_adapter/http_mock_adapter.dart'; +import 'package:http_parser/http_parser.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'; + + late Openapi client; + late DioAdapter tester; + + setUp(() { + client = Openapi(dio: Dio()); + tester = DioAdapter(dio: client.dio); + }); + + tearDown(() { + tester.close(); + }); + + group(PetApi, () { + group('getPetById', () { + test('complete', () async { + tester.onGet( + '/pet/5', + (server) => server.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', + }, + ] + }), + ); + + 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, hasLength(2)); + expect(response.data!.tags, hasLength(2)); + }); + + test('minimal', () async { + tester.onGet( + '/pet/5', + (server) => server.reply(200, { + 'id': 5, + 'name': 'Paula', + 'photoUrls': [], + }), + ); + + 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 { + tester.onPost( + '/pet', + (server) => server.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 { + tester.onPost( + '/pet', + (server) => server.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 { + tester.onRoute( + '/pet/findByStatus', + (server) => server.reply(200, [ + { + 'id': 5, + 'name': 'Paula', + 'status': 'sold', + 'photoUrls': [], + }, + { + 'id': 1, + 'name': 'Mickey', + 'status': 'available', + 'photoUrls': [], + }, + ]), + request: Request( + method: RequestMethods.get, + queryParameters: { + 'status': Matchers.listParam( + ListParam( + ['available', 'sold'], + ListFormat.csv, + ), + ), + }, + ), + ); + + final response = await client.getPetApi().findPetsByStatus( + // ignore: deprecated_member_use + status: ListBuilder([ + PetStatusEnum.available, + PetStatusEnum.sold, + ]).build(), + ); + + expect(response.statusCode, 200); + expect(response.data, isNotNull); + expect(response.data, hasLength(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); + }); + }); + + group('uploadFile', () { + test('uploadFileWithRequiredFile', () async { + final file = MultipartFile.fromBytes( + [1, 2, 3, 4], + filename: 'test.png', + contentType: MediaType.parse('image/png'), + ); + + tester.onRoute( + '/fake/5/uploadImageWithRequiredFile', + (server) => server.reply(200, { + 'code': 200, + 'type': 'success', + 'message': 'File uploaded', + }), + request: Request( + method: RequestMethods.post, + headers: { + Headers.contentTypeHeader: + Matchers.pattern('multipart/form-data'), + Headers.contentLengthHeader: Matchers.integer, + }, + data: Matchers.formData( + FormData.fromMap({ + r'requiredFile': file, + }), + ), + ), + ); + final response = await client.getPetApi().uploadFileWithRequiredFile( + petId: 5, + requiredFile: file, + ); + + expect(response.statusCode, 200); + expect(response.data?.message, 'File uploaded'); + }); + + test('uploadFileWithRequiredFile & additionalMetadata', () async { + final file = MultipartFile.fromBytes( + [1, 2, 3, 4], + filename: 'test.png', + contentType: MediaType.parse('image/png'), + ); + + tester.onRoute( + '/fake/3/uploadImageWithRequiredFile', + (server) => server.reply(200, { + 'code': 200, + 'type': 'success', + 'message': 'File uploaded', + }), + request: Request( + method: RequestMethods.post, + headers: { + Headers.contentTypeHeader: + Matchers.pattern('multipart/form-data'), + Headers.contentLengthHeader: Matchers.integer, + }, + data: Matchers.formData( + FormData.fromMap({ + 'additionalMetadata': 'foo', + r'requiredFile': file, + }), + ), + ), + ); + final response = await client.getPetApi().uploadFileWithRequiredFile( + petId: 3, + requiredFile: file, + additionalMetadata: 'foo', + ); + + expect(response.statusCode, 200); + expect(response.data?.message, 'File uploaded'); + }); + }); + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value_tests/test/api/store_api_test.dart b/samples/client/echo_api/dart/dio/built_value_tests/test/api/store_api_test.dart new file mode 100644 index 000000000000..5b233485f9a3 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value_tests/test/api/store_api_test.dart @@ -0,0 +1,37 @@ +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() { + late Openapi client; + late DioAdapter tester; + + setUp(() { + client = Openapi(dio: Dio()); + tester = DioAdapter(dio: client.dio); + }); + + tearDown(() { + tester.close(); + }); + + group(StoreApi, () { + test('getInventory', () async { + tester.onGet( + '/store/inventory', + (server) => server.reply(200, { + 'foo': 5, + 'bar': 999, + 'baz': 0, + }), + ); + + final response = await client.getStoreApi().getInventory(); + + expect(response.statusCode, 200); + expect(response.data, isNotNull); + expect(response.data, hasLength(3)); + }); + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value_tests/test/api_util_test.dart b/samples/client/echo_api/dart/dio/built_value_tests/test/api_util_test.dart new file mode 100644 index 000000000000..8b008ef6c5cc --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value_tests/test/api_util_test.dart @@ -0,0 +1,353 @@ +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', () { + final repository = BuiltValueJsonRepository(standardSerializers); + group('encodeQueryParameter should encode', () { + group('String enum', () { + test('empty String for null', () { + expect( + encodeQueryParameter( + repository, + null, + const TypeInfo(ModelEnumClass), + ), + '', + ); + }); + + test('correct String for value', () { + expect( + encodeQueryParameter( + repository, + ModelEnumClass.leftParenthesisXyzRightParenthesis, + const TypeInfo(ModelEnumClass), + ), + '(xyz)', + ); + }); + }); + + group('int enum', () { + test('empty String for null', () { + expect( + encodeQueryParameter( + repository, + null, + const TypeInfo(EnumTestEnumIntegerEnum), + ), + '', + ); + }); + + test('correct int for value', () { + expect( + encodeQueryParameter( + repository, + EnumTestEnumIntegerEnum.numberNegative1, + const TypeInfo(EnumTestEnumIntegerEnum), + ), + -1, + ); + }); + }); + }); + + group('encodeCollectionQueryParameter should encode', () { + final serializers = (standardSerializers.toBuilder() + ..addBuilderFactory( + const FullType(BuiltList, [FullType(ModelEnumClass)]), + () => ListBuilder(), + ) + ..addBuilderFactory( + const FullType(BuiltList, [FullType(EnumTestEnumIntegerEnum)]), + () => ListBuilder(), + )) + .build(); + final repository = BuiltValueJsonRepository(serializers); + group('String enum', () { + test('empty ListParam for empty list', () { + final param = encodeCollectionQueryParameter( + repository, + [].build(), + const TypeInfo(BuiltList, [TypeInfo(ModelEnumClass)]), + ); + + expect(param.value, isEmpty); + expect(param.format, ListFormat.multi); + }); + + test('correct ListParam for value', () { + final param = encodeCollectionQueryParameter( + repository, + [ + ModelEnumClass.leftParenthesisXyzRightParenthesis, + ModelEnumClass.efg, + ].build(), + const TypeInfo(BuiltList, [TypeInfo(ModelEnumClass)]), + ); + + expect(param.value, hasLength(2)); + expect(param.value, containsAll(['-efg', '(xyz)'])); + expect(param.format, ListFormat.multi); + }); + }); + + group('int enum', () { + test('empty ListParam for empty list', () { + final param = encodeCollectionQueryParameter( + repository, + [].build(), + const TypeInfo(BuiltList, [TypeInfo(EnumTestEnumIntegerEnum)]), + ); + + expect(param.value, isEmpty); + expect(param.format, ListFormat.multi); + }); + + test('correct ListParam for value', () { + final param = encodeCollectionQueryParameter( + repository, + [ + EnumTestEnumIntegerEnum.number1, + EnumTestEnumIntegerEnum.numberNegative1, + ].build(), + const TypeInfo(BuiltList, [TypeInfo(EnumTestEnumIntegerEnum)]), + ); + + expect(param.value, hasLength(2)); + expect(param.value, containsAll([1, -1])); + expect(param.format, ListFormat.multi); + }); + }); + }); + + group('encodeFormParameter should return', () { + test('empty String for null', () { + expect( + encodeFormParameter( + repository, + null, + const TypeInfo(Cat), + ), + '', + ); + }); + + test('String for String', () { + expect( + encodeFormParameter( + repository, + 'foo', + const TypeInfo(String), + ), + 'foo', + ); + }); + + test('List for BuiltList', () { + expect( + encodeFormParameter( + repository, + ListBuilder(['foo', 'bar', 'baz']).build(), + const TypeInfo(BuiltList, [TypeInfo(String)]), + ), + ['foo', 'bar', 'baz'], + ); + }); + + test('Map for BuiltList', () { + expect( + encodeFormParameter( + repository, + MapBuilder({ + 'foo': 'foo-value', + 'bar': 'bar-value', + 'baz': 'baz-value', + }).build(), + const TypeInfo(BuiltMap, [TypeInfo(String), TypeInfo(String)]), + ), + { + 'foo': 'foo-value', + 'bar': 'bar-value', + 'baz': 'baz-value', + }, + ); + }); + + test('num for num', () { + expect( + encodeFormParameter(repository, 0, const TypeInfo(int)), + 0, + ); + expect( + encodeFormParameter(repository, 1, const TypeInfo(int)), + 1, + ); + expect( + encodeFormParameter(repository, 1.0, const TypeInfo(num)), + 1.0, + ); + expect( + encodeFormParameter(repository, 1.234, const TypeInfo(double)), + 1.234, + ); + }); + + test('List for BuiltList', () { + expect( + encodeFormParameter( + repository, + ListBuilder([0, 1, 2, 3, 4.5, -123.456]).build(), + const TypeInfo(BuiltList, [TypeInfo(num)]), + ), + [0, 1, 2, 3, 4.5, -123.456], + ); + }); + + test('bool for bool', () { + expect( + encodeFormParameter( + repository, + true, + const TypeInfo(bool), + ), + true, + ); + expect( + encodeFormParameter( + repository, + false, + const TypeInfo(bool), + ), + false, + ); + }); + + test('String for Date', () { + expect( + encodeFormParameter( + repository, + DateTime.utc(2020, 8, 11), + const TypeInfo(DateTime), + ), + '2020-08-11T00:00:00.000Z', + ); + }); + + test('String for DateTime', () { + expect( + encodeFormParameter( + repository, + DateTime.utc(2020, 8, 11, 12, 30, 55, 123), + const TypeInfo(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( + repository, + (CatBuilder() + ..color = 'black' + ..className = 'cat' + ..declawed = false) + .build(), + const TypeInfo(Cat), + ), + equals({ + "className": "cat", + "color": "black", + "declawed": false, + }), + ); + }); + }); + + test('encodes FormData correctly', () { + final data = FormData.fromMap({ + 'null': encodeFormParameter( + repository, + null, + const TypeInfo(num), + ), + 'empty': encodeFormParameter( + repository, + '', + const TypeInfo(String), + ), + 'string_list': encodeFormParameter( + repository, + ListBuilder(['foo', 'bar', 'baz']).build(), + const TypeInfo(BuiltList, [TypeInfo(String)]), + ), + 'num_list': encodeFormParameter( + repository, + ListBuilder([0, 1, 2, 3, 4.5, -123.456]).build(), + const TypeInfo(BuiltList, [TypeInfo(num)]), + ), + 'string_map': encodeFormParameter( + repository, + MapBuilder({ + 'foo': 'foo-value', + 'bar': 'bar-value', + 'baz': 'baz-value', + }).build(), + const TypeInfo(BuiltMap, [TypeInfo(String), TypeInfo(String)]), + ), + 'bool': encodeFormParameter( + repository, + true, + const TypeInfo(bool), + ), + 'double': encodeFormParameter( + repository, + -123.456, + const TypeInfo(double), + ), + 'date_time': encodeFormParameter( + repository, + DateTime.utc(2020, 8, 11, 12, 30, 55, 123), + const TypeInfo(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/client/echo_api/dart/dio/built_value_tests/test/model/date_serializer_test.dart b/samples/client/echo_api/dart/dio/built_value_tests/test/model/date_serializer_test.dart new file mode 100644 index 000000000000..22eb27f392c6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value_tests/test/model/date_serializer_test.dart @@ -0,0 +1,30 @@ +import 'package:openapi/openapi.dart'; +import 'package:test/test.dart'; + +void main() { + final date1 = Date(1999, 3, 25); + const serializer = DateSerializer(); + + group(DateSerializer, () { + test('serialize', () { + expect( + serializer.serialize(serializers, date1), + '1999-03-25', + ); + }); + + test('deserialize date', () { + expect( + serializer.deserialize(serializers, '1999-03-25'), + date1, + ); + }); + + test('deserialize ISO', () { + expect( + serializer.deserialize(serializers, '1999-03-25T12:30:55.123Z'), + date1, + ); + }); + }); +} diff --git a/samples/client/echo_api/dart/dio/built_value_tests/test/model/date_test.dart b/samples/client/echo_api/dart/dio/built_value_tests/test/model/date_test.dart new file mode 100644 index 000000000000..34675bd672e1 --- /dev/null +++ b/samples/client/echo_api/dart/dio/built_value_tests/test/model/date_test.dart @@ -0,0 +1,25 @@ +import 'package:openapi/openapi.dart'; +import 'package:test/test.dart'; + +void main() { + final date1 = Date(1999, 3, 25); + final date2 = Date(1999, 1, 1); + + group(Date, () { + test('toString', () { + expect(date1.toString(), '1999-03-25'); + }); + + test('compare >', () { + expect(date1.compareTo(date2), 1); + }); + + test('compare <', () { + expect(date2.compareTo(date1), -1); + }); + + test('compare =', () { + expect(date1.compareTo(date1), 0); + }); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/.gitignore b/samples/client/echo_api/dart/dio/json_serializable/.gitignore new file mode 100644 index 000000000000..4298cdcbd1a2 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/.gitignore @@ -0,0 +1,41 @@ +# 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: + +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ + +# Mac +.DS_Store diff --git a/samples/client/echo_api/dart/dio/json_serializable/.openapi-generator-ignore b/samples/client/echo_api/dart/dio/json_serializable/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/echo_api/dart/dio/json_serializable/.openapi-generator/FILES b/samples/client/echo_api/dart/dio/json_serializable/.openapi-generator/FILES new file mode 100644 index 000000000000..dc5ad8e27cc4 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/.openapi-generator/FILES @@ -0,0 +1,236 @@ +.gitignore +README.md +analysis_options.yaml +build.yaml +doc/AdditionalPropertiesClass.md +doc/Addressable.md +doc/AllOfWithSingleRef.md +doc/Animal.md +doc/AnotherFakeApi.md +doc/ApiResponse.md +doc/Apple.md +doc/AppleAllOfDisc.md +doc/AppleGrandparentDisc.md +doc/AppleOneOfDisc.md +doc/AppleReqDisc.md +doc/AppleVariant1.md +doc/ArrayOfArrayOfNumberOnly.md +doc/ArrayOfNumberOnly.md +doc/ArrayTest.md +doc/Banana.md +doc/BananaAllOfDisc.md +doc/BananaGrandparentDisc.md +doc/BananaOneOfDisc.md +doc/BananaReqDisc.md +doc/Bar.md +doc/BarApi.md +doc/BarCreate.md +doc/BarRef.md +doc/BarRefOrValue.md +doc/Capitalization.md +doc/Cat.md +doc/Category.md +doc/ClassModel.md +doc/ComposedDiscMissingFromProperties.md +doc/ComposedDiscOptionalTypeCorrect.md +doc/ComposedDiscOptionalTypeInconsistent.md +doc/ComposedDiscOptionalTypeIncorrect.md +doc/ComposedDiscRequiredInconsistent.md +doc/ComposedDiscTypeInconsistent.md +doc/ComposedDiscTypeIncorrect.md +doc/DefaultApi.md +doc/DeprecatedObject.md +doc/DiscMissingFromProperties.md +doc/DiscOptionalTypeCorrect.md +doc/DiscOptionalTypeIncorrect.md +doc/DiscTypeIncorrect.md +doc/Dog.md +doc/Entity.md +doc/EntityRef.md +doc/EnumArrays.md +doc/EnumTest.md +doc/Extensible.md +doc/FakeApi.md +doc/FakeClassnameTags123Api.md +doc/FileSchemaTestClass.md +doc/Foo.md +doc/FooApi.md +doc/FooBasicGetDefaultResponse.md +doc/FooRef.md +doc/FooRefOrValue.md +doc/FormatTest.md +doc/Fruit.md +doc/FruitAllOfDisc.md +doc/FruitAnyOfDisc.md +doc/FruitGrandparentDisc.md +doc/FruitInlineDisc.md +doc/FruitInlineDiscOneOf.md +doc/FruitInlineDiscOneOf1.md +doc/FruitInlineInlineDisc.md +doc/FruitInlineInlineDiscOneOf.md +doc/FruitInlineInlineDiscOneOf1.md +doc/FruitInlineInlineDiscOneOfOneOf.md +doc/FruitOneOfDisc.md +doc/FruitReqDisc.md +doc/FruitType.md +doc/FruitVariant1.md +doc/GigaOneOf.md +doc/GrapeVariant1.md +doc/HasOnlyReadOnly.md +doc/HealthCheckResult.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/ObjectWithDeprecatedFields.md +doc/OneOfPrimitiveChild.md +doc/Order.md +doc/OuterComposite.md +doc/OuterEnum.md +doc/OuterEnumDefaultValue.md +doc/OuterEnumInteger.md +doc/OuterEnumIntegerDefaultValue.md +doc/OuterObjectWithEnumProperty.md +doc/Parent.md +doc/Pasta.md +doc/Pet.md +doc/PetApi.md +doc/Pizza.md +doc/PizzaSpeziale.md +doc/ReadOnlyFirst.md +doc/SingleRefType.md +doc/SpecialModelName.md +doc/StoreApi.md +doc/Tag.md +doc/User.md +doc/UserApi.md +lib/apis.dart +lib/models.dart +lib/openapi.dart +lib/src/api/another_fake_api.dart +lib/src/api/bar_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/foo_api.dart +lib/src/api/pet_api.dart +lib/src/api/store_api.dart +lib/src/api/user_api.dart +lib/src/api_client.dart +lib/src/api_util.dart +lib/src/auth/_exports.dart +lib/src/auth/api_key_auth.dart +lib/src/auth/auth.dart +lib/src/auth/basic_auth.dart +lib/src/auth/bearer_auth.dart +lib/src/auth/oauth.dart +lib/src/model/additional_properties_class.dart +lib/src/model/addressable.dart +lib/src/model/all_of_with_single_ref.dart +lib/src/model/animal.dart +lib/src/model/api_response.dart +lib/src/model/apple.dart +lib/src/model/apple_all_of_disc.dart +lib/src/model/apple_grandparent_disc.dart +lib/src/model/apple_one_of_disc.dart +lib/src/model/apple_req_disc.dart +lib/src/model/apple_variant1.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/banana.dart +lib/src/model/banana_all_of_disc.dart +lib/src/model/banana_grandparent_disc.dart +lib/src/model/banana_one_of_disc.dart +lib/src/model/banana_req_disc.dart +lib/src/model/bar.dart +lib/src/model/bar_create.dart +lib/src/model/bar_ref.dart +lib/src/model/bar_ref_or_value.dart +lib/src/model/capitalization.dart +lib/src/model/cat.dart +lib/src/model/category.dart +lib/src/model/class_model.dart +lib/src/model/composed_disc_missing_from_properties.dart +lib/src/model/composed_disc_optional_type_correct.dart +lib/src/model/composed_disc_optional_type_inconsistent.dart +lib/src/model/composed_disc_optional_type_incorrect.dart +lib/src/model/composed_disc_required_inconsistent.dart +lib/src/model/composed_disc_type_inconsistent.dart +lib/src/model/composed_disc_type_incorrect.dart +lib/src/model/deprecated_object.dart +lib/src/model/disc_missing_from_properties.dart +lib/src/model/disc_optional_type_correct.dart +lib/src/model/disc_optional_type_incorrect.dart +lib/src/model/disc_type_incorrect.dart +lib/src/model/dog.dart +lib/src/model/entity.dart +lib/src/model/entity_ref.dart +lib/src/model/enum_arrays.dart +lib/src/model/enum_test.dart +lib/src/model/extensible.dart +lib/src/model/file_schema_test_class.dart +lib/src/model/foo.dart +lib/src/model/foo_basic_get_default_response.dart +lib/src/model/foo_ref.dart +lib/src/model/foo_ref_or_value.dart +lib/src/model/format_test.dart +lib/src/model/fruit.dart +lib/src/model/fruit_all_of_disc.dart +lib/src/model/fruit_any_of_disc.dart +lib/src/model/fruit_grandparent_disc.dart +lib/src/model/fruit_inline_disc.dart +lib/src/model/fruit_inline_disc_one_of.dart +lib/src/model/fruit_inline_disc_one_of1.dart +lib/src/model/fruit_inline_inline_disc.dart +lib/src/model/fruit_inline_inline_disc_one_of.dart +lib/src/model/fruit_inline_inline_disc_one_of1.dart +lib/src/model/fruit_inline_inline_disc_one_of_one_of.dart +lib/src/model/fruit_one_of_disc.dart +lib/src/model/fruit_req_disc.dart +lib/src/model/fruit_type.dart +lib/src/model/fruit_variant1.dart +lib/src/model/giga_one_of.dart +lib/src/model/grape_variant1.dart +lib/src/model/has_only_read_only.dart +lib/src/model/health_check_result.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/object_with_deprecated_fields.dart +lib/src/model/one_of_primitive_child.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/parent.dart +lib/src/model/pasta.dart +lib/src/model/pet.dart +lib/src/model/pizza.dart +lib/src/model/pizza_speziale.dart +lib/src/model/read_only_first.dart +lib/src/model/single_ref_type.dart +lib/src/model/special_model_name.dart +lib/src/model/tag.dart +lib/src/model/user.dart +lib/src/repository_base.dart +lib/src/repository_impl.dart +pubspec.yaml diff --git a/samples/client/echo_api/dart/dio/json_serializable/.openapi-generator/VERSION b/samples/client/echo_api/dart/dio/json_serializable/.openapi-generator/VERSION new file mode 100644 index 000000000000..757e67400401 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/echo_api/dart/dio/json_serializable/README.md b/samples/client/echo_api/dart/dio/json_serializable/README.md new file mode 100644 index 000000000000..9abc84c0be6f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/README.md @@ -0,0 +1,264 @@ +# 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.DartNextClientCodegen + +## Requirements + +* Dart 2.15.0+ or Flutter 2.8.0+ +* Dio 5.0.0+ (https://pub.dev/packages/dio) +* JSON Serializable 6.1.5+ (https://pub.dev/packages/json_serializable) + +## Installation & Usage + +### pub.dev +To use the package from [pub.dev](https://pub.dev), please include the following in pubspec.yaml +```yaml +dependencies: + openapi: 1.0.0 +``` + +### Github +If this Dart package is published to Github, please include the following in pubspec.yaml +```yaml +dependencies: + openapi: + git: + url: https://github.com/GIT_USER_ID/GIT_REPO_ID.git + #ref: main +``` + +### Local development +To use the package from your local drive, please include the following in pubspec.yaml +```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 = Openapi().getAnotherFakeApi(); +final ModelClient modelClient = ; // ModelClient | client model + +try { + final response = await api.call123testSpecialTags(modelClient); + print(response); +} catch on DioException (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*](doc/AnotherFakeApi.md) | [**call123testSpecialTags**](doc/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +[*BarApi*](doc/BarApi.md) | [**createBar**](doc/BarApi.md#createbar) | **POST** /bar | Create a Bar +[*DefaultApi*](doc/DefaultApi.md) | [**fooBasicGet**](doc/DefaultApi.md#foobasicget) | **GET** /foo-basic | +[*DefaultApi*](doc/DefaultApi.md) | [**list**](doc/DefaultApi.md#list) | **GET** /oneof-primitive | +[*DefaultApi*](doc/DefaultApi.md) | [**oneofGet**](doc/DefaultApi.md#oneofget) | **GET** /oneof | +[*DefaultApi*](doc/DefaultApi.md) | [**test**](doc/DefaultApi.md#test) | **PUT** /variant1 | +[*DefaultApi*](doc/DefaultApi.md) | [**variant1Get**](doc/DefaultApi.md#variant1get) | **GET** /variant1 | +[*DefaultApi*](doc/DefaultApi.md) | [**variant2Get**](doc/DefaultApi.md#variant2get) | **GET** /variant2 | +[*FakeApi*](doc/FakeApi.md) | [**fakeHealthGet**](doc/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint +[*FakeApi*](doc/FakeApi.md) | [**fakeHttpSignatureTest**](doc/FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication +[*FakeApi*](doc/FakeApi.md) | [**fakeOuterBooleanSerialize**](doc/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +[*FakeApi*](doc/FakeApi.md) | [**fakeOuterCompositeSerialize**](doc/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +[*FakeApi*](doc/FakeApi.md) | [**fakeOuterNumberSerialize**](doc/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | +[*FakeApi*](doc/FakeApi.md) | [**fakeOuterStringSerialize**](doc/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +[*FakeApi*](doc/FakeApi.md) | [**fakePropertyEnumIntegerSerialize**](doc/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | +[*FakeApi*](doc/FakeApi.md) | [**testBodyWithBinary**](doc/FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | +[*FakeApi*](doc/FakeApi.md) | [**testBodyWithFileSchema**](doc/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | +[*FakeApi*](doc/FakeApi.md) | [**testBodyWithQueryParams**](doc/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | +[*FakeApi*](doc/FakeApi.md) | [**testClientModel**](doc/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model +[*FakeApi*](doc/FakeApi.md) | [**testEndpointParameters**](doc/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[*FakeApi*](doc/FakeApi.md) | [**testEnumParameters**](doc/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters +[*FakeApi*](doc/FakeApi.md) | [**testGroupParameters**](doc/FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[*FakeApi*](doc/FakeApi.md) | [**testInlineAdditionalProperties**](doc/FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[*FakeApi*](doc/FakeApi.md) | [**testJsonFormData**](doc/FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +[*FakeApi*](doc/FakeApi.md) | [**testQueryParameterCollectionFormat**](doc/FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | +[*FakeClassnameTags123Api*](doc/FakeClassnameTags123Api.md) | [**testClassname**](doc/FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case +[*FooApi*](doc/FooApi.md) | [**createFoo**](doc/FooApi.md#createfoo) | **POST** /foo | Create a Foo +[*FooApi*](doc/FooApi.md) | [**getAllFoos**](doc/FooApi.md#getallfoos) | **GET** /foo | GET all Foos +[*PetApi*](doc/PetApi.md) | [**addPet**](doc/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +[*PetApi*](doc/PetApi.md) | [**deletePet**](doc/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[*PetApi*](doc/PetApi.md) | [**findPetsByStatus**](doc/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +[*PetApi*](doc/PetApi.md) | [**findPetsByTags**](doc/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +[*PetApi*](doc/PetApi.md) | [**getPetById**](doc/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[*PetApi*](doc/PetApi.md) | [**updatePet**](doc/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +[*PetApi*](doc/PetApi.md) | [**updatePetWithForm**](doc/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +[*PetApi*](doc/PetApi.md) | [**uploadFile**](doc/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +[*PetApi*](doc/PetApi.md) | [**uploadFileWithRequiredFile**](doc/PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +[*StoreApi*](doc/StoreApi.md) | [**deleteOrder**](doc/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[*StoreApi*](doc/StoreApi.md) | [**getInventory**](doc/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[*StoreApi*](doc/StoreApi.md) | [**getOrderById**](doc/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID +[*StoreApi*](doc/StoreApi.md) | [**placeOrder**](doc/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet +[*UserApi*](doc/UserApi.md) | [**createUser**](doc/UserApi.md#createuser) | **POST** /user | Create user +[*UserApi*](doc/UserApi.md) | [**createUsersWithArrayInput**](doc/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +[*UserApi*](doc/UserApi.md) | [**createUsersWithListInput**](doc/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +[*UserApi*](doc/UserApi.md) | [**deleteUser**](doc/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +[*UserApi*](doc/UserApi.md) | [**getUserByName**](doc/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +[*UserApi*](doc/UserApi.md) | [**loginUser**](doc/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +[*UserApi*](doc/UserApi.md) | [**logoutUser**](doc/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +[*UserApi*](doc/UserApi.md) | [**updateUser**](doc/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + +## Documentation For Models + + - [AdditionalPropertiesClass](doc/AdditionalPropertiesClass.md) + - [Addressable](doc/Addressable.md) + - [AllOfWithSingleRef](doc/AllOfWithSingleRef.md) + - [Animal](doc/Animal.md) + - [ApiResponse](doc/ApiResponse.md) + - [Apple](doc/Apple.md) + - [AppleAllOfDisc](doc/AppleAllOfDisc.md) + - [AppleGrandparentDisc](doc/AppleGrandparentDisc.md) + - [AppleOneOfDisc](doc/AppleOneOfDisc.md) + - [AppleReqDisc](doc/AppleReqDisc.md) + - [AppleVariant1](doc/AppleVariant1.md) + - [ArrayOfArrayOfNumberOnly](doc/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](doc/ArrayOfNumberOnly.md) + - [ArrayTest](doc/ArrayTest.md) + - [Banana](doc/Banana.md) + - [BananaAllOfDisc](doc/BananaAllOfDisc.md) + - [BananaGrandparentDisc](doc/BananaGrandparentDisc.md) + - [BananaOneOfDisc](doc/BananaOneOfDisc.md) + - [BananaReqDisc](doc/BananaReqDisc.md) + - [Bar](doc/Bar.md) + - [BarCreate](doc/BarCreate.md) + - [BarRef](doc/BarRef.md) + - [BarRefOrValue](doc/BarRefOrValue.md) + - [Capitalization](doc/Capitalization.md) + - [Cat](doc/Cat.md) + - [Category](doc/Category.md) + - [ClassModel](doc/ClassModel.md) + - [ComposedDiscMissingFromProperties](doc/ComposedDiscMissingFromProperties.md) + - [ComposedDiscOptionalTypeCorrect](doc/ComposedDiscOptionalTypeCorrect.md) + - [ComposedDiscOptionalTypeInconsistent](doc/ComposedDiscOptionalTypeInconsistent.md) + - [ComposedDiscOptionalTypeIncorrect](doc/ComposedDiscOptionalTypeIncorrect.md) + - [ComposedDiscRequiredInconsistent](doc/ComposedDiscRequiredInconsistent.md) + - [ComposedDiscTypeInconsistent](doc/ComposedDiscTypeInconsistent.md) + - [ComposedDiscTypeIncorrect](doc/ComposedDiscTypeIncorrect.md) + - [DeprecatedObject](doc/DeprecatedObject.md) + - [DiscMissingFromProperties](doc/DiscMissingFromProperties.md) + - [DiscOptionalTypeCorrect](doc/DiscOptionalTypeCorrect.md) + - [DiscOptionalTypeIncorrect](doc/DiscOptionalTypeIncorrect.md) + - [DiscTypeIncorrect](doc/DiscTypeIncorrect.md) + - [Dog](doc/Dog.md) + - [Entity](doc/Entity.md) + - [EntityRef](doc/EntityRef.md) + - [EnumArrays](doc/EnumArrays.md) + - [EnumTest](doc/EnumTest.md) + - [Extensible](doc/Extensible.md) + - [FileSchemaTestClass](doc/FileSchemaTestClass.md) + - [Foo](doc/Foo.md) + - [FooBasicGetDefaultResponse](doc/FooBasicGetDefaultResponse.md) + - [FooRef](doc/FooRef.md) + - [FooRefOrValue](doc/FooRefOrValue.md) + - [FormatTest](doc/FormatTest.md) + - [Fruit](doc/Fruit.md) + - [FruitAllOfDisc](doc/FruitAllOfDisc.md) + - [FruitAnyOfDisc](doc/FruitAnyOfDisc.md) + - [FruitGrandparentDisc](doc/FruitGrandparentDisc.md) + - [FruitInlineDisc](doc/FruitInlineDisc.md) + - [FruitInlineDiscOneOf](doc/FruitInlineDiscOneOf.md) + - [FruitInlineDiscOneOf1](doc/FruitInlineDiscOneOf1.md) + - [FruitInlineInlineDisc](doc/FruitInlineInlineDisc.md) + - [FruitInlineInlineDiscOneOf](doc/FruitInlineInlineDiscOneOf.md) + - [FruitInlineInlineDiscOneOf1](doc/FruitInlineInlineDiscOneOf1.md) + - [FruitInlineInlineDiscOneOfOneOf](doc/FruitInlineInlineDiscOneOfOneOf.md) + - [FruitOneOfDisc](doc/FruitOneOfDisc.md) + - [FruitReqDisc](doc/FruitReqDisc.md) + - [FruitType](doc/FruitType.md) + - [FruitVariant1](doc/FruitVariant1.md) + - [GigaOneOf](doc/GigaOneOf.md) + - [GrapeVariant1](doc/GrapeVariant1.md) + - [HasOnlyReadOnly](doc/HasOnlyReadOnly.md) + - [HealthCheckResult](doc/HealthCheckResult.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) + - [ObjectWithDeprecatedFields](doc/ObjectWithDeprecatedFields.md) + - [OneOfPrimitiveChild](doc/OneOfPrimitiveChild.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) + - [Parent](doc/Parent.md) + - [Pasta](doc/Pasta.md) + - [Pet](doc/Pet.md) + - [Pizza](doc/Pizza.md) + - [PizzaSpeziale](doc/PizzaSpeziale.md) + - [ReadOnlyFirst](doc/ReadOnlyFirst.md) + - [SingleRefType](doc/SingleRefType.md) + - [SpecialModelName](doc/SpecialModelName.md) + - [Tag](doc/Tag.md) + - [User](doc/User.md) + + +## Documentation For Authorization + + +Authentication schemes defined for the API: +### 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 + +### 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 + +### http_basic_test + +- **Type**: HTTP basic authentication + +### bearer_test + +- **Type**: HTTP Bearer Token authentication (JWT) + +### http_signature_test + +- **Type**: HTTP signature authentication + + +## Author + + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/analysis_options.yaml b/samples/client/echo_api/dart/dio/json_serializable/analysis_options.yaml new file mode 100644 index 000000000000..2bb925d60c15 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/analysis_options.yaml @@ -0,0 +1,12 @@ +analyzer: + language: + strict-inference: true + strict-raw-types: true + strict-casts: true + exclude: + - lib/src/model/*.g.dart + errors: + deprecated_member_use_from_same_package: ignore + unused_import: ignore + unused_local_variable: ignore + unnecessary_import: ignore \ No newline at end of file diff --git a/samples/client/echo_api/dart/dio/json_serializable/build.yaml b/samples/client/echo_api/dart/dio/json_serializable/build.yaml new file mode 100644 index 000000000000..89a4dd6e1c2e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/build.yaml @@ -0,0 +1,18 @@ +targets: + $default: + builders: + json_serializable: + options: + # Options configure how source code is generated for every + # `@JsonSerializable`-annotated class in the package. + # + # The default value for each is listed. + any_map: false + checked: true + create_factory: true + create_to_json: true + disallow_unrecognized_keys: true + explicit_to_json: true + field_rename: none + ignore_unannotated: false + include_if_null: false diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/AdditionalPropertiesClass.md b/samples/client/echo_api/dart/dio/json_serializable/doc/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..c6a28464b698 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/AdditionalPropertiesClass.md @@ -0,0 +1,16 @@ +# openapi.model.AdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapProperty** | **Map<String, String>** | | [optional] +**mapOfMapProperty** | [**Map<String, Map<String, String>>**](Map.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/client/echo_api/dart/dio/json_serializable/doc/Addressable.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Addressable.md new file mode 100644 index 000000000000..d8b9beee9f52 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Addressable.md @@ -0,0 +1,16 @@ +# openapi.model.Addressable + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/AllOfWithSingleRef.md b/samples/client/echo_api/dart/dio/json_serializable/doc/AllOfWithSingleRef.md new file mode 100644 index 000000000000..b8c8c51c80af --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/AllOfWithSingleRef.md @@ -0,0 +1,16 @@ +# openapi.model.AllOfWithSingleRef + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **String** | | [optional] +**singleRefType** | [**SingleRefType**](SingleRefType.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/client/echo_api/dart/dio/json_serializable/doc/Animal.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Animal.md new file mode 100644 index 000000000000..df78e9937613 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Animal.md @@ -0,0 +1,16 @@ +# openapi.model.Animal + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/AnotherFakeApi.md b/samples/client/echo_api/dart/dio/json_serializable/doc/AnotherFakeApi.md new file mode 100644 index 000000000000..d45812aa3fde --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/AnotherFakeApi.md @@ -0,0 +1,57 @@ +# openapi.api.AnotherFakeApi + +## Load the API package +```dart +import 'package:openapi/openapi.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/openapi.dart'; + +final api = Openapi().getAnotherFakeApi(); +final ModelClient modelClient = ; // ModelClient | client model + +try { + final response = api.call123testSpecialTags(modelClient); + print(response); +} catch on DioException (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/client/echo_api/dart/dio/json_serializable/doc/ApiResponse.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ApiResponse.md new file mode 100644 index 000000000000..2928d50be81a --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ApiResponse.md @@ -0,0 +1,17 @@ +# openapi.model.ApiResponse + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/Apple.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Apple.md new file mode 100644 index 000000000000..14d4a3415182 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Apple.md @@ -0,0 +1,15 @@ +# openapi.model.Apple + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/AppleAllOfDisc.md b/samples/client/echo_api/dart/dio/json_serializable/doc/AppleAllOfDisc.md new file mode 100644 index 000000000000..0e7d4c990e48 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/AppleAllOfDisc.md @@ -0,0 +1,16 @@ +# openapi.model.AppleAllOfDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/AppleGrandparentDisc.md b/samples/client/echo_api/dart/dio/json_serializable/doc/AppleGrandparentDisc.md new file mode 100644 index 000000000000..41bb14fd764b --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/AppleGrandparentDisc.md @@ -0,0 +1,16 @@ +# openapi.model.AppleGrandparentDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/AppleOneOfDisc.md b/samples/client/echo_api/dart/dio/json_serializable/doc/AppleOneOfDisc.md new file mode 100644 index 000000000000..85eeb8a99eea --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/AppleOneOfDisc.md @@ -0,0 +1,16 @@ +# openapi.model.AppleOneOfDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/AppleReqDisc.md b/samples/client/echo_api/dart/dio/json_serializable/doc/AppleReqDisc.md new file mode 100644 index 000000000000..262c02ab50eb --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/AppleReqDisc.md @@ -0,0 +1,16 @@ +# openapi.model.AppleReqDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/AppleVariant1.md b/samples/client/echo_api/dart/dio/json_serializable/doc/AppleVariant1.md new file mode 100644 index 000000000000..82de5e6a492a --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/AppleVariant1.md @@ -0,0 +1,15 @@ +# openapi.model.AppleVariant1 + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/ArrayOfArrayOfNumberOnly.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..6c6a76f32432 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayArrayNumber** | [**List<List<num>>**](List.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/client/echo_api/dart/dio/json_serializable/doc/ArrayOfNumberOnly.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..26125cfaf8e8 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayNumber** | **List<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/client/echo_api/dart/dio/json_serializable/doc/ArrayTest.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ArrayTest.md new file mode 100644 index 000000000000..a4e7ff2bc79f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ArrayTest.md @@ -0,0 +1,17 @@ +# openapi.model.ArrayTest + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayOfString** | **List<String>** | | [optional] +**arrayArrayOfInteger** | [**List<List<int>>**](List.md) | | [optional] +**arrayArrayOfModel** | [**List<List<ReadOnlyFirst>>**](List.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/client/echo_api/dart/dio/json_serializable/doc/Banana.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Banana.md new file mode 100644 index 000000000000..cdae69466a61 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Banana.md @@ -0,0 +1,15 @@ +# openapi.model.Banana + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**count** | **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/client/echo_api/dart/dio/json_serializable/doc/BananaAllOfDisc.md b/samples/client/echo_api/dart/dio/json_serializable/doc/BananaAllOfDisc.md new file mode 100644 index 000000000000..668b2bf1af02 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/BananaAllOfDisc.md @@ -0,0 +1,16 @@ +# openapi.model.BananaAllOfDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/BananaGrandparentDisc.md b/samples/client/echo_api/dart/dio/json_serializable/doc/BananaGrandparentDisc.md new file mode 100644 index 000000000000..81bbb6cb54a6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/BananaGrandparentDisc.md @@ -0,0 +1,16 @@ +# openapi.model.BananaGrandparentDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/BananaOneOfDisc.md b/samples/client/echo_api/dart/dio/json_serializable/doc/BananaOneOfDisc.md new file mode 100644 index 000000000000..951cc5839179 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/BananaOneOfDisc.md @@ -0,0 +1,16 @@ +# openapi.model.BananaOneOfDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/BananaReqDisc.md b/samples/client/echo_api/dart/dio/json_serializable/doc/BananaReqDisc.md new file mode 100644 index 000000000000..574a3383916b --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/BananaReqDisc.md @@ -0,0 +1,16 @@ +# openapi.model.BananaReqDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/Bar.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Bar.md new file mode 100644 index 000000000000..e0668151935d --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Bar.md @@ -0,0 +1,22 @@ +# openapi.model.Bar + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**barPropA** | **String** | | [optional] +**fooPropB** | **String** | | [optional] +**foo** | [**FooRefOrValue**](FooRefOrValue.md) | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/json_serializable/doc/BarApi.md b/samples/client/echo_api/dart/dio/json_serializable/doc/BarApi.md new file mode 100644 index 000000000000..fd968c59c3ef --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/BarApi.md @@ -0,0 +1,55 @@ +# openapi.api.BarApi + +## Load the API package +```dart +import 'package:openapi/openapi.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createBar**](BarApi.md#createbar) | **POST** /bar | Create a Bar + + +# **createBar** +> Bar createBar(barCreate) + +Create a Bar + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getBarApi(); +final BarCreate barCreate = ; // BarCreate | + +try { + final response = api.createBar(barCreate); + print(response); +} catch on DioException (e) { + print('Exception when calling BarApi->createBar: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **barCreate** | [**BarCreate**](BarCreate.md)| | + +### Return type + +[**Bar**](Bar.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/client/echo_api/dart/dio/json_serializable/doc/BarCreate.md b/samples/client/echo_api/dart/dio/json_serializable/doc/BarCreate.md new file mode 100644 index 000000000000..bb0dbfd55790 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/BarCreate.md @@ -0,0 +1,22 @@ +# openapi.model.BarCreate + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**barPropA** | **String** | | [optional] +**fooPropB** | **String** | | [optional] +**foo** | [**FooRefOrValue**](FooRefOrValue.md) | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/json_serializable/doc/BarRef.md b/samples/client/echo_api/dart/dio/json_serializable/doc/BarRef.md new file mode 100644 index 000000000000..b9eab1af1a9b --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/BarRef.md @@ -0,0 +1,19 @@ +# openapi.model.BarRef + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/json_serializable/doc/BarRefOrValue.md b/samples/client/echo_api/dart/dio/json_serializable/doc/BarRefOrValue.md new file mode 100644 index 000000000000..fea6617a3c12 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/BarRefOrValue.md @@ -0,0 +1,19 @@ +# openapi.model.BarRefOrValue + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/json_serializable/doc/Capitalization.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Capitalization.md new file mode 100644 index 000000000000..7e933ba524a7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Capitalization.md @@ -0,0 +1,20 @@ +# openapi.model.Capitalization + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/Cat.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Cat.md new file mode 100644 index 000000000000..b7998f19f95f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Cat.md @@ -0,0 +1,17 @@ +# openapi.model.Cat + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/Category.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Category.md new file mode 100644 index 000000000000..5e51f5aa35bc --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Category.md @@ -0,0 +1,16 @@ +# openapi.model.Category + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/ClassModel.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ClassModel.md new file mode 100644 index 000000000000..3b5171103272 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ClassModel.md @@ -0,0 +1,15 @@ +# openapi.model.ClassModel + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscMissingFromProperties.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscMissingFromProperties.md new file mode 100644 index 000000000000..4137cc1a0add --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscMissingFromProperties.md @@ -0,0 +1,15 @@ +# openapi.model.ComposedDiscMissingFromProperties + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **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/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscOptionalTypeCorrect.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscOptionalTypeCorrect.md new file mode 100644 index 000000000000..ab27d1c4473a --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscOptionalTypeCorrect.md @@ -0,0 +1,15 @@ +# openapi.model.ComposedDiscOptionalTypeCorrect + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscOptionalTypeInconsistent.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscOptionalTypeInconsistent.md new file mode 100644 index 000000000000..8c32b4c72b6b --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscOptionalTypeInconsistent.md @@ -0,0 +1,15 @@ +# openapi.model.ComposedDiscOptionalTypeInconsistent + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscOptionalTypeIncorrect.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscOptionalTypeIncorrect.md new file mode 100644 index 000000000000..4f0fab65accc --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscOptionalTypeIncorrect.md @@ -0,0 +1,15 @@ +# openapi.model.ComposedDiscOptionalTypeIncorrect + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **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/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscRequiredInconsistent.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscRequiredInconsistent.md new file mode 100644 index 000000000000..bc60f26b183c --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscRequiredInconsistent.md @@ -0,0 +1,15 @@ +# openapi.model.ComposedDiscRequiredInconsistent + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscTypeInconsistent.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscTypeInconsistent.md new file mode 100644 index 000000000000..0cdb9b880b9f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscTypeInconsistent.md @@ -0,0 +1,15 @@ +# openapi.model.ComposedDiscTypeInconsistent + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscTypeIncorrect.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscTypeIncorrect.md new file mode 100644 index 000000000000..8000df558df6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ComposedDiscTypeIncorrect.md @@ -0,0 +1,15 @@ +# openapi.model.ComposedDiscTypeIncorrect + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **int** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/DefaultApi.md b/samples/client/echo_api/dart/dio/json_serializable/doc/DefaultApi.md new file mode 100644 index 000000000000..98b18637fb2c --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/DefaultApi.md @@ -0,0 +1,244 @@ +# openapi.api.DefaultApi + +## Load the API package +```dart +import 'package:openapi/openapi.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fooBasicGet**](DefaultApi.md#foobasicget) | **GET** /foo-basic | +[**list**](DefaultApi.md#list) | **GET** /oneof-primitive | +[**oneofGet**](DefaultApi.md#oneofget) | **GET** /oneof | +[**test**](DefaultApi.md#test) | **PUT** /variant1 | +[**variant1Get**](DefaultApi.md#variant1get) | **GET** /variant1 | +[**variant2Get**](DefaultApi.md#variant2get) | **GET** /variant2 | + + +# **fooBasicGet** +> FooBasicGetDefaultResponse fooBasicGet() + + + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getDefaultApi(); + +try { + final response = api.fooBasicGet(); + print(response); +} catch on DioException (e) { + print('Exception when calling DefaultApi->fooBasicGet: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FooBasicGetDefaultResponse**](FooBasicGetDefaultResponse.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) + +# **list** +> GigaOneOf list() + + + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getDefaultApi(); + +try { + final response = api.list(); + print(response); +} catch on DioException (e) { + print('Exception when calling DefaultApi->list: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**GigaOneOf**](GigaOneOf.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) + +# **oneofGet** +> Fruit oneofGet() + + + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getDefaultApi(); + +try { + final response = api.oneofGet(); + print(response); +} catch on DioException (e) { + print('Exception when calling DefaultApi->oneofGet: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**Fruit**](Fruit.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) + +# **test** +> test(body) + + + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getDefaultApi(); +final Object body = ; // Object | + +try { + api.test(body); +} catch on DioException (e) { + print('Exception when calling DefaultApi->test: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Object**| | [optional] + +### 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) + +# **variant1Get** +> FruitVariant1 variant1Get() + + + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getDefaultApi(); + +try { + final response = api.variant1Get(); + print(response); +} catch on DioException (e) { + print('Exception when calling DefaultApi->variant1Get: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FruitVariant1**](FruitVariant1.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) + +# **variant2Get** +> FruitAllOfDisc variant2Get() + + + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getDefaultApi(); + +try { + final response = api.variant2Get(); + print(response); +} catch on DioException (e) { + print('Exception when calling DefaultApi->variant2Get: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FruitAllOfDisc**](FruitAllOfDisc.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/client/echo_api/dart/dio/json_serializable/doc/DeprecatedObject.md b/samples/client/echo_api/dart/dio/json_serializable/doc/DeprecatedObject.md new file mode 100644 index 000000000000..76215e98669f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/DeprecatedObject.md @@ -0,0 +1,15 @@ +# openapi.model.DeprecatedObject + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**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/client/echo_api/dart/dio/json_serializable/doc/DiscMissingFromProperties.md b/samples/client/echo_api/dart/dio/json_serializable/doc/DiscMissingFromProperties.md new file mode 100644 index 000000000000..c38a5c2b5226 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/DiscMissingFromProperties.md @@ -0,0 +1,15 @@ +# openapi.model.DiscMissingFromProperties + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **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/client/echo_api/dart/dio/json_serializable/doc/DiscOptionalTypeCorrect.md b/samples/client/echo_api/dart/dio/json_serializable/doc/DiscOptionalTypeCorrect.md new file mode 100644 index 000000000000..38601f552917 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/DiscOptionalTypeCorrect.md @@ -0,0 +1,15 @@ +# openapi.model.DiscOptionalTypeCorrect + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/DiscOptionalTypeIncorrect.md b/samples/client/echo_api/dart/dio/json_serializable/doc/DiscOptionalTypeIncorrect.md new file mode 100644 index 000000000000..b6787edea47b --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/DiscOptionalTypeIncorrect.md @@ -0,0 +1,15 @@ +# openapi.model.DiscOptionalTypeIncorrect + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **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/client/echo_api/dart/dio/json_serializable/doc/DiscTypeIncorrect.md b/samples/client/echo_api/dart/dio/json_serializable/doc/DiscTypeIncorrect.md new file mode 100644 index 000000000000..519a8e0333e7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/DiscTypeIncorrect.md @@ -0,0 +1,15 @@ +# openapi.model.DiscTypeIncorrect + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **int** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/Dog.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Dog.md new file mode 100644 index 000000000000..712ed082eb91 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Dog.md @@ -0,0 +1,17 @@ +# openapi.model.Dog + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/Entity.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Entity.md new file mode 100644 index 000000000000..ccf43340ed10 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Entity.md @@ -0,0 +1,19 @@ +# openapi.model.Entity + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/json_serializable/doc/EntityRef.md b/samples/client/echo_api/dart/dio/json_serializable/doc/EntityRef.md new file mode 100644 index 000000000000..6fad4884910f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/EntityRef.md @@ -0,0 +1,21 @@ +# openapi.model.EntityRef + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Name of the related entity. | [optional] +**atReferredType** | **String** | The actual type of the target instance when needed for disambiguation. | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/json_serializable/doc/EnumArrays.md b/samples/client/echo_api/dart/dio/json_serializable/doc/EnumArrays.md new file mode 100644 index 000000000000..a0652e36735a --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/EnumArrays.md @@ -0,0 +1,16 @@ +# openapi.model.EnumArrays + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justSymbol** | **String** | | [optional] +**arrayEnum** | **List<String>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/EnumTest.md b/samples/client/echo_api/dart/dio/json_serializable/doc/EnumTest.md new file mode 100644 index 000000000000..8dc105ee3146 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/EnumTest.md @@ -0,0 +1,22 @@ +# openapi.model.EnumTest + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/Extensible.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Extensible.md new file mode 100644 index 000000000000..76e8c3340955 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Extensible.md @@ -0,0 +1,17 @@ +# openapi.model.Extensible + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/json_serializable/doc/FakeApi.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FakeApi.md new file mode 100644 index 000000000000..4c08917075bc --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FakeApi.md @@ -0,0 +1,816 @@ +# openapi.api.FakeApi + +## Load the API package +```dart +import 'package:openapi/openapi.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 | +[**testBodyWithBinary**](FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | +[**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-parameters | + + +# **fakeHealthGet** +> HealthCheckResult fakeHealthGet() + +Health check endpoint + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getFakeApi(); + +try { + final response = api.fakeHealthGet(); + print(response); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store +final String query1 = query1_example; // String | query parameter +final String header1 = header1_example; // String | header parameter + +try { + api.fakeHttpSignatureTest(pet, query1, header1); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final bool body = true; // bool | Input boolean as post body + +try { + final response = api.fakeOuterBooleanSerialize(body); + print(response); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final OuterComposite outerComposite = ; // OuterComposite | Input composite as post body + +try { + final response = api.fakeOuterCompositeSerialize(outerComposite); + print(response); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final num body = 8.14; // num | Input number as post body + +try { + final response = api.fakeOuterNumberSerialize(body); + print(response); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final String body = body_example; // String | Input string as post body + +try { + final response = api.fakeOuterStringSerialize(body); + print(response); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final OuterObjectWithEnumProperty outerObjectWithEnumProperty = ; // OuterObjectWithEnumProperty | Input enum (int) as post body + +try { + final response = api.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty); + print(response); +} catch on DioException (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) + +# **testBodyWithBinary** +> testBodyWithBinary(body) + + + +For this test, the body has to be a binary file. + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getFakeApi(); +final MultipartFile body = BINARY_DATA_HERE; // MultipartFile | image to upload + +try { + api.testBodyWithBinary(body); +} catch on DioException (e) { + print('Exception when calling FakeApi->testBodyWithBinary: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **MultipartFile**| image to upload | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: image/png + - **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) + +# **testBodyWithFileSchema** +> testBodyWithFileSchema(fileSchemaTestClass) + + + +For this test, the body for this request must reference a schema named `File`. + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getFakeApi(); +final FileSchemaTestClass fileSchemaTestClass = ; // FileSchemaTestClass | + +try { + api.testBodyWithFileSchema(fileSchemaTestClass); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final String query = query_example; // String | +final User user = ; // User | + +try { + api.testBodyWithQueryParams(query, user); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final ModelClient modelClient = ; // ModelClient | client model + +try { + final response = api.testClientModel(modelClient); + print(response); +} catch on DioException (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/openapi.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'; + +final api = Openapi().getFakeApi(); +final num number = 8.14; // num | None +final double double_ = 1.2; // double | None +final String patternWithoutDelimiter = patternWithoutDelimiter_example; // String | None +final String byte = BYTE_ARRAY_DATA_HERE; // String | None +final int integer = 56; // int | None +final int int32 = 56; // int | None +final int int64 = 789; // int | None +final double float = 3.4; // double | None +final String string = string_example; // String | None +final MultipartFile binary = BINARY_DATA_HERE; // MultipartFile | None +final DateTime date = 2013-10-20; // DateTime | None +final DateTime dateTime = 2013-10-20T19:20:30+01:00; // DateTime | None +final String password = password_example; // String | None +final String callback = callback_example; // String | None + +try { + api.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); +} catch on DioException (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** | **MultipartFile**| 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, enumQueryModelArray, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getFakeApi(); +final List enumHeaderStringArray = ; // List | Header parameter enum test (string array) +final String enumHeaderString = enumHeaderString_example; // String | Header parameter enum test (string) +final List enumQueryStringArray = ; // List | Query parameter enum test (string array) +final String enumQueryString = enumQueryString_example; // String | Query parameter enum test (string) +final int enumQueryInteger = 56; // int | Query parameter enum test (double) +final double enumQueryDouble = 1.2; // double | Query parameter enum test (double) +final List enumQueryModelArray = ; // List | +final List enumFormStringArray = ; // List | Form parameter enum test (string array) +final String enumFormString = enumFormString_example; // String | Form parameter enum test (string) + +try { + api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString); +} catch on DioException (e) { + print('Exception when calling FakeApi->testEnumParameters: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] + **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to r'-efg'] + **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] + **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to r'-efg'] + **enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] + **enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] + **enumQueryModelArray** | [**List<ModelEnumClass>**](ModelEnumClass.md)| | [optional] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to r'$'] + **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to r'-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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final int requiredStringGroup = 56; // int | Required String in group parameters +final bool requiredBooleanGroup = true; // bool | Required Boolean in group parameters +final int requiredInt64Group = 789; // int | Required Integer in group parameters +final int stringGroup = 56; // int | String in group parameters +final bool booleanGroup = true; // bool | Boolean in group parameters +final int int64Group = 789; // int | Integer in group parameters + +try { + api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final Map requestBody = ; // Map | request body + +try { + api.testInlineAdditionalProperties(requestBody); +} catch on DioException (e) { + print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**Map<String, String>**](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/openapi.dart'; + +final api = Openapi().getFakeApi(); +final String param = param_example; // String | field1 +final String param2 = param2_example; // String | field2 + +try { + api.testJsonFormData(param, param2); +} catch on DioException (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, allowEmpty, language) + + + +To test the collection format in query parameters + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getFakeApi(); +final List pipe = ; // List | +final List ioutil = ; // List | +final List http = ; // List | +final List url = ; // List | +final List context = ; // List | +final String allowEmpty = allowEmpty_example; // String | +final Map language = ; // Map | + +try { + api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); +} catch on DioException (e) { + print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pipe** | [**List<String>**](String.md)| | + **ioutil** | [**List<String>**](String.md)| | + **http** | [**List<String>**](String.md)| | + **url** | [**List<String>**](String.md)| | + **context** | [**List<String>**](String.md)| | + **allowEmpty** | **String**| | + **language** | [**Map<String, String>**](String.md)| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/FakeClassnameTags123Api.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..663901532d62 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FakeClassnameTags123Api.md @@ -0,0 +1,61 @@ +# openapi.api.FakeClassnameTags123Api + +## Load the API package +```dart +import 'package:openapi/openapi.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/openapi.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'; + +final api = Openapi().getFakeClassnameTags123Api(); +final ModelClient modelClient = ; // ModelClient | client model + +try { + final response = api.testClassname(modelClient); + print(response); +} catch on DioException (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/client/echo_api/dart/dio/json_serializable/doc/FileSchemaTestClass.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FileSchemaTestClass.md new file mode 100644 index 000000000000..898858934ee7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FileSchemaTestClass.md @@ -0,0 +1,16 @@ +# openapi.model.FileSchemaTestClass + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**ModelFile**](ModelFile.md) | | [optional] +**files** | [**List<ModelFile>**](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/client/echo_api/dart/dio/json_serializable/doc/Foo.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Foo.md new file mode 100644 index 000000000000..c03233a1b1df --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Foo.md @@ -0,0 +1,21 @@ +# openapi.model.Foo + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fooPropA** | **String** | | [optional] +**fooPropB** | **String** | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/json_serializable/doc/FooApi.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FooApi.md new file mode 100644 index 000000000000..ca95ad062c43 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FooApi.md @@ -0,0 +1,93 @@ +# openapi.api.FooApi + +## Load the API package +```dart +import 'package:openapi/openapi.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createFoo**](FooApi.md#createfoo) | **POST** /foo | Create a Foo +[**getAllFoos**](FooApi.md#getallfoos) | **GET** /foo | GET all Foos + + +# **createFoo** +> FooRefOrValue createFoo(foo) + +Create a Foo + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getFooApi(); +final Foo foo = ; // Foo | The Foo to be created + +try { + final response = api.createFoo(foo); + print(response); +} catch on DioException (e) { + print('Exception when calling FooApi->createFoo: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **foo** | [**Foo**](Foo.md)| The Foo to be created | [optional] + +### Return type + +[**FooRefOrValue**](FooRefOrValue.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json;charset=utf-8 + - **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) + +# **getAllFoos** +> List getAllFoos() + +GET all Foos + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getFooApi(); + +try { + final response = api.getAllFoos(); + print(response); +} catch on DioException (e) { + print('Exception when calling FooApi->getAllFoos: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**List<FooRefOrValue>**](FooRefOrValue.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json;charset=utf-8 + +[[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/petstore_client_lib_fake-json_serializable/doc/InlineResponseDefault.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FooBasicGetDefaultResponse.md similarity index 81% rename from samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/InlineResponseDefault.md rename to samples/client/echo_api/dart/dio/json_serializable/doc/FooBasicGetDefaultResponse.md index c5e61e1162bf..504630ea31a9 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/InlineResponseDefault.md +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FooBasicGetDefaultResponse.md @@ -1,8 +1,8 @@ -# openapi.model.InlineResponseDefault +# openapi.model.FooBasicGetDefaultResponse ## Load the model package ```dart -import 'package:openapi/api.dart'; +import 'package:openapi/openapi.dart'; ``` ## Properties diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/FooRef.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FooRef.md new file mode 100644 index 000000000000..d49ad9b8a84f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FooRef.md @@ -0,0 +1,20 @@ +# openapi.model.FooRef + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foorefPropA** | **String** | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/json_serializable/doc/FooRefOrValue.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FooRefOrValue.md new file mode 100644 index 000000000000..e79adafd24e7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FooRefOrValue.md @@ -0,0 +1,19 @@ +# openapi.model.FooRefOrValue + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/json_serializable/doc/FormatTest.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FormatTest.md new file mode 100644 index 000000000000..675b59b8469c --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FormatTest.md @@ -0,0 +1,30 @@ +# openapi.model.FormatTest + +## Load the model package +```dart +import 'package:openapi/openapi.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** | [**MultipartFile**](MultipartFile.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/client/echo_api/dart/dio/json_serializable/doc/Fruit.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Fruit.md new file mode 100644 index 000000000000..fd6be273d730 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Fruit.md @@ -0,0 +1,17 @@ +# openapi.model.Fruit + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**color** | **String** | | [optional] +**kind** | **String** | | [optional] +**count** | **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/client/echo_api/dart/dio/json_serializable/doc/FruitAllOfDisc.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitAllOfDisc.md new file mode 100644 index 000000000000..f63fe99752c0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitAllOfDisc.md @@ -0,0 +1,15 @@ +# openapi.model.FruitAllOfDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/FruitAnyOfDisc.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitAnyOfDisc.md new file mode 100644 index 000000000000..c77b16556c53 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitAnyOfDisc.md @@ -0,0 +1,15 @@ +# openapi.model.FruitAnyOfDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/FruitGrandparentDisc.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitGrandparentDisc.md new file mode 100644 index 000000000000..ce9687bf5a6a --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitGrandparentDisc.md @@ -0,0 +1,15 @@ +# openapi.model.FruitGrandparentDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineDisc.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineDisc.md new file mode 100644 index 000000000000..634614481813 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineDisc.md @@ -0,0 +1,17 @@ +# openapi.model.FruitInlineDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **int** | | +**fruitType** | **String** | | +**length** | **int** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineDiscOneOf.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineDiscOneOf.md new file mode 100644 index 000000000000..c842f7706c46 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineDiscOneOf.md @@ -0,0 +1,16 @@ +# openapi.model.FruitInlineDiscOneOf + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineDiscOneOf1.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineDiscOneOf1.md new file mode 100644 index 000000000000..2ab55f905a67 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineDiscOneOf1.md @@ -0,0 +1,16 @@ +# openapi.model.FruitInlineDiscOneOf1 + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineInlineDisc.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineInlineDisc.md new file mode 100644 index 000000000000..a94f2de1f3bc --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineInlineDisc.md @@ -0,0 +1,15 @@ +# openapi.model.FruitInlineInlineDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineInlineDiscOneOf.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineInlineDiscOneOf.md new file mode 100644 index 000000000000..511b8519164e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineInlineDiscOneOf.md @@ -0,0 +1,16 @@ +# openapi.model.FruitInlineInlineDiscOneOf + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineInlineDiscOneOf1.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineInlineDiscOneOf1.md new file mode 100644 index 000000000000..59d09becd314 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineInlineDiscOneOf1.md @@ -0,0 +1,16 @@ +# openapi.model.FruitInlineInlineDiscOneOf1 + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **int** | | +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineInlineDiscOneOfOneOf.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineInlineDiscOneOfOneOf.md new file mode 100644 index 000000000000..5267793720af --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitInlineInlineDiscOneOfOneOf.md @@ -0,0 +1,15 @@ +# openapi.model.FruitInlineInlineDiscOneOfOneOf + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/FruitOneOfDisc.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitOneOfDisc.md new file mode 100644 index 000000000000..98c529e8c203 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitOneOfDisc.md @@ -0,0 +1,15 @@ +# openapi.model.FruitOneOfDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/FruitReqDisc.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitReqDisc.md new file mode 100644 index 000000000000..6ed06ec95a84 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitReqDisc.md @@ -0,0 +1,17 @@ +# openapi.model.FruitReqDisc + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **int** | | +**fruitType** | **String** | | +**length** | **int** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/FruitType.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitType.md new file mode 100644 index 000000000000..a5ac48ebfcef --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitType.md @@ -0,0 +1,15 @@ +# openapi.model.FruitType + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/FruitVariant1.md b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitVariant1.md new file mode 100644 index 000000000000..f56649903b0f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/FruitVariant1.md @@ -0,0 +1,16 @@ +# openapi.model.FruitVariant1 + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**color** | **String** | | [optional] +**kind** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/GigaOneOf.md b/samples/client/echo_api/dart/dio/json_serializable/doc/GigaOneOf.md new file mode 100644 index 000000000000..c4148a9477f6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/GigaOneOf.md @@ -0,0 +1,15 @@ +# openapi.model.GigaOneOf + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**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/client/echo_api/dart/dio/json_serializable/doc/GrapeVariant1.md b/samples/client/echo_api/dart/dio/json_serializable/doc/GrapeVariant1.md new file mode 100644 index 000000000000..ac6637c2a1c9 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/GrapeVariant1.md @@ -0,0 +1,15 @@ +# openapi.model.GrapeVariant1 + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**color** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/HasOnlyReadOnly.md b/samples/client/echo_api/dart/dio/json_serializable/doc/HasOnlyReadOnly.md new file mode 100644 index 000000000000..c0884669d1a6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/HasOnlyReadOnly.md @@ -0,0 +1,16 @@ +# openapi.model.HasOnlyReadOnly + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/HealthCheckResult.md b/samples/client/echo_api/dart/dio/json_serializable/doc/HealthCheckResult.md new file mode 100644 index 000000000000..30abe9693f7e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/HealthCheckResult.md @@ -0,0 +1,15 @@ +# openapi.model.HealthCheckResult + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/MapTest.md b/samples/client/echo_api/dart/dio/json_serializable/doc/MapTest.md new file mode 100644 index 000000000000..76419a86b17e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/MapTest.md @@ -0,0 +1,18 @@ +# openapi.model.MapTest + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] +**mapOfEnumString** | **Map<String, String>** | | [optional] +**directMap** | **Map<String, bool>** | | [optional] +**indirectMap** | **Map<String, 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/client/echo_api/dart/dio/json_serializable/doc/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/echo_api/dart/dio/json_serializable/doc/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..595e88faccf6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,17 @@ +# openapi.model.MixedPropertiesAndAdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **String** | | [optional] +**dateTime** | [**DateTime**](DateTime.md) | | [optional] +**map** | [**Map<String, Animal>**](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/client/echo_api/dart/dio/json_serializable/doc/Model200Response.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Model200Response.md new file mode 100644 index 000000000000..d3a4eed65282 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Model200Response.md @@ -0,0 +1,16 @@ +# openapi.model.Model200Response + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/ModelClient.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ModelClient.md new file mode 100644 index 000000000000..491c2dffa0c3 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ModelClient.md @@ -0,0 +1,15 @@ +# openapi.model.ModelClient + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/ModelEnumClass.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ModelEnumClass.md new file mode 100644 index 000000000000..6346922b80fa --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ModelEnumClass.md @@ -0,0 +1,14 @@ +# openapi.model.ModelEnumClass + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/ModelFile.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ModelFile.md new file mode 100644 index 000000000000..810d321ec7f0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ModelFile.md @@ -0,0 +1,15 @@ +# openapi.model.ModelFile + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/ModelList.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ModelList.md new file mode 100644 index 000000000000..95bbed7bd916 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ModelList.md @@ -0,0 +1,15 @@ +# openapi.model.ModelList + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/ModelReturn.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ModelReturn.md new file mode 100644 index 000000000000..49e007d35af6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ModelReturn.md @@ -0,0 +1,15 @@ +# openapi.model.ModelReturn + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/Name.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Name.md new file mode 100644 index 000000000000..7f8db15a7c71 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Name.md @@ -0,0 +1,18 @@ +# openapi.model.Name + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/NullableClass.md b/samples/client/echo_api/dart/dio/json_serializable/doc/NullableClass.md new file mode 100644 index 000000000000..5e48a20ff988 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/NullableClass.md @@ -0,0 +1,26 @@ +# openapi.model.NullableClass + +## Load the model package +```dart +import 'package:openapi/openapi.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** | **List<Object>** | | [optional] +**arrayAndItemsNullableProp** | **List<Object>** | | [optional] +**arrayItemsNullable** | **List<Object>** | | [optional] +**objectNullableProp** | **Map<String, Object>** | | [optional] +**objectAndItemsNullableProp** | **Map<String, Object>** | | [optional] +**objectItemsNullable** | **Map<String, Object>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/NumberOnly.md b/samples/client/echo_api/dart/dio/json_serializable/doc/NumberOnly.md new file mode 100644 index 000000000000..12d634cfdbbd --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/NumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.NumberOnly + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/ObjectWithDeprecatedFields.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..4d793f522d22 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ObjectWithDeprecatedFields.md @@ -0,0 +1,18 @@ +# openapi.model.ObjectWithDeprecatedFields + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **String** | | [optional] +**id** | **num** | | [optional] +**deprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] +**bars** | [**List<Bar>**](Bar.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/client/echo_api/dart/dio/json_serializable/doc/OneOfPrimitiveChild.md b/samples/client/echo_api/dart/dio/json_serializable/doc/OneOfPrimitiveChild.md new file mode 100644 index 000000000000..cb1eec1c5b7f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/OneOfPrimitiveChild.md @@ -0,0 +1,15 @@ +# openapi.model.OneOfPrimitiveChild + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**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/client/echo_api/dart/dio/json_serializable/doc/Order.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Order.md new file mode 100644 index 000000000000..d18d3d8408ad --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Order.md @@ -0,0 +1,20 @@ +# openapi.model.Order + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/OuterComposite.md b/samples/client/echo_api/dart/dio/json_serializable/doc/OuterComposite.md new file mode 100644 index 000000000000..fab14cb2d17d --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/OuterComposite.md @@ -0,0 +1,17 @@ +# openapi.model.OuterComposite + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/OuterEnum.md b/samples/client/echo_api/dart/dio/json_serializable/doc/OuterEnum.md new file mode 100644 index 000000000000..77123453e019 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/OuterEnum.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnum + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/OuterEnumDefaultValue.md b/samples/client/echo_api/dart/dio/json_serializable/doc/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..715afba3433f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/OuterEnumDefaultValue.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumDefaultValue + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/OuterEnumInteger.md b/samples/client/echo_api/dart/dio/json_serializable/doc/OuterEnumInteger.md new file mode 100644 index 000000000000..98e74cfbc21e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/OuterEnumInteger.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumInteger + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/OuterEnumIntegerDefaultValue.md b/samples/client/echo_api/dart/dio/json_serializable/doc/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..14b955ed876f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumIntegerDefaultValue + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/OuterObjectWithEnumProperty.md b/samples/client/echo_api/dart/dio/json_serializable/doc/OuterObjectWithEnumProperty.md new file mode 100644 index 000000000000..881373f258bb --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/OuterObjectWithEnumProperty.md @@ -0,0 +1,15 @@ +# openapi.model.OuterObjectWithEnumProperty + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/Parent.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Parent.md new file mode 100644 index 000000000000..cb343a1e4f5a --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Parent.md @@ -0,0 +1,15 @@ +# openapi.model.Parent + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/doc/Pasta.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Pasta.md new file mode 100644 index 000000000000..027d4e96abe0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Pasta.md @@ -0,0 +1,20 @@ +# openapi.model.Pasta + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**vendor** | **String** | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/json_serializable/doc/Pet.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Pet.md new file mode 100644 index 000000000000..12626cbb5983 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Pet.md @@ -0,0 +1,20 @@ +# openapi.model.Pet + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **Set<String>** | | +**tags** | [**List<Tag>**](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/client/echo_api/dart/dio/json_serializable/doc/PetApi.md b/samples/client/echo_api/dart/dio/json_serializable/doc/PetApi.md new file mode 100644 index 000000000000..c25d1bd0822e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/PetApi.md @@ -0,0 +1,439 @@ +# openapi.api.PetApi + +## Load the API package +```dart +import 'package:openapi/openapi.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/openapi.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store + +try { + api.addPet(pet); +} catch on DioException (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/openapi.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | Pet id to delete +final String apiKey = apiKey_example; // String | + +try { + api.deletePet(petId, apiKey); +} catch on DioException (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** +> List findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```dart +import 'package:openapi/openapi.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final List status = ; // List | Status values that need to be considered for filter + +try { + final response = api.findPetsByStatus(status); + print(response); +} catch on DioException (e) { + print('Exception when calling PetApi->findPetsByStatus: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | + +### Return type + +[**List<Pet>**](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** +> Set 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/openapi.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final Set tags = ; // Set | Tags to filter by + +try { + final response = api.findPetsByTags(tags); + print(response); +} catch on DioException (e) { + print('Exception when calling PetApi->findPetsByTags: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**Set<String>**](String.md)| Tags to filter by | + +### Return type + +[**Set<Pet>**](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/openapi.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'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | ID of pet to return + +try { + final response = api.getPetById(petId); + print(response); +} catch on DioException (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/openapi.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store + +try { + api.updatePet(pet); +} catch on DioException (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/openapi.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | ID of pet that needs to be updated +final String name = name_example; // String | Updated name of the pet +final String status = status_example; // String | Updated status of the pet + +try { + api.updatePetWithForm(petId, name, status); +} catch on DioException (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/openapi.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | ID of pet to update +final String additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server +final MultipartFile file = BINARY_DATA_HERE; // MultipartFile | file to upload + +try { + final response = api.uploadFile(petId, additionalMetadata, file); + print(response); +} catch on DioException (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** | **MultipartFile**| 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/openapi.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | ID of pet to update +final MultipartFile requiredFile = BINARY_DATA_HERE; // MultipartFile | file to upload +final String additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server + +try { + final response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + print(response); +} catch on DioException (e) { + print('Exception when calling PetApi->uploadFileWithRequiredFile: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | + **requiredFile** | **MultipartFile**| 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/client/echo_api/dart/dio/json_serializable/doc/Pizza.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Pizza.md new file mode 100644 index 000000000000..a9a0163a18e3 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Pizza.md @@ -0,0 +1,20 @@ +# openapi.model.Pizza + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**pizzaSize** | **num** | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/json_serializable/doc/PizzaSpeziale.md b/samples/client/echo_api/dart/dio/json_serializable/doc/PizzaSpeziale.md new file mode 100644 index 000000000000..483cc83e301b --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/PizzaSpeziale.md @@ -0,0 +1,20 @@ +# openapi.model.PizzaSpeziale + +## Load the model package +```dart +import 'package:openapi/openapi.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**toppings** | **String** | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/echo_api/dart/dio/json_serializable/doc/ReadOnlyFirst.md b/samples/client/echo_api/dart/dio/json_serializable/doc/ReadOnlyFirst.md new file mode 100644 index 000000000000..e21d61aa3f20 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/ReadOnlyFirst.md @@ -0,0 +1,16 @@ +# openapi.model.ReadOnlyFirst + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/SingleRefType.md b/samples/client/echo_api/dart/dio/json_serializable/doc/SingleRefType.md new file mode 100644 index 000000000000..cbcf9ead7e6c --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/SingleRefType.md @@ -0,0 +1,14 @@ +# openapi.model.SingleRefType + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/SpecialModelName.md b/samples/client/echo_api/dart/dio/json_serializable/doc/SpecialModelName.md new file mode 100644 index 000000000000..8c22491d783c --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/SpecialModelName.md @@ -0,0 +1,15 @@ +# openapi.model.SpecialModelName + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/StoreApi.md b/samples/client/echo_api/dart/dio/json_serializable/doc/StoreApi.md new file mode 100644 index 000000000000..198b78d86527 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/StoreApi.md @@ -0,0 +1,188 @@ +# openapi.api.StoreApi + +## Load the API package +```dart +import 'package:openapi/openapi.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/openapi.dart'; + +final api = Openapi().getStoreApi(); +final String orderId = orderId_example; // String | ID of the order that needs to be deleted + +try { + api.deleteOrder(orderId); +} catch on DioException (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** +> Map getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```dart +import 'package:openapi/openapi.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'; + +final api = Openapi().getStoreApi(); + +try { + final response = api.getInventory(); + print(response); +} catch on DioException (e) { + print('Exception when calling StoreApi->getInventory: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**Map<String, int>** + +### 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 generate exceptions + +### Example +```dart +import 'package:openapi/openapi.dart'; + +final api = Openapi().getStoreApi(); +final int orderId = 789; // int | ID of pet that needs to be fetched + +try { + final response = api.getOrderById(orderId); + print(response); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getStoreApi(); +final Order order = ; // Order | order placed for purchasing the pet + +try { + final response = api.placeOrder(order); + print(response); +} catch on DioException (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/client/echo_api/dart/dio/json_serializable/doc/Tag.md b/samples/client/echo_api/dart/dio/json_serializable/doc/Tag.md new file mode 100644 index 000000000000..1c0ee4595a65 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/Tag.md @@ -0,0 +1,16 @@ +# openapi.model.Tag + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/User.md b/samples/client/echo_api/dart/dio/json_serializable/doc/User.md new file mode 100644 index 000000000000..c51ef002c6b2 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/User.md @@ -0,0 +1,22 @@ +# openapi.model.User + +## Load the model package +```dart +import 'package:openapi/openapi.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/client/echo_api/dart/dio/json_serializable/doc/UserApi.md b/samples/client/echo_api/dart/dio/json_serializable/doc/UserApi.md new file mode 100644 index 000000000000..c17e4f7c5689 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/doc/UserApi.md @@ -0,0 +1,359 @@ +# openapi.api.UserApi + +## Load the API package +```dart +import 'package:openapi/openapi.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/openapi.dart'; + +final api = Openapi().getUserApi(); +final User user = ; // User | Created user object + +try { + api.createUser(user); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getUserApi(); +final List user = ; // List | List of user object + +try { + api.createUsersWithArrayInput(user); +} catch on DioException (e) { + print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List<User>**](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/openapi.dart'; + +final api = Openapi().getUserApi(); +final List user = ; // List | List of user object + +try { + api.createUsersWithListInput(user); +} catch on DioException (e) { + print('Exception when calling UserApi->createUsersWithListInput: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List<User>**](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/openapi.dart'; + +final api = Openapi().getUserApi(); +final String username = username_example; // String | The name that needs to be deleted + +try { + api.deleteUser(username); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getUserApi(); +final String username = username_example; // String | The name that needs to be fetched. Use user1 for testing. + +try { + final response = api.getUserByName(username); + print(response); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getUserApi(); +final String username = username_example; // String | The user name for login +final String password = password_example; // String | The password for login in clear text + +try { + final response = api.loginUser(username, password); + print(response); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getUserApi(); + +try { + api.logoutUser(); +} catch on DioException (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/openapi.dart'; + +final api = Openapi().getUserApi(); +final String username = username_example; // String | name that need to be deleted +final User user = ; // User | Updated user object + +try { + api.updateUser(username, user); +} catch on DioException (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/client/echo_api/dart/dio/json_serializable/lib/apis.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/apis.dart new file mode 100644 index 000000000000..4facc7ca3861 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/apis.dart @@ -0,0 +1,10 @@ +export 'package:openapi/src/api_client.dart'; +export 'package:openapi/src/api/another_fake_api.dart'; +export 'package:openapi/src/api/bar_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/foo_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'; diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/models.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/models.dart new file mode 100644 index 000000000000..02ef41593ef1 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/models.dart @@ -0,0 +1,103 @@ + +export 'package:openapi/src/repository_base.dart'; +export 'package:openapi/src/repository_impl.dart'; +export 'package:openapi/src/model/additional_properties_class.dart'; +export 'package:openapi/src/model/addressable.dart'; +export 'package:openapi/src/model/all_of_with_single_ref.dart'; +export 'package:openapi/src/model/animal.dart'; +export 'package:openapi/src/model/api_response.dart'; +export 'package:openapi/src/model/apple.dart'; +export 'package:openapi/src/model/apple_all_of_disc.dart'; +export 'package:openapi/src/model/apple_grandparent_disc.dart'; +export 'package:openapi/src/model/apple_one_of_disc.dart'; +export 'package:openapi/src/model/apple_req_disc.dart'; +export 'package:openapi/src/model/apple_variant1.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/banana.dart'; +export 'package:openapi/src/model/banana_all_of_disc.dart'; +export 'package:openapi/src/model/banana_grandparent_disc.dart'; +export 'package:openapi/src/model/banana_one_of_disc.dart'; +export 'package:openapi/src/model/banana_req_disc.dart'; +export 'package:openapi/src/model/bar.dart'; +export 'package:openapi/src/model/bar_create.dart'; +export 'package:openapi/src/model/bar_ref.dart'; +export 'package:openapi/src/model/bar_ref_or_value.dart'; +export 'package:openapi/src/model/capitalization.dart'; +export 'package:openapi/src/model/cat.dart'; +export 'package:openapi/src/model/category.dart'; +export 'package:openapi/src/model/class_model.dart'; +export 'package:openapi/src/model/composed_disc_missing_from_properties.dart'; +export 'package:openapi/src/model/composed_disc_optional_type_correct.dart'; +export 'package:openapi/src/model/composed_disc_optional_type_inconsistent.dart'; +export 'package:openapi/src/model/composed_disc_optional_type_incorrect.dart'; +export 'package:openapi/src/model/composed_disc_required_inconsistent.dart'; +export 'package:openapi/src/model/composed_disc_type_inconsistent.dart'; +export 'package:openapi/src/model/composed_disc_type_incorrect.dart'; +export 'package:openapi/src/model/deprecated_object.dart'; +export 'package:openapi/src/model/disc_missing_from_properties.dart'; +export 'package:openapi/src/model/disc_optional_type_correct.dart'; +export 'package:openapi/src/model/disc_optional_type_incorrect.dart'; +export 'package:openapi/src/model/disc_type_incorrect.dart'; +export 'package:openapi/src/model/dog.dart'; +export 'package:openapi/src/model/entity.dart'; +export 'package:openapi/src/model/entity_ref.dart'; +export 'package:openapi/src/model/enum_arrays.dart'; +export 'package:openapi/src/model/enum_test.dart'; +export 'package:openapi/src/model/extensible.dart'; +export 'package:openapi/src/model/file_schema_test_class.dart'; +export 'package:openapi/src/model/foo.dart'; +export 'package:openapi/src/model/foo_basic_get_default_response.dart'; +export 'package:openapi/src/model/foo_ref.dart'; +export 'package:openapi/src/model/foo_ref_or_value.dart'; +export 'package:openapi/src/model/format_test.dart'; +export 'package:openapi/src/model/fruit.dart'; +export 'package:openapi/src/model/fruit_all_of_disc.dart'; +export 'package:openapi/src/model/fruit_any_of_disc.dart'; +export 'package:openapi/src/model/fruit_grandparent_disc.dart'; +export 'package:openapi/src/model/fruit_inline_disc.dart'; +export 'package:openapi/src/model/fruit_inline_disc_one_of.dart'; +export 'package:openapi/src/model/fruit_inline_disc_one_of1.dart'; +export 'package:openapi/src/model/fruit_inline_inline_disc.dart'; +export 'package:openapi/src/model/fruit_inline_inline_disc_one_of.dart'; +export 'package:openapi/src/model/fruit_inline_inline_disc_one_of1.dart'; +export 'package:openapi/src/model/fruit_inline_inline_disc_one_of_one_of.dart'; +export 'package:openapi/src/model/fruit_one_of_disc.dart'; +export 'package:openapi/src/model/fruit_req_disc.dart'; +export 'package:openapi/src/model/fruit_type.dart'; +export 'package:openapi/src/model/fruit_variant1.dart'; +export 'package:openapi/src/model/giga_one_of.dart'; +export 'package:openapi/src/model/grape_variant1.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/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/object_with_deprecated_fields.dart'; +export 'package:openapi/src/model/one_of_primitive_child.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/parent.dart'; +export 'package:openapi/src/model/pasta.dart'; +export 'package:openapi/src/model/pet.dart'; +export 'package:openapi/src/model/pizza.dart'; +export 'package:openapi/src/model/pizza_speziale.dart'; +export 'package:openapi/src/model/read_only_first.dart'; +export 'package:openapi/src/model/single_ref_type.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/client/echo_api/dart/dio/json_serializable/lib/openapi.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/openapi.dart new file mode 100644 index 000000000000..6c3dbb746aa8 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/openapi.dart @@ -0,0 +1,8 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + + +export 'apis.dart'; +export 'models.dart'; +export 'package:openapi/src/auth/_exports.dart'; diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/api.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api.dart new file mode 100644 index 000000000000..fc036ae659de --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api.dart @@ -0,0 +1,124 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/api_key_auth.dart'; +import 'package:openapi/src/auth/basic_auth.dart'; +import 'package:openapi/src/auth/bearer_auth.dart'; +import 'package:openapi/src/auth/oauth.dart'; +import 'package:openapi/src/api/another_fake_api.dart'; +import 'package:openapi/src/api/bar_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/foo_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; + Openapi({ + Dio? dio, + String? basePathOverride, + List? interceptors, + }) : + this.dio = dio ?? + Dio(BaseOptions( + baseUrl: basePathOverride ?? basePath, + connectTimeout: const Duration(milliseconds: 5000), + receiveTimeout: const Duration(milliseconds: 3000), + )) { + if (interceptors == null) { + this.dio.interceptors.addAll([ + OAuthInterceptor(), + BasicAuthInterceptor(), + BearerAuthInterceptor(), + 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 setBearerAuth(String name, String token) { + if (this.dio.interceptors.any((i) => i is BearerAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is BearerAuthInterceptor) as BearerAuthInterceptor).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); + } + + /// Get BarApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + BarApi getBarApi() { + return BarApi(dio); + } + + /// 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); + } + + /// 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); + } + + /// 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); + } + + /// Get FooApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + FooApi getFooApi() { + return FooApi(dio); + } + + /// 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); + } + + /// 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); + } + + /// 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); + } +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/another_fake_api.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/another_fake_api.dart new file mode 100644 index 000000000000..73a338f00c68 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/another_fake_api.dart @@ -0,0 +1,162 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'package:dio/dio.dart'; + +import 'package:json_annotation/json_annotation.dart'; +import 'package:openapi/src/repository_base.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/models.dart'; +import 'package:openapi/src/model/model_client.dart'; + +part 'another_fake_api.g.dart'; + +class AnotherFakeApi { + + final AnotherFakeApiRaw rawApi; + final SerializationRepositoryBase _repository; + + const AnotherFakeApi(this.rawApi, this._repository); + + /// To test special tags + /// To test special tags and operation ID starting with number + /// + /// Parameters: + /// * [modelClient] - client model + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ModelClient] as data + /// Throws [DioException] if API call or serialization fails + Future> call123testSpecialTags({ + required ModelClient modelClient, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, modelClient, const TypeInfo( + + + ModelClient + ) + +); + + final _response = await rawApi.call123testSpecialTags( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ModelClient? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + ModelClient + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + +} +class AnotherFakeApiRaw { + + final Dio _dio; + + const AnotherFakeApiRaw(this._dio); + + /// To test special tags + /// To test special tags and operation ID starting with number + /// + /// Parameters: + /// * [modelClient] - client model + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ModelClient] as data + /// Throws [DioException] if API call or serialization fails + Future> call123testSpecialTags({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + +} + + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/bar_api.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/bar_api.dart new file mode 100644 index 000000000000..7f52bbce1abd --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/bar_api.dart @@ -0,0 +1,163 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'package:dio/dio.dart'; + +import 'package:json_annotation/json_annotation.dart'; +import 'package:openapi/src/repository_base.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/models.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:openapi/src/model/bar_create.dart'; + +part 'bar_api.g.dart'; + +class BarApi { + + final BarApiRaw rawApi; + final SerializationRepositoryBase _repository; + + const BarApi(this.rawApi, this._repository); + + /// Create a Bar + /// + /// + /// Parameters: + /// * [barCreate] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Bar] as data + /// Throws [DioException] if API call or serialization fails + Future> createBar({ + required BarCreate barCreate, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, barCreate, const TypeInfo( + + + BarCreate + ) + +); + + final _response = await rawApi.createBar( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Bar? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + Bar + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + +} +class BarApiRaw { + + final Dio _dio; + + const BarApiRaw(this._dio); + + /// Create a Bar + /// + /// + /// Parameters: + /// * [barCreate] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Bar] as data + /// Throws [DioException] if API call or serialization fails + Future> createBar({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/bar'; + final _options = Options( + method: r'POST', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + +} + + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/default_api.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/default_api.dart new file mode 100644 index 000000000000..316fac48cad9 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/default_api.dart @@ -0,0 +1,721 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'package:dio/dio.dart'; + +import 'package:json_annotation/json_annotation.dart'; +import 'package:openapi/src/repository_base.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/models.dart'; +import 'package:openapi/src/model/foo_basic_get_default_response.dart'; +import 'package:openapi/src/model/fruit.dart'; +import 'package:openapi/src/model/fruit_all_of_disc.dart'; +import 'package:openapi/src/model/fruit_variant1.dart'; +import 'package:openapi/src/model/giga_one_of.dart'; + +part 'default_api.g.dart'; + +class DefaultApi { + + final DefaultApiRaw rawApi; + final SerializationRepositoryBase _repository; + + const DefaultApi(this.rawApi, this._repository); + + /// fooBasicGet + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FooBasicGetDefaultResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> fooBasicGet({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.fooBasicGet( + + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + FooBasicGetDefaultResponse? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + FooBasicGetDefaultResponse + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + + /// list + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [GigaOneOf] as data + /// Throws [DioException] if API call or serialization fails + Future> list({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.list( + + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + GigaOneOf? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + GigaOneOf + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + + /// oneofGet + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Fruit] as data + /// Throws [DioException] if API call or serialization fails + Future> oneofGet({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.oneofGet( + + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Fruit? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + Fruit + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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 + /// + /// + /// Parameters: + /// * [body] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> test({ + Object? body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, body, const TypeInfo.nullable( + + + Object + ) + +); + + final _response = await rawApi.test( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// variant1Get + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FruitVariant1] as data + /// Throws [DioException] if API call or serialization fails + Future> variant1Get({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.variant1Get( + + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + FruitVariant1? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + FruitVariant1 + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + + /// variant2Get + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FruitAllOfDisc] as data + /// Throws [DioException] if API call or serialization fails + Future> variant2Get({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.variant2Get( + + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + FruitAllOfDisc? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + FruitAllOfDisc + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + +} +class DefaultApiRaw { + + final Dio _dio; + + const DefaultApiRaw(this._dio); + + /// fooBasicGet + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FooBasicGetDefaultResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> fooBasicGet({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/foo-basic'; + final _options = Options( + method: r'GET', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// list + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [GigaOneOf] as data + /// Throws [DioException] if API call or serialization fails + Future> list({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/oneof-primitive'; + final _options = Options( + method: r'GET', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// oneofGet + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Fruit] as data + /// Throws [DioException] if API call or serialization fails + Future> oneofGet({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/oneof'; + final _options = Options( + method: r'GET', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// test + /// + /// + /// Parameters: + /// * [body] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> test({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/variant1'; + final _options = Options( + method: r'PUT', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// variant1Get + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FruitVariant1] as data + /// Throws [DioException] if API call or serialization fails + Future> variant1Get({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/variant1'; + final _options = Options( + method: r'GET', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// variant2Get + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FruitAllOfDisc] as data + /// Throws [DioException] if API call or serialization fails + Future> variant2Get({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/variant2'; + final _options = Options( + method: r'GET', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + +} + + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/fake_api.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/fake_api.dart new file mode 100644 index 000000000000..15ce95b2fde7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/fake_api.dart @@ -0,0 +1,2570 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'package:dio/dio.dart'; + +import 'package:json_annotation/json_annotation.dart'; +import 'package:openapi/src/repository_base.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/models.dart'; +import 'package:openapi/src/model/file_schema_test_class.dart'; +import 'package:openapi/src/model/health_check_result.dart'; +import 'package:openapi/src/model/model_client.dart'; +import 'package:openapi/src/model/model_enum_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/pet.dart'; +import 'package:openapi/src/model/user.dart'; + +part 'fake_api.g.dart'; + +class FakeApi { + + final FakeApiRaw rawApi; + final SerializationRepositoryBase _repository; + + const FakeApi(this.rawApi, this._repository); + + /// Health check endpoint + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [HealthCheckResult] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeHealthGet({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.fakeHealthGet( + + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + HealthCheckResult? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + HealthCheckResult + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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 + /// + /// + /// Parameters: + /// * [pet] - Pet object that needs to be added to the store + /// * [query1] - query parameter + /// * [header1] - header parameter + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> fakeHttpSignatureTest({ + required Pet pet, + required String query1, + required String header1, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, pet, const TypeInfo( + + + Pet + ) + +); + + final _response = await rawApi.fakeHttpSignatureTest( + + query1: encodeQueryParameter(_repository, query1, const TypeInfo( + + + String + ) + +, ), + header1: encodeStringParameter(_repository, header1, const TypeInfo( + + + String + ) + +), + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// fakeOuterBooleanSerialize + /// Test serialization of outer boolean types + /// + /// Parameters: + /// * [body] - Input boolean as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [bool] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterBooleanSerialize({ + required bool body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, body, const TypeInfo( + + + bool + ) + +); + + final _response = await rawApi.fakeOuterBooleanSerialize( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + bool? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + bool + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + + /// fakeOuterCompositeSerialize + /// Test serialization of object with outer number type + /// + /// Parameters: + /// * [outerComposite] - Input composite as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [OuterComposite] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterCompositeSerialize({ + required OuterComposite outerComposite, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, outerComposite, const TypeInfo( + + + OuterComposite + ) + +); + + final _response = await rawApi.fakeOuterCompositeSerialize( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + OuterComposite? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + OuterComposite + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + + /// fakeOuterNumberSerialize + /// Test serialization of outer number types + /// + /// Parameters: + /// * [body] - Input number as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [num] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterNumberSerialize({ + required num body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, body, const TypeInfo( + + + num + ) + +); + + final _response = await rawApi.fakeOuterNumberSerialize( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + num? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + num + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + + /// fakeOuterStringSerialize + /// Test serialization of outer string types + /// + /// Parameters: + /// * [body] - Input string as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [String] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterStringSerialize({ + required String body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, body, const TypeInfo( + + + String + ) + +); + + final _response = await rawApi.fakeOuterStringSerialize( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + String? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + String + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + + /// fakePropertyEnumIntegerSerialize + /// Test serialization of enum (int) properties with examples + /// + /// Parameters: + /// * [outerObjectWithEnumProperty] - Input enum (int) as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [OuterObjectWithEnumProperty] as data + /// Throws [DioException] if API call or serialization fails + Future> fakePropertyEnumIntegerSerialize({ + required OuterObjectWithEnumProperty outerObjectWithEnumProperty, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, outerObjectWithEnumProperty, const TypeInfo( + + + OuterObjectWithEnumProperty + ) + +); + + final _response = await rawApi.fakePropertyEnumIntegerSerialize( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + OuterObjectWithEnumProperty? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + OuterObjectWithEnumProperty + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + + /// testBodyWithBinary + /// For this test, the body has to be a binary file. + /// + /// Parameters: + /// * [body] - image to upload + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testBodyWithBinary({ + required MultipartFile? body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, body, const TypeInfo.nullable( + + + MultipartFile + ) + +); + + final _response = await rawApi.testBodyWithBinary( + + body: _bodyData, + requestContentType: 'image/png', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// testBodyWithFileSchema + /// For this test, the body for this request must reference a schema named `File`. + /// + /// Parameters: + /// * [fileSchemaTestClass] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testBodyWithFileSchema({ + required FileSchemaTestClass fileSchemaTestClass, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, fileSchemaTestClass, const TypeInfo( + + + FileSchemaTestClass + ) + +); + + final _response = await rawApi.testBodyWithFileSchema( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// testBodyWithQueryParams + /// + /// + /// Parameters: + /// * [query] + /// * [user] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testBodyWithQueryParams({ + required String query, + required User user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, user, const TypeInfo( + + + User + ) + +); + + final _response = await rawApi.testBodyWithQueryParams( + + query: encodeQueryParameter(_repository, query, const TypeInfo( + + + String + ) + +, ), + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// To test \"client\" model + /// To test \"client\" model + /// + /// Parameters: + /// * [modelClient] - client model + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ModelClient] as data + /// Throws [DioException] if API call or serialization fails + Future> testClientModel({ + required ModelClient modelClient, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, modelClient, const TypeInfo( + + + ModelClient + ) + +); + + final _response = await rawApi.testClientModel( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ModelClient? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + ModelClient + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Parameters: + /// * [number] - None + /// * [double_] - None + /// * [patternWithoutDelimiter] - None + /// * [byte] - None + /// * [integer] - None + /// * [int32] - None + /// * [int64] - None + /// * [float] - None + /// * [string] - None + /// * [binary] - None + /// * [date] - None + /// * [dateTime] - None + /// * [password] - None + /// * [callback] - None + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testEndpointParameters({ + required num number, + required double double_, + required String patternWithoutDelimiter, + required String byte, + required int integer, + required int int32, + required int int64, + required double float, + required String string, + required MultipartFile binary, + required DateTime date, + required DateTime dateTime, + required String password, + required String callback, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + final _bodyMap = { + if (integer != null) r'integer': encodeFormParameter(_repository, integer, const TypeInfo( + + + int + ) + +), + if (int32 != null) r'int32': encodeFormParameter(_repository, int32, const TypeInfo( + + + int + ) + +), + if (int64 != null) r'int64': encodeFormParameter(_repository, int64, const TypeInfo( + + + int + ) + +), + r'number': encodeFormParameter(_repository, number, const TypeInfo( + + + num + ) + +), + if (float != null) r'float': encodeFormParameter(_repository, float, const TypeInfo( + + + double + ) + +), + r'double': encodeFormParameter(_repository, double_, const TypeInfo( + + + double + ) + +), + if (string != null) r'string': encodeFormParameter(_repository, string, const TypeInfo( + + + String + ) + +), + r'pattern_without_delimiter': encodeFormParameter(_repository, patternWithoutDelimiter, const TypeInfo( + + + String + ) + +), + r'byte': encodeFormParameter(_repository, byte, const TypeInfo( + + + String + ) + +), + if (binary != null) r'binary': encodeFormParameter(_repository, binary, const TypeInfo( + + + MultipartFile + ) + +), + if (date != null) r'date': encodeFormParameter(_repository, date, const TypeInfo( + + + DateTime + ) + +), + if (dateTime != null) r'dateTime': encodeFormParameter(_repository, dateTime, const TypeInfo( + + + DateTime + ) + +), + if (password != null) r'password': encodeFormParameter(_repository, password, const TypeInfo( + + + String + ) + +), + if (callback != null) r'callback': encodeFormParameter(_repository, callback, const TypeInfo( + + + String + ) + +), + }; + _bodyData = _bodyMap; + + final _response = await rawApi.testEndpointParameters( + + body: _bodyData, + requestContentType: 'application/x-www-form-urlencoded', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// To test enum parameters + /// To test enum parameters + /// + /// Parameters: + /// * [enumHeaderStringArray] - Header parameter enum test (string array) + /// * [enumHeaderString] - Header parameter enum test (string) (Default: r'-efg') + /// * [enumQueryStringArray] - Query parameter enum test (string array) + /// * [enumQueryString] - Query parameter enum test (string) (Default: r'-efg') + /// * [enumQueryInteger] - Query parameter enum test (double) + /// * [enumQueryDouble] - Query parameter enum test (double) + /// * [enumQueryModelArray] + /// * [enumFormStringArray] - Form parameter enum test (string array) (Default: r'$') + /// * [enumFormString] - Form parameter enum test (string) (Default: r'-efg') + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testEnumParameters({ + required List enumHeaderStringArray, + EnumHeaderStringEnum enumHeaderString = r'-efg', + required List enumQueryStringArray, + EnumQueryStringEnum enumQueryString = r'-efg', + required EnumQueryIntegerEnum enumQueryInteger, + required EnumQueryDoubleEnum enumQueryDouble, + required List enumQueryModelArray, + List enumFormStringArray = r'$', + EnumFormStringEnum enumFormString = r'-efg', + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + final _bodyMap = { + if (enumFormStringArray != null) r'enum_form_string_array': encodeFormParameter(_repository, enumFormStringArray, const TypeInfo( + List, [ + + const TypeInfo( + + InnerEnum + + ) + +, + ]) + +), + if (enumFormString != null) r'enum_form_string': encodeFormParameter(_repository, enumFormString, const TypeInfo( + + EnumFormStringEnum + + ) + +), + }; + _bodyData = _bodyMap; + + final _response = await rawApi.testEnumParameters( + + enumHeaderStringArray: encodeStringParameter(_repository, enumHeaderStringArray, const TypeInfo( + List, [ + + const TypeInfo( + + EnumHeaderStringArrayEnum + + ) + +, + ]) + +), + enumHeaderString: encodeStringParameter(_repository, enumHeaderString, const TypeInfo( + + EnumHeaderStringEnum + + ) + +), + enumQueryStringArray: encodeQueryParameter(_repository, enumQueryStringArray, const TypeInfo( + List, [ + + const TypeInfo( + + EnumQueryStringArrayEnum + + ) + +, + ]) + +, format: ListFormat.multi,), + enumQueryString: encodeQueryParameter(_repository, enumQueryString, const TypeInfo( + + EnumQueryStringEnum + + ) + +, ), + enumQueryInteger: encodeQueryParameter(_repository, enumQueryInteger, const TypeInfo( + + EnumQueryIntegerEnum + + ) + +, ), + enumQueryDouble: encodeQueryParameter(_repository, enumQueryDouble, const TypeInfo( + + EnumQueryDoubleEnum + + ) + +, ), + enumQueryModelArray: encodeQueryParameter(_repository, enumQueryModelArray, const TypeInfo( + List, [ + + const TypeInfo( + + ModelEnumClass + + ) + +, + ]) + +, format: ListFormat.multi,), + body: _bodyData, + requestContentType: 'application/x-www-form-urlencoded', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Fake endpoint to test group parameters (optional) + /// Fake endpoint to test group parameters (optional) + /// + /// Parameters: + /// * [requiredStringGroup] - Required String in group parameters + /// * [requiredBooleanGroup] - Required Boolean in group parameters + /// * [requiredInt64Group] - Required Integer in group parameters + /// * [stringGroup] - String in group parameters + /// * [booleanGroup] - Boolean in group parameters + /// * [int64Group] - Integer in group parameters + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testGroupParameters({ + required int requiredStringGroup, + required bool requiredBooleanGroup, + required int requiredInt64Group, + required int stringGroup, + required bool booleanGroup, + required int int64Group, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.testGroupParameters( + + requiredStringGroup: encodeQueryParameter(_repository, requiredStringGroup, const TypeInfo( + + + int + ) + +, ), + requiredBooleanGroup: encodeStringParameter(_repository, requiredBooleanGroup, const TypeInfo( + + + bool + ) + +), + requiredInt64Group: encodeQueryParameter(_repository, requiredInt64Group, const TypeInfo( + + + int + ) + +, ), + stringGroup: encodeQueryParameter(_repository, stringGroup, const TypeInfo( + + + int + ) + +, ), + booleanGroup: encodeStringParameter(_repository, booleanGroup, const TypeInfo( + + + bool + ) + +), + int64Group: encodeQueryParameter(_repository, int64Group, const TypeInfo( + + + int + ) + +, ), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test inline additionalProperties + /// + /// + /// Parameters: + /// * [requestBody] - request body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testInlineAdditionalProperties({ + required Map requestBody, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, requestBody, const TypeInfo( + Map, [ + TypeInfo(String), + const TypeInfo( + + String + + ) + +, + ]) + +); + + final _response = await rawApi.testInlineAdditionalProperties( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test json serialization of form data + /// + /// + /// Parameters: + /// * [param] - field1 + /// * [param2] - field2 + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testJsonFormData({ + required String param, + required String param2, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + final _bodyMap = { + r'param': encodeFormParameter(_repository, param, const TypeInfo( + + + String + ) + +), + r'param2': encodeFormParameter(_repository, param2, const TypeInfo( + + + String + ) + +), + }; + _bodyData = _bodyMap; + + final _response = await rawApi.testJsonFormData( + + body: _bodyData, + requestContentType: 'application/x-www-form-urlencoded', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// testQueryParameterCollectionFormat + /// To test the collection format in query parameters + /// + /// Parameters: + /// * [pipe] + /// * [ioutil] + /// * [http] + /// * [url] + /// * [context] + /// * [allowEmpty] + /// * [language] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testQueryParameterCollectionFormat({ + required List pipe, + required List ioutil, + required List http, + required List url, + required List context, + required String allowEmpty, + required Map language, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.testQueryParameterCollectionFormat( + + pipe: encodeQueryParameter(_repository, pipe, const TypeInfo( + List, [ + + const TypeInfo( + + String + + ) + +, + ]) + +, format: ListFormat.pipes,), + ioutil: encodeQueryParameter(_repository, ioutil, const TypeInfo( + List, [ + + const TypeInfo( + + String + + ) + +, + ]) + +, format: ListFormat.csv,), + http: encodeQueryParameter(_repository, http, const TypeInfo( + List, [ + + const TypeInfo( + + String + + ) + +, + ]) + +, format: ListFormat.ssv,), + url: encodeQueryParameter(_repository, url, const TypeInfo( + List, [ + + const TypeInfo( + + String + + ) + +, + ]) + +, format: ListFormat.csv,), + context: encodeQueryParameter(_repository, context, const TypeInfo( + List, [ + + const TypeInfo( + + String + + ) + +, + ]) + +, format: ListFormat.multi,), + allowEmpty: encodeQueryParameter(_repository, allowEmpty, const TypeInfo( + + + String + ) + +, ), + language: encodeQueryParameter(_repository, language, const TypeInfo( + Map, [ + TypeInfo(String), + const TypeInfo( + + String + + ) + +, + ]) + +, ), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + +} +class FakeApiRaw { + + final Dio _dio; + + const FakeApiRaw(this._dio); + + /// Health check endpoint + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [HealthCheckResult] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeHealthGet({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// test http signature authentication + /// + /// + /// Parameters: + /// * [pet] - Pet object that needs to be added to the store + /// * [query1] - query parameter + /// * [header1] - header parameter + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> fakeHttpSignatureTest({ + Object? query1, + String? header1, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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, + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'signature', + 'name': 'http_signature_test', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (query1 != null) r'query_1': query1, + }; + + return await _dio.request( + _path, + data: body, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// fakeOuterBooleanSerialize + /// Test serialization of outer boolean types + /// + /// Parameters: + /// * [body] - Input boolean as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [bool] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterBooleanSerialize({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// fakeOuterCompositeSerialize + /// Test serialization of object with outer number type + /// + /// Parameters: + /// * [outerComposite] - Input composite as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [OuterComposite] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterCompositeSerialize({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// fakeOuterNumberSerialize + /// Test serialization of outer number types + /// + /// Parameters: + /// * [body] - Input number as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [num] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterNumberSerialize({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// fakeOuterStringSerialize + /// Test serialization of outer string types + /// + /// Parameters: + /// * [body] - Input string as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [String] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterStringSerialize({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// fakePropertyEnumIntegerSerialize + /// Test serialization of enum (int) properties with examples + /// + /// Parameters: + /// * [outerObjectWithEnumProperty] - Input enum (int) as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [OuterObjectWithEnumProperty] as data + /// Throws [DioException] if API call or serialization fails + Future> fakePropertyEnumIntegerSerialize({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// testBodyWithBinary + /// For this test, the body has to be a binary file. + /// + /// Parameters: + /// * [body] - image to upload + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testBodyWithBinary({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/body-with-binary'; + final _options = Options( + method: r'PUT', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// testBodyWithFileSchema + /// For this test, the body for this request must reference a schema named `File`. + /// + /// Parameters: + /// * [fileSchemaTestClass] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testBodyWithFileSchema({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// testBodyWithQueryParams + /// + /// + /// Parameters: + /// * [query] + /// * [user] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testBodyWithQueryParams({ + required Object query, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'query': query, + }; + + return await _dio.request( + _path, + data: body, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// To test \"client\" model + /// To test \"client\" model + /// + /// Parameters: + /// * [modelClient] - client model + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ModelClient] as data + /// Throws [DioException] if API call or serialization fails + Future> testClientModel({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'PATCH', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Parameters: + /// * [number] - None + /// * [double_] - None + /// * [patternWithoutDelimiter] - None + /// * [byte] - None + /// * [integer] - None + /// * [int32] - None + /// * [int64] - None + /// * [float] - None + /// * [string] - None + /// * [binary] - None + /// * [date] - None + /// * [dateTime] - None + /// * [password] - None + /// * [callback] - None + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testEndpointParameters({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'POST', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'basic', + 'name': 'http_basic_test', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// To test enum parameters + /// To test enum parameters + /// + /// Parameters: + /// * [enumHeaderStringArray] - Header parameter enum test (string array) + /// * [enumHeaderString] - Header parameter enum test (string) (Default: r'-efg') + /// * [enumQueryStringArray] - Query parameter enum test (string array) + /// * [enumQueryString] - Query parameter enum test (string) (Default: r'-efg') + /// * [enumQueryInteger] - Query parameter enum test (double) + /// * [enumQueryDouble] - Query parameter enum test (double) + /// * [enumQueryModelArray] + /// * [enumFormStringArray] - Form parameter enum test (string array) (Default: r'$') + /// * [enumFormString] - Form parameter enum test (string) (Default: r'-efg') + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testEnumParameters({ + String? enumHeaderStringArray, + String? enumHeaderString, + Object? enumQueryStringArray, + Object? enumQueryString, + Object? enumQueryInteger, + Object? enumQueryDouble, + Object? enumQueryModelArray, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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, + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + 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, + if (enumQueryModelArray != null) r'enum_query_model_array': enumQueryModelArray, + }; + + return await _dio.request( + _path, + data: body, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Fake endpoint to test group parameters (optional) + /// Fake endpoint to test group parameters (optional) + /// + /// Parameters: + /// * [requiredStringGroup] - Required String in group parameters + /// * [requiredBooleanGroup] - Required Boolean in group parameters + /// * [requiredInt64Group] - Required Integer in group parameters + /// * [stringGroup] - String in group parameters + /// * [booleanGroup] - Boolean in group parameters + /// * [int64Group] - Integer in group parameters + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testGroupParameters({ + required Object requiredStringGroup, + required String requiredBooleanGroup, + required Object requiredInt64Group, + Object? stringGroup, + String? booleanGroup, + Object? int64Group, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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, + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'bearer_test', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + 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, + }; + + return await _dio.request( + _path, + data: body, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// test inline additionalProperties + /// + /// + /// Parameters: + /// * [requestBody] - request body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testInlineAdditionalProperties({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// test json serialization of form data + /// + /// + /// Parameters: + /// * [param] - field1 + /// * [param2] - field2 + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testJsonFormData({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// testQueryParameterCollectionFormat + /// To test the collection format in query parameters + /// + /// Parameters: + /// * [pipe] + /// * [ioutil] + /// * [http] + /// * [url] + /// * [context] + /// * [allowEmpty] + /// * [language] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testQueryParameterCollectionFormat({ + required Object pipe, + required Object ioutil, + required Object http, + required Object url, + required Object context, + required Object allowEmpty, + Object? language, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/test-query-parameters'; + final _options = Options( + method: r'PUT', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'pipe': pipe, + r'ioutil': ioutil, + r'http': http, + r'url': url, + r'context': context, + if (language != null) r'language': language, + r'allowEmpty': allowEmpty, + }; + + return await _dio.request( + _path, + data: body, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +enum EnumHeaderStringArrayEnum { + @JsonValue(rr'>') + greaterThan, + @JsonValue(rr'$') + dollar, + @JsonValue(rr'unknown_default_open_api') + unknownDefaultOpenApi, +} + + + +/// Header parameter enum test (string) +enum EnumHeaderStringEnum { + @JsonValue(rr'_abc') + abc, + @JsonValue(rr'-efg') + efg, + @JsonValue(rr'(xyz)') + leftParenthesisXyzRightParenthesis, + @JsonValue(rr'unknown_default_open_api') + unknownDefaultOpenApi, +} + + + +enum EnumQueryStringArrayEnum { + @JsonValue(rr'>') + greaterThan, + @JsonValue(rr'$') + dollar, + @JsonValue(rr'unknown_default_open_api') + unknownDefaultOpenApi, +} + + + +/// Query parameter enum test (string) +enum EnumQueryStringEnum { + @JsonValue(rr'_abc') + abc, + @JsonValue(rr'-efg') + efg, + @JsonValue(rr'(xyz)') + leftParenthesisXyzRightParenthesis, + @JsonValue(rr'unknown_default_open_api') + unknownDefaultOpenApi, +} + + +/// Query parameter enum test (double) +enum EnumQueryIntegerEnum { + @JsonValue(1) + number1, + @JsonValue(-2) + numberNegative2, + @JsonValue(11184809) + unknownDefaultOpenApi, +} + + +/// Query parameter enum test (double) +enum EnumQueryDoubleEnum { + @JsonValue(r'1.1') + number1Period1, + @JsonValue(r'-1.2') + numberNegative1Period2, + @JsonValue(r'11184809') + unknownDefaultOpenApi, +} + + + + +enum InnerEnum { +} + + + +/// Form parameter enum test (string) +enum EnumFormStringEnum { + @JsonValue(rr'_abc') + abc, + @JsonValue(rr'-efg') + efg, + @JsonValue(rr'(xyz)') + leftParenthesisXyzRightParenthesis, + @JsonValue(rr'unknown_default_open_api') + unknownDefaultOpenApi, +} + + + + + + + + + + + + + + + + + + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/fake_classname_tags123_api.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/fake_classname_tags123_api.dart new file mode 100644 index 000000000000..a39749d0be45 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/fake_classname_tags123_api.dart @@ -0,0 +1,169 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'package:dio/dio.dart'; + +import 'package:json_annotation/json_annotation.dart'; +import 'package:openapi/src/repository_base.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/models.dart'; +import 'package:openapi/src/model/model_client.dart'; + +part 'fake_classname_tags123_api.g.dart'; + +class FakeClassnameTags123Api { + + final FakeClassnameTags123ApiRaw rawApi; + final SerializationRepositoryBase _repository; + + const FakeClassnameTags123Api(this.rawApi, this._repository); + + /// To test class name in snake case + /// To test class name in snake case + /// + /// Parameters: + /// * [modelClient] - client model + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ModelClient] as data + /// Throws [DioException] if API call or serialization fails + Future> testClassname({ + required ModelClient modelClient, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, modelClient, const TypeInfo( + + + ModelClient + ) + +); + + final _response = await rawApi.testClassname( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ModelClient? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + ModelClient + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + +} +class FakeClassnameTags123ApiRaw { + + final Dio _dio; + + const FakeClassnameTags123ApiRaw(this._dio); + + /// To test class name in snake case + /// To test class name in snake case + /// + /// Parameters: + /// * [modelClient] - client model + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ModelClient] as data + /// Throws [DioException] if API call or serialization fails + Future> testClassname({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'apiKey', + 'name': 'api_key_query', + 'keyName': 'api_key_query', + 'where': 'query', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + +} + + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/foo_api.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/foo_api.dart new file mode 100644 index 000000000000..82aa013c1719 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/foo_api.dart @@ -0,0 +1,286 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'package:dio/dio.dart'; + +import 'package:json_annotation/json_annotation.dart'; +import 'package:openapi/src/repository_base.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/models.dart'; +import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/foo_ref_or_value.dart'; + +part 'foo_api.g.dart'; + +class FooApi { + + final FooApiRaw rawApi; + final SerializationRepositoryBase _repository; + + const FooApi(this.rawApi, this._repository); + + /// Create a Foo + /// + /// + /// Parameters: + /// * [foo] - The Foo to be created + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FooRefOrValue] as data + /// Throws [DioException] if API call or serialization fails + Future> createFoo({ + required Foo foo, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, foo, const TypeInfo( + + + Foo + ) + +); + + final _response = await rawApi.createFoo( + + body: _bodyData, + requestContentType: 'application/json;charset=utf-8', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + FooRefOrValue? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + FooRefOrValue + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + + /// GET all Foos + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [List] as data + /// Throws [DioException] if API call or serialization fails + Future>> getAllFoos({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.getAllFoos( + + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + List? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + List, [ + + const TypeInfo( + + FooRefOrValue + + ) + +, + ]) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + +} +class FooApiRaw { + + final Dio _dio; + + const FooApiRaw(this._dio); + + /// Create a Foo + /// + /// + /// Parameters: + /// * [foo] - The Foo to be created + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FooRefOrValue] as data + /// Throws [DioException] if API call or serialization fails + Future> createFoo({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/foo'; + final _options = Options( + method: r'POST', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// GET all Foos + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [List] as data + /// Throws [DioException] if API call or serialization fails + Future> getAllFoos({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/foo'; + final _options = Options( + method: r'GET', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + +} + + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/pet_api.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/pet_api.dart new file mode 100644 index 000000000000..f5c06fc13e24 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/pet_api.dart @@ -0,0 +1,1267 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'package:dio/dio.dart'; + +import 'package:json_annotation/json_annotation.dart'; +import 'package:openapi/src/repository_base.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/models.dart'; +import 'package:openapi/src/model/api_response.dart'; +import 'package:openapi/src/model/pet.dart'; + +part 'pet_api.g.dart'; + +class PetApi { + + final PetApiRaw rawApi; + final SerializationRepositoryBase _repository; + + const PetApi(this.rawApi, this._repository); + + /// Add a new pet to the store + /// + /// + /// Parameters: + /// * [pet] - Pet object that needs to be added to the store + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> addPet({ + required Pet pet, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, pet, const TypeInfo( + + + Pet + ) + +); + + final _response = await rawApi.addPet( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Deletes a pet + /// + /// + /// Parameters: + /// * [petId] - Pet id to delete + /// * [apiKey] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> deletePet({ + required int petId, + required String apiKey, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.deletePet( + + petId: encodeStringParameter(_repository, petId, const TypeInfo( + + + int + ) + +), + apiKey: encodeStringParameter(_repository, apiKey, const TypeInfo( + + + String + ) + +), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Finds Pets by status + /// Multiple status values can be provided with comma separated strings + /// + /// Parameters: + /// * [status] - Status values that need to be considered for filter + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [List] as data + /// Throws [DioException] if API call or serialization fails + Future>> findPetsByStatus({ + @Deprecated('status is deprecated') required List status, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.findPetsByStatus( + + status: encodeQueryParameter(_repository, status, const TypeInfo( + List, [ + + const TypeInfo( + + StatusEnum + + ) + +, + ]) + +, format: ListFormat.csv,), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + List? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + List, [ + + const TypeInfo( + + Pet + + ) + +, + ]) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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. + /// + /// Parameters: + /// * [tags] - Tags to filter by + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Set] as data + /// Throws [DioException] if API call or serialization fails + @Deprecated('This operation has been deprecated') + Future>> findPetsByTags({ + required Set tags, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.findPetsByTags( + + tags: encodeQueryParameter(_repository, tags, const TypeInfo( + Set, [ + + const TypeInfo( + + String + + ) + +, + ]) + +, format: ListFormat.csv,), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Set? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + Set, [ + + const TypeInfo( + + Pet + + ) + +, + ]) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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 + /// + /// Parameters: + /// * [petId] - ID of pet to return + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Pet] as data + /// Throws [DioException] if API call or serialization fails + Future> getPetById({ + required int petId, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.getPetById( + + petId: encodeStringParameter(_repository, petId, const TypeInfo( + + + int + ) + +), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Pet? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + Pet + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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 + /// + /// + /// Parameters: + /// * [pet] - Pet object that needs to be added to the store + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> updatePet({ + required Pet pet, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, pet, const TypeInfo( + + + Pet + ) + +); + + final _response = await rawApi.updatePet( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Updates a pet in the store with form data + /// + /// + /// Parameters: + /// * [petId] - ID of pet that needs to be updated + /// * [name] - Updated name of the pet + /// * [status] - Updated status of the pet + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> updatePetWithForm({ + required int petId, + required String name, + required String status, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + final _bodyMap = { + if (name != null) r'name': encodeFormParameter(_repository, name, const TypeInfo( + + + String + ) + +), + if (status != null) r'status': encodeFormParameter(_repository, status, const TypeInfo( + + + String + ) + +), + }; + _bodyData = _bodyMap; + + final _response = await rawApi.updatePetWithForm( + + petId: encodeStringParameter(_repository, petId, const TypeInfo( + + + int + ) + +), + body: _bodyData, + requestContentType: 'application/x-www-form-urlencoded', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// uploads an image + /// + /// + /// Parameters: + /// * [petId] - ID of pet to update + /// * [additionalMetadata] - Additional data to pass to server + /// * [file] - file to upload + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ApiResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> uploadFile({ + required int petId, + required String additionalMetadata, + required MultipartFile file, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + final _bodyMap = { + if (additionalMetadata != null) r'additionalMetadata': encodeFormParameter(_repository, additionalMetadata, const TypeInfo( + + + String + ) + +), + if (file != null) r'file': encodeFormParameter(_repository, file, const TypeInfo( + + + MultipartFile + ) + +), + }; + _bodyData = FormData.fromMap(_bodyMap); + + final _response = await rawApi.uploadFile( + + petId: encodeStringParameter(_repository, petId, const TypeInfo( + + + int + ) + +), + body: _bodyData, + requestContentType: 'multipart/form-data', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ApiResponse? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + ApiResponse + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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) + /// + /// + /// Parameters: + /// * [petId] - ID of pet to update + /// * [requiredFile] - file to upload + /// * [additionalMetadata] - Additional data to pass to server + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ApiResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> uploadFileWithRequiredFile({ + required int petId, + required MultipartFile requiredFile, + required String additionalMetadata, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + final _bodyMap = { + if (additionalMetadata != null) r'additionalMetadata': encodeFormParameter(_repository, additionalMetadata, const TypeInfo( + + + String + ) + +), + r'requiredFile': encodeFormParameter(_repository, requiredFile, const TypeInfo( + + + MultipartFile + ) + +), + }; + _bodyData = FormData.fromMap(_bodyMap); + + final _response = await rawApi.uploadFileWithRequiredFile( + + petId: encodeStringParameter(_repository, petId, const TypeInfo( + + + int + ) + +), + body: _bodyData, + requestContentType: 'multipart/form-data', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ApiResponse? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + ApiResponse + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + +} +class PetApiRaw { + + final Dio _dio; + + const PetApiRaw(this._dio); + + /// Add a new pet to the store + /// + /// + /// Parameters: + /// * [pet] - Pet object that needs to be added to the store + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> addPet({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet'; + final _options = Options( + method: r'POST', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Deletes a pet + /// + /// + /// Parameters: + /// * [petId] - Pet id to delete + /// * [apiKey] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> deletePet({ + required String petId, + String? apiKey, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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, + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Finds Pets by status + /// Multiple status values can be provided with comma separated strings + /// + /// Parameters: + /// * [status] - Status values that need to be considered for filter + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [List] as data + /// Throws [DioException] if API call or serialization fails + Future> findPetsByStatus({ + @Deprecated('status is deprecated') required Object status, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'status': status, + }; + + return await _dio.request( + _path, + data: body, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Finds Pets by tags + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Parameters: + /// * [tags] - Tags to filter by + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Set] as data + /// Throws [DioException] if API call or serialization fails + @Deprecated('This operation has been deprecated') + Future> findPetsByTags({ + required Object tags, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'tags': tags, + }; + + return await _dio.request( + _path, + data: body, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Find pet by ID + /// Returns a single pet + /// + /// Parameters: + /// * [petId] - ID of pet to return + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Pet] as data + /// Throws [DioException] if API call or serialization fails + Future> getPetById({ + required String petId, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'apiKey', + 'name': 'api_key', + 'keyName': 'api_key', + 'where': 'header', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Update an existing pet + /// + /// + /// Parameters: + /// * [pet] - Pet object that needs to be added to the store + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> updatePet({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet'; + final _options = Options( + method: r'PUT', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Updates a pet in the store with form data + /// + /// + /// Parameters: + /// * [petId] - ID of pet that needs to be updated + /// * [name] - Updated name of the pet + /// * [status] - Updated status of the pet + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> updatePetWithForm({ + required String petId, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// uploads an image + /// + /// + /// Parameters: + /// * [petId] - ID of pet to update + /// * [additionalMetadata] - Additional data to pass to server + /// * [file] - file to upload + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ApiResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> uploadFile({ + required String petId, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// uploads an image (required) + /// + /// + /// Parameters: + /// * [petId] - ID of pet to update + /// * [requiredFile] - file to upload + /// * [additionalMetadata] - Additional data to pass to server + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ApiResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> uploadFileWithRequiredFile({ + required String petId, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + +} + + + + + +@Deprecated('StatusEnum has been deprecated') +enum StatusEnum { + @JsonValue(rr'available') + available, + @JsonValue(rr'pending') + pending, + @JsonValue(rr'sold') + sold, + @JsonValue(rr'unknown_default_open_api') + unknownDefaultOpenApi, +} + + + + + + + + + + + + + + + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/store_api.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/store_api.dart new file mode 100644 index 000000000000..7d8d00ab8fca --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/store_api.dart @@ -0,0 +1,520 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'package:dio/dio.dart'; + +import 'package:json_annotation/json_annotation.dart'; +import 'package:openapi/src/repository_base.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/models.dart'; +import 'package:openapi/src/model/order.dart'; + +part 'store_api.g.dart'; + +class StoreApi { + + final StoreApiRaw rawApi; + final SerializationRepositoryBase _repository; + + const StoreApi(this.rawApi, this._repository); + + /// Delete purchase order by ID + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Parameters: + /// * [orderId] - ID of the order that needs to be deleted + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> deleteOrder({ + required String orderId, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.deleteOrder( + + orderId: encodeStringParameter(_repository, orderId, const TypeInfo( + + + String + ) + +), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Returns pet inventories by status + /// Returns a map of status codes to quantities + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Map] as data + /// Throws [DioException] if API call or serialization fails + Future>> getInventory({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.getInventory( + + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Map? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + Map, [ + TypeInfo(String), + const TypeInfo( + + int + + ) + +, + ]) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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 generate exceptions + /// + /// Parameters: + /// * [orderId] - ID of pet that needs to be fetched + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Order] as data + /// Throws [DioException] if API call or serialization fails + Future> getOrderById({ + required int orderId, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.getOrderById( + + orderId: encodeStringParameter(_repository, orderId, const TypeInfo( + + + int + ) + +), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Order? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + Order + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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 + /// + /// + /// Parameters: + /// * [order] - order placed for purchasing the pet + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Order] as data + /// Throws [DioException] if API call or serialization fails + Future> placeOrder({ + required Order order, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, order, const TypeInfo( + + + Order + ) + +); + + final _response = await rawApi.placeOrder( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Order? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + Order + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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, + ); + } + +} +class StoreApiRaw { + + final Dio _dio; + + const StoreApiRaw(this._dio); + + /// Delete purchase order by ID + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Parameters: + /// * [orderId] - ID of the order that needs to be deleted + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> deleteOrder({ + required String orderId, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Returns pet inventories by status + /// Returns a map of status codes to quantities + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Map] as data + /// Throws [DioException] if API call or serialization fails + Future> getInventory({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'apiKey', + 'name': 'api_key', + 'keyName': 'api_key', + 'where': 'header', + }, + ], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Find purchase order by ID + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Parameters: + /// * [orderId] - ID of pet that needs to be fetched + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Order] as data + /// Throws [DioException] if API call or serialization fails + Future> getOrderById({ + required String orderId, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Place an order for a pet + /// + /// + /// Parameters: + /// * [order] - order placed for purchasing the pet + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Order] as data + /// Throws [DioException] if API call or serialization fails + Future> placeOrder({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + +} + + + + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/user_api.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/user_api.dart new file mode 100644 index 000000000000..f1c1d118e0c3 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api/user_api.dart @@ -0,0 +1,918 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; +import 'package:dio/dio.dart'; + +import 'package:json_annotation/json_annotation.dart'; +import 'package:openapi/src/repository_base.dart'; +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/models.dart'; +import 'package:openapi/src/model/user.dart'; + +part 'user_api.g.dart'; + +class UserApi { + + final UserApiRaw rawApi; + final SerializationRepositoryBase _repository; + + const UserApi(this.rawApi, this._repository); + + /// Create user + /// This can only be done by the logged in user. + /// + /// Parameters: + /// * [user] - Created user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> createUser({ + required User user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, user, const TypeInfo( + + + User + ) + +); + + final _response = await rawApi.createUser( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Creates list of users with given input array + /// + /// + /// Parameters: + /// * [user] - List of user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> createUsersWithArrayInput({ + required List user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, user, const TypeInfo( + List, [ + + const TypeInfo( + + User + + ) + +, + ]) + +); + + final _response = await rawApi.createUsersWithArrayInput( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Creates list of users with given input array + /// + /// + /// Parameters: + /// * [user] - List of user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> createUsersWithListInput({ + required List user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, user, const TypeInfo( + List, [ + + const TypeInfo( + + User + + ) + +, + ]) + +); + + final _response = await rawApi.createUsersWithListInput( + + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Delete user + /// This can only be done by the logged in user. + /// + /// Parameters: + /// * [username] - The name that needs to be deleted + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> deleteUser({ + required String username, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.deleteUser( + + username: encodeStringParameter(_repository, username, const TypeInfo( + + + String + ) + +), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Get user by user name + /// + /// + /// Parameters: + /// * [username] - The name that needs to be fetched. Use user1 for testing. + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [User] as data + /// Throws [DioException] if API call or serialization fails + Future> getUserByName({ + required String username, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.getUserByName( + + username: encodeStringParameter(_repository, username, const TypeInfo( + + + String + ) + +), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + User? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + User + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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 + /// + /// + /// Parameters: + /// * [username] - The user name for login + /// * [password] - The password for login in clear text + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [String] as data + /// Throws [DioException] if API call or serialization fails + Future> loginUser({ + required String username, + required String password, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.loginUser( + + username: encodeQueryParameter(_repository, username, const TypeInfo( + + + String + ) + +, ), + password: encodeQueryParameter(_repository, password, const TypeInfo( + + + String + ) + +, ), + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + String? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : decodeResponse(_repository, rawResponse, const TypeInfo( + + String + + ) + +); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + 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 + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> logoutUser({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + + final _response = await rawApi.logoutUser( + + + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Updated user + /// This can only be done by the logged in user. + /// + /// Parameters: + /// * [username] - name that need to be deleted + /// * [user] - Updated user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> updateUser({ + required String username, + required User user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + Object? _bodyData; + _bodyData = encodeBodyParameter(_repository, user, const TypeInfo( + + + User + ) + +); + + final _response = await rawApi.updateUser( + + username: encodeStringParameter(_repository, username, const TypeInfo( + + + String + ) + +), + body: _bodyData, + requestContentType: 'application/json', + cancelToken: cancelToken, + headers: headers, + extra: extra, + validateStatus: validateStatus, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + +} +class UserApiRaw { + + final Dio _dio; + + const UserApiRaw(this._dio); + + /// Create user + /// This can only be done by the logged in user. + /// + /// Parameters: + /// * [user] - Created user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> createUser({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user'; + final _options = Options( + method: r'POST', + headers: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Creates list of users with given input array + /// + /// + /// Parameters: + /// * [user] - List of user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> createUsersWithArrayInput({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Creates list of users with given input array + /// + /// + /// Parameters: + /// * [user] - List of user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> createUsersWithListInput({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Delete user + /// This can only be done by the logged in user. + /// + /// Parameters: + /// * [username] - The name that needs to be deleted + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> deleteUser({ + required String username, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Get user by user name + /// + /// + /// Parameters: + /// * [username] - The name that needs to be fetched. Use user1 for testing. + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [User] as data + /// Throws [DioException] if API call or serialization fails + Future> getUserByName({ + required String username, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Logs user into the system + /// + /// + /// Parameters: + /// * [username] - The user name for login + /// * [password] - The password for login in clear text + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [String] as data + /// Throws [DioException] if API call or serialization fails + Future> loginUser({ + required Object username, + required Object password, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'username': username, + r'password': password, + }; + + return await _dio.request( + _path, + data: body, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Logs out current logged in user session + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> logoutUser({ + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + + /// Updated user + /// This can only be done by the logged in user. + /// + /// Parameters: + /// * [username] - name that need to be deleted + /// * [user] - Updated user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> updateUser({ + required String username, + Object? body, + String? requestContentType, + String? acceptContentType, + ResponseType? responseType, + 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: { + if (acceptContentType != null) 'Accept': acceptContentType, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: requestContentType, + responseType: responseType, + validateStatus: validateStatus, + ); + + return await _dio.request( + _path, + data: body, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + } + +} + + + + + + + + + + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/api_client.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api_client.dart new file mode 100644 index 000000000000..587fd726c76a --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api_client.dart @@ -0,0 +1,119 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'repository_base.dart'; +import 'repository_impl.dart'; +import 'package:openapi/apis.dart'; +import 'package:openapi/models.dart'; +import 'package:openapi/src/auth/_exports.dart'; + +class Openapi { + static const String basePath = r'http://petstore.swagger.io:80/v2'; + + final Dio dio; + final SerializationRepositoryBase serializationRepository; + + + Openapi({ + Dio? dio, + SerializationRepositoryBase? serializationRepositoryOverride, + String? basePathOverride, + List? interceptors, + }) : this.dio = dio ?? + Dio(BaseOptions( + baseUrl: basePathOverride ?? basePath, + connectTimeout: const Duration(milliseconds: 5000), + receiveTimeout: const Duration(milliseconds: 3000), + )), this.serializationRepository = serializationRepositoryOverride ?? JsonSerializableRepository() { + if (interceptors == null) { + this.dio.interceptors.addAll([ + OAuthInterceptor(), + BasicAuthInterceptor(), + BearerAuthInterceptor(), + 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 setBearerAuth(String name, String token) { + if (this.dio.interceptors.any((i) => i is BearerAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is BearerAuthInterceptor) as BearerAuthInterceptor).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(AnotherFakeApiRaw(dio), serializationRepository); + } + + /// Get BarApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + BarApi getBarApi() { + return BarApi(BarApiRaw(dio), serializationRepository); + } + + /// 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(DefaultApiRaw(dio), serializationRepository); + } + + /// 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(FakeApiRaw(dio), serializationRepository); + } + + /// 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(FakeClassnameTags123ApiRaw(dio), serializationRepository); + } + + /// Get FooApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + FooApi getFooApi() { + return FooApi(FooApiRaw(dio), serializationRepository); + } + + /// 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(PetApiRaw(dio), serializationRepository); + } + + /// 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(StoreApiRaw(dio), serializationRepository); + } + + /// 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(UserApiRaw(dio), serializationRepository); + } +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/api_util.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api_util.dart new file mode 100644 index 000000000000..cca5b3427a0a --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/api_util.dart @@ -0,0 +1,88 @@ +import 'package:dio/dio.dart'; +import 'dart:convert'; +import 'package:openapi/models.dart'; +import 'dart:typed_data'; + +/// 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. +Object encodeFormParameter( + SerializationRepositoryBase repository, + T value, + TypeInfo type, +) { + if (value == null) { + return ''; + } + final serialized = repository.serialize( + value, + type, + ); + return serialized; +} + +String encodeStringParameter( + SerializationRepositoryBase repository, + T value, + TypeInfo type, +) { + return repository.serialize(value, type).toString(); +} + +Object encodeBodyParameter( + SerializationRepositoryBase repository, + T value, + TypeInfo type, +) { + if (value == null) { + return ''; + } + final serialized = repository.serialize( + value, + type, + ); + return serialized; +} + +Object encodeQueryParameter( + SerializationRepositoryBase repository, + T value, + TypeInfo type, { + ListFormat format = ListFormat.multi, +}) { + if (value == null) { + return ''; + } + if (value is String || value is num || value is bool) { + return value; + } + if (value is Uint8List) { + // Currently not sure how to serialize this + return value; + } + final serialized = repository.serialize( + value, + type, + ); + return serialized; +} + +ListParam encodeCollectionQueryParameter( + SerializationRepositoryBase repository, + Iterable value, + TypeInfo type, { + ListFormat format = ListFormat.multi, +}) { + final serialized = repository.serialize( + value, + type, + ); + if (serialized is Iterable) { + return ListParam(serialized.toList(), format); + } + throw ArgumentError('Invalid value passed to encodeCollectionQueryParameter'); +} + +TOutput decodeResponse(SerializationRepositoryBase repository, TInput value, TypeInfo type) { + return repository.deserialize(value, type); +} \ No newline at end of file diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/auth/_exports.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/auth/_exports.dart new file mode 100644 index 000000000000..f038e92358ef --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/auth/_exports.dart @@ -0,0 +1,5 @@ +export 'api_key_auth.dart'; +export 'basic_auth.dart'; +export 'oauth.dart'; +export 'bearer_auth.dart'; +export 'auth.dart'; \ No newline at end of file diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/auth/api_key_auth.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/auth/api_key_auth.dart new file mode 100644 index 000000000000..ee16e3f0f92f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/auth/api_key_auth.dart @@ -0,0 +1,30 @@ +// +// 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, (secure) => secure['type'] == '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/client/echo_api/dart/dio/json_serializable/lib/src/auth/auth.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/auth/auth.dart new file mode 100644 index 000000000000..f7ae9bf3f11e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/auth/auth.dart @@ -0,0 +1,18 @@ +// +// 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, bool Function(Map secure) handles) { + if (route.extra.containsKey('secure')) { + final auth = route.extra['secure'] as List>; + return auth.where((secure) => handles(secure)).toList(); + } + return []; + } +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/auth/basic_auth.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/auth/basic_auth.dart new file mode 100644 index 000000000000..b6e6dce04f9c --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/auth/basic_auth.dart @@ -0,0 +1,37 @@ +// +// 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, (secure) => (secure['type'] == 'http' && secure['scheme'] == 'basic') || secure['type'] == '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/client/echo_api/dart/dio/json_serializable/lib/src/auth/bearer_auth.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/auth/bearer_auth.dart new file mode 100644 index 000000000000..1d4402b376c0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/auth/bearer_auth.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/auth.dart'; + +class BearerAuthInterceptor extends AuthInterceptor { + final Map tokens = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'http' && secure['scheme'] == 'bearer'); + 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/client/echo_api/dart/dio/json_serializable/lib/src/auth/oauth.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/auth/oauth.dart new file mode 100644 index 000000000000..337cf762b0ce --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/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, (secure) => secure['type'] == 'oauth' || secure['type'] == 'oauth2'); + 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/client/echo_api/dart/dio/json_serializable/lib/src/deserialize.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/deserialize.dart new file mode 100644 index 000000000000..f5b09fc89fb3 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/deserialize.dart @@ -0,0 +1,345 @@ +import 'package:openapi/src/model/additional_properties_class.dart'; +import 'package:openapi/src/model/addressable.dart'; +import 'package:openapi/src/model/all_of_with_single_ref.dart'; +import 'package:openapi/src/model/animal.dart'; +import 'package:openapi/src/model/api_response.dart'; +import 'package:openapi/src/model/apple.dart'; +import 'package:openapi/src/model/apple_all_of_disc.dart'; +import 'package:openapi/src/model/apple_grandparent_disc.dart'; +import 'package:openapi/src/model/apple_one_of_disc.dart'; +import 'package:openapi/src/model/apple_req_disc.dart'; +import 'package:openapi/src/model/apple_variant1.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/banana.dart'; +import 'package:openapi/src/model/banana_all_of_disc.dart'; +import 'package:openapi/src/model/banana_grandparent_disc.dart'; +import 'package:openapi/src/model/banana_one_of_disc.dart'; +import 'package:openapi/src/model/banana_req_disc.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:openapi/src/model/bar_create.dart'; +import 'package:openapi/src/model/bar_ref.dart'; +import 'package:openapi/src/model/bar_ref_or_value.dart'; +import 'package:openapi/src/model/capitalization.dart'; +import 'package:openapi/src/model/cat.dart'; +import 'package:openapi/src/model/category.dart'; +import 'package:openapi/src/model/class_model.dart'; +import 'package:openapi/src/model/composed_disc_missing_from_properties.dart'; +import 'package:openapi/src/model/composed_disc_optional_type_correct.dart'; +import 'package:openapi/src/model/composed_disc_optional_type_inconsistent.dart'; +import 'package:openapi/src/model/composed_disc_optional_type_incorrect.dart'; +import 'package:openapi/src/model/composed_disc_required_inconsistent.dart'; +import 'package:openapi/src/model/composed_disc_type_inconsistent.dart'; +import 'package:openapi/src/model/composed_disc_type_incorrect.dart'; +import 'package:openapi/src/model/deprecated_object.dart'; +import 'package:openapi/src/model/disc_missing_from_properties.dart'; +import 'package:openapi/src/model/disc_optional_type_correct.dart'; +import 'package:openapi/src/model/disc_optional_type_incorrect.dart'; +import 'package:openapi/src/model/disc_type_incorrect.dart'; +import 'package:openapi/src/model/dog.dart'; +import 'package:openapi/src/model/entity.dart'; +import 'package:openapi/src/model/entity_ref.dart'; +import 'package:openapi/src/model/enum_arrays.dart'; +import 'package:openapi/src/model/enum_test.dart'; +import 'package:openapi/src/model/extensible.dart'; +import 'package:openapi/src/model/file_schema_test_class.dart'; +import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/foo_basic_get_default_response.dart'; +import 'package:openapi/src/model/foo_ref.dart'; +import 'package:openapi/src/model/foo_ref_or_value.dart'; +import 'package:openapi/src/model/format_test.dart'; +import 'package:openapi/src/model/fruit.dart'; +import 'package:openapi/src/model/fruit_all_of_disc.dart'; +import 'package:openapi/src/model/fruit_any_of_disc.dart'; +import 'package:openapi/src/model/fruit_grandparent_disc.dart'; +import 'package:openapi/src/model/fruit_inline_disc.dart'; +import 'package:openapi/src/model/fruit_inline_disc_one_of.dart'; +import 'package:openapi/src/model/fruit_inline_disc_one_of1.dart'; +import 'package:openapi/src/model/fruit_inline_inline_disc.dart'; +import 'package:openapi/src/model/fruit_inline_inline_disc_one_of.dart'; +import 'package:openapi/src/model/fruit_inline_inline_disc_one_of1.dart'; +import 'package:openapi/src/model/fruit_inline_inline_disc_one_of_one_of.dart'; +import 'package:openapi/src/model/fruit_one_of_disc.dart'; +import 'package:openapi/src/model/fruit_req_disc.dart'; +import 'package:openapi/src/model/fruit_type.dart'; +import 'package:openapi/src/model/fruit_variant1.dart'; +import 'package:openapi/src/model/giga_one_of.dart'; +import 'package:openapi/src/model/grape_variant1.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/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_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/object_with_deprecated_fields.dart'; +import 'package:openapi/src/model/one_of_primitive_child.dart'; +import 'package:openapi/src/model/order.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/parent.dart'; +import 'package:openapi/src/model/pasta.dart'; +import 'package:openapi/src/model/pet.dart'; +import 'package:openapi/src/model/pizza.dart'; +import 'package:openapi/src/model/pizza_speziale.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'; + +final _regList = RegExp(r'^List<(.*)>$'); +final _regSet = RegExp(r'^Set<(.*)>$'); +final _regMap = RegExp(r'^Map$'); + + ReturnType deserialize(dynamic value, String targetType, {bool growable= true}) { + switch (targetType) { + case 'String': + return '$value' as ReturnType; + case 'int': + return (value is int ? value : int.parse('$value')) as ReturnType; + case 'bool': + if (value is bool) { + return value as ReturnType; + } + final valueString = '$value'.toLowerCase(); + return (valueString == 'true' || valueString == '1') as ReturnType; + case 'double': + return (value is double ? value : double.parse('$value')) as ReturnType; + case 'AdditionalPropertiesClass': + return AdditionalPropertiesClass.fromJson(value as Map) as ReturnType; + case 'Addressable': + return Addressable.fromJson(value as Map) as ReturnType; + case 'AllOfWithSingleRef': + return AllOfWithSingleRef.fromJson(value as Map) as ReturnType; + case 'Animal': + return Animal.fromJson(value as Map) as ReturnType; + case 'ApiResponse': + return ApiResponse.fromJson(value as Map) as ReturnType; + case 'Apple': + return Apple.fromJson(value as Map) as ReturnType; + case 'AppleAllOfDisc': + return AppleAllOfDisc.fromJson(value as Map) as ReturnType; + case 'AppleGrandparentDisc': + return AppleGrandparentDisc.fromJson(value as Map) as ReturnType; + case 'AppleOneOfDisc': + return AppleOneOfDisc.fromJson(value as Map) as ReturnType; + case 'AppleReqDisc': + return AppleReqDisc.fromJson(value as Map) as ReturnType; + case 'AppleVariant1': + return AppleVariant1.fromJson(value as Map) as ReturnType; + case 'ArrayOfArrayOfNumberOnly': + return ArrayOfArrayOfNumberOnly.fromJson(value as Map) as ReturnType; + case 'ArrayOfNumberOnly': + return ArrayOfNumberOnly.fromJson(value as Map) as ReturnType; + case 'ArrayTest': + return ArrayTest.fromJson(value as Map) as ReturnType; + case 'Banana': + return Banana.fromJson(value as Map) as ReturnType; + case 'BananaAllOfDisc': + return BananaAllOfDisc.fromJson(value as Map) as ReturnType; + case 'BananaGrandparentDisc': + return BananaGrandparentDisc.fromJson(value as Map) as ReturnType; + case 'BananaOneOfDisc': + return BananaOneOfDisc.fromJson(value as Map) as ReturnType; + case 'BananaReqDisc': + return BananaReqDisc.fromJson(value as Map) as ReturnType; + case 'Bar': + return Bar.fromJson(value as Map) as ReturnType; + case 'BarCreate': + return BarCreate.fromJson(value as Map) as ReturnType; + case 'BarRef': + return BarRef.fromJson(value as Map) as ReturnType; + case 'BarRefOrValue': + return BarRefOrValue.fromJson(value as Map) as ReturnType; + case 'Capitalization': + return Capitalization.fromJson(value as Map) as ReturnType; + case 'Cat': + return Cat.fromJson(value as Map) as ReturnType; + case 'Category': + return Category.fromJson(value as Map) as ReturnType; + case 'ClassModel': + return ClassModel.fromJson(value as Map) as ReturnType; + case 'ComposedDiscMissingFromProperties': + return ComposedDiscMissingFromProperties.fromJson(value as Map) as ReturnType; + case 'ComposedDiscOptionalTypeCorrect': + return ComposedDiscOptionalTypeCorrect.fromJson(value as Map) as ReturnType; + case 'ComposedDiscOptionalTypeInconsistent': + return ComposedDiscOptionalTypeInconsistent.fromJson(value as Map) as ReturnType; + case 'ComposedDiscOptionalTypeIncorrect': + return ComposedDiscOptionalTypeIncorrect.fromJson(value as Map) as ReturnType; + case 'ComposedDiscRequiredInconsistent': + return ComposedDiscRequiredInconsistent.fromJson(value as Map) as ReturnType; + case 'ComposedDiscTypeInconsistent': + return ComposedDiscTypeInconsistent.fromJson(value as Map) as ReturnType; + case 'ComposedDiscTypeIncorrect': + return ComposedDiscTypeIncorrect.fromJson(value as Map) as ReturnType; + case 'DeprecatedObject': + return DeprecatedObject.fromJson(value as Map) as ReturnType; + case 'DiscMissingFromProperties': + return DiscMissingFromProperties.fromJson(value as Map) as ReturnType; + case 'DiscOptionalTypeCorrect': + return DiscOptionalTypeCorrect.fromJson(value as Map) as ReturnType; + case 'DiscOptionalTypeIncorrect': + return DiscOptionalTypeIncorrect.fromJson(value as Map) as ReturnType; + case 'DiscTypeIncorrect': + return DiscTypeIncorrect.fromJson(value as Map) as ReturnType; + case 'Dog': + return Dog.fromJson(value as Map) as ReturnType; + case 'Entity': + return Entity.fromJson(value as Map) as ReturnType; + case 'EntityRef': + return EntityRef.fromJson(value as Map) as ReturnType; + case 'EnumArrays': + return EnumArrays.fromJson(value as Map) as ReturnType; + case 'EnumTest': + return EnumTest.fromJson(value as Map) as ReturnType; + case 'Extensible': + return Extensible.fromJson(value as Map) as ReturnType; + case 'FileSchemaTestClass': + return FileSchemaTestClass.fromJson(value as Map) as ReturnType; + case 'Foo': + return Foo.fromJson(value as Map) as ReturnType; + case 'FooBasicGetDefaultResponse': + return FooBasicGetDefaultResponse.fromJson(value as Map) as ReturnType; + case 'FooRef': + return FooRef.fromJson(value as Map) as ReturnType; + case 'FooRefOrValue': + return FooRefOrValue.fromJson(value as Map) as ReturnType; + case 'FormatTest': + return FormatTest.fromJson(value as Map) as ReturnType; + case 'Fruit': + return Fruit.fromJson(value as Map) as ReturnType; + case 'FruitAllOfDisc': + return FruitAllOfDisc.fromJson(value as Map) as ReturnType; + case 'FruitAnyOfDisc': + return FruitAnyOfDisc.fromJson(value as Map) as ReturnType; + case 'FruitGrandparentDisc': + return FruitGrandparentDisc.fromJson(value as Map) as ReturnType; + case 'FruitInlineDisc': + return FruitInlineDisc.fromJson(value as Map) as ReturnType; + case 'FruitInlineDiscOneOf': + return FruitInlineDiscOneOf.fromJson(value as Map) as ReturnType; + case 'FruitInlineDiscOneOf1': + return FruitInlineDiscOneOf1.fromJson(value as Map) as ReturnType; + case 'FruitInlineInlineDisc': + return FruitInlineInlineDisc.fromJson(value as Map) as ReturnType; + case 'FruitInlineInlineDiscOneOf': + return FruitInlineInlineDiscOneOf.fromJson(value as Map) as ReturnType; + case 'FruitInlineInlineDiscOneOf1': + return FruitInlineInlineDiscOneOf1.fromJson(value as Map) as ReturnType; + case 'FruitInlineInlineDiscOneOfOneOf': + return FruitInlineInlineDiscOneOfOneOf.fromJson(value as Map) as ReturnType; + case 'FruitOneOfDisc': + return FruitOneOfDisc.fromJson(value as Map) as ReturnType; + case 'FruitReqDisc': + return FruitReqDisc.fromJson(value as Map) as ReturnType; + case 'FruitType': + return FruitType.fromJson(value as Map) as ReturnType; + case 'FruitVariant1': + return FruitVariant1.fromJson(value as Map) as ReturnType; + case 'GigaOneOf': + return GigaOneOf.fromJson(value as Map) as ReturnType; + case 'GrapeVariant1': + return GrapeVariant1.fromJson(value as Map) as ReturnType; + case 'HasOnlyReadOnly': + return HasOnlyReadOnly.fromJson(value as Map) as ReturnType; + case 'HealthCheckResult': + return HealthCheckResult.fromJson(value as Map) as ReturnType; + case 'MapTest': + return MapTest.fromJson(value as Map) as ReturnType; + case 'MixedPropertiesAndAdditionalPropertiesClass': + return MixedPropertiesAndAdditionalPropertiesClass.fromJson(value as Map) as ReturnType; + case 'Model200Response': + return Model200Response.fromJson(value as Map) as ReturnType; + case 'ModelClient': + return ModelClient.fromJson(value as Map) as ReturnType; + case 'ModelEnumClass': + + + case 'ModelFile': + return ModelFile.fromJson(value as Map) as ReturnType; + case 'ModelList': + return ModelList.fromJson(value as Map) as ReturnType; + case 'ModelReturn': + return ModelReturn.fromJson(value as Map) as ReturnType; + case 'Name': + return Name.fromJson(value as Map) as ReturnType; + case 'NullableClass': + return NullableClass.fromJson(value as Map) as ReturnType; + case 'NumberOnly': + return NumberOnly.fromJson(value as Map) as ReturnType; + case 'ObjectWithDeprecatedFields': + return ObjectWithDeprecatedFields.fromJson(value as Map) as ReturnType; + case 'OneOfPrimitiveChild': + return OneOfPrimitiveChild.fromJson(value as Map) as ReturnType; + case 'Order': + return Order.fromJson(value as Map) as ReturnType; + case 'OuterComposite': + return OuterComposite.fromJson(value as Map) as ReturnType; + case 'OuterEnum': + + + case 'OuterEnumDefaultValue': + + + case 'OuterEnumInteger': + + + case 'OuterEnumIntegerDefaultValue': + + + case 'OuterObjectWithEnumProperty': + return OuterObjectWithEnumProperty.fromJson(value as Map) as ReturnType; + case 'Parent': + return Parent.fromJson(value as Map) as ReturnType; + case 'Pasta': + return Pasta.fromJson(value as Map) as ReturnType; + case 'Pet': + return Pet.fromJson(value as Map) as ReturnType; + case 'Pizza': + return Pizza.fromJson(value as Map) as ReturnType; + case 'PizzaSpeziale': + return PizzaSpeziale.fromJson(value as Map) as ReturnType; + case 'ReadOnlyFirst': + return ReadOnlyFirst.fromJson(value as Map) as ReturnType; + case 'SingleRefType': + + + case 'SpecialModelName': + return SpecialModelName.fromJson(value as Map) as ReturnType; + case 'Tag': + return Tag.fromJson(value as Map) as ReturnType; + case 'User': + return User.fromJson(value as Map) as ReturnType; + default: + RegExpMatch? match; + + if (value is List && (match = _regList.firstMatch(targetType)) != null) { + targetType = match![1]!; // ignore: parameter_assignments + return value + .map((dynamic v) => deserialize(v, targetType, growable: growable)) + .toList(growable: growable) as ReturnType; + } + if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { + targetType = match![1]!; // ignore: parameter_assignments + return value + .map((dynamic v) => deserialize(v, targetType, growable: growable)) + .toSet() as ReturnType; + } + if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { + targetType = match![1]!; // ignore: parameter_assignments + return Map.fromIterables( + value.keys, + value.values.map((dynamic v) => deserialize(v, targetType, growable: growable)), + ) as ReturnType; + } + break; + } + throw Exception('Cannot deserialize'); + } \ No newline at end of file diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/additional_properties_class.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/additional_properties_class.dart new file mode 100644 index 000000000000..a3d4df084be5 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/additional_properties_class.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'additional_properties_class.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class AdditionalPropertiesClass { + /// Returns a new [AdditionalPropertiesClass] instance. + AdditionalPropertiesClass({ + + this.mapProperty, + + this.mapOfMapProperty, + }); + + @JsonKey( + + name: r'map_property', + required: false, + includeIfNull: false + ) + + + final Map? mapProperty; + + + + @JsonKey( + + name: r'map_of_map_property', + required: false, + includeIfNull: false + ) + + + final Map>? mapOfMapProperty; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is AdditionalPropertiesClass && + other.mapProperty == mapProperty && + other.mapOfMapProperty == mapOfMapProperty; + + @override + int get hashCode => + mapProperty.hashCode + + mapOfMapProperty.hashCode; + + factory AdditionalPropertiesClass.fromJson(Map json) => _$AdditionalPropertiesClassFromJson(json); + + Map toJson() => _$AdditionalPropertiesClassToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/addressable.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/addressable.dart new file mode 100644 index 000000000000..014a58b24f0a --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/addressable.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'addressable.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Addressable { + /// Returns a new [Addressable] instance. + Addressable({ + + this.href, + + this.id, + }); + + /// Hyperlink reference + @JsonKey( + + name: r'href', + required: false, + includeIfNull: false + ) + + + final String? href; + + + + /// unique identifier + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false + ) + + + final String? id; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Addressable && + other.href == href && + other.id == id; + + @override + int get hashCode => + href.hashCode + + id.hashCode; + + factory Addressable.fromJson(Map json) => _$AddressableFromJson(json); + + Map toJson() => _$AddressableToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/all_of_with_single_ref.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/all_of_with_single_ref.dart new file mode 100644 index 000000000000..b654a66733e9 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/all_of_with_single_ref.dart @@ -0,0 +1,71 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/single_ref_type.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'all_of_with_single_ref.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class AllOfWithSingleRef { + /// Returns a new [AllOfWithSingleRef] instance. + AllOfWithSingleRef({ + + this.username, + + this.singleRefType, + }); + + @JsonKey( + + name: r'username', + required: false, + includeIfNull: false + ) + + + final String? username; + + + + @JsonKey( + + name: r'SingleRefType', + required: false, + includeIfNull: false + ) + + + final SingleRefType? singleRefType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is AllOfWithSingleRef && + other.username == username && + other.singleRefType == singleRefType; + + @override + int get hashCode => + username.hashCode + + singleRefType.hashCode; + + factory AllOfWithSingleRef.fromJson(Map json) => _$AllOfWithSingleRefFromJson(json); + + Map toJson() => _$AllOfWithSingleRefToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/animal.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/animal.dart new file mode 100644 index 000000000000..22a196ce7d7f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/animal.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'animal.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Animal { + /// Returns a new [Animal] instance. + Animal({ + + required this.className, + + this.color = 'red', + }); + + @JsonKey( + + name: r'className', + required: true, + includeIfNull: false + ) + + + final String className; + + + + @JsonKey( + defaultValue: 'red', + name: r'color', + required: false, + includeIfNull: false + ) + + + final String? color; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Animal && + other.className == className && + other.color == color; + + @override + int get hashCode => + className.hashCode + + color.hashCode; + + factory Animal.fromJson(Map json) => _$AnimalFromJson(json); + + Map toJson() => _$AnimalToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/api_response.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/api_response.dart new file mode 100644 index 000000000000..c6700e2d39ce --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/api_response.dart @@ -0,0 +1,86 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'api_response.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ApiResponse { + /// Returns a new [ApiResponse] instance. + ApiResponse({ + + this.code, + + this.type, + + this.message, + }); + + @JsonKey( + + name: r'code', + required: false, + includeIfNull: false + ) + + + final int? code; + + + + @JsonKey( + + name: r'type', + required: false, + includeIfNull: false + ) + + + final String? type; + + + + @JsonKey( + + name: r'message', + required: false, + includeIfNull: false + ) + + + final String? message; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ApiResponse && + other.code == code && + other.type == type && + other.message == message; + + @override + int get hashCode => + code.hashCode + + type.hashCode + + message.hashCode; + + factory ApiResponse.fromJson(Map json) => _$ApiResponseFromJson(json); + + Map toJson() => _$ApiResponseToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/dog_all_of.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/apple.dart similarity index 58% rename from samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/dog_all_of.dart rename to samples/client/echo_api/dart/dio/json_serializable/lib/src/model/apple.dart index 19bd4c0267be..96aa5d5598c7 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/dog_all_of.dart +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/apple.dart @@ -5,7 +5,7 @@ // ignore_for_file: unused_element import 'package:json_annotation/json_annotation.dart'; -part 'dog_all_of.g.dart'; +part 'apple.g.dart'; @JsonSerializable( @@ -14,36 +14,36 @@ part 'dog_all_of.g.dart'; disallowUnrecognizedKeys: false, explicitToJson: true, ) -class DogAllOf { - /// Returns a new [DogAllOf] instance. - DogAllOf({ +class Apple { + /// Returns a new [Apple] instance. + Apple({ - this.breed, + this.kind, }); @JsonKey( - name: r'breed', + name: r'kind', required: false, includeIfNull: false ) - final String? breed; + final String? kind; @override - bool operator ==(Object other) => identical(this, other) || other is DogAllOf && - other.breed == breed; + bool operator ==(Object other) => identical(this, other) || other is Apple && + other.kind == kind; @override int get hashCode => - breed.hashCode; + kind.hashCode; - factory DogAllOf.fromJson(Map json) => _$DogAllOfFromJson(json); + factory Apple.fromJson(Map json) => _$AppleFromJson(json); - Map toJson() => _$DogAllOfToJson(this); + Map toJson() => _$AppleToJson(this); @override String toString() { diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/apple_all_of_disc.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/apple_all_of_disc.dart new file mode 100644 index 000000000000..a3a77e9adc58 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/apple_all_of_disc.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'apple_all_of_disc.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class AppleAllOfDisc { + /// Returns a new [AppleAllOfDisc] instance. + AppleAllOfDisc({ + + required this.seeds, + + required this.fruitType, + }); + + @JsonKey( + + name: r'seeds', + required: true, + includeIfNull: false + ) + + + final int seeds; + + + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is AppleAllOfDisc && + other.seeds == seeds && + other.fruitType == fruitType; + + @override + int get hashCode => + seeds.hashCode + + fruitType.hashCode; + + factory AppleAllOfDisc.fromJson(Map json) => _$AppleAllOfDiscFromJson(json); + + Map toJson() => _$AppleAllOfDiscToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/apple_grandparent_disc.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/apple_grandparent_disc.dart new file mode 100644 index 000000000000..ffc417571fd2 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/apple_grandparent_disc.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'apple_grandparent_disc.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class AppleGrandparentDisc { + /// Returns a new [AppleGrandparentDisc] instance. + AppleGrandparentDisc({ + + required this.seeds, + + required this.fruitType, + }); + + @JsonKey( + + name: r'seeds', + required: true, + includeIfNull: false + ) + + + final int seeds; + + + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is AppleGrandparentDisc && + other.seeds == seeds && + other.fruitType == fruitType; + + @override + int get hashCode => + seeds.hashCode + + fruitType.hashCode; + + factory AppleGrandparentDisc.fromJson(Map json) => _$AppleGrandparentDiscFromJson(json); + + Map toJson() => _$AppleGrandparentDiscToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/apple_one_of_disc.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/apple_one_of_disc.dart new file mode 100644 index 000000000000..9f24d3622e9c --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/apple_one_of_disc.dart @@ -0,0 +1,71 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_type.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'apple_one_of_disc.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class AppleOneOfDisc { + /// Returns a new [AppleOneOfDisc] instance. + AppleOneOfDisc({ + + required this.seeds, + + required this.fruitType, + }); + + @JsonKey( + + name: r'seeds', + required: true, + includeIfNull: false + ) + + + final int seeds; + + + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is AppleOneOfDisc && + other.seeds == seeds && + other.fruitType == fruitType; + + @override + int get hashCode => + seeds.hashCode + + fruitType.hashCode; + + factory AppleOneOfDisc.fromJson(Map json) => _$AppleOneOfDiscFromJson(json); + + Map toJson() => _$AppleOneOfDiscToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/apple_req_disc.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/apple_req_disc.dart new file mode 100644 index 000000000000..4ea609af07be --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/apple_req_disc.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'apple_req_disc.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class AppleReqDisc { + /// Returns a new [AppleReqDisc] instance. + AppleReqDisc({ + + required this.seeds, + + required this.fruitType, + }); + + @JsonKey( + + name: r'seeds', + required: true, + includeIfNull: false + ) + + + final int seeds; + + + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is AppleReqDisc && + other.seeds == seeds && + other.fruitType == fruitType; + + @override + int get hashCode => + seeds.hashCode + + fruitType.hashCode; + + factory AppleReqDisc.fromJson(Map json) => _$AppleReqDiscFromJson(json); + + Map toJson() => _$AppleReqDiscToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/apple_variant1.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/apple_variant1.dart new file mode 100644 index 000000000000..409aca725037 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/apple_variant1.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'apple_variant1.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class AppleVariant1 { + /// Returns a new [AppleVariant1] instance. + AppleVariant1({ + + this.kind, + }); + + @JsonKey( + + name: r'kind', + required: false, + includeIfNull: false + ) + + + final String? kind; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is AppleVariant1 && + other.kind == kind; + + @override + int get hashCode => + kind.hashCode; + + factory AppleVariant1.fromJson(Map json) => _$AppleVariant1FromJson(json); + + Map toJson() => _$AppleVariant1ToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/array_of_array_of_number_only.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/array_of_array_of_number_only.dart new file mode 100644 index 000000000000..7372be1583f2 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/array_of_array_of_number_only.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'array_of_array_of_number_only.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ArrayOfArrayOfNumberOnly { + /// Returns a new [ArrayOfArrayOfNumberOnly] instance. + ArrayOfArrayOfNumberOnly({ + + this.arrayArrayNumber, + }); + + @JsonKey( + + name: r'ArrayArrayNumber', + required: false, + includeIfNull: false + ) + + + final List>? arrayArrayNumber; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ArrayOfArrayOfNumberOnly && + other.arrayArrayNumber == arrayArrayNumber; + + @override + int get hashCode => + arrayArrayNumber.hashCode; + + factory ArrayOfArrayOfNumberOnly.fromJson(Map json) => _$ArrayOfArrayOfNumberOnlyFromJson(json); + + Map toJson() => _$ArrayOfArrayOfNumberOnlyToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/array_of_number_only.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/array_of_number_only.dart new file mode 100644 index 000000000000..d538bb312fde --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/array_of_number_only.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'array_of_number_only.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ArrayOfNumberOnly { + /// Returns a new [ArrayOfNumberOnly] instance. + ArrayOfNumberOnly({ + + this.arrayNumber, + }); + + @JsonKey( + + name: r'ArrayNumber', + required: false, + includeIfNull: false + ) + + + final List? arrayNumber; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ArrayOfNumberOnly && + other.arrayNumber == arrayNumber; + + @override + int get hashCode => + arrayNumber.hashCode; + + factory ArrayOfNumberOnly.fromJson(Map json) => _$ArrayOfNumberOnlyFromJson(json); + + Map toJson() => _$ArrayOfNumberOnlyToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/array_test.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/array_test.dart new file mode 100644 index 000000000000..30a6ec8a8b72 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/array_test.dart @@ -0,0 +1,87 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/read_only_first.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'array_test.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ArrayTest { + /// Returns a new [ArrayTest] instance. + ArrayTest({ + + this.arrayOfString, + + this.arrayArrayOfInteger, + + this.arrayArrayOfModel, + }); + + @JsonKey( + + name: r'array_of_string', + required: false, + includeIfNull: false + ) + + + final List? arrayOfString; + + + + @JsonKey( + + name: r'array_array_of_integer', + required: false, + includeIfNull: false + ) + + + final List>? arrayArrayOfInteger; + + + + @JsonKey( + + name: r'array_array_of_model', + required: false, + includeIfNull: false + ) + + + final List>? arrayArrayOfModel; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ArrayTest && + other.arrayOfString == arrayOfString && + other.arrayArrayOfInteger == arrayArrayOfInteger && + other.arrayArrayOfModel == arrayArrayOfModel; + + @override + int get hashCode => + arrayOfString.hashCode + + arrayArrayOfInteger.hashCode + + arrayArrayOfModel.hashCode; + + factory ArrayTest.fromJson(Map json) => _$ArrayTestFromJson(json); + + Map toJson() => _$ArrayTestToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/cat_all_of.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/banana.dart similarity index 57% rename from samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/cat_all_of.dart rename to samples/client/echo_api/dart/dio/json_serializable/lib/src/model/banana.dart index abb9dbc25e5f..62eb2439ddb8 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/cat_all_of.dart +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/banana.dart @@ -5,7 +5,7 @@ // ignore_for_file: unused_element import 'package:json_annotation/json_annotation.dart'; -part 'cat_all_of.g.dart'; +part 'banana.g.dart'; @JsonSerializable( @@ -14,36 +14,36 @@ part 'cat_all_of.g.dart'; disallowUnrecognizedKeys: false, explicitToJson: true, ) -class CatAllOf { - /// Returns a new [CatAllOf] instance. - CatAllOf({ +class Banana { + /// Returns a new [Banana] instance. + Banana({ - this.declawed, + this.count, }); @JsonKey( - name: r'declawed', + name: r'count', required: false, includeIfNull: false ) - final bool? declawed; + final num? count; @override - bool operator ==(Object other) => identical(this, other) || other is CatAllOf && - other.declawed == declawed; + bool operator ==(Object other) => identical(this, other) || other is Banana && + other.count == count; @override int get hashCode => - declawed.hashCode; + count.hashCode; - factory CatAllOf.fromJson(Map json) => _$CatAllOfFromJson(json); + factory Banana.fromJson(Map json) => _$BananaFromJson(json); - Map toJson() => _$CatAllOfToJson(this); + Map toJson() => _$BananaToJson(this); @override String toString() { diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/banana_all_of_disc.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/banana_all_of_disc.dart new file mode 100644 index 000000000000..dec0c1d1e22e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/banana_all_of_disc.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'banana_all_of_disc.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class BananaAllOfDisc { + /// Returns a new [BananaAllOfDisc] instance. + BananaAllOfDisc({ + + required this.length, + + required this.fruitType, + }); + + @JsonKey( + + name: r'length', + required: true, + includeIfNull: false + ) + + + final int length; + + + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is BananaAllOfDisc && + other.length == length && + other.fruitType == fruitType; + + @override + int get hashCode => + length.hashCode + + fruitType.hashCode; + + factory BananaAllOfDisc.fromJson(Map json) => _$BananaAllOfDiscFromJson(json); + + Map toJson() => _$BananaAllOfDiscToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/banana_grandparent_disc.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/banana_grandparent_disc.dart new file mode 100644 index 000000000000..d4fb1a32b3cf --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/banana_grandparent_disc.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'banana_grandparent_disc.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class BananaGrandparentDisc { + /// Returns a new [BananaGrandparentDisc] instance. + BananaGrandparentDisc({ + + required this.length, + + required this.fruitType, + }); + + @JsonKey( + + name: r'length', + required: true, + includeIfNull: false + ) + + + final int length; + + + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is BananaGrandparentDisc && + other.length == length && + other.fruitType == fruitType; + + @override + int get hashCode => + length.hashCode + + fruitType.hashCode; + + factory BananaGrandparentDisc.fromJson(Map json) => _$BananaGrandparentDiscFromJson(json); + + Map toJson() => _$BananaGrandparentDiscToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/banana_one_of_disc.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/banana_one_of_disc.dart new file mode 100644 index 000000000000..d9088ace5ef6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/banana_one_of_disc.dart @@ -0,0 +1,71 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_type.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'banana_one_of_disc.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class BananaOneOfDisc { + /// Returns a new [BananaOneOfDisc] instance. + BananaOneOfDisc({ + + required this.length, + + required this.fruitType, + }); + + @JsonKey( + + name: r'length', + required: true, + includeIfNull: false + ) + + + final int length; + + + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is BananaOneOfDisc && + other.length == length && + other.fruitType == fruitType; + + @override + int get hashCode => + length.hashCode + + fruitType.hashCode; + + factory BananaOneOfDisc.fromJson(Map json) => _$BananaOneOfDiscFromJson(json); + + Map toJson() => _$BananaOneOfDiscToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/banana_req_disc.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/banana_req_disc.dart new file mode 100644 index 000000000000..cc6b5e0400f3 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/banana_req_disc.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'banana_req_disc.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class BananaReqDisc { + /// Returns a new [BananaReqDisc] instance. + BananaReqDisc({ + + required this.length, + + required this.fruitType, + }); + + @JsonKey( + + name: r'length', + required: true, + includeIfNull: false + ) + + + final int length; + + + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is BananaReqDisc && + other.length == length && + other.fruitType == fruitType; + + @override + int get hashCode => + length.hashCode + + fruitType.hashCode; + + factory BananaReqDisc.fromJson(Map json) => _$BananaReqDiscFromJson(json); + + Map toJson() => _$BananaReqDiscToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/bar.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/bar.dart new file mode 100644 index 000000000000..f37c58357d80 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/bar.dart @@ -0,0 +1,174 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/foo_ref_or_value.dart'; +import 'package:openapi/src/model/entity.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'bar.g.dart'; + +// ignore_for_file: unused_import + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Bar { + /// Returns a new [Bar] instance. + Bar({ + + required this.id, + + this.barPropA, + + this.fooPropB, + + this.foo, + + this.href, + + this.atSchemaLocation, + + this.atBaseType, + + required this.atType, + }); + + @JsonKey( + + name: r'id', + required: true, + includeIfNull: false + ) + + + final String id; + + + + @JsonKey( + + name: r'barPropA', + required: false, + includeIfNull: false + ) + + + final String? barPropA; + + + + @JsonKey( + + name: r'fooPropB', + required: false, + includeIfNull: false + ) + + + final String? fooPropB; + + + + @JsonKey( + + name: r'foo', + required: false, + includeIfNull: false + ) + + + final FooRefOrValue? foo; + + + + /// Hyperlink reference + @JsonKey( + + name: r'href', + required: false, + includeIfNull: false + ) + + + final String? href; + + + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey( + + name: r'@schemaLocation', + required: false, + includeIfNull: false + ) + + + final String? atSchemaLocation; + + + + /// When sub-classing, this defines the super-class + @JsonKey( + + name: r'@baseType', + required: false, + includeIfNull: false + ) + + + final String? atBaseType; + + + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey( + + name: r'@type', + required: true, + includeIfNull: false + ) + + + final String atType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Bar && + other.id == id && + other.barPropA == barPropA && + other.fooPropB == fooPropB && + other.foo == foo && + other.href == href && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + id.hashCode + + barPropA.hashCode + + fooPropB.hashCode + + foo.hashCode + + href.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory Bar.fromJson(Map json) => _$BarFromJson(json); + + Map toJson() => _$BarToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/bar_create.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/bar_create.dart new file mode 100644 index 000000000000..64f9509277cc --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/bar_create.dart @@ -0,0 +1,175 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/foo_ref_or_value.dart'; +import 'package:openapi/src/model/entity.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'bar_create.g.dart'; + +// ignore_for_file: unused_import + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class BarCreate { + /// Returns a new [BarCreate] instance. + BarCreate({ + + this.barPropA, + + this.fooPropB, + + this.foo, + + this.href, + + this.id, + + this.atSchemaLocation, + + this.atBaseType, + + required this.atType, + }); + + @JsonKey( + + name: r'barPropA', + required: false, + includeIfNull: false + ) + + + final String? barPropA; + + + + @JsonKey( + + name: r'fooPropB', + required: false, + includeIfNull: false + ) + + + final String? fooPropB; + + + + @JsonKey( + + name: r'foo', + required: false, + includeIfNull: false + ) + + + final FooRefOrValue? foo; + + + + /// Hyperlink reference + @JsonKey( + + name: r'href', + required: false, + includeIfNull: false + ) + + + final String? href; + + + + /// unique identifier + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false + ) + + + final String? id; + + + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey( + + name: r'@schemaLocation', + required: false, + includeIfNull: false + ) + + + final String? atSchemaLocation; + + + + /// When sub-classing, this defines the super-class + @JsonKey( + + name: r'@baseType', + required: false, + includeIfNull: false + ) + + + final String? atBaseType; + + + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey( + + name: r'@type', + required: true, + includeIfNull: false + ) + + + final String atType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is BarCreate && + other.barPropA == barPropA && + other.fooPropB == fooPropB && + other.foo == foo && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + barPropA.hashCode + + fooPropB.hashCode + + foo.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory BarCreate.fromJson(Map json) => _$BarCreateFromJson(json); + + Map toJson() => _$BarCreateToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/bar_ref.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/bar_ref.dart new file mode 100644 index 000000000000..f6b6bc05e15c --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/bar_ref.dart @@ -0,0 +1,126 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity_ref.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'bar_ref.g.dart'; + +// ignore_for_file: unused_import + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class BarRef { + /// Returns a new [BarRef] instance. + BarRef({ + + this.href, + + this.id, + + this.atSchemaLocation, + + this.atBaseType, + + required this.atType, + }); + + /// Hyperlink reference + @JsonKey( + + name: r'href', + required: false, + includeIfNull: false + ) + + + final String? href; + + + + /// unique identifier + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false + ) + + + final String? id; + + + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey( + + name: r'@schemaLocation', + required: false, + includeIfNull: false + ) + + + final String? atSchemaLocation; + + + + /// When sub-classing, this defines the super-class + @JsonKey( + + name: r'@baseType', + required: false, + includeIfNull: false + ) + + + final String? atBaseType; + + + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey( + + name: r'@type', + required: true, + includeIfNull: false + ) + + + final String atType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is BarRef && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory BarRef.fromJson(Map json) => _$BarRefFromJson(json); + + Map toJson() => _$BarRefToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/bar_ref_or_value.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/bar_ref_or_value.dart new file mode 100644 index 000000000000..4103e72ca7f6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/bar_ref_or_value.dart @@ -0,0 +1,125 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/bar_ref.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'bar_ref_or_value.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class BarRefOrValue { + /// Returns a new [BarRefOrValue] instance. + BarRefOrValue({ + + this.href, + + required this.id, + + this.atSchemaLocation, + + this.atBaseType, + + required this.atType, + }); + + /// Hyperlink reference + @JsonKey( + + name: r'href', + required: false, + includeIfNull: false + ) + + + final String? href; + + + + /// unique identifier + @JsonKey( + + name: r'id', + required: true, + includeIfNull: false + ) + + + final String id; + + + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey( + + name: r'@schemaLocation', + required: false, + includeIfNull: false + ) + + + final String? atSchemaLocation; + + + + /// When sub-classing, this defines the super-class + @JsonKey( + + name: r'@baseType', + required: false, + includeIfNull: false + ) + + + final String? atBaseType; + + + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey( + + name: r'@type', + required: true, + includeIfNull: false + ) + + + final String atType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is BarRefOrValue && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory BarRefOrValue.fromJson(Map json) => _$BarRefOrValueFromJson(json); + + Map toJson() => _$BarRefOrValueToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/capitalization.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/capitalization.dart new file mode 100644 index 000000000000..707cb05a040f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/capitalization.dart @@ -0,0 +1,135 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'capitalization.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Capitalization { + /// Returns a new [Capitalization] instance. + Capitalization({ + + this.smallCamel, + + this.capitalCamel, + + this.smallSnake, + + this.capitalSnake, + + this.sCAETHFlowPoints, + + this.ATT_NAME, + }); + + @JsonKey( + + name: r'smallCamel', + required: false, + includeIfNull: false + ) + + + final String? smallCamel; + + + + @JsonKey( + + name: r'CapitalCamel', + required: false, + includeIfNull: false + ) + + + final String? capitalCamel; + + + + @JsonKey( + + name: r'small_Snake', + required: false, + includeIfNull: false + ) + + + final String? smallSnake; + + + + @JsonKey( + + name: r'Capital_Snake', + required: false, + includeIfNull: false + ) + + + final String? capitalSnake; + + + + @JsonKey( + + name: r'SCA_ETH_Flow_Points', + required: false, + includeIfNull: false + ) + + + final String? sCAETHFlowPoints; + + + + /// Name of the pet + @JsonKey( + + name: r'ATT_NAME', + required: false, + includeIfNull: false + ) + + + final String? ATT_NAME; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Capitalization && + other.smallCamel == smallCamel && + other.capitalCamel == capitalCamel && + other.smallSnake == smallSnake && + other.capitalSnake == capitalSnake && + other.sCAETHFlowPoints == sCAETHFlowPoints && + other.ATT_NAME == ATT_NAME; + + @override + int get hashCode => + smallCamel.hashCode + + capitalCamel.hashCode + + smallSnake.hashCode + + capitalSnake.hashCode + + sCAETHFlowPoints.hashCode + + ATT_NAME.hashCode; + + factory Capitalization.fromJson(Map json) => _$CapitalizationFromJson(json); + + Map toJson() => _$CapitalizationToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/cat.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/cat.dart new file mode 100644 index 000000000000..0b176faf313e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/cat.dart @@ -0,0 +1,89 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/animal.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'cat.g.dart'; + +// ignore_for_file: unused_import + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Cat { + /// Returns a new [Cat] instance. + Cat({ + + required this.className, + + this.color = 'red', + + this.declawed, + }); + + @JsonKey( + + name: r'className', + required: true, + includeIfNull: false + ) + + + final String className; + + + + @JsonKey( + defaultValue: 'red', + name: r'color', + required: false, + includeIfNull: false + ) + + + final String? color; + + + + @JsonKey( + + name: r'declawed', + required: false, + includeIfNull: false + ) + + + final bool? declawed; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Cat && + other.className == className && + other.color == color && + other.declawed == declawed; + + @override + int get hashCode => + className.hashCode + + color.hashCode + + declawed.hashCode; + + factory Cat.fromJson(Map json) => _$CatFromJson(json); + + Map toJson() => _$CatToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/category.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/category.dart new file mode 100644 index 000000000000..b94c61579909 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/category.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'category.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Category { + /// Returns a new [Category] instance. + Category({ + + this.id, + + this.name = 'default-name', + }); + + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false + ) + + + final int? id; + + + + @JsonKey( + defaultValue: 'default-name', + name: r'name', + required: true, + includeIfNull: false + ) + + + final String name; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Category && + other.id == id && + other.name == name; + + @override + int get hashCode => + id.hashCode + + name.hashCode; + + factory Category.fromJson(Map json) => _$CategoryFromJson(json); + + Map toJson() => _$CategoryToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/class_model.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/class_model.dart new file mode 100644 index 000000000000..01837bfcca96 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/class_model.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'class_model.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ClassModel { + /// Returns a new [ClassModel] instance. + ClassModel({ + + this.class_, + }); + + @JsonKey( + + name: r'_class', + required: false, + includeIfNull: false + ) + + + final String? class_; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ClassModel && + other.class_ == class_; + + @override + int get hashCode => + class_.hashCode; + + factory ClassModel.fromJson(Map json) => _$ClassModelFromJson(json); + + Map toJson() => _$ClassModelToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_missing_from_properties.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_missing_from_properties.dart new file mode 100644 index 000000000000..50ce619f3f15 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_missing_from_properties.dart @@ -0,0 +1,55 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/disc_missing_from_properties.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'composed_disc_missing_from_properties.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ComposedDiscMissingFromProperties { + /// Returns a new [ComposedDiscMissingFromProperties] instance. + ComposedDiscMissingFromProperties({ + + this.length, + }); + + @JsonKey( + + name: r'length', + required: false, + includeIfNull: false + ) + + + final int? length; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ComposedDiscMissingFromProperties && + other.length == length; + + @override + int get hashCode => + length.hashCode; + + factory ComposedDiscMissingFromProperties.fromJson(Map json) => _$ComposedDiscMissingFromPropertiesFromJson(json); + + Map toJson() => _$ComposedDiscMissingFromPropertiesToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_optional_type_correct.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_optional_type_correct.dart new file mode 100644 index 000000000000..b6a10c7582b5 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_optional_type_correct.dart @@ -0,0 +1,55 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/disc_optional_type_correct.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'composed_disc_optional_type_correct.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ComposedDiscOptionalTypeCorrect { + /// Returns a new [ComposedDiscOptionalTypeCorrect] instance. + ComposedDiscOptionalTypeCorrect({ + + this.fruitType, + }); + + @JsonKey( + + name: r'fruitType', + required: false, + includeIfNull: false + ) + + + final String? fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ComposedDiscOptionalTypeCorrect && + other.fruitType == fruitType; + + @override + int get hashCode => + fruitType.hashCode; + + factory ComposedDiscOptionalTypeCorrect.fromJson(Map json) => _$ComposedDiscOptionalTypeCorrectFromJson(json); + + Map toJson() => _$ComposedDiscOptionalTypeCorrectToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_optional_type_inconsistent.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_optional_type_inconsistent.dart new file mode 100644 index 000000000000..1576b2caae2b --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_optional_type_inconsistent.dart @@ -0,0 +1,56 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/disc_optional_type_incorrect.dart'; +import 'package:openapi/src/model/disc_optional_type_correct.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'composed_disc_optional_type_inconsistent.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ComposedDiscOptionalTypeInconsistent { + /// Returns a new [ComposedDiscOptionalTypeInconsistent] instance. + ComposedDiscOptionalTypeInconsistent({ + + this.fruitType, + }); + + @JsonKey( + + name: r'fruitType', + required: false, + includeIfNull: false + ) + + + final String? fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ComposedDiscOptionalTypeInconsistent && + other.fruitType == fruitType; + + @override + int get hashCode => + fruitType.hashCode; + + factory ComposedDiscOptionalTypeInconsistent.fromJson(Map json) => _$ComposedDiscOptionalTypeInconsistentFromJson(json); + + Map toJson() => _$ComposedDiscOptionalTypeInconsistentToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_optional_type_incorrect.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_optional_type_incorrect.dart new file mode 100644 index 000000000000..d340242de626 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_optional_type_incorrect.dart @@ -0,0 +1,55 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/disc_optional_type_incorrect.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'composed_disc_optional_type_incorrect.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ComposedDiscOptionalTypeIncorrect { + /// Returns a new [ComposedDiscOptionalTypeIncorrect] instance. + ComposedDiscOptionalTypeIncorrect({ + + this.fruitType, + }); + + @JsonKey( + + name: r'fruitType', + required: false, + includeIfNull: false + ) + + + final int? fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ComposedDiscOptionalTypeIncorrect && + other.fruitType == fruitType; + + @override + int get hashCode => + fruitType.hashCode; + + factory ComposedDiscOptionalTypeIncorrect.fromJson(Map json) => _$ComposedDiscOptionalTypeIncorrectFromJson(json); + + Map toJson() => _$ComposedDiscOptionalTypeIncorrectToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_required_inconsistent.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_required_inconsistent.dart new file mode 100644 index 000000000000..872902c846e7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_required_inconsistent.dart @@ -0,0 +1,56 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_type.dart'; +import 'package:openapi/src/model/disc_optional_type_correct.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'composed_disc_required_inconsistent.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ComposedDiscRequiredInconsistent { + /// Returns a new [ComposedDiscRequiredInconsistent] instance. + ComposedDiscRequiredInconsistent({ + + required this.fruitType, + }); + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ComposedDiscRequiredInconsistent && + other.fruitType == fruitType; + + @override + int get hashCode => + fruitType.hashCode; + + factory ComposedDiscRequiredInconsistent.fromJson(Map json) => _$ComposedDiscRequiredInconsistentFromJson(json); + + Map toJson() => _$ComposedDiscRequiredInconsistentToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_type_inconsistent.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_type_inconsistent.dart new file mode 100644 index 000000000000..d2fe273df4c9 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_type_inconsistent.dart @@ -0,0 +1,56 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/disc_type_incorrect.dart'; +import 'package:openapi/src/model/fruit_type.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'composed_disc_type_inconsistent.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ComposedDiscTypeInconsistent { + /// Returns a new [ComposedDiscTypeInconsistent] instance. + ComposedDiscTypeInconsistent({ + + required this.fruitType, + }); + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ComposedDiscTypeInconsistent && + other.fruitType == fruitType; + + @override + int get hashCode => + fruitType.hashCode; + + factory ComposedDiscTypeInconsistent.fromJson(Map json) => _$ComposedDiscTypeInconsistentFromJson(json); + + Map toJson() => _$ComposedDiscTypeInconsistentToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_type_incorrect.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_type_incorrect.dart new file mode 100644 index 000000000000..7da0535ff755 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/composed_disc_type_incorrect.dart @@ -0,0 +1,55 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/disc_type_incorrect.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'composed_disc_type_incorrect.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ComposedDiscTypeIncorrect { + /// Returns a new [ComposedDiscTypeIncorrect] instance. + ComposedDiscTypeIncorrect({ + + required this.fruitType, + }); + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final int fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ComposedDiscTypeIncorrect && + other.fruitType == fruitType; + + @override + int get hashCode => + fruitType.hashCode; + + factory ComposedDiscTypeIncorrect.fromJson(Map json) => _$ComposedDiscTypeIncorrectFromJson(json); + + Map toJson() => _$ComposedDiscTypeIncorrectToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/deprecated_object.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/deprecated_object.dart new file mode 100644 index 000000000000..0151b72e23a1 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/deprecated_object.dart @@ -0,0 +1,55 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'deprecated_object.g.dart'; + + +@Deprecated('DeprecatedObject has been deprecated') +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class DeprecatedObject { + /// Returns a new [DeprecatedObject] instance. + DeprecatedObject({ + + this.name, + }); + + @JsonKey( + + name: r'name', + required: false, + includeIfNull: false + ) + + + final String? name; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is DeprecatedObject && + other.name == name; + + @override + int get hashCode => + name.hashCode; + + factory DeprecatedObject.fromJson(Map json) => _$DeprecatedObjectFromJson(json); + + Map toJson() => _$DeprecatedObjectToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/disc_missing_from_properties.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/disc_missing_from_properties.dart new file mode 100644 index 000000000000..428ab5aabe2a --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/disc_missing_from_properties.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'disc_missing_from_properties.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class DiscMissingFromProperties { + /// Returns a new [DiscMissingFromProperties] instance. + DiscMissingFromProperties({ + + this.length, + }); + + @JsonKey( + + name: r'length', + required: false, + includeIfNull: false + ) + + + final int? length; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is DiscMissingFromProperties && + other.length == length; + + @override + int get hashCode => + length.hashCode; + + factory DiscMissingFromProperties.fromJson(Map json) => _$DiscMissingFromPropertiesFromJson(json); + + Map toJson() => _$DiscMissingFromPropertiesToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/disc_optional_type_correct.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/disc_optional_type_correct.dart new file mode 100644 index 000000000000..87c5ee5855ef --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/disc_optional_type_correct.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'disc_optional_type_correct.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class DiscOptionalTypeCorrect { + /// Returns a new [DiscOptionalTypeCorrect] instance. + DiscOptionalTypeCorrect({ + + this.fruitType, + }); + + @JsonKey( + + name: r'fruitType', + required: false, + includeIfNull: false + ) + + + final String? fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is DiscOptionalTypeCorrect && + other.fruitType == fruitType; + + @override + int get hashCode => + fruitType.hashCode; + + factory DiscOptionalTypeCorrect.fromJson(Map json) => _$DiscOptionalTypeCorrectFromJson(json); + + Map toJson() => _$DiscOptionalTypeCorrectToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/disc_optional_type_incorrect.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/disc_optional_type_incorrect.dart new file mode 100644 index 000000000000..c3c1c6745240 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/disc_optional_type_incorrect.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'disc_optional_type_incorrect.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class DiscOptionalTypeIncorrect { + /// Returns a new [DiscOptionalTypeIncorrect] instance. + DiscOptionalTypeIncorrect({ + + this.fruitType, + }); + + @JsonKey( + + name: r'fruitType', + required: false, + includeIfNull: false + ) + + + final int? fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is DiscOptionalTypeIncorrect && + other.fruitType == fruitType; + + @override + int get hashCode => + fruitType.hashCode; + + factory DiscOptionalTypeIncorrect.fromJson(Map json) => _$DiscOptionalTypeIncorrectFromJson(json); + + Map toJson() => _$DiscOptionalTypeIncorrectToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/disc_type_incorrect.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/disc_type_incorrect.dart new file mode 100644 index 000000000000..12a5cfa8ac08 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/disc_type_incorrect.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'disc_type_incorrect.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class DiscTypeIncorrect { + /// Returns a new [DiscTypeIncorrect] instance. + DiscTypeIncorrect({ + + required this.fruitType, + }); + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final int fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is DiscTypeIncorrect && + other.fruitType == fruitType; + + @override + int get hashCode => + fruitType.hashCode; + + factory DiscTypeIncorrect.fromJson(Map json) => _$DiscTypeIncorrectFromJson(json); + + Map toJson() => _$DiscTypeIncorrectToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/dog.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/dog.dart new file mode 100644 index 000000000000..a049d0479fb0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/dog.dart @@ -0,0 +1,89 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/animal.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'dog.g.dart'; + +// ignore_for_file: unused_import + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Dog { + /// Returns a new [Dog] instance. + Dog({ + + required this.className, + + this.color = 'red', + + this.breed, + }); + + @JsonKey( + + name: r'className', + required: true, + includeIfNull: false + ) + + + final String className; + + + + @JsonKey( + defaultValue: 'red', + name: r'color', + required: false, + includeIfNull: false + ) + + + final String? color; + + + + @JsonKey( + + name: r'breed', + required: false, + includeIfNull: false + ) + + + final String? breed; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Dog && + other.className == className && + other.color == color && + other.breed == breed; + + @override + int get hashCode => + className.hashCode + + color.hashCode + + breed.hashCode; + + factory Dog.fromJson(Map json) => _$DogFromJson(json); + + Map toJson() => _$DogToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/entity.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/entity.dart new file mode 100644 index 000000000000..c95e0e404f88 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/entity.dart @@ -0,0 +1,123 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'entity.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Entity { + /// Returns a new [Entity] instance. + Entity({ + + this.href, + + this.id, + + this.atSchemaLocation, + + this.atBaseType, + + required this.atType, + }); + + /// Hyperlink reference + @JsonKey( + + name: r'href', + required: false, + includeIfNull: false + ) + + + final String? href; + + + + /// unique identifier + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false + ) + + + final String? id; + + + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey( + + name: r'@schemaLocation', + required: false, + includeIfNull: false + ) + + + final String? atSchemaLocation; + + + + /// When sub-classing, this defines the super-class + @JsonKey( + + name: r'@baseType', + required: false, + includeIfNull: false + ) + + + final String? atBaseType; + + + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey( + + name: r'@type', + required: true, + includeIfNull: false + ) + + + final String atType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Entity && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory Entity.fromJson(Map json) => _$EntityFromJson(json); + + Map toJson() => _$EntityToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/entity_ref.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/entity_ref.dart new file mode 100644 index 000000000000..91cf2f4ed1ae --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/entity_ref.dart @@ -0,0 +1,157 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'entity_ref.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class EntityRef { + /// Returns a new [EntityRef] instance. + EntityRef({ + + this.name, + + this.atReferredType, + + this.href, + + this.id, + + this.atSchemaLocation, + + this.atBaseType, + + required this.atType, + }); + + /// Name of the related entity. + @JsonKey( + + name: r'name', + required: false, + includeIfNull: false + ) + + + final String? name; + + + + /// The actual type of the target instance when needed for disambiguation. + @JsonKey( + + name: r'@referredType', + required: false, + includeIfNull: false + ) + + + final String? atReferredType; + + + + /// Hyperlink reference + @JsonKey( + + name: r'href', + required: false, + includeIfNull: false + ) + + + final String? href; + + + + /// unique identifier + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false + ) + + + final String? id; + + + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey( + + name: r'@schemaLocation', + required: false, + includeIfNull: false + ) + + + final String? atSchemaLocation; + + + + /// When sub-classing, this defines the super-class + @JsonKey( + + name: r'@baseType', + required: false, + includeIfNull: false + ) + + + final String? atBaseType; + + + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey( + + name: r'@type', + required: true, + includeIfNull: false + ) + + + final String atType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is EntityRef && + other.name == name && + other.atReferredType == atReferredType && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + name.hashCode + + atReferredType.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory EntityRef.fromJson(Map json) => _$EntityRefFromJson(json); + + Map toJson() => _$EntityRefToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/enum_arrays.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/enum_arrays.dart new file mode 100644 index 000000000000..f941a9318135 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/enum_arrays.dart @@ -0,0 +1,92 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'enum_arrays.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class EnumArrays { + /// Returns a new [EnumArrays] instance. + EnumArrays({ + + this.justSymbol, + + this.arrayEnum, + }); + + @JsonKey( + + name: r'just_symbol', + required: false, + includeIfNull: false + ) + + + final EnumArraysJustSymbolEnum? justSymbol; + + + + @JsonKey( + + name: r'array_enum', + required: false, + includeIfNull: false + ) + + + final List? arrayEnum; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is EnumArrays && + other.justSymbol == justSymbol && + other.arrayEnum == arrayEnum; + + @override + int get hashCode => + justSymbol.hashCode + + arrayEnum.hashCode; + + factory EnumArrays.fromJson(Map json) => _$EnumArraysFromJson(json); + + Map toJson() => _$EnumArraysToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + + +enum EnumArraysJustSymbolEnum { + @JsonValue(rr'>=') + greaterThanEqual, + @JsonValue(rr'$') + dollar, + @JsonValue(rr'unknown_default_open_api') + unknownDefaultOpenApi, +} + + + +enum EnumArraysArrayEnumEnum { + @JsonValue(rr'fish') + fish, + @JsonValue(rr'crab') + crab, + @JsonValue(rr'unknown_default_open_api') + unknownDefaultOpenApi, +} + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/enum_test.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/enum_test.dart new file mode 100644 index 000000000000..84026da5d834 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/enum_test.dart @@ -0,0 +1,218 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +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:json_annotation/json_annotation.dart'; + +part 'enum_test.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class EnumTest { + /// Returns a new [EnumTest] instance. + EnumTest({ + + this.enumString, + + required this.enumStringRequired, + + this.enumInteger, + + this.enumNumber, + + this.outerEnum, + + this.outerEnumInteger, + + this.outerEnumDefaultValue, + + this.outerEnumIntegerDefaultValue, + }); + + @JsonKey( + + name: r'enum_string', + required: false, + includeIfNull: false + ) + + + final EnumTestEnumStringEnum? enumString; + + + + @JsonKey( + + name: r'enum_string_required', + required: true, + includeIfNull: false + ) + + + final EnumTestEnumStringRequiredEnum enumStringRequired; + + + + @JsonKey( + + name: r'enum_integer', + required: false, + includeIfNull: false + ) + + + final EnumTestEnumIntegerEnum? enumInteger; + + + + @JsonKey( + + name: r'enum_number', + required: false, + includeIfNull: false + ) + + + final EnumTestEnumNumberEnum? enumNumber; + + + + @JsonKey( + + name: r'outerEnum', + required: false, + includeIfNull: false + ) + + + final OuterEnum? outerEnum; + + + + @JsonKey( + + name: r'outerEnumInteger', + required: false, + includeIfNull: false + ) + + + final OuterEnumInteger? outerEnumInteger; + + + + @JsonKey( + + name: r'outerEnumDefaultValue', + required: false, + includeIfNull: false + ) + + + final OuterEnumDefaultValue? outerEnumDefaultValue; + + + + @JsonKey( + + name: r'outerEnumIntegerDefaultValue', + required: false, + includeIfNull: false + ) + + + final OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is EnumTest && + other.enumString == enumString && + other.enumStringRequired == enumStringRequired && + other.enumInteger == enumInteger && + other.enumNumber == enumNumber && + other.outerEnum == outerEnum && + other.outerEnumInteger == outerEnumInteger && + other.outerEnumDefaultValue == outerEnumDefaultValue && + other.outerEnumIntegerDefaultValue == outerEnumIntegerDefaultValue; + + @override + int get hashCode => + enumString.hashCode + + enumStringRequired.hashCode + + enumInteger.hashCode + + enumNumber.hashCode + + (outerEnum == null ? 0 : outerEnum.hashCode) + + outerEnumInteger.hashCode + + outerEnumDefaultValue.hashCode + + outerEnumIntegerDefaultValue.hashCode; + + factory EnumTest.fromJson(Map json) => _$EnumTestFromJson(json); + + Map toJson() => _$EnumTestToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + + +enum EnumTestEnumStringEnum { + @JsonValue(rr'UPPER') + UPPER, + @JsonValue(rr'lower') + lower, + @JsonValue(rr'') + empty, + @JsonValue(rr'unknown_default_open_api') + unknownDefaultOpenApi, +} + + + +enum EnumTestEnumStringRequiredEnum { + @JsonValue(rr'UPPER') + UPPER, + @JsonValue(rr'lower') + lower, + @JsonValue(rr'') + empty, + @JsonValue(rr'unknown_default_open_api') + unknownDefaultOpenApi, +} + + + +enum EnumTestEnumIntegerEnum { + @JsonValue(1) + number1, + @JsonValue(-1) + numberNegative1, + @JsonValue(11184809) + unknownDefaultOpenApi, +} + + + +enum EnumTestEnumNumberEnum { + @JsonValue(r'1.1') + number1Period1, + @JsonValue(r'-1.2') + numberNegative1Period2, + @JsonValue(r'11184809') + unknownDefaultOpenApi, +} + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/extensible.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/extensible.dart new file mode 100644 index 000000000000..c54846e3d45e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/extensible.dart @@ -0,0 +1,89 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'extensible.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Extensible { + /// Returns a new [Extensible] instance. + Extensible({ + + this.atSchemaLocation, + + this.atBaseType, + + required this.atType, + }); + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey( + + name: r'@schemaLocation', + required: false, + includeIfNull: false + ) + + + final String? atSchemaLocation; + + + + /// When sub-classing, this defines the super-class + @JsonKey( + + name: r'@baseType', + required: false, + includeIfNull: false + ) + + + final String? atBaseType; + + + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey( + + name: r'@type', + required: true, + includeIfNull: false + ) + + + final String atType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Extensible && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory Extensible.fromJson(Map json) => _$ExtensibleFromJson(json); + + Map toJson() => _$ExtensibleToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/file_schema_test_class.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/file_schema_test_class.dart new file mode 100644 index 000000000000..bd2a9dc6f2fc --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/file_schema_test_class.dart @@ -0,0 +1,71 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/model_file.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'file_schema_test_class.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FileSchemaTestClass { + /// Returns a new [FileSchemaTestClass] instance. + FileSchemaTestClass({ + + this.file, + + this.files, + }); + + @JsonKey( + + name: r'file', + required: false, + includeIfNull: false + ) + + + final ModelFile? file; + + + + @JsonKey( + + name: r'files', + required: false, + includeIfNull: false + ) + + + final List? files; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FileSchemaTestClass && + other.file == file && + other.files == files; + + @override + int get hashCode => + file.hashCode + + files.hashCode; + + factory FileSchemaTestClass.fromJson(Map json) => _$FileSchemaTestClassFromJson(json); + + Map toJson() => _$FileSchemaTestClassToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/foo.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/foo.dart new file mode 100644 index 000000000000..591b297c5625 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/foo.dart @@ -0,0 +1,158 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'foo.g.dart'; + +// ignore_for_file: unused_import + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Foo { + /// Returns a new [Foo] instance. + Foo({ + + this.fooPropA, + + this.fooPropB, + + this.href, + + this.id, + + this.atSchemaLocation, + + this.atBaseType, + + required this.atType, + }); + + @JsonKey( + + name: r'fooPropA', + required: false, + includeIfNull: false + ) + + + final String? fooPropA; + + + + @JsonKey( + + name: r'fooPropB', + required: false, + includeIfNull: false + ) + + + final String? fooPropB; + + + + /// Hyperlink reference + @JsonKey( + + name: r'href', + required: false, + includeIfNull: false + ) + + + final String? href; + + + + /// unique identifier + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false + ) + + + final String? id; + + + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey( + + name: r'@schemaLocation', + required: false, + includeIfNull: false + ) + + + final String? atSchemaLocation; + + + + /// When sub-classing, this defines the super-class + @JsonKey( + + name: r'@baseType', + required: false, + includeIfNull: false + ) + + + final String? atBaseType; + + + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey( + + name: r'@type', + required: true, + includeIfNull: false + ) + + + final String atType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Foo && + other.fooPropA == fooPropA && + other.fooPropB == fooPropB && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + fooPropA.hashCode + + fooPropB.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory Foo.fromJson(Map json) => _$FooFromJson(json); + + Map toJson() => _$FooToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/inline_response_default.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/foo_basic_get_default_response.dart similarity index 59% rename from samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/inline_response_default.dart rename to samples/client/echo_api/dart/dio/json_serializable/lib/src/model/foo_basic_get_default_response.dart index 9f1eefd4c1a3..0ea084ab4a00 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/inline_response_default.dart +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/foo_basic_get_default_response.dart @@ -2,10 +2,11 @@ // AUTO-GENERATED FILE, DO NOT MODIFY! // +// ignore_for_file: unused_element import 'package:openapi/src/model/foo.dart'; import 'package:json_annotation/json_annotation.dart'; -part 'inline_response_default.g.dart'; +part 'foo_basic_get_default_response.g.dart'; @JsonSerializable( @@ -14,9 +15,9 @@ part 'inline_response_default.g.dart'; disallowUnrecognizedKeys: false, explicitToJson: true, ) -class InlineResponseDefault { - /// Returns a new [InlineResponseDefault] instance. - InlineResponseDefault({ +class FooBasicGetDefaultResponse { + /// Returns a new [FooBasicGetDefaultResponse] instance. + FooBasicGetDefaultResponse({ this.string, }); @@ -34,16 +35,16 @@ class InlineResponseDefault { @override - bool operator ==(Object other) => identical(this, other) || other is InlineResponseDefault && + bool operator ==(Object other) => identical(this, other) || other is FooBasicGetDefaultResponse && other.string == string; @override int get hashCode => string.hashCode; - factory InlineResponseDefault.fromJson(Map json) => _$InlineResponseDefaultFromJson(json); + factory FooBasicGetDefaultResponse.fromJson(Map json) => _$FooBasicGetDefaultResponseFromJson(json); - Map toJson() => _$InlineResponseDefaultToJson(this); + Map toJson() => _$FooBasicGetDefaultResponseToJson(this); @override String toString() { diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/foo_ref.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/foo_ref.dart new file mode 100644 index 000000000000..797ff7c32e59 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/foo_ref.dart @@ -0,0 +1,142 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity_ref.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'foo_ref.g.dart'; + +// ignore_for_file: unused_import + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FooRef { + /// Returns a new [FooRef] instance. + FooRef({ + + this.foorefPropA, + + this.href, + + this.id, + + this.atSchemaLocation, + + this.atBaseType, + + required this.atType, + }); + + @JsonKey( + + name: r'foorefPropA', + required: false, + includeIfNull: false + ) + + + final String? foorefPropA; + + + + /// Hyperlink reference + @JsonKey( + + name: r'href', + required: false, + includeIfNull: false + ) + + + final String? href; + + + + /// unique identifier + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false + ) + + + final String? id; + + + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey( + + name: r'@schemaLocation', + required: false, + includeIfNull: false + ) + + + final String? atSchemaLocation; + + + + /// When sub-classing, this defines the super-class + @JsonKey( + + name: r'@baseType', + required: false, + includeIfNull: false + ) + + + final String? atBaseType; + + + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey( + + name: r'@type', + required: true, + includeIfNull: false + ) + + + final String atType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FooRef && + other.foorefPropA == foorefPropA && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + foorefPropA.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory FooRef.fromJson(Map json) => _$FooRefFromJson(json); + + Map toJson() => _$FooRefToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/foo_ref_or_value.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/foo_ref_or_value.dart new file mode 100644 index 000000000000..6e45b169dc8d --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/foo_ref_or_value.dart @@ -0,0 +1,125 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/foo_ref.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'foo_ref_or_value.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FooRefOrValue { + /// Returns a new [FooRefOrValue] instance. + FooRefOrValue({ + + this.href, + + this.id, + + this.atSchemaLocation, + + this.atBaseType, + + required this.atType, + }); + + /// Hyperlink reference + @JsonKey( + + name: r'href', + required: false, + includeIfNull: false + ) + + + final String? href; + + + + /// unique identifier + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false + ) + + + final String? id; + + + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey( + + name: r'@schemaLocation', + required: false, + includeIfNull: false + ) + + + final String? atSchemaLocation; + + + + /// When sub-classing, this defines the super-class + @JsonKey( + + name: r'@baseType', + required: false, + includeIfNull: false + ) + + + final String? atBaseType; + + + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey( + + name: r'@type', + required: true, + includeIfNull: false + ) + + + final String atType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FooRefOrValue && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory FooRefOrValue.fromJson(Map json) => _$FooRefOrValueFromJson(json); + + Map toJson() => _$FooRefOrValueToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/format_test.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/format_test.dart new file mode 100644 index 000000000000..91b35595a34d --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/format_test.dart @@ -0,0 +1,302 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:dio/dio.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'format_test.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FormatTest { + /// Returns a new [FormatTest] instance. + FormatTest({ + + this.integer, + + this.int32, + + this.int64, + + required this.number, + + this.float, + + this.double_, + + this.decimal, + + this.string, + + required this.byte, + + this.binary, + + required this.date, + + this.dateTime, + + this.uuid, + + required this.password, + + this.patternWithDigits, + + this.patternWithDigitsAndDelimiter, + }); + + // minimum: 10 + // maximum: 100 + @JsonKey( + + name: r'integer', + required: false, + includeIfNull: false + ) + + + final int? integer; + + + + // minimum: 20 + // maximum: 200 + @JsonKey( + + name: r'int32', + required: false, + includeIfNull: false + ) + + + final int? int32; + + + + @JsonKey( + + name: r'int64', + required: false, + includeIfNull: false + ) + + + final int? int64; + + + + // minimum: 32.1 + // maximum: 543.2 + @JsonKey( + + name: r'number', + required: true, + includeIfNull: false + ) + + + final num number; + + + + // minimum: 54.3 + // maximum: 987.6 + @JsonKey( + + name: r'float', + required: false, + includeIfNull: false + ) + + + final double? float; + + + + // minimum: 67.8 + // maximum: 123.4 + @JsonKey( + + name: r'double', + required: false, + includeIfNull: false + ) + + + final double? double_; + + + + @JsonKey( + + name: r'decimal', + required: false, + includeIfNull: false + ) + + + final double? decimal; + + + + @JsonKey( + + name: r'string', + required: false, + includeIfNull: false + ) + + + final String? string; + + + + @JsonKey( + + name: r'byte', + required: true, + includeIfNull: false + ) + + + final String byte; + + + + @JsonKey(ignore: true) + + + final MultipartFile? binary; + + + + @JsonKey( + + name: r'date', + required: true, + includeIfNull: false + ) + + + final DateTime date; + + + + @JsonKey( + + name: r'dateTime', + required: false, + includeIfNull: false + ) + + + final DateTime? dateTime; + + + + @JsonKey( + + name: r'uuid', + required: false, + includeIfNull: false + ) + + + final String? uuid; + + + + @JsonKey( + + name: r'password', + required: true, + includeIfNull: false + ) + + + final String password; + + + + /// A string that is a 10 digit number. Can have leading zeros. + @JsonKey( + + name: r'pattern_with_digits', + required: false, + includeIfNull: false + ) + + + final String? patternWithDigits; + + + + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + @JsonKey( + + name: r'pattern_with_digits_and_delimiter', + required: false, + includeIfNull: false + ) + + + final String? patternWithDigitsAndDelimiter; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FormatTest && + other.integer == integer && + other.int32 == int32 && + other.int64 == int64 && + other.number == number && + other.float == float && + other.double_ == double_ && + other.decimal == decimal && + other.string == string && + other.byte == byte && + other.binary == binary && + other.date == date && + other.dateTime == dateTime && + other.uuid == uuid && + other.password == password && + other.patternWithDigits == patternWithDigits && + other.patternWithDigitsAndDelimiter == patternWithDigitsAndDelimiter; + + @override + int get hashCode => + integer.hashCode + + int32.hashCode + + int64.hashCode + + number.hashCode + + float.hashCode + + double_.hashCode + + decimal.hashCode + + string.hashCode + + byte.hashCode + + binary.hashCode + + date.hashCode + + dateTime.hashCode + + uuid.hashCode + + password.hashCode + + patternWithDigits.hashCode + + patternWithDigitsAndDelimiter.hashCode; + + factory FormatTest.fromJson(Map json) => _$FormatTestFromJson(json); + + Map toJson() => _$FormatTestToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit.dart new file mode 100644 index 000000000000..1fe8d76856a1 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit.dart @@ -0,0 +1,88 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/apple.dart'; +import 'package:openapi/src/model/banana.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'fruit.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Fruit { + /// Returns a new [Fruit] instance. + Fruit({ + + this.color, + + this.kind, + + this.count, + }); + + @JsonKey( + + name: r'color', + required: false, + includeIfNull: false + ) + + + final String? color; + + + + @JsonKey( + + name: r'kind', + required: false, + includeIfNull: false + ) + + + final String? kind; + + + + @JsonKey( + + name: r'count', + required: false, + includeIfNull: false + ) + + + final num? count; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Fruit && + other.color == color && + other.kind == kind && + other.count == count; + + @override + int get hashCode => + color.hashCode + + kind.hashCode + + count.hashCode; + + factory Fruit.fromJson(Map json) => _$FruitFromJson(json); + + Map toJson() => _$FruitToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_all_of_disc.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_all_of_disc.dart new file mode 100644 index 000000000000..412d3e8c2848 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_all_of_disc.dart @@ -0,0 +1,56 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/banana_all_of_disc.dart'; +import 'package:openapi/src/model/apple_all_of_disc.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'fruit_all_of_disc.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FruitAllOfDisc { + /// Returns a new [FruitAllOfDisc] instance. + FruitAllOfDisc({ + + required this.fruitType, + }); + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FruitAllOfDisc && + other.fruitType == fruitType; + + @override + int get hashCode => + fruitType.hashCode; + + factory FruitAllOfDisc.fromJson(Map json) => _$FruitAllOfDiscFromJson(json); + + Map toJson() => _$FruitAllOfDiscToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_any_of_disc.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_any_of_disc.dart new file mode 100644 index 000000000000..87f9d8e75e9d --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_any_of_disc.dart @@ -0,0 +1,55 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_type.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'fruit_any_of_disc.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FruitAnyOfDisc { + /// Returns a new [FruitAnyOfDisc] instance. + FruitAnyOfDisc({ + + required this.fruitType, + }); + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FruitAnyOfDisc && + other.fruitType == fruitType; + + @override + int get hashCode => + fruitType.hashCode; + + factory FruitAnyOfDisc.fromJson(Map json) => _$FruitAnyOfDiscFromJson(json); + + Map toJson() => _$FruitAnyOfDiscToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_grandparent_disc.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_grandparent_disc.dart new file mode 100644 index 000000000000..bf57d0cfba0e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_grandparent_disc.dart @@ -0,0 +1,56 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/banana_grandparent_disc.dart'; +import 'package:openapi/src/model/apple_grandparent_disc.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'fruit_grandparent_disc.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FruitGrandparentDisc { + /// Returns a new [FruitGrandparentDisc] instance. + FruitGrandparentDisc({ + + required this.fruitType, + }); + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FruitGrandparentDisc && + other.fruitType == fruitType; + + @override + int get hashCode => + fruitType.hashCode; + + factory FruitGrandparentDisc.fromJson(Map json) => _$FruitGrandparentDiscFromJson(json); + + Map toJson() => _$FruitGrandparentDiscToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_disc.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_disc.dart new file mode 100644 index 000000000000..b847c36d5935 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_disc.dart @@ -0,0 +1,88 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_inline_disc_one_of.dart'; +import 'package:openapi/src/model/fruit_inline_disc_one_of1.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'fruit_inline_disc.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FruitInlineDisc { + /// Returns a new [FruitInlineDisc] instance. + FruitInlineDisc({ + + required this.seeds, + + required this.fruitType, + + required this.length, + }); + + @JsonKey( + + name: r'seeds', + required: true, + includeIfNull: false + ) + + + final int seeds; + + + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @JsonKey( + + name: r'length', + required: true, + includeIfNull: false + ) + + + final int length; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FruitInlineDisc && + other.seeds == seeds && + other.fruitType == fruitType && + other.length == length; + + @override + int get hashCode => + seeds.hashCode + + fruitType.hashCode + + length.hashCode; + + factory FruitInlineDisc.fromJson(Map json) => _$FruitInlineDiscFromJson(json); + + Map toJson() => _$FruitInlineDiscToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_disc_one_of.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_disc_one_of.dart new file mode 100644 index 000000000000..b40e4561588a --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_disc_one_of.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'fruit_inline_disc_one_of.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FruitInlineDiscOneOf { + /// Returns a new [FruitInlineDiscOneOf] instance. + FruitInlineDiscOneOf({ + + required this.seeds, + + required this.fruitType, + }); + + @JsonKey( + + name: r'seeds', + required: true, + includeIfNull: false + ) + + + final int seeds; + + + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FruitInlineDiscOneOf && + other.seeds == seeds && + other.fruitType == fruitType; + + @override + int get hashCode => + seeds.hashCode + + fruitType.hashCode; + + factory FruitInlineDiscOneOf.fromJson(Map json) => _$FruitInlineDiscOneOfFromJson(json); + + Map toJson() => _$FruitInlineDiscOneOfToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_disc_one_of1.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_disc_one_of1.dart new file mode 100644 index 000000000000..6cf10e08ec51 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_disc_one_of1.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'fruit_inline_disc_one_of1.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FruitInlineDiscOneOf1 { + /// Returns a new [FruitInlineDiscOneOf1] instance. + FruitInlineDiscOneOf1({ + + required this.length, + + required this.fruitType, + }); + + @JsonKey( + + name: r'length', + required: true, + includeIfNull: false + ) + + + final int length; + + + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FruitInlineDiscOneOf1 && + other.length == length && + other.fruitType == fruitType; + + @override + int get hashCode => + length.hashCode + + fruitType.hashCode; + + factory FruitInlineDiscOneOf1.fromJson(Map json) => _$FruitInlineDiscOneOf1FromJson(json); + + Map toJson() => _$FruitInlineDiscOneOf1ToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_inline_disc.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_inline_disc.dart new file mode 100644 index 000000000000..b1f24bb65922 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_inline_disc.dart @@ -0,0 +1,56 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_inline_inline_disc_one_of.dart'; +import 'package:openapi/src/model/fruit_inline_inline_disc_one_of1.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'fruit_inline_inline_disc.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FruitInlineInlineDisc { + /// Returns a new [FruitInlineInlineDisc] instance. + FruitInlineInlineDisc({ + + required this.fruitType, + }); + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FruitInlineInlineDisc && + other.fruitType == fruitType; + + @override + int get hashCode => + fruitType.hashCode; + + factory FruitInlineInlineDisc.fromJson(Map json) => _$FruitInlineInlineDiscFromJson(json); + + Map toJson() => _$FruitInlineInlineDiscToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_inline_disc_one_of.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_inline_disc_one_of.dart new file mode 100644 index 000000000000..b3df0106fd03 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_inline_disc_one_of.dart @@ -0,0 +1,71 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_inline_inline_disc_one_of_one_of.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'fruit_inline_inline_disc_one_of.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FruitInlineInlineDiscOneOf { + /// Returns a new [FruitInlineInlineDiscOneOf] instance. + FruitInlineInlineDiscOneOf({ + + required this.seeds, + + required this.fruitType, + }); + + @JsonKey( + + name: r'seeds', + required: true, + includeIfNull: false + ) + + + final int seeds; + + + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FruitInlineInlineDiscOneOf && + other.seeds == seeds && + other.fruitType == fruitType; + + @override + int get hashCode => + seeds.hashCode + + fruitType.hashCode; + + factory FruitInlineInlineDiscOneOf.fromJson(Map json) => _$FruitInlineInlineDiscOneOfFromJson(json); + + Map toJson() => _$FruitInlineInlineDiscOneOfToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_inline_disc_one_of1.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_inline_disc_one_of1.dart new file mode 100644 index 000000000000..adf4ae58f946 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_inline_disc_one_of1.dart @@ -0,0 +1,71 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/fruit_inline_inline_disc_one_of_one_of.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'fruit_inline_inline_disc_one_of1.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FruitInlineInlineDiscOneOf1 { + /// Returns a new [FruitInlineInlineDiscOneOf1] instance. + FruitInlineInlineDiscOneOf1({ + + required this.length, + + required this.fruitType, + }); + + @JsonKey( + + name: r'length', + required: true, + includeIfNull: false + ) + + + final int length; + + + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FruitInlineInlineDiscOneOf1 && + other.length == length && + other.fruitType == fruitType; + + @override + int get hashCode => + length.hashCode + + fruitType.hashCode; + + factory FruitInlineInlineDiscOneOf1.fromJson(Map json) => _$FruitInlineInlineDiscOneOf1FromJson(json); + + Map toJson() => _$FruitInlineInlineDiscOneOf1ToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_inline_disc_one_of_one_of.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_inline_disc_one_of_one_of.dart new file mode 100644 index 000000000000..af9265de646a --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_inline_inline_disc_one_of_one_of.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'fruit_inline_inline_disc_one_of_one_of.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FruitInlineInlineDiscOneOfOneOf { + /// Returns a new [FruitInlineInlineDiscOneOfOneOf] instance. + FruitInlineInlineDiscOneOfOneOf({ + + required this.fruitType, + }); + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FruitInlineInlineDiscOneOfOneOf && + other.fruitType == fruitType; + + @override + int get hashCode => + fruitType.hashCode; + + factory FruitInlineInlineDiscOneOfOneOf.fromJson(Map json) => _$FruitInlineInlineDiscOneOfOneOfFromJson(json); + + Map toJson() => _$FruitInlineInlineDiscOneOfOneOfToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_one_of_disc.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_one_of_disc.dart new file mode 100644 index 000000000000..d3d978dfd78d --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_one_of_disc.dart @@ -0,0 +1,56 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/banana_one_of_disc.dart'; +import 'package:openapi/src/model/apple_one_of_disc.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'fruit_one_of_disc.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FruitOneOfDisc { + /// Returns a new [FruitOneOfDisc] instance. + FruitOneOfDisc({ + + required this.fruitType, + }); + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FruitOneOfDisc && + other.fruitType == fruitType; + + @override + int get hashCode => + fruitType.hashCode; + + factory FruitOneOfDisc.fromJson(Map json) => _$FruitOneOfDiscFromJson(json); + + Map toJson() => _$FruitOneOfDiscToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_req_disc.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_req_disc.dart new file mode 100644 index 000000000000..f567d896cf26 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_req_disc.dart @@ -0,0 +1,88 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/banana_req_disc.dart'; +import 'package:openapi/src/model/apple_req_disc.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'fruit_req_disc.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FruitReqDisc { + /// Returns a new [FruitReqDisc] instance. + FruitReqDisc({ + + required this.seeds, + + required this.fruitType, + + required this.length, + }); + + @JsonKey( + + name: r'seeds', + required: true, + includeIfNull: false + ) + + + final int seeds; + + + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @JsonKey( + + name: r'length', + required: true, + includeIfNull: false + ) + + + final int length; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FruitReqDisc && + other.seeds == seeds && + other.fruitType == fruitType && + other.length == length; + + @override + int get hashCode => + seeds.hashCode + + fruitType.hashCode + + length.hashCode; + + factory FruitReqDisc.fromJson(Map json) => _$FruitReqDiscFromJson(json); + + Map toJson() => _$FruitReqDiscToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_type.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_type.dart new file mode 100644 index 000000000000..beb914444663 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_type.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'fruit_type.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FruitType { + /// Returns a new [FruitType] instance. + FruitType({ + + required this.fruitType, + }); + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FruitType && + other.fruitType == fruitType; + + @override + int get hashCode => + fruitType.hashCode; + + factory FruitType.fromJson(Map json) => _$FruitTypeFromJson(json); + + Map toJson() => _$FruitTypeToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_variant1.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_variant1.dart new file mode 100644 index 000000000000..9f960afb4ce6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/fruit_variant1.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/apple_variant1.dart'; +import 'package:openapi/src/model/grape_variant1.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'fruit_variant1.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FruitVariant1 { + /// Returns a new [FruitVariant1] instance. + FruitVariant1({ + + this.color, + + this.kind, + }); + + @JsonKey( + + name: r'color', + required: false, + includeIfNull: false + ) + + + final String? color; + + + + @JsonKey( + + name: r'kind', + required: false, + includeIfNull: false + ) + + + final String? kind; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FruitVariant1 && + other.color == color && + other.kind == kind; + + @override + int get hashCode => + color.hashCode + + kind.hashCode; + + factory FruitVariant1.fromJson(Map json) => _$FruitVariant1FromJson(json); + + Map toJson() => _$FruitVariant1ToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/giga_one_of.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/giga_one_of.dart new file mode 100644 index 000000000000..be280b065a79 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/giga_one_of.dart @@ -0,0 +1,55 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/one_of_primitive_child.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'giga_one_of.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class GigaOneOf { + /// Returns a new [GigaOneOf] instance. + GigaOneOf({ + + this.name, + }); + + @JsonKey( + + name: r'name', + required: false, + includeIfNull: false + ) + + + final String? name; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is GigaOneOf && + other.name == name; + + @override + int get hashCode => + name.hashCode; + + factory GigaOneOf.fromJson(Map json) => _$GigaOneOfFromJson(json); + + Map toJson() => _$GigaOneOfToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/grape_variant1.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/grape_variant1.dart new file mode 100644 index 000000000000..d1575e833cbc --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/grape_variant1.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'grape_variant1.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class GrapeVariant1 { + /// Returns a new [GrapeVariant1] instance. + GrapeVariant1({ + + this.color, + }); + + @JsonKey( + + name: r'color', + required: false, + includeIfNull: false + ) + + + final String? color; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is GrapeVariant1 && + other.color == color; + + @override + int get hashCode => + color.hashCode; + + factory GrapeVariant1.fromJson(Map json) => _$GrapeVariant1FromJson(json); + + Map toJson() => _$GrapeVariant1ToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/has_only_read_only.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/has_only_read_only.dart new file mode 100644 index 000000000000..84c99fbc188c --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/has_only_read_only.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'has_only_read_only.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class HasOnlyReadOnly { + /// Returns a new [HasOnlyReadOnly] instance. + HasOnlyReadOnly({ + + this.bar, + + this.foo, + }); + + @JsonKey( + + name: r'bar', + required: false, + includeIfNull: false + ) + + + final String? bar; + + + + @JsonKey( + + name: r'foo', + required: false, + includeIfNull: false + ) + + + final String? foo; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is HasOnlyReadOnly && + other.bar == bar && + other.foo == foo; + + @override + int get hashCode => + bar.hashCode + + foo.hashCode; + + factory HasOnlyReadOnly.fromJson(Map json) => _$HasOnlyReadOnlyFromJson(json); + + Map toJson() => _$HasOnlyReadOnlyToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/health_check_result.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/health_check_result.dart new file mode 100644 index 000000000000..fcb2973b7514 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/health_check_result.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'health_check_result.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class HealthCheckResult { + /// Returns a new [HealthCheckResult] instance. + HealthCheckResult({ + + this.nullableMessage, + }); + + @JsonKey( + + name: r'NullableMessage', + required: false, + includeIfNull: false + ) + + + final String? nullableMessage; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is HealthCheckResult && + other.nullableMessage == nullableMessage; + + @override + int get hashCode => + (nullableMessage == null ? 0 : nullableMessage.hashCode); + + factory HealthCheckResult.fromJson(Map json) => _$HealthCheckResultFromJson(json); + + Map toJson() => _$HealthCheckResultToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/map_test.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/map_test.dart new file mode 100644 index 000000000000..b75b1684cb54 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/map_test.dart @@ -0,0 +1,113 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'map_test.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class MapTest { + /// Returns a new [MapTest] instance. + MapTest({ + + this.mapMapOfString, + + this.mapOfEnumString, + + this.directMap, + + this.indirectMap, + }); + + @JsonKey( + + name: r'map_map_of_string', + required: false, + includeIfNull: false + ) + + + final Map>? mapMapOfString; + + + + @JsonKey( + + name: r'map_of_enum_string', + required: false, + includeIfNull: false + ) + + + final Map? mapOfEnumString; + + + + @JsonKey( + + name: r'direct_map', + required: false, + includeIfNull: false + ) + + + final Map? directMap; + + + + @JsonKey( + + name: r'indirect_map', + required: false, + includeIfNull: false + ) + + + final Map? indirectMap; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is MapTest && + other.mapMapOfString == mapMapOfString && + other.mapOfEnumString == mapOfEnumString && + other.directMap == directMap && + other.indirectMap == indirectMap; + + @override + int get hashCode => + mapMapOfString.hashCode + + mapOfEnumString.hashCode + + directMap.hashCode + + indirectMap.hashCode; + + factory MapTest.fromJson(Map json) => _$MapTestFromJson(json); + + Map toJson() => _$MapTestToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + + +enum MapTestMapOfEnumStringEnum { + @JsonValue(rr'UPPER') + UPPER, + @JsonValue(rr'lower') + lower, + @JsonValue(rr'unknown_default_open_api') + unknownDefaultOpenApi, +} + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/mixed_properties_and_additional_properties_class.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/mixed_properties_and_additional_properties_class.dart new file mode 100644 index 000000000000..e2e3cd0b857a --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/mixed_properties_and_additional_properties_class.dart @@ -0,0 +1,87 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/animal.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'mixed_properties_and_additional_properties_class.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class MixedPropertiesAndAdditionalPropertiesClass { + /// Returns a new [MixedPropertiesAndAdditionalPropertiesClass] instance. + MixedPropertiesAndAdditionalPropertiesClass({ + + this.uuid, + + this.dateTime, + + this.map, + }); + + @JsonKey( + + name: r'uuid', + required: false, + includeIfNull: false + ) + + + final String? uuid; + + + + @JsonKey( + + name: r'dateTime', + required: false, + includeIfNull: false + ) + + + final DateTime? dateTime; + + + + @JsonKey( + + name: r'map', + required: false, + includeIfNull: false + ) + + + final Map? map; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is MixedPropertiesAndAdditionalPropertiesClass && + other.uuid == uuid && + other.dateTime == dateTime && + other.map == map; + + @override + int get hashCode => + uuid.hashCode + + dateTime.hashCode + + map.hashCode; + + factory MixedPropertiesAndAdditionalPropertiesClass.fromJson(Map json) => _$MixedPropertiesAndAdditionalPropertiesClassFromJson(json); + + Map toJson() => _$MixedPropertiesAndAdditionalPropertiesClassToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/model200_response.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/model200_response.dart new file mode 100644 index 000000000000..346f1257555f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/model200_response.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'model200_response.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Model200Response { + /// Returns a new [Model200Response] instance. + Model200Response({ + + this.name, + + this.class_, + }); + + @JsonKey( + + name: r'name', + required: false, + includeIfNull: false + ) + + + final int? name; + + + + @JsonKey( + + name: r'class', + required: false, + includeIfNull: false + ) + + + final String? class_; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Model200Response && + other.name == name && + other.class_ == class_; + + @override + int get hashCode => + name.hashCode + + class_.hashCode; + + factory Model200Response.fromJson(Map json) => _$Model200ResponseFromJson(json); + + Map toJson() => _$Model200ResponseToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/model_client.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/model_client.dart new file mode 100644 index 000000000000..14e22005a161 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/model_client.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'model_client.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ModelClient { + /// Returns a new [ModelClient] instance. + ModelClient({ + + this.client, + }); + + @JsonKey( + + name: r'client', + required: false, + includeIfNull: false + ) + + + final String? client; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ModelClient && + other.client == client; + + @override + int get hashCode => + client.hashCode; + + factory ModelClient.fromJson(Map json) => _$ModelClientFromJson(json); + + Map toJson() => _$ModelClientToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/model_enum_class.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/model_enum_class.dart new file mode 100644 index 000000000000..060dbc5695d0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/model_enum_class.dart @@ -0,0 +1,18 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + + +enum ModelEnumClass { + @JsonValue(rr'_abc') + abc, + @JsonValue(rr'-efg') + efg, + @JsonValue(rr'(xyz)') + leftParenthesisXyzRightParenthesis, + @JsonValue(rr'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/model_file.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/model_file.dart new file mode 100644 index 000000000000..fe95e3ff0029 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/model_file.dart @@ -0,0 +1,55 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'model_file.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ModelFile { + /// Returns a new [ModelFile] instance. + ModelFile({ + + this.sourceURI, + }); + + /// Test capitalization + @JsonKey( + + name: r'sourceURI', + required: false, + includeIfNull: false + ) + + + final String? sourceURI; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ModelFile && + other.sourceURI == sourceURI; + + @override + int get hashCode => + sourceURI.hashCode; + + factory ModelFile.fromJson(Map json) => _$ModelFileFromJson(json); + + Map toJson() => _$ModelFileToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/model_list.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/model_list.dart new file mode 100644 index 000000000000..543b79ac9f13 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/model_list.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'model_list.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ModelList { + /// Returns a new [ModelList] instance. + ModelList({ + + this.n123list, + }); + + @JsonKey( + + name: r'123-list', + required: false, + includeIfNull: false + ) + + + final String? n123list; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ModelList && + other.n123list == n123list; + + @override + int get hashCode => + n123list.hashCode; + + factory ModelList.fromJson(Map json) => _$ModelListFromJson(json); + + Map toJson() => _$ModelListToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/model_return.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/model_return.dart new file mode 100644 index 000000000000..192b134d8fc6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/model_return.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'model_return.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ModelReturn { + /// Returns a new [ModelReturn] instance. + ModelReturn({ + + this.return_, + }); + + @JsonKey( + + name: r'return', + required: false, + includeIfNull: false + ) + + + final int? return_; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ModelReturn && + other.return_ == return_; + + @override + int get hashCode => + return_.hashCode; + + factory ModelReturn.fromJson(Map json) => _$ModelReturnFromJson(json); + + Map toJson() => _$ModelReturnToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/name.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/name.dart new file mode 100644 index 000000000000..6613fa3afc8b --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/name.dart @@ -0,0 +1,102 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'name.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Name { + /// Returns a new [Name] instance. + Name({ + + required this.name, + + this.snakeCase, + + this.property, + + this.n123number, + }); + + @JsonKey( + + name: r'name', + required: true, + includeIfNull: false + ) + + + final int name; + + + + @JsonKey( + + name: r'snake_case', + required: false, + includeIfNull: false + ) + + + final int? snakeCase; + + + + @JsonKey( + + name: r'property', + required: false, + includeIfNull: false + ) + + + final String? property; + + + + @JsonKey( + + name: r'123Number', + required: false, + includeIfNull: false + ) + + + final int? n123number; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Name && + other.name == name && + other.snakeCase == snakeCase && + other.property == property && + other.n123number == n123number; + + @override + int get hashCode => + name.hashCode + + snakeCase.hashCode + + property.hashCode + + n123number.hashCode; + + factory Name.fromJson(Map json) => _$NameFromJson(json); + + Map toJson() => _$NameToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/nullable_class.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/nullable_class.dart new file mode 100644 index 000000000000..897d489ba450 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/nullable_class.dart @@ -0,0 +1,230 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'nullable_class.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class NullableClass { + /// Returns a new [NullableClass] instance. + NullableClass({ + + this.integerProp, + + this.numberProp, + + this.booleanProp, + + this.stringProp, + + this.dateProp, + + this.datetimeProp, + + this.arrayNullableProp, + + this.arrayAndItemsNullableProp, + + this.arrayItemsNullable, + + this.objectNullableProp, + + this.objectAndItemsNullableProp, + + this.objectItemsNullable, + }); + + @JsonKey( + + name: r'integer_prop', + required: false, + includeIfNull: false + ) + + + final int? integerProp; + + + + @JsonKey( + + name: r'number_prop', + required: false, + includeIfNull: false + ) + + + final num? numberProp; + + + + @JsonKey( + + name: r'boolean_prop', + required: false, + includeIfNull: false + ) + + + final bool? booleanProp; + + + + @JsonKey( + + name: r'string_prop', + required: false, + includeIfNull: false + ) + + + final String? stringProp; + + + + @JsonKey( + + name: r'date_prop', + required: false, + includeIfNull: false + ) + + + final DateTime? dateProp; + + + + @JsonKey( + + name: r'datetime_prop', + required: false, + includeIfNull: false + ) + + + final DateTime? datetimeProp; + + + + @JsonKey( + + name: r'array_nullable_prop', + required: false, + includeIfNull: false + ) + + + final List? arrayNullableProp; + + + + @JsonKey( + + name: r'array_and_items_nullable_prop', + required: false, + includeIfNull: false + ) + + + final List? arrayAndItemsNullableProp; + + + + @JsonKey( + + name: r'array_items_nullable', + required: false, + includeIfNull: false + ) + + + final List? arrayItemsNullable; + + + + @JsonKey( + + name: r'object_nullable_prop', + required: false, + includeIfNull: false + ) + + + final Map? objectNullableProp; + + + + @JsonKey( + + name: r'object_and_items_nullable_prop', + required: false, + includeIfNull: false + ) + + + final Map? objectAndItemsNullableProp; + + + + @JsonKey( + + name: r'object_items_nullable', + required: false, + includeIfNull: false + ) + + + final Map? objectItemsNullable; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is NullableClass && + other.integerProp == integerProp && + other.numberProp == numberProp && + other.booleanProp == booleanProp && + other.stringProp == stringProp && + other.dateProp == dateProp && + other.datetimeProp == datetimeProp && + other.arrayNullableProp == arrayNullableProp && + other.arrayAndItemsNullableProp == arrayAndItemsNullableProp && + other.arrayItemsNullable == arrayItemsNullable && + other.objectNullableProp == objectNullableProp && + other.objectAndItemsNullableProp == objectAndItemsNullableProp && + other.objectItemsNullable == objectItemsNullable; + + @override + int get hashCode => + (integerProp == null ? 0 : integerProp.hashCode) + + (numberProp == null ? 0 : numberProp.hashCode) + + (booleanProp == null ? 0 : booleanProp.hashCode) + + (stringProp == null ? 0 : stringProp.hashCode) + + (dateProp == null ? 0 : dateProp.hashCode) + + (datetimeProp == null ? 0 : datetimeProp.hashCode) + + (arrayNullableProp == null ? 0 : arrayNullableProp.hashCode) + + (arrayAndItemsNullableProp == null ? 0 : arrayAndItemsNullableProp.hashCode) + + arrayItemsNullable.hashCode + + (objectNullableProp == null ? 0 : objectNullableProp.hashCode) + + (objectAndItemsNullableProp == null ? 0 : objectAndItemsNullableProp.hashCode) + + objectItemsNullable.hashCode; + + factory NullableClass.fromJson(Map json) => _$NullableClassFromJson(json); + + Map toJson() => _$NullableClassToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/number_only.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/number_only.dart new file mode 100644 index 000000000000..3ca6bf704b59 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/number_only.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'number_only.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class NumberOnly { + /// Returns a new [NumberOnly] instance. + NumberOnly({ + + this.justNumber, + }); + + @JsonKey( + + name: r'JustNumber', + required: false, + includeIfNull: false + ) + + + final num? justNumber; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is NumberOnly && + other.justNumber == justNumber; + + @override + int get hashCode => + justNumber.hashCode; + + factory NumberOnly.fromJson(Map json) => _$NumberOnlyFromJson(json); + + Map toJson() => _$NumberOnlyToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/object_with_deprecated_fields.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/object_with_deprecated_fields.dart new file mode 100644 index 000000000000..dce29b30d982 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/object_with_deprecated_fields.dart @@ -0,0 +1,107 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/deprecated_object.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'object_with_deprecated_fields.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ObjectWithDeprecatedFields { + /// Returns a new [ObjectWithDeprecatedFields] instance. + ObjectWithDeprecatedFields({ + + this.uuid, + + this.id, + + this.deprecatedRef, + + this.bars, + }); + + @JsonKey( + + name: r'uuid', + required: false, + includeIfNull: false + ) + + + final String? uuid; + + + + @Deprecated('id has been deprecated') + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false + ) + + + final num? id; + + + + @Deprecated('deprecatedRef has been deprecated') + @JsonKey( + + name: r'deprecatedRef', + required: false, + includeIfNull: false + ) + + + final DeprecatedObject? deprecatedRef; + + + + @Deprecated('bars has been deprecated') + @JsonKey( + + name: r'bars', + required: false, + includeIfNull: false + ) + + + final List? bars; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ObjectWithDeprecatedFields && + other.uuid == uuid && + other.id == id && + other.deprecatedRef == deprecatedRef && + other.bars == bars; + + @override + int get hashCode => + uuid.hashCode + + id.hashCode + + deprecatedRef.hashCode + + bars.hashCode; + + factory ObjectWithDeprecatedFields.fromJson(Map json) => _$ObjectWithDeprecatedFieldsFromJson(json); + + Map toJson() => _$ObjectWithDeprecatedFieldsToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/one_of_primitive_child.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/one_of_primitive_child.dart new file mode 100644 index 000000000000..820718622275 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/one_of_primitive_child.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'one_of_primitive_child.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class OneOfPrimitiveChild { + /// Returns a new [OneOfPrimitiveChild] instance. + OneOfPrimitiveChild({ + + this.name, + }); + + @JsonKey( + + name: r'name', + required: false, + includeIfNull: false + ) + + + final String? name; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is OneOfPrimitiveChild && + other.name == name; + + @override + int get hashCode => + name.hashCode; + + factory OneOfPrimitiveChild.fromJson(Map json) => _$OneOfPrimitiveChildFromJson(json); + + Map toJson() => _$OneOfPrimitiveChildToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/order.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/order.dart new file mode 100644 index 000000000000..7ddd2257c5bb --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/order.dart @@ -0,0 +1,148 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'order.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Order { + /// Returns a new [Order] instance. + Order({ + + this.id, + + this.petId, + + this.quantity, + + this.shipDate, + + this.status, + + this.complete = false, + }); + + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false + ) + + + final int? id; + + + + @JsonKey( + + name: r'petId', + required: false, + includeIfNull: false + ) + + + final int? petId; + + + + @JsonKey( + + name: r'quantity', + required: false, + includeIfNull: false + ) + + + final int? quantity; + + + + @JsonKey( + + name: r'shipDate', + required: false, + includeIfNull: false + ) + + + final DateTime? shipDate; + + + + /// Order Status + @JsonKey( + + name: r'status', + required: false, + includeIfNull: false + ) + + + final OrderStatusEnum? status; + + + + @JsonKey( + defaultValue: false, + name: r'complete', + required: false, + includeIfNull: false + ) + + + final bool? complete; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Order && + other.id == id && + other.petId == petId && + other.quantity == quantity && + other.shipDate == shipDate && + other.status == status && + other.complete == complete; + + @override + int get hashCode => + id.hashCode + + petId.hashCode + + quantity.hashCode + + shipDate.hashCode + + status.hashCode + + complete.hashCode; + + factory Order.fromJson(Map json) => _$OrderFromJson(json); + + Map toJson() => _$OrderToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + +/// Order Status +enum OrderStatusEnum { + @JsonValue(rr'placed') + placed, + @JsonValue(rr'approved') + approved, + @JsonValue(rr'delivered') + delivered, + @JsonValue(rr'unknown_default_open_api') + unknownDefaultOpenApi, +} + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/outer_composite.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/outer_composite.dart new file mode 100644 index 000000000000..f2509cb99213 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/outer_composite.dart @@ -0,0 +1,86 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'outer_composite.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class OuterComposite { + /// Returns a new [OuterComposite] instance. + OuterComposite({ + + this.myNumber, + + this.myString, + + this.myBoolean, + }); + + @JsonKey( + + name: r'my_number', + required: false, + includeIfNull: false + ) + + + final num? myNumber; + + + + @JsonKey( + + name: r'my_string', + required: false, + includeIfNull: false + ) + + + final String? myString; + + + + @JsonKey( + + name: r'my_boolean', + required: false, + includeIfNull: false + ) + + + final bool? myBoolean; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is OuterComposite && + other.myNumber == myNumber && + other.myString == myString && + other.myBoolean == myBoolean; + + @override + int get hashCode => + myNumber.hashCode + + myString.hashCode + + myBoolean.hashCode; + + factory OuterComposite.fromJson(Map json) => _$OuterCompositeFromJson(json); + + Map toJson() => _$OuterCompositeToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/outer_enum.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/outer_enum.dart new file mode 100644 index 000000000000..fb9eb9e15efd --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/outer_enum.dart @@ -0,0 +1,18 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + + +enum OuterEnum { + @JsonValue(rr'placed') + placed, + @JsonValue(rr'approved') + approved, + @JsonValue(rr'delivered') + delivered, + @JsonValue(rr'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/outer_enum_default_value.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/outer_enum_default_value.dart new file mode 100644 index 000000000000..0b99109f2cd3 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/outer_enum_default_value.dart @@ -0,0 +1,18 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + + +enum OuterEnumDefaultValue { + @JsonValue(rr'placed') + placed, + @JsonValue(rr'approved') + approved, + @JsonValue(rr'delivered') + delivered, + @JsonValue(rr'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/outer_enum_integer.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/outer_enum_integer.dart new file mode 100644 index 000000000000..34268d0e9c53 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/outer_enum_integer.dart @@ -0,0 +1,18 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + + +enum OuterEnumInteger { + @JsonValue(0) + number0, + @JsonValue(1) + number1, + @JsonValue(2) + number2, + @JsonValue(11184809) + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/outer_enum_integer_default_value.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/outer_enum_integer_default_value.dart new file mode 100644 index 000000000000..97b325938828 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/outer_enum_integer_default_value.dart @@ -0,0 +1,18 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + + +enum OuterEnumIntegerDefaultValue { + @JsonValue(0) + number0, + @JsonValue(1) + number1, + @JsonValue(2) + number2, + @JsonValue(11184809) + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/outer_object_with_enum_property.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/outer_object_with_enum_property.dart new file mode 100644 index 000000000000..76d18676a110 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/outer_object_with_enum_property.dart @@ -0,0 +1,55 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/outer_enum_integer.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'outer_object_with_enum_property.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class OuterObjectWithEnumProperty { + /// Returns a new [OuterObjectWithEnumProperty] instance. + OuterObjectWithEnumProperty({ + + required this.value, + }); + + @JsonKey( + + name: r'value', + required: true, + includeIfNull: false + ) + + + final OuterEnumInteger value; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is OuterObjectWithEnumProperty && + other.value == value; + + @override + int get hashCode => + value.hashCode; + + factory OuterObjectWithEnumProperty.fromJson(Map json) => _$OuterObjectWithEnumPropertyFromJson(json); + + Map toJson() => _$OuterObjectWithEnumPropertyToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/parent.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/parent.dart new file mode 100644 index 000000000000..166ff4e6af69 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/parent.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'parent.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Parent { + /// Returns a new [Parent] instance. + Parent({ + + required this.fruitType, + }); + + @JsonKey( + + name: r'fruitType', + required: true, + includeIfNull: false + ) + + + final String fruitType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Parent && + other.fruitType == fruitType; + + @override + int get hashCode => + fruitType.hashCode; + + factory Parent.fromJson(Map json) => _$ParentFromJson(json); + + Map toJson() => _$ParentToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/pasta.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/pasta.dart new file mode 100644 index 000000000000..cb955e849bb6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/pasta.dart @@ -0,0 +1,142 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'pasta.g.dart'; + +// ignore_for_file: unused_import + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Pasta { + /// Returns a new [Pasta] instance. + Pasta({ + + this.vendor, + + this.href, + + this.id, + + this.atSchemaLocation, + + this.atBaseType, + + required this.atType, + }); + + @JsonKey( + + name: r'vendor', + required: false, + includeIfNull: false + ) + + + final String? vendor; + + + + /// Hyperlink reference + @JsonKey( + + name: r'href', + required: false, + includeIfNull: false + ) + + + final String? href; + + + + /// unique identifier + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false + ) + + + final String? id; + + + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey( + + name: r'@schemaLocation', + required: false, + includeIfNull: false + ) + + + final String? atSchemaLocation; + + + + /// When sub-classing, this defines the super-class + @JsonKey( + + name: r'@baseType', + required: false, + includeIfNull: false + ) + + + final String? atBaseType; + + + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey( + + name: r'@type', + required: true, + includeIfNull: false + ) + + + final String atType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Pasta && + other.vendor == vendor && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + vendor.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory Pasta.fromJson(Map json) => _$PastaFromJson(json); + + Map toJson() => _$PastaToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/pet.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/pet.dart new file mode 100644 index 000000000000..d502d8d1d0a2 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/pet.dart @@ -0,0 +1,150 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/category.dart'; +import 'package:openapi/src/model/tag.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'pet.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Pet { + /// Returns a new [Pet] instance. + Pet({ + + this.id, + + this.category, + + required this.name, + + required this.photoUrls, + + this.tags, + + this.status, + }); + + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false + ) + + + final int? id; + + + + @JsonKey( + + name: r'category', + required: false, + includeIfNull: false + ) + + + final Category? category; + + + + @JsonKey( + + name: r'name', + required: true, + includeIfNull: false + ) + + + final String name; + + + + @JsonKey( + + name: r'photoUrls', + required: true, + includeIfNull: false + ) + + + final Set photoUrls; + + + + @JsonKey( + + name: r'tags', + required: false, + includeIfNull: false + ) + + + final List? tags; + + + + /// pet status in the store + @JsonKey( + + name: r'status', + required: false, + includeIfNull: false + ) + + + final PetStatusEnum? status; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Pet && + other.id == id && + other.category == category && + other.name == name && + other.photoUrls == photoUrls && + other.tags == tags && + other.status == status; + + @override + int get hashCode => + id.hashCode + + category.hashCode + + name.hashCode + + photoUrls.hashCode + + tags.hashCode + + status.hashCode; + + factory Pet.fromJson(Map json) => _$PetFromJson(json); + + Map toJson() => _$PetToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + +/// pet status in the store +enum PetStatusEnum { + @JsonValue(rr'available') + available, + @JsonValue(rr'pending') + pending, + @JsonValue(rr'sold') + sold, + @JsonValue(rr'unknown_default_open_api') + unknownDefaultOpenApi, +} + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/pizza.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/pizza.dart new file mode 100644 index 000000000000..a098d524e52e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/pizza.dart @@ -0,0 +1,142 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'pizza.g.dart'; + +// ignore_for_file: unused_import + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Pizza { + /// Returns a new [Pizza] instance. + Pizza({ + + this.pizzaSize, + + this.href, + + this.id, + + this.atSchemaLocation, + + this.atBaseType, + + required this.atType, + }); + + @JsonKey( + + name: r'pizzaSize', + required: false, + includeIfNull: false + ) + + + final num? pizzaSize; + + + + /// Hyperlink reference + @JsonKey( + + name: r'href', + required: false, + includeIfNull: false + ) + + + final String? href; + + + + /// unique identifier + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false + ) + + + final String? id; + + + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey( + + name: r'@schemaLocation', + required: false, + includeIfNull: false + ) + + + final String? atSchemaLocation; + + + + /// When sub-classing, this defines the super-class + @JsonKey( + + name: r'@baseType', + required: false, + includeIfNull: false + ) + + + final String? atBaseType; + + + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey( + + name: r'@type', + required: true, + includeIfNull: false + ) + + + final String atType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Pizza && + other.pizzaSize == pizzaSize && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + pizzaSize.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory Pizza.fromJson(Map json) => _$PizzaFromJson(json); + + Map toJson() => _$PizzaToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/pizza_speziale.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/pizza_speziale.dart new file mode 100644 index 000000000000..de6bb5bd6ae7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/pizza_speziale.dart @@ -0,0 +1,142 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/pizza.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'pizza_speziale.g.dart'; + +// ignore_for_file: unused_import + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class PizzaSpeziale { + /// Returns a new [PizzaSpeziale] instance. + PizzaSpeziale({ + + this.toppings, + + this.href, + + this.id, + + this.atSchemaLocation, + + this.atBaseType, + + required this.atType, + }); + + @JsonKey( + + name: r'toppings', + required: false, + includeIfNull: false + ) + + + final String? toppings; + + + + /// Hyperlink reference + @JsonKey( + + name: r'href', + required: false, + includeIfNull: false + ) + + + final String? href; + + + + /// unique identifier + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false + ) + + + final String? id; + + + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey( + + name: r'@schemaLocation', + required: false, + includeIfNull: false + ) + + + final String? atSchemaLocation; + + + + /// When sub-classing, this defines the super-class + @JsonKey( + + name: r'@baseType', + required: false, + includeIfNull: false + ) + + + final String? atBaseType; + + + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey( + + name: r'@type', + required: true, + includeIfNull: false + ) + + + final String atType; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is PizzaSpeziale && + other.toppings == toppings && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + toppings.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory PizzaSpeziale.fromJson(Map json) => _$PizzaSpezialeFromJson(json); + + Map toJson() => _$PizzaSpezialeToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/read_only_first.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/read_only_first.dart new file mode 100644 index 000000000000..c71c088f1381 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/read_only_first.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'read_only_first.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ReadOnlyFirst { + /// Returns a new [ReadOnlyFirst] instance. + ReadOnlyFirst({ + + this.bar, + + this.baz, + }); + + @JsonKey( + + name: r'bar', + required: false, + includeIfNull: false + ) + + + final String? bar; + + + + @JsonKey( + + name: r'baz', + required: false, + includeIfNull: false + ) + + + final String? baz; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ReadOnlyFirst && + other.bar == bar && + other.baz == baz; + + @override + int get hashCode => + bar.hashCode + + baz.hashCode; + + factory ReadOnlyFirst.fromJson(Map json) => _$ReadOnlyFirstFromJson(json); + + Map toJson() => _$ReadOnlyFirstToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/single_ref_type.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/single_ref_type.dart new file mode 100644 index 000000000000..3bee8c68c1be --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/single_ref_type.dart @@ -0,0 +1,16 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + + +enum SingleRefType { + @JsonValue(rr'admin') + admin, + @JsonValue(rr'user') + user, + @JsonValue(rr'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/special_model_name.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/special_model_name.dart new file mode 100644 index 000000000000..acd3ba099576 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/special_model_name.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'special_model_name.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class SpecialModelName { + /// Returns a new [SpecialModelName] instance. + SpecialModelName({ + + this.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket, + }); + + @JsonKey( + + name: r'$special[property.name]', + required: false, + includeIfNull: false + ) + + + final int? dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is SpecialModelName && + other.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket == dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + + @override + int get hashCode => + dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket.hashCode; + + factory SpecialModelName.fromJson(Map json) => _$SpecialModelNameFromJson(json); + + Map toJson() => _$SpecialModelNameToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/tag.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/tag.dart new file mode 100644 index 000000000000..d8a87eec1820 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/tag.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'tag.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Tag { + /// Returns a new [Tag] instance. + Tag({ + + this.id, + + this.name, + }); + + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false + ) + + + final int? id; + + + + @JsonKey( + + name: r'name', + required: false, + includeIfNull: false + ) + + + final String? name; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Tag && + other.id == id && + other.name == name; + + @override + int get hashCode => + id.hashCode + + name.hashCode; + + factory Tag.fromJson(Map json) => _$TagFromJson(json); + + Map toJson() => _$TagToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/user.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/user.dart new file mode 100644 index 000000000000..62f132ce776d --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/model/user.dart @@ -0,0 +1,167 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'user.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class User { + /// Returns a new [User] instance. + User({ + + this.id, + + this.username, + + this.firstName, + + this.lastName, + + this.email, + + this.password, + + this.phone, + + this.userStatus, + }); + + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false + ) + + + final int? id; + + + + @JsonKey( + + name: r'username', + required: false, + includeIfNull: false + ) + + + final String? username; + + + + @JsonKey( + + name: r'firstName', + required: false, + includeIfNull: false + ) + + + final String? firstName; + + + + @JsonKey( + + name: r'lastName', + required: false, + includeIfNull: false + ) + + + final String? lastName; + + + + @JsonKey( + + name: r'email', + required: false, + includeIfNull: false + ) + + + final String? email; + + + + @JsonKey( + + name: r'password', + required: false, + includeIfNull: false + ) + + + final String? password; + + + + @JsonKey( + + name: r'phone', + required: false, + includeIfNull: false + ) + + + final String? phone; + + + + /// User Status + @JsonKey( + + name: r'userStatus', + required: false, + includeIfNull: false + ) + + + final int? userStatus; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is User && + other.id == id && + other.username == username && + other.firstName == firstName && + other.lastName == lastName && + other.email == email && + other.password == password && + other.phone == phone && + other.userStatus == userStatus; + + @override + int get hashCode => + id.hashCode + + username.hashCode + + firstName.hashCode + + lastName.hashCode + + email.hashCode + + password.hashCode + + phone.hashCode + + userStatus.hashCode; + + factory User.fromJson(Map json) => _$UserFromJson(json); + + Map toJson() => _$UserToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/repository_base.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/repository_base.dart new file mode 100644 index 000000000000..c4c2def37aa6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/repository_base.dart @@ -0,0 +1,58 @@ +/// The general rule for implementing this class is +/// json == serialize(deserialize(json)) +/// object == deserialize(serialize(object)) +/// Where json in this context means a dart primitive +/// JSON = String | num | bool | null | Uint8List | List | Map +abstract class SerializationRepositoryBase { + const SerializationRepositoryBase(); + + FutureOr serialize(T src, TypeInfo inputTypeInfo, {Object? context,}); + FutureOr deserialize(Object? value, TypeInfo targetTypeInfo, {Object? context,}); +} + +/// A modified version of `built_value`'s `FullType` class, found here +/// https://github.com/google/built_value.dart/blob/ee22d400a69c673330481a6da1f0796b90bb369b/built_value/lib/serializer.dart +/// It holds type information known by the spec (including generic type parameters) +class TypeInfo { + final Type root; + final bool nullable; + final List parameters; + + /// The [Object] type. + static const TypeInfo object = TypeInfo(Object); + + const TypeInfo(this.root, [this.parameters = const []]) : nullable = false; + const TypeInfo.nullable(this.root, [this.parameters = const []]) : nullable = true; + + @override + bool operator ==(dynamic other) { + if (identical(other, this)) return true; + if (other is! TypeInfo) return false; + if (root != other.root) return false; + if (nullable != other.nullable) return false; + if (parameters.length != other.parameters.length) return false; + for (var i = 0; i != parameters.length; ++i) { + if (parameters[i] != other.parameters[i]) return false; + } + return true; + } + + @override + int get hashCode { + return Object.hash(root, Object.hashAll(parameters), nullable); + } + + @override + String toString() => (parameters.isEmpty + ? _getRawName(root) + : '${_getRawName(root)}<${parameters.join(", ")}>') + + _nullabilitySuffix; + + String get _nullabilitySuffix => nullable ? '?' : ''; + + static String _getRawName(Type? type) { + var name = type.toString(); + var genericsStart = name.indexOf('<'); + return genericsStart == -1 ? name : name.substring(0, genericsStart); + } +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/lib/src/repository_impl.dart b/samples/client/echo_api/dart/dio/json_serializable/lib/src/repository_impl.dart new file mode 100644 index 000000000000..b07401f2f3a9 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/lib/src/repository_impl.dart @@ -0,0 +1,315 @@ +import 'dart:convert'; +import 'dart:typed_data'; +import 'repository_base.dart'; +import 'package:openapi/models.dart'; + +class JsonSerializableRepository extends SerializationRepositoryBase { + JsonSerializableRepository(); + + /// Transforms an object of arbitrary type [T] (whose information is passed in inputTypeInfo) to a dart primitive + @override + FutureOr serialize(T src, TypeInfo inputTypeInfo, {Object? context}) { + if (src == null) { + return null; + } + if (src is String) { + return src; + } + if (src is bool) { + return src; + } + if (src is DateTime) { + return src.toIso8601String(); + } + if (src is num) { + return src; + } + if (src is Uint8List) { + return src; + } + if (src is Iterable) { + return src.map((value) => serialize(value, inputTypeInfo.parameters[0], context: context)).toList(); + } + if (src is Map) { + return src.map((key,value) => MapEntry( + //Json Map keys must always be strings + serialize(key, inputTypeInfo.parameters[0], context: context).toString(), + serialize(value, inputTypeInfo.parameters[1], context: context) + )); + } + + if (context is Object? Function(Object?)) { + return context(src); + } + + try { + return (src as dynamic).toJson(); + } on NoSuchMethodError { + assert(false, + ''' + Failed to serialize the object properly, falling back to `toString()` + '''); + return src.toString(); + } + } + + /// Transforms a dart primitive to an object of arbitrary type [T] (whose information is passed in inputTypeInfo) + @override + T deserialize(Object? value, TypeInfo targetTypeInfo, {Object? context}) { + //Don't rely on T being accurate here, since it won't get passed for generic arguments. + if (value == null) { + return null as T; + } + final targetRootType = targetTypeInfo.root; + if (targetRootType == T) { + //short circuit if we already have the output as the input + return value as T; + } + switch (targetRootType) { + case String: + return value.toString() as T; + case double: + return (value is num ? value.toDouble() : double.tryParse(value.toString())) as T; + case int: + return (value is num ? value.toInt() : int.tryParse(value.toString())) as T; + case num: + return (value is num ? value : num.tryParse(value.toString())) as T; + case bool: + return (value is bool ? value : bool.tryParse(value.toString())) as T; + case DateTime: + return (value is DateTime ? value : DateTime.tryParse(value.toString())) as T; + case Iterable: + case List: + case Set: + if (value is! Iterable) { + throw Exception('Cannot deserialize'); + } + final mappedItems = value.map((v) => deserialize(v, targetTypeInfo.parameters[0], context: context)); + if (targetRootType == List) { + return List.from(mappedItems); + } else if (targetRootType == Set) { + return Set.from(mappedItems); + } else if (targetRootType == Iterable) { + return mappedItems; + } else { + throw Exception('Cannot deserialize'); + } + case Map: + if (value is! Map) { + throw Exception('Cannot deserialize'); + } + return value.map((k,v) => MapEntry(deserialize(k, targetTypeInfo.parameters[0], context: context),deserialize(v, targetTypeInfo.parameters[1], context: context))); + case AdditionalPropertiesClass: + return AdditionalPropertiesClass.fromJson(value as Map) as T; + case Addressable: + return Addressable.fromJson(value as Map) as T; + case AllOfWithSingleRef: + return AllOfWithSingleRef.fromJson(value as Map) as T; + case Animal: + return Animal.fromJson(value as Map) as T; + case ApiResponse: + return ApiResponse.fromJson(value as Map) as T; + case Apple: + return Apple.fromJson(value as Map) as T; + case AppleAllOfDisc: + return AppleAllOfDisc.fromJson(value as Map) as T; + case AppleGrandparentDisc: + return AppleGrandparentDisc.fromJson(value as Map) as T; + case AppleOneOfDisc: + return AppleOneOfDisc.fromJson(value as Map) as T; + case AppleReqDisc: + return AppleReqDisc.fromJson(value as Map) as T; + case AppleVariant1: + return AppleVariant1.fromJson(value as Map) as T; + case ArrayOfArrayOfNumberOnly: + return ArrayOfArrayOfNumberOnly.fromJson(value as Map) as T; + case ArrayOfNumberOnly: + return ArrayOfNumberOnly.fromJson(value as Map) as T; + case ArrayTest: + return ArrayTest.fromJson(value as Map) as T; + case Banana: + return Banana.fromJson(value as Map) as T; + case BananaAllOfDisc: + return BananaAllOfDisc.fromJson(value as Map) as T; + case BananaGrandparentDisc: + return BananaGrandparentDisc.fromJson(value as Map) as T; + case BananaOneOfDisc: + return BananaOneOfDisc.fromJson(value as Map) as T; + case BananaReqDisc: + return BananaReqDisc.fromJson(value as Map) as T; + case Bar: + return Bar.fromJson(value as Map) as T; + case BarCreate: + return BarCreate.fromJson(value as Map) as T; + case BarRef: + return BarRef.fromJson(value as Map) as T; + case BarRefOrValue: + return BarRefOrValue.fromJson(value as Map) as T; + case Capitalization: + return Capitalization.fromJson(value as Map) as T; + case Cat: + return Cat.fromJson(value as Map) as T; + case Category: + return Category.fromJson(value as Map) as T; + case ClassModel: + return ClassModel.fromJson(value as Map) as T; + case ComposedDiscMissingFromProperties: + return ComposedDiscMissingFromProperties.fromJson(value as Map) as T; + case ComposedDiscOptionalTypeCorrect: + return ComposedDiscOptionalTypeCorrect.fromJson(value as Map) as T; + case ComposedDiscOptionalTypeInconsistent: + return ComposedDiscOptionalTypeInconsistent.fromJson(value as Map) as T; + case ComposedDiscOptionalTypeIncorrect: + return ComposedDiscOptionalTypeIncorrect.fromJson(value as Map) as T; + case ComposedDiscRequiredInconsistent: + return ComposedDiscRequiredInconsistent.fromJson(value as Map) as T; + case ComposedDiscTypeInconsistent: + return ComposedDiscTypeInconsistent.fromJson(value as Map) as T; + case ComposedDiscTypeIncorrect: + return ComposedDiscTypeIncorrect.fromJson(value as Map) as T; + case DeprecatedObject: + return DeprecatedObject.fromJson(value as Map) as T; + case DiscMissingFromProperties: + return DiscMissingFromProperties.fromJson(value as Map) as T; + case DiscOptionalTypeCorrect: + return DiscOptionalTypeCorrect.fromJson(value as Map) as T; + case DiscOptionalTypeIncorrect: + return DiscOptionalTypeIncorrect.fromJson(value as Map) as T; + case DiscTypeIncorrect: + return DiscTypeIncorrect.fromJson(value as Map) as T; + case Dog: + return Dog.fromJson(value as Map) as T; + case Entity: + return Entity.fromJson(value as Map) as T; + case EntityRef: + return EntityRef.fromJson(value as Map) as T; + case EnumArrays: + return EnumArrays.fromJson(value as Map) as T; + case EnumTest: + return EnumTest.fromJson(value as Map) as T; + case Extensible: + return Extensible.fromJson(value as Map) as T; + case FileSchemaTestClass: + return FileSchemaTestClass.fromJson(value as Map) as T; + case Foo: + return Foo.fromJson(value as Map) as T; + case FooBasicGetDefaultResponse: + return FooBasicGetDefaultResponse.fromJson(value as Map) as T; + case FooRef: + return FooRef.fromJson(value as Map) as T; + case FooRefOrValue: + return FooRefOrValue.fromJson(value as Map) as T; + case FormatTest: + return FormatTest.fromJson(value as Map) as T; + case Fruit: + return Fruit.fromJson(value as Map) as T; + case FruitAllOfDisc: + return FruitAllOfDisc.fromJson(value as Map) as T; + case FruitAnyOfDisc: + return FruitAnyOfDisc.fromJson(value as Map) as T; + case FruitGrandparentDisc: + return FruitGrandparentDisc.fromJson(value as Map) as T; + case FruitInlineDisc: + return FruitInlineDisc.fromJson(value as Map) as T; + case FruitInlineDiscOneOf: + return FruitInlineDiscOneOf.fromJson(value as Map) as T; + case FruitInlineDiscOneOf1: + return FruitInlineDiscOneOf1.fromJson(value as Map) as T; + case FruitInlineInlineDisc: + return FruitInlineInlineDisc.fromJson(value as Map) as T; + case FruitInlineInlineDiscOneOf: + return FruitInlineInlineDiscOneOf.fromJson(value as Map) as T; + case FruitInlineInlineDiscOneOf1: + return FruitInlineInlineDiscOneOf1.fromJson(value as Map) as T; + case FruitInlineInlineDiscOneOfOneOf: + return FruitInlineInlineDiscOneOfOneOf.fromJson(value as Map) as T; + case FruitOneOfDisc: + return FruitOneOfDisc.fromJson(value as Map) as T; + case FruitReqDisc: + return FruitReqDisc.fromJson(value as Map) as T; + case FruitType: + return FruitType.fromJson(value as Map) as T; + case FruitVariant1: + return FruitVariant1.fromJson(value as Map) as T; + case GigaOneOf: + return GigaOneOf.fromJson(value as Map) as T; + case GrapeVariant1: + return GrapeVariant1.fromJson(value as Map) as T; + case HasOnlyReadOnly: + return HasOnlyReadOnly.fromJson(value as Map) as T; + case HealthCheckResult: + return HealthCheckResult.fromJson(value as Map) as T; + case MapTest: + return MapTest.fromJson(value as Map) as T; + case MixedPropertiesAndAdditionalPropertiesClass: + return MixedPropertiesAndAdditionalPropertiesClass.fromJson(value as Map) as T; + case Model200Response: + return Model200Response.fromJson(value as Map) as T; + case ModelClient: + return ModelClient.fromJson(value as Map) as T; + case ModelEnumClass: + //TODO: find a way to support enums + return value as T; + case ModelFile: + return ModelFile.fromJson(value as Map) as T; + case ModelList: + return ModelList.fromJson(value as Map) as T; + case ModelReturn: + return ModelReturn.fromJson(value as Map) as T; + case Name: + return Name.fromJson(value as Map) as T; + case NullableClass: + return NullableClass.fromJson(value as Map) as T; + case NumberOnly: + return NumberOnly.fromJson(value as Map) as T; + case ObjectWithDeprecatedFields: + return ObjectWithDeprecatedFields.fromJson(value as Map) as T; + case OneOfPrimitiveChild: + return OneOfPrimitiveChild.fromJson(value as Map) as T; + case Order: + return Order.fromJson(value as Map) as T; + case OuterComposite: + return OuterComposite.fromJson(value as Map) as T; + case OuterEnum: + //TODO: find a way to support enums + return value as T; + case OuterEnumDefaultValue: + //TODO: find a way to support enums + return value as T; + case OuterEnumInteger: + //TODO: find a way to support enums + return value as T; + case OuterEnumIntegerDefaultValue: + //TODO: find a way to support enums + return value as T; + case OuterObjectWithEnumProperty: + return OuterObjectWithEnumProperty.fromJson(value as Map) as T; + case Parent: + return Parent.fromJson(value as Map) as T; + case Pasta: + return Pasta.fromJson(value as Map) as T; + case Pet: + return Pet.fromJson(value as Map) as T; + case Pizza: + return Pizza.fromJson(value as Map) as T; + case PizzaSpeziale: + return PizzaSpeziale.fromJson(value as Map) as T; + case ReadOnlyFirst: + return ReadOnlyFirst.fromJson(value as Map) as T; + case SingleRefType: + //TODO: find a way to support enums + return value as T; + case SpecialModelName: + return SpecialModelName.fromJson(value as Map) as T; + case Tag: + return Tag.fromJson(value as Map) as T; + case User: + return User.fromJson(value as Map) as T; + default: + if (value is T) { + return value; + } + throw Exception('Cannot deserialize'); + } + } +} \ No newline at end of file diff --git a/samples/client/echo_api/dart/dio/json_serializable/pom.xml b/samples/client/echo_api/dart/dio/json_serializable/pom.xml new file mode 100644 index 000000000000..d4d82ba9718d --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/pom.xml @@ -0,0 +1,89 @@ + + 4.0.0 + org.openapitools + DartNextDioJsonSerializableSample + pom + 1.0.0-SNAPSHOT + Dart Echo API Sample (dio/json_serializable) + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + + + pub-get + pre-integration-test + + exec + + + dart + + pub + get + + + + + pub-run-build-runner + pre-integration-test + + exec + + + dart + + pub + run + build_runner + build + + + + + dart-analyze + integration-test + + exec + + + dart + + analyze + --fatal-infos + + + + + dart-test + integration-test + + exec + + + dart + + test + + + + + + + + diff --git a/samples/client/echo_api/dart/dio/json_serializable/pubspec.yaml b/samples/client/echo_api/dart/dio/json_serializable/pubspec.yaml new file mode 100644 index 000000000000..8acec8ec10bb --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/pubspec.yaml @@ -0,0 +1,16 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client +homepage: homepage + +environment: + sdk: '>=2.15.0 <3.0.0' + +dependencies: + dio: '^5.2.0' + json_annotation: ^4.8.1 + +dev_dependencies: + build_runner: any + json_serializable: '^6.1.5' + test: ^1.16.0 diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/additional_properties_class_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/additional_properties_class_test.dart new file mode 100644 index 000000000000..e9d8dbaec130 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/additional_properties_class_test.dart @@ -0,0 +1,17 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AdditionalPropertiesClass +void main() { + final AdditionalPropertiesClass? + instance = /* AdditionalPropertiesClass(...) */ null; + // add properties to the entity + + group(AdditionalPropertiesClass, () { + // Map mapProperty + test('to test the property `mapProperty`', () async {}); + + // Map> mapOfMapProperty + test('to test the property `mapOfMapProperty`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/addressable_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/addressable_test.dart new file mode 100644 index 000000000000..bbdc7725b0ab --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/addressable_test.dart @@ -0,0 +1,18 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Addressable +void main() { + final Addressable? instance = /* Addressable(...) */ null; + // add properties to the entity + + group(Addressable, () { + // Hyperlink reference + // String href + test('to test the property `href`', () async {}); + + // unique identifier + // String id + test('to test the property `id`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/all_of_with_single_ref_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/all_of_with_single_ref_test.dart new file mode 100644 index 000000000000..b398d3cb7394 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/all_of_with_single_ref_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AllOfWithSingleRef +void main() { + final AllOfWithSingleRef? instance = /* AllOfWithSingleRef(...) */ null; + // add properties to the entity + + group(AllOfWithSingleRef, () { + // String username + test('to test the property `username`', () async {}); + + // SingleRefType singleRefType + test('to test the property `singleRefType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/animal_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/animal_test.dart new file mode 100644 index 000000000000..e18d62d5f646 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/animal_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Animal +void main() { + final Animal? instance = /* Animal(...) */ null; + // add properties to the entity + + group(Animal, () { + // String className + test('to test the property `className`', () async {}); + + // String color (default value: r'red') + test('to test the property `color`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/another_fake_api_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/another_fake_api_test.dart new file mode 100644 index 000000000000..5b98fa2a4e0a --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/another_fake_api_test.dart @@ -0,0 +1,16 @@ +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 {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/api_response_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/api_response_test.dart new file mode 100644 index 000000000000..8d77a18549fe --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/api_response_test.dart @@ -0,0 +1,19 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ApiResponse +void main() { + final ApiResponse? instance = /* ApiResponse(...) */ null; + // add properties to the entity + + group(ApiResponse, () { + // int code + test('to test the property `code`', () async {}); + + // String type + test('to test the property `type`', () async {}); + + // String message + test('to test the property `message`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/apple_all_of_disc_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/apple_all_of_disc_test.dart new file mode 100644 index 000000000000..dea988fb4814 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/apple_all_of_disc_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AppleAllOfDisc +void main() { + final AppleAllOfDisc? instance = /* AppleAllOfDisc(...) */ null; + // add properties to the entity + + group(AppleAllOfDisc, () { + // int seeds + test('to test the property `seeds`', () async {}); + + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/apple_grandparent_disc_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/apple_grandparent_disc_test.dart new file mode 100644 index 000000000000..e2dc6e593c7a --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/apple_grandparent_disc_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AppleGrandparentDisc +void main() { + final AppleGrandparentDisc? instance = /* AppleGrandparentDisc(...) */ null; + // add properties to the entity + + group(AppleGrandparentDisc, () { + // int seeds + test('to test the property `seeds`', () async {}); + + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/apple_one_of_disc_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/apple_one_of_disc_test.dart new file mode 100644 index 000000000000..95f0608c25fc --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/apple_one_of_disc_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AppleOneOfDisc +void main() { + final AppleOneOfDisc? instance = /* AppleOneOfDisc(...) */ null; + // add properties to the entity + + group(AppleOneOfDisc, () { + // int seeds + test('to test the property `seeds`', () async {}); + + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/apple_req_disc_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/apple_req_disc_test.dart new file mode 100644 index 000000000000..a1db5b180284 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/apple_req_disc_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AppleReqDisc +void main() { + final AppleReqDisc? instance = /* AppleReqDisc(...) */ null; + // add properties to the entity + + group(AppleReqDisc, () { + // int seeds + test('to test the property `seeds`', () async {}); + + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/apple_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/apple_test.dart new file mode 100644 index 000000000000..57c8d5b58882 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/apple_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Apple +void main() { + final Apple? instance = /* Apple(...) */ null; + // add properties to the entity + + group(Apple, () { + // String kind + test('to test the property `kind`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/apple_variant1_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/apple_variant1_test.dart new file mode 100644 index 000000000000..ae810e3a455f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/apple_variant1_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AppleVariant1 +void main() { + final AppleVariant1? instance = /* AppleVariant1(...) */ null; + // add properties to the entity + + group(AppleVariant1, () { + // String kind + test('to test the property `kind`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/array_of_array_of_number_only_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/array_of_array_of_number_only_test.dart new file mode 100644 index 000000000000..a572243fe334 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/array_of_array_of_number_only_test.dart @@ -0,0 +1,14 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayOfArrayOfNumberOnly +void main() { + final ArrayOfArrayOfNumberOnly? instance = /* ArrayOfArrayOfNumberOnly(...) */ + null; + // add properties to the entity + + group(ArrayOfArrayOfNumberOnly, () { + // List> arrayArrayNumber + test('to test the property `arrayArrayNumber`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/array_of_number_only_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/array_of_number_only_test.dart new file mode 100644 index 000000000000..d5faf37a3369 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/array_of_number_only_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayOfNumberOnly +void main() { + final ArrayOfNumberOnly? instance = /* ArrayOfNumberOnly(...) */ null; + // add properties to the entity + + group(ArrayOfNumberOnly, () { + // List arrayNumber + test('to test the property `arrayNumber`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/array_test_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/array_test_test.dart new file mode 100644 index 000000000000..d15d2b928241 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/array_test_test.dart @@ -0,0 +1,19 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayTest +void main() { + final ArrayTest? instance = /* ArrayTest(...) */ null; + // add properties to the entity + + group(ArrayTest, () { + // List arrayOfString + test('to test the property `arrayOfString`', () async {}); + + // List> arrayArrayOfInteger + test('to test the property `arrayArrayOfInteger`', () async {}); + + // List> arrayArrayOfModel + test('to test the property `arrayArrayOfModel`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/banana_all_of_disc_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/banana_all_of_disc_test.dart new file mode 100644 index 000000000000..b051558b9544 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/banana_all_of_disc_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BananaAllOfDisc +void main() { + final BananaAllOfDisc? instance = /* BananaAllOfDisc(...) */ null; + // add properties to the entity + + group(BananaAllOfDisc, () { + // int length + test('to test the property `length`', () async {}); + + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/banana_grandparent_disc_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/banana_grandparent_disc_test.dart new file mode 100644 index 000000000000..5d9e66c59d7e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/banana_grandparent_disc_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BananaGrandparentDisc +void main() { + final BananaGrandparentDisc? instance = /* BananaGrandparentDisc(...) */ null; + // add properties to the entity + + group(BananaGrandparentDisc, () { + // int length + test('to test the property `length`', () async {}); + + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/banana_one_of_disc_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/banana_one_of_disc_test.dart new file mode 100644 index 000000000000..55f1cb0cc526 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/banana_one_of_disc_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BananaOneOfDisc +void main() { + final BananaOneOfDisc? instance = /* BananaOneOfDisc(...) */ null; + // add properties to the entity + + group(BananaOneOfDisc, () { + // int length + test('to test the property `length`', () async {}); + + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/banana_req_disc_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/banana_req_disc_test.dart new file mode 100644 index 000000000000..1e1a4a7ea5f5 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/banana_req_disc_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BananaReqDisc +void main() { + final BananaReqDisc? instance = /* BananaReqDisc(...) */ null; + // add properties to the entity + + group(BananaReqDisc, () { + // int length + test('to test the property `length`', () async {}); + + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/banana_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/banana_test.dart new file mode 100644 index 000000000000..9aee52bea59b --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/banana_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Banana +void main() { + final Banana? instance = /* Banana(...) */ null; + // add properties to the entity + + group(Banana, () { + // num count + test('to test the property `count`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/bar_api_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/bar_api_test.dart new file mode 100644 index 000000000000..b85771fca95b --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/bar_api_test.dart @@ -0,0 +1,14 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for BarApi +void main() { + final instance = Openapi().getBarApi(); + + group(BarApi, () { + // Create a Bar + // + //Future createBar(BarCreate barCreate) async + test('test createBar', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/bar_create_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/bar_create_test.dart new file mode 100644 index 000000000000..7b82c1e20eb2 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/bar_create_test.dart @@ -0,0 +1,39 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BarCreate +void main() { + final BarCreate? instance = /* BarCreate(...) */ null; + // add properties to the entity + + group(BarCreate, () { + // String barPropA + test('to test the property `barPropA`', () async {}); + + // String fooPropB + test('to test the property `fooPropB`', () async {}); + + // FooRefOrValue foo + test('to test the property `foo`', () async {}); + + // Hyperlink reference + // String href + test('to test the property `href`', () async {}); + + // unique identifier + // String id + test('to test the property `id`', () async {}); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async {}); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async {}); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/bar_ref_or_value_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/bar_ref_or_value_test.dart new file mode 100644 index 000000000000..9f9676456408 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/bar_ref_or_value_test.dart @@ -0,0 +1,30 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BarRefOrValue +void main() { + final BarRefOrValue? instance = /* BarRefOrValue(...) */ null; + // add properties to the entity + + group(BarRefOrValue, () { + // Hyperlink reference + // String href + test('to test the property `href`', () async {}); + + // unique identifier + // String id + test('to test the property `id`', () async {}); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async {}); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async {}); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/bar_ref_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/bar_ref_test.dart new file mode 100644 index 000000000000..ebafc2a9717d --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/bar_ref_test.dart @@ -0,0 +1,30 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BarRef +void main() { + final BarRef? instance = /* BarRef(...) */ null; + // add properties to the entity + + group(BarRef, () { + // Hyperlink reference + // String href + test('to test the property `href`', () async {}); + + // unique identifier + // String id + test('to test the property `id`', () async {}); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async {}); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async {}); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/bar_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/bar_test.dart new file mode 100644 index 000000000000..bae1408ce6a7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/bar_test.dart @@ -0,0 +1,38 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Bar +void main() { + final Bar? instance = /* Bar(...) */ null; + // add properties to the entity + + group(Bar, () { + // String id + test('to test the property `id`', () async {}); + + // String barPropA + test('to test the property `barPropA`', () async {}); + + // String fooPropB + test('to test the property `fooPropB`', () async {}); + + // FooRefOrValue foo + test('to test the property `foo`', () async {}); + + // Hyperlink reference + // String href + test('to test the property `href`', () async {}); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async {}); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async {}); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/capitalization_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/capitalization_test.dart new file mode 100644 index 000000000000..584540dba7d7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/capitalization_test.dart @@ -0,0 +1,29 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Capitalization +void main() { + final Capitalization? instance = /* Capitalization(...) */ null; + // add properties to the entity + + group(Capitalization, () { + // String smallCamel + test('to test the property `smallCamel`', () async {}); + + // String capitalCamel + test('to test the property `capitalCamel`', () async {}); + + // String smallSnake + test('to test the property `smallSnake`', () async {}); + + // String capitalSnake + test('to test the property `capitalSnake`', () async {}); + + // String sCAETHFlowPoints + test('to test the property `sCAETHFlowPoints`', () async {}); + + // Name of the pet + // String ATT_NAME + test('to test the property `ATT_NAME`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/cat_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/cat_test.dart new file mode 100644 index 000000000000..260a564cb60a --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/cat_test.dart @@ -0,0 +1,19 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Cat +void main() { + final Cat? instance = /* Cat(...) */ null; + // add properties to the entity + + group(Cat, () { + // String className + test('to test the property `className`', () async {}); + + // String color (default value: r'red') + test('to test the property `color`', () async {}); + + // bool declawed + test('to test the property `declawed`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/category_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/category_test.dart new file mode 100644 index 000000000000..1435106525e8 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/category_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Category +void main() { + final Category? instance = /* Category(...) */ null; + // add properties to the entity + + group(Category, () { + // int id + test('to test the property `id`', () async {}); + + // String name (default value: r'default-name') + test('to test the property `name`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/class_model_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/class_model_test.dart new file mode 100644 index 000000000000..7818c205258e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/class_model_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ClassModel +void main() { + final ClassModel? instance = /* ClassModel(...) */ null; + // add properties to the entity + + group(ClassModel, () { + // String class_ + test('to test the property `class_`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_missing_from_properties_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_missing_from_properties_test.dart new file mode 100644 index 000000000000..e8d8d1671732 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_missing_from_properties_test.dart @@ -0,0 +1,14 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ComposedDiscMissingFromProperties +void main() { + final ComposedDiscMissingFromProperties? + instance = /* ComposedDiscMissingFromProperties(...) */ null; + // add properties to the entity + + group(ComposedDiscMissingFromProperties, () { + // int length + test('to test the property `length`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_optional_type_correct_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_optional_type_correct_test.dart new file mode 100644 index 000000000000..df93193940f3 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_optional_type_correct_test.dart @@ -0,0 +1,14 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ComposedDiscOptionalTypeCorrect +void main() { + final ComposedDiscOptionalTypeCorrect? + instance = /* ComposedDiscOptionalTypeCorrect(...) */ null; + // add properties to the entity + + group(ComposedDiscOptionalTypeCorrect, () { + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_optional_type_inconsistent_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_optional_type_inconsistent_test.dart new file mode 100644 index 000000000000..fbc52a26ecbd --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_optional_type_inconsistent_test.dart @@ -0,0 +1,14 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ComposedDiscOptionalTypeInconsistent +void main() { + final ComposedDiscOptionalTypeInconsistent? + instance = /* ComposedDiscOptionalTypeInconsistent(...) */ null; + // add properties to the entity + + group(ComposedDiscOptionalTypeInconsistent, () { + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_optional_type_incorrect_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_optional_type_incorrect_test.dart new file mode 100644 index 000000000000..96c906705ddf --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_optional_type_incorrect_test.dart @@ -0,0 +1,14 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ComposedDiscOptionalTypeIncorrect +void main() { + final ComposedDiscOptionalTypeIncorrect? + instance = /* ComposedDiscOptionalTypeIncorrect(...) */ null; + // add properties to the entity + + group(ComposedDiscOptionalTypeIncorrect, () { + // int fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_required_inconsistent_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_required_inconsistent_test.dart new file mode 100644 index 000000000000..fdd6834a8029 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_required_inconsistent_test.dart @@ -0,0 +1,14 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ComposedDiscRequiredInconsistent +void main() { + final ComposedDiscRequiredInconsistent? + instance = /* ComposedDiscRequiredInconsistent(...) */ null; + // add properties to the entity + + group(ComposedDiscRequiredInconsistent, () { + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_type_inconsistent_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_type_inconsistent_test.dart new file mode 100644 index 000000000000..0e980486db1a --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_type_inconsistent_test.dart @@ -0,0 +1,14 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ComposedDiscTypeInconsistent +void main() { + final ComposedDiscTypeInconsistent? + instance = /* ComposedDiscTypeInconsistent(...) */ null; + // add properties to the entity + + group(ComposedDiscTypeInconsistent, () { + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_type_incorrect_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_type_incorrect_test.dart new file mode 100644 index 000000000000..51c8290d9f50 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/composed_disc_type_incorrect_test.dart @@ -0,0 +1,14 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ComposedDiscTypeIncorrect +void main() { + final ComposedDiscTypeIncorrect? + instance = /* ComposedDiscTypeIncorrect(...) */ null; + // add properties to the entity + + group(ComposedDiscTypeIncorrect, () { + // int fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/default_api_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/default_api_test.dart new file mode 100644 index 000000000000..a083a0416b02 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/default_api_test.dart @@ -0,0 +1,27 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for DefaultApi +void main() { + final instance = Openapi().getDefaultApi(); + + group(DefaultApi, () { + //Future fooBasicGet() async + test('test fooBasicGet', () async {}); + + //Future list() async + test('test list', () async {}); + + //Future oneofGet() async + test('test oneofGet', () async {}); + + //Future test({ Object body }) async + test('test test', () async {}); + + //Future variant1Get() async + test('test variant1Get', () async {}); + + //Future variant2Get() async + test('test variant2Get', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/deprecated_object_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/deprecated_object_test.dart new file mode 100644 index 000000000000..f0131b657232 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/deprecated_object_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DeprecatedObject +void main() { + final DeprecatedObject? instance = /* DeprecatedObject(...) */ null; + // add properties to the entity + + group(DeprecatedObject, () { + // String name + test('to test the property `name`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/disc_missing_from_properties_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/disc_missing_from_properties_test.dart new file mode 100644 index 000000000000..3585ee4c9aaf --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/disc_missing_from_properties_test.dart @@ -0,0 +1,14 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DiscMissingFromProperties +void main() { + final DiscMissingFromProperties? + instance = /* DiscMissingFromProperties(...) */ null; + // add properties to the entity + + group(DiscMissingFromProperties, () { + // int length + test('to test the property `length`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/disc_optional_type_correct_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/disc_optional_type_correct_test.dart new file mode 100644 index 000000000000..2eabb0728afd --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/disc_optional_type_correct_test.dart @@ -0,0 +1,14 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DiscOptionalTypeCorrect +void main() { + final DiscOptionalTypeCorrect? instance = /* DiscOptionalTypeCorrect(...) */ + null; + // add properties to the entity + + group(DiscOptionalTypeCorrect, () { + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/disc_optional_type_incorrect_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/disc_optional_type_incorrect_test.dart new file mode 100644 index 000000000000..82cbc9bb3687 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/disc_optional_type_incorrect_test.dart @@ -0,0 +1,14 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DiscOptionalTypeIncorrect +void main() { + final DiscOptionalTypeIncorrect? + instance = /* DiscOptionalTypeIncorrect(...) */ null; + // add properties to the entity + + group(DiscOptionalTypeIncorrect, () { + // int fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/disc_type_incorrect_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/disc_type_incorrect_test.dart new file mode 100644 index 000000000000..709b19535702 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/disc_type_incorrect_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DiscTypeIncorrect +void main() { + final DiscTypeIncorrect? instance = /* DiscTypeIncorrect(...) */ null; + // add properties to the entity + + group(DiscTypeIncorrect, () { + // int fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/dog_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/dog_test.dart new file mode 100644 index 000000000000..2ec7895143d6 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/dog_test.dart @@ -0,0 +1,19 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Dog +void main() { + final Dog? instance = /* Dog(...) */ null; + // add properties to the entity + + group(Dog, () { + // String className + test('to test the property `className`', () async {}); + + // String color (default value: r'red') + test('to test the property `color`', () async {}); + + // String breed + test('to test the property `breed`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/entity_ref_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/entity_ref_test.dart new file mode 100644 index 000000000000..48cfd4fa75e5 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/entity_ref_test.dart @@ -0,0 +1,38 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EntityRef +void main() { + final EntityRef? instance = /* EntityRef(...) */ null; + // add properties to the entity + + group(EntityRef, () { + // Name of the related entity. + // String name + test('to test the property `name`', () async {}); + + // The actual type of the target instance when needed for disambiguation. + // String atReferredType + test('to test the property `atReferredType`', () async {}); + + // Hyperlink reference + // String href + test('to test the property `href`', () async {}); + + // unique identifier + // String id + test('to test the property `id`', () async {}); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async {}); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async {}); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/entity_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/entity_test.dart new file mode 100644 index 000000000000..32eb67a90cda --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/entity_test.dart @@ -0,0 +1,30 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Entity +void main() { + final Entity? instance = /* Entity(...) */ null; + // add properties to the entity + + group(Entity, () { + // Hyperlink reference + // String href + test('to test the property `href`', () async {}); + + // unique identifier + // String id + test('to test the property `id`', () async {}); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async {}); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async {}); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/enum_arrays_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/enum_arrays_test.dart new file mode 100644 index 000000000000..c675421e55c9 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/enum_arrays_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EnumArrays +void main() { + final EnumArrays? instance = /* EnumArrays(...) */ null; + // add properties to the entity + + group(EnumArrays, () { + // String justSymbol + test('to test the property `justSymbol`', () async {}); + + // List arrayEnum + test('to test the property `arrayEnum`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/enum_test_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/enum_test_test.dart new file mode 100644 index 000000000000..aed8498fe61b --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/enum_test_test.dart @@ -0,0 +1,34 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EnumTest +void main() { + final EnumTest? instance = /* EnumTest(...) */ null; + // add properties to the entity + + group(EnumTest, () { + // String enumString + test('to test the property `enumString`', () async {}); + + // String enumStringRequired + test('to test the property `enumStringRequired`', () async {}); + + // int enumInteger + test('to test the property `enumInteger`', () async {}); + + // double enumNumber + test('to test the property `enumNumber`', () async {}); + + // OuterEnum outerEnum + test('to test the property `outerEnum`', () async {}); + + // OuterEnumInteger outerEnumInteger + test('to test the property `outerEnumInteger`', () async {}); + + // OuterEnumDefaultValue outerEnumDefaultValue + test('to test the property `outerEnumDefaultValue`', () async {}); + + // OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue + test('to test the property `outerEnumIntegerDefaultValue`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/extensible_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/extensible_test.dart new file mode 100644 index 000000000000..89efd21178fd --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/extensible_test.dart @@ -0,0 +1,22 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Extensible +void main() { + final Extensible? instance = /* Extensible(...) */ null; + // add properties to the entity + + group(Extensible, () { + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async {}); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async {}); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/fake_api_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/fake_api_test.dart new file mode 100644 index 000000000000..3344dacc57cc --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/fake_api_test.dart @@ -0,0 +1,104 @@ +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 {}); + + // test http signature authentication + // + //Future fakeHttpSignatureTest(Pet pet, { String query1, String header1 }) async + test('test fakeHttpSignatureTest', () async {}); + + // Test serialization of outer boolean types + // + //Future fakeOuterBooleanSerialize({ bool body }) async + test('test fakeOuterBooleanSerialize', () async {}); + + // Test serialization of object with outer number type + // + //Future fakeOuterCompositeSerialize({ OuterComposite outerComposite }) async + test('test fakeOuterCompositeSerialize', () async {}); + + // Test serialization of outer number types + // + //Future fakeOuterNumberSerialize({ num body }) async + test('test fakeOuterNumberSerialize', () async {}); + + // Test serialization of outer string types + // + //Future fakeOuterStringSerialize({ String body }) async + test('test fakeOuterStringSerialize', () async {}); + + // Test serialization of enum (int) properties with examples + // + //Future fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty) async + test('test fakePropertyEnumIntegerSerialize', () async {}); + + // For this test, the body has to be a binary file. + // + //Future testBodyWithBinary(MultipartFile body) async + test('test testBodyWithBinary', () async {}); + + // For this test, the body for this request must reference a schema named `File`. + // + //Future testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) async + test('test testBodyWithFileSchema', () async {}); + + //Future testBodyWithQueryParams(String query, User user) async + test('test testBodyWithQueryParams', () async {}); + + // To test \"client\" model + // + // To test \"client\" model + // + //Future testClientModel(ModelClient modelClient) async + test('test testClientModel', () async {}); + + // 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, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async + test('test testEndpointParameters', () async {}); + + // To test enum parameters + // + // To test enum parameters + // + //Future testEnumParameters({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumQueryModelArray, List enumFormStringArray, String enumFormString }) async + test('test testEnumParameters', () async {}); + + // 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 {}); + + // test inline additionalProperties + // + // + // + //Future testInlineAdditionalProperties(Map requestBody) async + test('test testInlineAdditionalProperties', () async {}); + + // test json serialization of form data + // + // + // + //Future testJsonFormData(String param, String param2) async + test('test testJsonFormData', () async {}); + + // To test the collection format in query parameters + // + //Future testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, String allowEmpty, { Map language }) async + test('test testQueryParameterCollectionFormat', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/fake_classname_tags123_api_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/fake_classname_tags123_api_test.dart new file mode 100644 index 000000000000..e2b2e38526dd --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/fake_classname_tags123_api_test.dart @@ -0,0 +1,16 @@ +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 {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/file_schema_test_class_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/file_schema_test_class_test.dart new file mode 100644 index 000000000000..934f530caf6f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/file_schema_test_class_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FileSchemaTestClass +void main() { + final FileSchemaTestClass? instance = /* FileSchemaTestClass(...) */ null; + // add properties to the entity + + group(FileSchemaTestClass, () { + // ModelFile file + test('to test the property `file`', () async {}); + + // List files + test('to test the property `files`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/foo_api_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/foo_api_test.dart new file mode 100644 index 000000000000..37e97eb7b7a0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/foo_api_test.dart @@ -0,0 +1,19 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for FooApi +void main() { + final instance = Openapi().getFooApi(); + + group(FooApi, () { + // Create a Foo + // + //Future createFoo({ Foo foo }) async + test('test createFoo', () async {}); + + // GET all Foos + // + //Future> getAllFoos() async + test('test getAllFoos', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/foo_basic_get_default_response_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/foo_basic_get_default_response_test.dart new file mode 100644 index 000000000000..07aa63e74690 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/foo_basic_get_default_response_test.dart @@ -0,0 +1,14 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FooBasicGetDefaultResponse +void main() { + final FooBasicGetDefaultResponse? + instance = /* FooBasicGetDefaultResponse(...) */ null; + // add properties to the entity + + group(FooBasicGetDefaultResponse, () { + // Foo string + test('to test the property `string`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/foo_ref_or_value_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/foo_ref_or_value_test.dart new file mode 100644 index 000000000000..7d91e69c2e13 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/foo_ref_or_value_test.dart @@ -0,0 +1,30 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FooRefOrValue +void main() { + final FooRefOrValue? instance = /* FooRefOrValue(...) */ null; + // add properties to the entity + + group(FooRefOrValue, () { + // Hyperlink reference + // String href + test('to test the property `href`', () async {}); + + // unique identifier + // String id + test('to test the property `id`', () async {}); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async {}); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async {}); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/foo_ref_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/foo_ref_test.dart new file mode 100644 index 000000000000..f6f684fcf861 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/foo_ref_test.dart @@ -0,0 +1,33 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FooRef +void main() { + final FooRef? instance = /* FooRef(...) */ null; + // add properties to the entity + + group(FooRef, () { + // String foorefPropA + test('to test the property `foorefPropA`', () async {}); + + // Hyperlink reference + // String href + test('to test the property `href`', () async {}); + + // unique identifier + // String id + test('to test the property `id`', () async {}); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async {}); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async {}); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/foo_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/foo_test.dart new file mode 100644 index 000000000000..57fe605b6865 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/foo_test.dart @@ -0,0 +1,36 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Foo +void main() { + final Foo? instance = /* Foo(...) */ null; + // add properties to the entity + + group(Foo, () { + // String fooPropA + test('to test the property `fooPropA`', () async {}); + + // String fooPropB + test('to test the property `fooPropB`', () async {}); + + // Hyperlink reference + // String href + test('to test the property `href`', () async {}); + + // unique identifier + // String id + test('to test the property `id`', () async {}); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async {}); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async {}); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/format_test_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/format_test_test.dart new file mode 100644 index 000000000000..df0e277f8fce --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/format_test_test.dart @@ -0,0 +1,60 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FormatTest +void main() { + final FormatTest? instance = /* FormatTest(...) */ null; + // add properties to the entity + + group(FormatTest, () { + // int integer + test('to test the property `integer`', () async {}); + + // int int32 + test('to test the property `int32`', () async {}); + + // int int64 + test('to test the property `int64`', () async {}); + + // num number + test('to test the property `number`', () async {}); + + // double float + test('to test the property `float`', () async {}); + + // double double_ + test('to test the property `double_`', () async {}); + + // double decimal + test('to test the property `decimal`', () async {}); + + // String string + test('to test the property `string`', () async {}); + + // String byte + test('to test the property `byte`', () async {}); + + // MultipartFile binary + test('to test the property `binary`', () async {}); + + // DateTime date + test('to test the property `date`', () async {}); + + // DateTime dateTime + test('to test the property `dateTime`', () async {}); + + // String uuid + test('to test the property `uuid`', () async {}); + + // String password + test('to test the property `password`', () async {}); + + // A string that is a 10 digit number. Can have leading zeros. + // String patternWithDigits + test('to test the property `patternWithDigits`', () async {}); + + // 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 {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/fruit_all_of_disc_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_all_of_disc_test.dart new file mode 100644 index 000000000000..1d6b05bd8905 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_all_of_disc_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitAllOfDisc +void main() { + final FruitAllOfDisc? instance = /* FruitAllOfDisc(...) */ null; + // add properties to the entity + + group(FruitAllOfDisc, () { + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/fruit_any_of_disc_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_any_of_disc_test.dart new file mode 100644 index 000000000000..986e1f86a67f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_any_of_disc_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitAnyOfDisc +void main() { + final FruitAnyOfDisc? instance = /* FruitAnyOfDisc(...) */ null; + // add properties to the entity + + group(FruitAnyOfDisc, () { + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/fruit_grandparent_disc_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_grandparent_disc_test.dart new file mode 100644 index 000000000000..7b0ed4b5f1ba --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_grandparent_disc_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitGrandparentDisc +void main() { + final FruitGrandparentDisc? instance = /* FruitGrandparentDisc(...) */ null; + // add properties to the entity + + group(FruitGrandparentDisc, () { + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_disc_one_of1_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_disc_one_of1_test.dart new file mode 100644 index 000000000000..051e872b5ade --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_disc_one_of1_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitInlineDiscOneOf1 +void main() { + final FruitInlineDiscOneOf1? instance = /* FruitInlineDiscOneOf1(...) */ null; + // add properties to the entity + + group(FruitInlineDiscOneOf1, () { + // int length + test('to test the property `length`', () async {}); + + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_disc_one_of_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_disc_one_of_test.dart new file mode 100644 index 000000000000..563b53be4ea4 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_disc_one_of_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitInlineDiscOneOf +void main() { + final FruitInlineDiscOneOf? instance = /* FruitInlineDiscOneOf(...) */ null; + // add properties to the entity + + group(FruitInlineDiscOneOf, () { + // int seeds + test('to test the property `seeds`', () async {}); + + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_disc_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_disc_test.dart new file mode 100644 index 000000000000..502f4e7ef50c --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_disc_test.dart @@ -0,0 +1,19 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitInlineDisc +void main() { + final FruitInlineDisc? instance = /* FruitInlineDisc(...) */ null; + // add properties to the entity + + group(FruitInlineDisc, () { + // int seeds + test('to test the property `seeds`', () async {}); + + // String fruitType + test('to test the property `fruitType`', () async {}); + + // int length + test('to test the property `length`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_inline_disc_one_of1_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_inline_disc_one_of1_test.dart new file mode 100644 index 000000000000..825b41d9cc14 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_inline_disc_one_of1_test.dart @@ -0,0 +1,17 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitInlineInlineDiscOneOf1 +void main() { + final FruitInlineInlineDiscOneOf1? + instance = /* FruitInlineInlineDiscOneOf1(...) */ null; + // add properties to the entity + + group(FruitInlineInlineDiscOneOf1, () { + // int length + test('to test the property `length`', () async {}); + + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_inline_disc_one_of_one_of_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_inline_disc_one_of_one_of_test.dart new file mode 100644 index 000000000000..16e0e703e347 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_inline_disc_one_of_one_of_test.dart @@ -0,0 +1,14 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitInlineInlineDiscOneOfOneOf +void main() { + final FruitInlineInlineDiscOneOfOneOf? + instance = /* FruitInlineInlineDiscOneOfOneOf(...) */ null; + // add properties to the entity + + group(FruitInlineInlineDiscOneOfOneOf, () { + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_inline_disc_one_of_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_inline_disc_one_of_test.dart new file mode 100644 index 000000000000..42566f6da0cd --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_inline_disc_one_of_test.dart @@ -0,0 +1,17 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitInlineInlineDiscOneOf +void main() { + final FruitInlineInlineDiscOneOf? + instance = /* FruitInlineInlineDiscOneOf(...) */ null; + // add properties to the entity + + group(FruitInlineInlineDiscOneOf, () { + // int seeds + test('to test the property `seeds`', () async {}); + + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_inline_disc_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_inline_disc_test.dart new file mode 100644 index 000000000000..f5c13c87c591 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_inline_inline_disc_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitInlineInlineDisc +void main() { + final FruitInlineInlineDisc? instance = /* FruitInlineInlineDisc(...) */ null; + // add properties to the entity + + group(FruitInlineInlineDisc, () { + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/fruit_one_of_disc_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_one_of_disc_test.dart new file mode 100644 index 000000000000..f12c284ba507 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_one_of_disc_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitOneOfDisc +void main() { + final FruitOneOfDisc? instance = /* FruitOneOfDisc(...) */ null; + // add properties to the entity + + group(FruitOneOfDisc, () { + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/fruit_req_disc_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_req_disc_test.dart new file mode 100644 index 000000000000..f9aadcc2fd86 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_req_disc_test.dart @@ -0,0 +1,19 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitReqDisc +void main() { + final FruitReqDisc? instance = /* FruitReqDisc(...) */ null; + // add properties to the entity + + group(FruitReqDisc, () { + // int seeds + test('to test the property `seeds`', () async {}); + + // String fruitType + test('to test the property `fruitType`', () async {}); + + // int length + test('to test the property `length`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/fruit_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_test.dart new file mode 100644 index 000000000000..ed0918001305 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_test.dart @@ -0,0 +1,19 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Fruit +void main() { + final Fruit? instance = /* Fruit(...) */ null; + // add properties to the entity + + group(Fruit, () { + // String color + test('to test the property `color`', () async {}); + + // String kind + test('to test the property `kind`', () async {}); + + // num count + test('to test the property `count`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/fruit_type_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_type_test.dart new file mode 100644 index 000000000000..dbff53174feb --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_type_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitType +void main() { + final FruitType? instance = /* FruitType(...) */ null; + // add properties to the entity + + group(FruitType, () { + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/fruit_variant1_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_variant1_test.dart new file mode 100644 index 000000000000..5b63b1301ce2 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/fruit_variant1_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitVariant1 +void main() { + final FruitVariant1? instance = /* FruitVariant1(...) */ null; + // add properties to the entity + + group(FruitVariant1, () { + // String color + test('to test the property `color`', () async {}); + + // String kind + test('to test the property `kind`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/giga_one_of_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/giga_one_of_test.dart new file mode 100644 index 000000000000..baaa072aad50 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/giga_one_of_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for GigaOneOf +void main() { + final GigaOneOf? instance = /* GigaOneOf(...) */ null; + // add properties to the entity + + group(GigaOneOf, () { + // String name + test('to test the property `name`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/grape_variant1_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/grape_variant1_test.dart new file mode 100644 index 000000000000..9d7aab37b3f4 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/grape_variant1_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for GrapeVariant1 +void main() { + final GrapeVariant1? instance = /* GrapeVariant1(...) */ null; + // add properties to the entity + + group(GrapeVariant1, () { + // String color + test('to test the property `color`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/has_only_read_only_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/has_only_read_only_test.dart new file mode 100644 index 000000000000..8c50f9bffae1 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/has_only_read_only_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for HasOnlyReadOnly +void main() { + final HasOnlyReadOnly? instance = /* HasOnlyReadOnly(...) */ null; + // add properties to the entity + + group(HasOnlyReadOnly, () { + // String bar + test('to test the property `bar`', () async {}); + + // String foo + test('to test the property `foo`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/health_check_result_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/health_check_result_test.dart new file mode 100644 index 000000000000..cac9fc773e64 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/health_check_result_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for HealthCheckResult +void main() { + final HealthCheckResult? instance = /* HealthCheckResult(...) */ null; + // add properties to the entity + + group(HealthCheckResult, () { + // String nullableMessage + test('to test the property `nullableMessage`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/map_test_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/map_test_test.dart new file mode 100644 index 000000000000..2e4968e31621 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/map_test_test.dart @@ -0,0 +1,22 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for MapTest +void main() { + final MapTest? instance = /* MapTest(...) */ null; + // add properties to the entity + + group(MapTest, () { + // Map> mapMapOfString + test('to test the property `mapMapOfString`', () async {}); + + // Map mapOfEnumString + test('to test the property `mapOfEnumString`', () async {}); + + // Map directMap + test('to test the property `directMap`', () async {}); + + // Map indirectMap + test('to test the property `indirectMap`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/mixed_properties_and_additional_properties_class_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/mixed_properties_and_additional_properties_class_test.dart new file mode 100644 index 000000000000..ba7d3e7e1d0f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/mixed_properties_and_additional_properties_class_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for MixedPropertiesAndAdditionalPropertiesClass +void main() { + final MixedPropertiesAndAdditionalPropertiesClass? + instance = /* MixedPropertiesAndAdditionalPropertiesClass(...) */ null; + // add properties to the entity + + group(MixedPropertiesAndAdditionalPropertiesClass, () { + // String uuid + test('to test the property `uuid`', () async {}); + + // DateTime dateTime + test('to test the property `dateTime`', () async {}); + + // Map map + test('to test the property `map`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/model200_response_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/model200_response_test.dart new file mode 100644 index 000000000000..513eeaf5b0ca --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/model200_response_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Model200Response +void main() { + final Model200Response? instance = /* Model200Response(...) */ null; + // add properties to the entity + + group(Model200Response, () { + // int name + test('to test the property `name`', () async {}); + + // String class_ + test('to test the property `class_`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/model_client_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/model_client_test.dart new file mode 100644 index 000000000000..bd1a98e0d42c --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/model_client_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelClient +void main() { + final ModelClient? instance = /* ModelClient(...) */ null; + // add properties to the entity + + group(ModelClient, () { + // String client + test('to test the property `client`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/model_enum_class_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/model_enum_class_test.dart new file mode 100644 index 000000000000..fa31f816801c --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/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/client/echo_api/dart/dio/json_serializable/test/model_file_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/model_file_test.dart new file mode 100644 index 000000000000..7e48a75765b5 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/model_file_test.dart @@ -0,0 +1,14 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelFile +void main() { + final ModelFile? instance = /* ModelFile(...) */ null; + // add properties to the entity + + group(ModelFile, () { + // Test capitalization + // String sourceURI + test('to test the property `sourceURI`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/model_list_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/model_list_test.dart new file mode 100644 index 000000000000..98466f84a50d --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/model_list_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelList +void main() { + final ModelList? instance = /* ModelList(...) */ null; + // add properties to the entity + + group(ModelList, () { + // String n123list + test('to test the property `n123list`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/model_return_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/model_return_test.dart new file mode 100644 index 000000000000..e13ca216a72b --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/model_return_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelReturn +void main() { + final ModelReturn? instance = /* ModelReturn(...) */ null; + // add properties to the entity + + group(ModelReturn, () { + // int return_ + test('to test the property `return_`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/name_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/name_test.dart new file mode 100644 index 000000000000..ada0d1c60bc0 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/name_test.dart @@ -0,0 +1,22 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Name +void main() { + final Name? instance = /* Name(...) */ null; + // add properties to the entity + + group(Name, () { + // int name + test('to test the property `name`', () async {}); + + // int snakeCase + test('to test the property `snakeCase`', () async {}); + + // String property + test('to test the property `property`', () async {}); + + // int n123number + test('to test the property `n123number`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/nullable_class_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/nullable_class_test.dart new file mode 100644 index 000000000000..9d4fe62b1014 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/nullable_class_test.dart @@ -0,0 +1,46 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for NullableClass +void main() { + final NullableClass? instance = /* NullableClass(...) */ null; + // add properties to the entity + + group(NullableClass, () { + // int integerProp + test('to test the property `integerProp`', () async {}); + + // num numberProp + test('to test the property `numberProp`', () async {}); + + // bool booleanProp + test('to test the property `booleanProp`', () async {}); + + // String stringProp + test('to test the property `stringProp`', () async {}); + + // DateTime dateProp + test('to test the property `dateProp`', () async {}); + + // DateTime datetimeProp + test('to test the property `datetimeProp`', () async {}); + + // List arrayNullableProp + test('to test the property `arrayNullableProp`', () async {}); + + // List arrayAndItemsNullableProp + test('to test the property `arrayAndItemsNullableProp`', () async {}); + + // List arrayItemsNullable + test('to test the property `arrayItemsNullable`', () async {}); + + // Map objectNullableProp + test('to test the property `objectNullableProp`', () async {}); + + // Map objectAndItemsNullableProp + test('to test the property `objectAndItemsNullableProp`', () async {}); + + // Map objectItemsNullable + test('to test the property `objectItemsNullable`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/number_only_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/number_only_test.dart new file mode 100644 index 000000000000..1cd19b9bcd33 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/number_only_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for NumberOnly +void main() { + final NumberOnly? instance = /* NumberOnly(...) */ null; + // add properties to the entity + + group(NumberOnly, () { + // num justNumber + test('to test the property `justNumber`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/object_with_deprecated_fields_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/object_with_deprecated_fields_test.dart new file mode 100644 index 000000000000..bd636f2eb2f1 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/object_with_deprecated_fields_test.dart @@ -0,0 +1,23 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ObjectWithDeprecatedFields +void main() { + final ObjectWithDeprecatedFields? + instance = /* ObjectWithDeprecatedFields(...) */ null; + // add properties to the entity + + group(ObjectWithDeprecatedFields, () { + // String uuid + test('to test the property `uuid`', () async {}); + + // num id + test('to test the property `id`', () async {}); + + // DeprecatedObject deprecatedRef + test('to test the property `deprecatedRef`', () async {}); + + // List bars + test('to test the property `bars`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/one_of_primitive_child_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/one_of_primitive_child_test.dart new file mode 100644 index 000000000000..90259deed94a --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/one_of_primitive_child_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OneOfPrimitiveChild +void main() { + final OneOfPrimitiveChild? instance = /* OneOfPrimitiveChild(...) */ null; + // add properties to the entity + + group(OneOfPrimitiveChild, () { + // String name + test('to test the property `name`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/order_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/order_test.dart new file mode 100644 index 000000000000..e7456dbc208b --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/order_test.dart @@ -0,0 +1,29 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Order +void main() { + final Order? instance = /* Order(...) */ null; + // add properties to the entity + + group(Order, () { + // int id + test('to test the property `id`', () async {}); + + // int petId + test('to test the property `petId`', () async {}); + + // int quantity + test('to test the property `quantity`', () async {}); + + // DateTime shipDate + test('to test the property `shipDate`', () async {}); + + // Order Status + // String status + test('to test the property `status`', () async {}); + + // bool complete (default value: false) + test('to test the property `complete`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/outer_composite_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/outer_composite_test.dart new file mode 100644 index 000000000000..620cb8580d1e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/outer_composite_test.dart @@ -0,0 +1,19 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterComposite +void main() { + final OuterComposite? instance = /* OuterComposite(...) */ null; + // add properties to the entity + + group(OuterComposite, () { + // num myNumber + test('to test the property `myNumber`', () async {}); + + // String myString + test('to test the property `myString`', () async {}); + + // bool myBoolean + test('to test the property `myBoolean`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/outer_enum_default_value_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/outer_enum_default_value_test.dart new file mode 100644 index 000000000000..a5c83f615194 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/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/client/echo_api/dart/dio/json_serializable/test/outer_enum_integer_default_value_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/outer_enum_integer_default_value_test.dart new file mode 100644 index 000000000000..49ebbfcead7f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/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/client/echo_api/dart/dio/json_serializable/test/outer_enum_integer_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/outer_enum_integer_test.dart new file mode 100644 index 000000000000..3c6b81305c71 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/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/client/echo_api/dart/dio/json_serializable/test/outer_enum_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/outer_enum_test.dart new file mode 100644 index 000000000000..4ee10f379d5e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/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/client/echo_api/dart/dio/json_serializable/test/outer_object_with_enum_property_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/outer_object_with_enum_property_test.dart new file mode 100644 index 000000000000..197fdbef8ea7 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/outer_object_with_enum_property_test.dart @@ -0,0 +1,14 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterObjectWithEnumProperty +void main() { + final OuterObjectWithEnumProperty? + instance = /* OuterObjectWithEnumProperty(...) */ null; + // add properties to the entity + + group(OuterObjectWithEnumProperty, () { + // OuterEnumInteger value + test('to test the property `value`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/parent_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/parent_test.dart new file mode 100644 index 000000000000..a15e32f69fde --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/parent_test.dart @@ -0,0 +1,13 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Parent +void main() { + final Parent? instance = /* Parent(...) */ null; + // add properties to the entity + + group(Parent, () { + // String fruitType + test('to test the property `fruitType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/pasta_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/pasta_test.dart new file mode 100644 index 000000000000..aa8cac46702c --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/pasta_test.dart @@ -0,0 +1,33 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Pasta +void main() { + final Pasta? instance = /* Pasta(...) */ null; + // add properties to the entity + + group(Pasta, () { + // String vendor + test('to test the property `vendor`', () async {}); + + // Hyperlink reference + // String href + test('to test the property `href`', () async {}); + + // unique identifier + // String id + test('to test the property `id`', () async {}); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async {}); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async {}); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/pet_api_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/pet_api_test.dart new file mode 100644 index 000000000000..adb75c822a58 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/pet_api_test.dart @@ -0,0 +1,72 @@ +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 {}); + + // Deletes a pet + // + // + // + //Future deletePet(int petId, { String apiKey }) async + test('test deletePet', () async {}); + + // Finds Pets by status + // + // Multiple status values can be provided with comma separated strings + // + //Future> findPetsByStatus(List status) async + test('test findPetsByStatus', () async {}); + + // Finds Pets by tags + // + // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + // + //Future> findPetsByTags(Set tags) async + test('test findPetsByTags', () async {}); + + // Find pet by ID + // + // Returns a single pet + // + //Future getPetById(int petId) async + test('test getPetById', () async {}); + + // Update an existing pet + // + // + // + //Future updatePet(Pet pet) async + test('test updatePet', () async {}); + + // Updates a pet in the store with form data + // + // + // + //Future updatePetWithForm(int petId, { String name, String status }) async + test('test updatePetWithForm', () async {}); + + // uploads an image + // + // + // + //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async + test('test uploadFile', () async {}); + + // uploads an image (required) + // + // + // + //Future uploadFileWithRequiredFile(int petId, MultipartFile requiredFile, { String additionalMetadata }) async + test('test uploadFileWithRequiredFile', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/pet_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/pet_test.dart new file mode 100644 index 000000000000..3ef32379be9d --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/pet_test.dart @@ -0,0 +1,29 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Pet +void main() { + final Pet? instance = /* Pet(...) */ null; + // add properties to the entity + + group(Pet, () { + // int id + test('to test the property `id`', () async {}); + + // Category category + test('to test the property `category`', () async {}); + + // String name + test('to test the property `name`', () async {}); + + // Set photoUrls + test('to test the property `photoUrls`', () async {}); + + // List tags + test('to test the property `tags`', () async {}); + + // pet status in the store + // String status + test('to test the property `status`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/pizza_speziale_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/pizza_speziale_test.dart new file mode 100644 index 000000000000..a66c45371050 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/pizza_speziale_test.dart @@ -0,0 +1,33 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for PizzaSpeziale +void main() { + final PizzaSpeziale? instance = /* PizzaSpeziale(...) */ null; + // add properties to the entity + + group(PizzaSpeziale, () { + // String toppings + test('to test the property `toppings`', () async {}); + + // Hyperlink reference + // String href + test('to test the property `href`', () async {}); + + // unique identifier + // String id + test('to test the property `id`', () async {}); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async {}); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async {}); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/pizza_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/pizza_test.dart new file mode 100644 index 000000000000..3b94adfed7a4 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/pizza_test.dart @@ -0,0 +1,33 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Pizza +void main() { + final Pizza? instance = /* Pizza(...) */ null; + // add properties to the entity + + group(Pizza, () { + // num pizzaSize + test('to test the property `pizzaSize`', () async {}); + + // Hyperlink reference + // String href + test('to test the property `href`', () async {}); + + // unique identifier + // String id + test('to test the property `id`', () async {}); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async {}); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async {}); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/read_only_first_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/read_only_first_test.dart new file mode 100644 index 000000000000..283271ed5a2e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/read_only_first_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ReadOnlyFirst +void main() { + final ReadOnlyFirst? instance = /* ReadOnlyFirst(...) */ null; + // add properties to the entity + + group(ReadOnlyFirst, () { + // String bar + test('to test the property `bar`', () async {}); + + // String baz + test('to test the property `baz`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/single_ref_type_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/single_ref_type_test.dart new file mode 100644 index 000000000000..2c265f0d24ae --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/single_ref_type_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for SingleRefType +void main() { + group(SingleRefType, () {}); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/special_model_name_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/special_model_name_test.dart new file mode 100644 index 000000000000..3105bbd21bf8 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/special_model_name_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for SpecialModelName +void main() { + final SpecialModelName? instance = /* SpecialModelName(...) */ null; + // add properties to the entity + + group(SpecialModelName, () { + // int dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket + test( + 'to test the property `dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket`', + () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/store_api_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/store_api_test.dart new file mode 100644 index 000000000000..df8b3438d90e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/store_api_test.dart @@ -0,0 +1,37 @@ +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 {}); + + // Returns pet inventories by status + // + // Returns a map of status codes to quantities + // + //Future> getInventory() async + test('test getInventory', () async {}); + + // Find purchase order by ID + // + // For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + // + //Future getOrderById(int orderId) async + test('test getOrderById', () async {}); + + // Place an order for a pet + // + // + // + //Future placeOrder(Order order) async + test('test placeOrder', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/tag_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/tag_test.dart new file mode 100644 index 000000000000..7b4992ed979e --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/tag_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Tag +void main() { + final Tag? instance = /* Tag(...) */ null; + // add properties to the entity + + group(Tag, () { + // int id + test('to test the property `id`', () async {}); + + // String name + test('to test the property `name`', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/user_api_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/user_api_test.dart new file mode 100644 index 000000000000..30bc306fecc9 --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/user_api_test.dart @@ -0,0 +1,65 @@ +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 {}); + + // Creates list of users with given input array + // + // + // + //Future createUsersWithArrayInput(List user) async + test('test createUsersWithArrayInput', () async {}); + + // Creates list of users with given input array + // + // + // + //Future createUsersWithListInput(List user) async + test('test createUsersWithListInput', () async {}); + + // Delete user + // + // This can only be done by the logged in user. + // + //Future deleteUser(String username) async + test('test deleteUser', () async {}); + + // Get user by user name + // + // + // + //Future getUserByName(String username) async + test('test getUserByName', () async {}); + + // Logs user into the system + // + // + // + //Future loginUser(String username, String password) async + test('test loginUser', () async {}); + + // Logs out current logged in user session + // + // + // + //Future logoutUser() async + test('test logoutUser', () async {}); + + // Updated user + // + // This can only be done by the logged in user. + // + //Future updateUser(String username, User user) async + test('test updateUser', () async {}); + }); +} diff --git a/samples/client/echo_api/dart/dio/json_serializable/test/user_test.dart b/samples/client/echo_api/dart/dio/json_serializable/test/user_test.dart new file mode 100644 index 000000000000..2780d247eb1f --- /dev/null +++ b/samples/client/echo_api/dart/dio/json_serializable/test/user_test.dart @@ -0,0 +1,35 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for User +void main() { + final User? instance = /* User(...) */ null; + // add properties to the entity + + group(User, () { + // int id + test('to test the property `id`', () async {}); + + // String username + test('to test the property `username`', () async {}); + + // String firstName + test('to test the property `firstName`', () async {}); + + // String lastName + test('to test the property `lastName`', () async {}); + + // String email + test('to test the property `email`', () async {}); + + // String password + test('to test the property `password`', () async {}); + + // String phone + test('to test the property `phone`', () async {}); + + // User Status + // int userStatus + test('to test the property `userStatus`', () async {}); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/test/fake_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/test/fake_api_test.dart index 06418dfa53c4..c31c4aac2708 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/test/fake_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/test/fake_api_test.dart @@ -7,6 +7,13 @@ void main() { final instance = Openapi().getFakeApi(); group(FakeApi, () { + // for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + // + //Future fakeBigDecimalMap() async + test('test fakeBigDecimalMap', () async { + // TODO + }); + // Health check endpoint // //Future fakeHealthGet() async diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/inline_response_default.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/inline_response_default.dart deleted file mode 100644 index 74d5ed70f1e8..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/inline_response_default.dart +++ /dev/null @@ -1,91 +0,0 @@ -// -// 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'; -import 'package:one_of/one_of.dart'; -import 'package:one_of/any_of.dart'; -// ignore_for_file: unused_element, unused_import - -part 'inline_response_default.g.dart'; - -/// InlineResponseDefault -/// -/// Properties: -/// * [string] -@BuiltValue() -abstract class InlineResponseDefault implements Built { - @BuiltValueField(wireName: r'string') - Foo? get string; - - - InlineResponseDefault._(); - - factory InlineResponseDefault([void updates(InlineResponseDefaultBuilder b)]) = _$InlineResponseDefault; - - @BuiltValueHook(initializeBuilder: true) - static void _defaults(InlineResponseDefaultBuilder b) => b; - - @BuiltValueSerializer(custom: true) - static Serializer get serializer => _$InlineResponseDefaultSerializer(); - - -} - -class _$InlineResponseDefaultSerializer implements PrimitiveSerializer { - @override - final Iterable types = const [InlineResponseDefault, _$InlineResponseDefault]; - - @override - final String wireName = r'InlineResponseDefault'; - - Iterable _serializeProperties(Serializers serializers, InlineResponseDefault object, - {FullType specifiedType = FullType.unspecified}) sync* { - if (object.string != null) { - yield r'string'; - yield serializers.serialize(object.string, - specifiedType: const FullType(Foo)); - } - } - - @override - Object serialize(Serializers serializers, InlineResponseDefault object, - {FullType specifiedType = FullType.unspecified}) { - return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); - } - - void _deserializeProperties(Serializers serializers, Object serialized, - {FullType specifiedType = FullType.unspecified, required List serializedList,required InlineResponseDefaultBuilder result, required List unhandled}) { - for (var i = 0; i < serializedList.length; i += 2) { - final key = serializedList[i] as String; - final value = serializedList[i + 1]; - switch (key) { - case r'string': - final valueDes = serializers.deserialize(value, - specifiedType: const FullType(Foo)) as Foo; - result.string.replace(valueDes); - break; - default: - unhandled.add(key); - unhandled.add(value); - break; - } - } - } - - @override - InlineResponseDefault deserialize(Serializers serializers, Object serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = InlineResponseDefaultBuilder(); - final serializedList = (serialized as Iterable).toList(); - final unhandled = []; - _deserializeProperties(serializers, serialized, specifiedType: specifiedType, serializedList: serializedList, unhandled: unhandled, result: result); - return result.build(); - } -} - - - - diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_api_test.dart index c552474e280b..07319f9363fb 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_api_test.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_api_test.dart @@ -7,6 +7,13 @@ void main() { final instance = Openapi().getFakeApi(); group(FakeApi, () { + // for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + // + //Future fakeBigDecimalMap() async + test('test fakeBigDecimalMap', () async { + // TODO + }); + // Health check endpoint // //Future fakeHealthGet() async diff --git a/website/i18n/en.json b/website/i18n/en.json index 1599045b79f9..f94cede04528 100644 --- a/website/i18n/en.json +++ b/website/i18n/en.json @@ -131,6 +131,10 @@ "title": "Config Options for dart-dio", "sidebar_label": "dart-dio" }, + "generators/dart-next": { + "title": "Config Options for dart-next", + "sidebar_label": "dart-next" + }, "generators/dart-jaguar": { "title": "Config Options for dart-jaguar", "sidebar_label": "dart-jaguar"