diff --git a/.github/workflows/samples-dart-freezed.yaml b/.github/workflows/samples-dart-freezed.yaml new file mode 100644 index 000000000000..4b66b55e5007 --- /dev/null +++ b/.github/workflows/samples-dart-freezed.yaml @@ -0,0 +1,39 @@ +name: Samples Dart + +on: + push: + branches: + - master + - '[5-9]+.[0-9]+.x' + pull_request: + branches: + - master + - '[5-9]+.[0-9]+.x' + paths: + - 'samples/openapi3/client/petstore/dart*/freezed' + +jobs: + tests-dart: + name: Tests Dart + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 11 + cache: maven + - name: Cache test dependencies + uses: actions/cache@v4 + env: + cache-name: pub-cache + with: + path: $PUB_CACHE + key: ${{ runner.os }}-${{ github.job }}-${{ env.cache-name }}-${{ hashFiles('samples/**/pubspec.*') }} + - uses: dart-lang/setup-dart@v1 + with: + sdk: 3.0.0 + - name: Run tests + uses: ./.github/actions/run-samples + with: + name: samples.dart diff --git a/.github/workflows/samples-dart.yaml b/.github/workflows/samples-dart.yaml index aeb5637634d1..21dd560615bf 100644 --- a/.github/workflows/samples-dart.yaml +++ b/.github/workflows/samples-dart.yaml @@ -11,6 +11,8 @@ on: - '[5-9]+.[0-9]+.x' paths: - 'samples/openapi3/client/petstore/dart*/**' + - '!samples/openapi3/client/petstore/dart*/freezed' + jobs: tests-dart: diff --git a/bin/configs/dart-dio-oneof-freezed.yaml b/bin/configs/dart-dio-oneof-freezed.yaml new file mode 100644 index 000000000000..7c2baeb15adf --- /dev/null +++ b/bin/configs/dart-dio-oneof-freezed.yaml @@ -0,0 +1,12 @@ +generatorName: dart-dio +outputDir: samples/openapi3/client/petstore/dart-dio/freezed/oneof +inputSpec: modules/openapi-generator/src/test/resources/3_0/oneOf.yaml +templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio +typeMappings: + Client: "ModelClient" + File: "ModelFile" + EnumClass: "ModelEnumClass" +additionalProperties: + hideGenerationTimestamp: "true" + serializationLibrary: "freezed" + diff --git a/bin/configs/dart-dio-oneof-polymorphism-and-inheritance-freezed.yaml b/bin/configs/dart-dio-oneof-polymorphism-and-inheritance-freezed.yaml new file mode 100644 index 000000000000..df67bb1d13c2 --- /dev/null +++ b/bin/configs/dart-dio-oneof-polymorphism-and-inheritance-freezed.yaml @@ -0,0 +1,12 @@ +generatorName: dart-dio +outputDir: samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance +inputSpec: modules/openapi-generator/src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml +templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio +typeMappings: + Client: "ModelClient" + File: "ModelFile" + EnumClass: "ModelEnumClass" +additionalProperties: + hideGenerationTimestamp: "true" + enumUnknownDefaultCase: "true" + serializationLibrary: "freezed" diff --git a/bin/configs/dart-dio-oneof-primitive-freezed.yaml b/bin/configs/dart-dio-oneof-primitive-freezed.yaml new file mode 100644 index 000000000000..a2c948ebe086 --- /dev/null +++ b/bin/configs/dart-dio-oneof-primitive-freezed.yaml @@ -0,0 +1,12 @@ +generatorName: dart-dio +outputDir: samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive +inputSpec: modules/openapi-generator/src/test/resources/3_0/oneOf_primitive.yaml +templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio +typeMappings: + Client: "ModelClient" + File: "ModelFile" + EnumClass: "ModelEnumClass" +additionalProperties: + hideGenerationTimestamp: "true" + enumUnknownDefaultCase: "true" + serializationLibrary: "freezed" diff --git a/bin/configs/dart-dio-petstore-client-lib-fake-freezed.yaml b/bin/configs/dart-dio-petstore-client-lib-fake-freezed.yaml new file mode 100644 index 000000000000..82723cd9c2d1 --- /dev/null +++ b/bin/configs/dart-dio-petstore-client-lib-fake-freezed.yaml @@ -0,0 +1,12 @@ +generatorName: dart-dio +outputDir: samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml +templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio +typeMappings: + Client: "ModelClient" + File: "ModelFile" + EnumClass: "ModelEnumClass" +additionalProperties: + hideGenerationTimestamp: "true" + enumUnknownDefaultCase: "true" + serializationLibrary: "freezed" diff --git a/docs/generators/dart-dio.md b/docs/generators/dart-dio.md index 7e62f92f0782..2521ce07e7fd 100644 --- a/docs/generators/dart-dio.md +++ b/docs/generators/dart-dio.md @@ -36,7 +36,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |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| +|serializationLibrary|Specify serialization library|
**built_value**
[DEFAULT] built_value
**json_serializable**
[BETA] json_serializable
**freezed**
[BETA] freezed
|built_value| |skipCopyWith|Skip CopyWith when using Json Serializable for serialization| |false| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java index d9d038746372..0bc43f7ef953 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java @@ -24,6 +24,7 @@ import lombok.Getter; import lombok.Setter; import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.*; import org.openapitools.codegen.CodegenDiscriminator.MappedModel; import org.openapitools.codegen.api.TemplatePathLocator; @@ -49,6 +50,8 @@ import java.util.*; import java.util.stream.Collectors; +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.underscore; public class DartDioClientCodegen extends AbstractDartCodegen { @@ -65,6 +68,8 @@ public class DartDioClientCodegen extends AbstractDartCodegen { public static final String EQUALITY_CHECK_METHOD_EQUATABLE = "equatable"; 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_FREEZED = "freezed"; public static final String SERIALIZATION_LIBRARY_DEFAULT = SERIALIZATION_LIBRARY_BUILT_VALUE; private static final String DIO_IMPORT = "package:dio/dio.dart"; @@ -74,6 +79,7 @@ public class DartDioClientCodegen extends AbstractDartCodegen { public static final String SKIP_COPY_WITH_DEFAULT_VALUE = "false"; private static final String CLIENT_NAME = "clientName"; + private static final String FREEZED_UNION_RESPONSE = "freezedUnionResponse"; @Getter @Setter private String dateLibrary; @@ -111,6 +117,7 @@ public DartDioClientCodegen() { supportedLibraries.put(SERIALIZATION_LIBRARY_BUILT_VALUE, "[DEFAULT] built_value"); supportedLibraries.put(SERIALIZATION_LIBRARY_JSON_SERIALIZABLE, "[BETA] json_serializable"); + supportedLibraries.put(SERIALIZATION_LIBRARY_FREEZED, "[BETA] freezed"); final CliOption serializationLibrary = CliOption.newString(CodegenConstants.SERIALIZATION_LIBRARY, "Specify serialization library"); serializationLibrary.setEnum(supportedLibraries); serializationLibrary.setDefault(SERIALIZATION_LIBRARY_DEFAULT); @@ -231,6 +238,10 @@ private void configureSerializationLibrary(String srcFolder) { additionalProperties.put("useJsonSerializable", "true"); configureSerializationLibraryJsonSerializable(srcFolder); break; + case SERIALIZATION_LIBRARY_FREEZED: + additionalProperties.put("useFreezed", "true"); + configureSerializationLibraryFreezed(srcFolder); + break; default: case SERIALIZATION_LIBRARY_BUILT_VALUE: additionalProperties.put("useBuiltValue", "true"); @@ -306,6 +317,94 @@ private void configureEqualityCheckMethod(String srcFolder) { } } + private void configureSerializationLibraryFreezed(String srcFolder) { + if (!additionalProperties.containsKey(FREEZED_UNION_RESPONSE)) { + additionalProperties.put(FREEZED_UNION_RESPONSE, false); + LOGGER.debug("freezedUnionResponse not set, using default {}", false); + } + supportingFiles.add(new SupportingFile("serialization/freezed/build.yaml.mustache", "" /* main project dir */, "build.yaml")); + supportingFiles.add(new SupportingFile("serialization/freezed/models.dart.mustache", srcFolder + File.separator + modelPackage, "models.dart")); + supportingFiles.add(new SupportingFile("serialization/freezed/primitive_union_types.mustache", srcFolder + File.separator + modelPackage, "primitive_union_types.dart")); + if(((boolean) additionalProperties.getOrDefault(FREEZED_UNION_RESPONSE, false))){ + supportingFiles.add(new SupportingFile("serialization/freezed/response_models.mustache", srcFolder + File.separator + modelPackage, "response_models.dart")); + } + // most of these are defined in AbstractDartCodegen, we are overriding + // just the binary / file handling + languageSpecificPrimitives.add("Object"); + imports.put("Uint8List", "dart:typed_data"); + imports.put("MultipartFile", DIO_IMPORT); + // A lambda which removes the model name prefix and suffix. Used mainly for default descrimator class name + // mapping in fromJson methods for unions in freezed. + additionalProperties.put("DelModelNamePrefixSuffix", (Mustache.Lambda) (fragment, writer) -> { + String content = fragment.execute(); + content = content.trim().replaceAll("\n", ""); + content = content.replaceAll(this.modelNamePrefix, ""); + content = content.replaceAll(this.modelNameSuffix, ""); + writer.write(content); + }); + // A lambda which transforms Types for naming factory constructors inFreezed unions. + additionalProperties.put("PrimitiveInUnion", (Mustache.Lambda) (fragment, writer) -> { + String content = fragment.execute(); + content = content.trim().replaceAll("\n", ""); + Set collectionTypes = Sets.newHashSet("List","Map","Set"); + Set nonCollectionTypes = defaultIncludes.stream().filter(e -> !collectionTypes.contains(e)).collect(Collectors.toSet()); + if(nonCollectionTypes.contains(content)){ + writer.write(content + "InUnion"); + return; + } + writer.write(content); + }); + // A lambda to generate correct form of FromJson methods. + additionalProperties.put("PrimitiveFromJson", (Mustache.Lambda) (fragment, writer) -> { + String content = fragment.execute(); + content = content.trim().replaceAll("\n", ""); + // Remove Generics Declarations as this is not required for factoryNames in freezed + String tmp_1 = StringUtils.substringBefore(content, "<"); + if(defaultIncludes.contains(tmp_1)) { + if (tmp_1.equals("Set") || tmp_1.equals("Map")) { + content = "<"+StringUtils.substringAfter(content, "<")+"{}"; + }else if(tmp_1.equals("List")){ + content = "<"+StringUtils.substringAfter(content, "<")+"[]"; + }else{ + content = tmp_1+"InUnion"; + } + } + writer.write(content); + }); + // A lambda to filter out collection types from anyOf and oneOf sets in codegenmodel. + additionalProperties.put("PrimitiveCollectionsExtension", (Mustache.Lambda) (fragment, writer) -> { + String content = fragment.execute(); + content = content.trim().replaceAll("\n", ""); + Set collectionTypes = Sets.newHashSet("List","Map","Set"); + // Remove Generics Declarations as this is not required for factoryNames in freezed + String tmp_1 = StringUtils.substringBefore(content, "<"); + if(collectionTypes.contains(tmp_1)){ + String variableName = camelize(fragment.execute().replace(" ", "_"), LOWERCASE_FIRST_LETTER); + variableName = this.sanitizeName(variableName); + if (this.reservedWords().contains(variableName)) { + // Escaping must be done *after* camelize, because generators may escape using characters removed by camelize function. + variableName = this.escapeReservedWord(variableName); + } + tmp_1 = String.join("\n", "extension on "+ content + "{", + "dynamic fromJson(Map json) {", + "return json[\""+variableName+"Value\"];", + "}", + + "Map toJson() {", + "return {", + "\""+variableName+"Value\": this,", + "};", + "}", + "}"); + writer.write(tmp_1); + }else{ + writer.write(""); + + } + }); + + } + private void configureDateLibrary(String srcFolder) { switch (dateLibrary) { case DATE_LIBRARY_TIME_MACHINE: @@ -602,7 +701,7 @@ protected CodegenDiscriminator createDiscriminator(String schemaName, Schema sch @Override public Map postProcessAllModels(Map objs) { objs = super.postProcessAllModels(objs); - if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(library)) { + if (SERIALIZATION_LIBRARY_BUILT_VALUE.equals(library) || SERIALIZATION_LIBRARY_FREEZED.equals(library)) { adaptToDartInheritance(objs); syncRootTypesWithInnerVars(objs); } diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/analysis_options.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/analysis_options.mustache index b625c648d600..c8420bea2674 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/analysis_options.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/analysis_options.mustache @@ -6,5 +6,9 @@ analyzer: exclude: - test/*.dart{{#useJsonSerializable}} - lib/{{sourceFolder}}/model/*.g.dart{{/useJsonSerializable}} + {{#useFreezed}} + - lib/src/model/*.g.dart + - lib/src/model/*.freezed.dart + {{/useFreezed}} errors: deprecated_member_use_from_same_package: ignore diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/api.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api.mustache index e86a2cfb005a..97ae46a17dec 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/api.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api.mustache @@ -5,8 +5,12 @@ import 'dart:async'; import 'package:dio/dio.dart'; {{#operations}} -{{#imports}}import '{{.}}'; -{{/imports}} +{{! No need to Import all the required model files as freezed uses the part of directive for it models}} +{{^useFreezed}} + {{#imports}} +import '{{.}}'; + {{/imports}} +{{/useFreezed}} class {{classname}} { @@ -38,7 +42,16 @@ class {{classname}} { {{#isDeprecated}} @Deprecated('This operation has been deprecated') {{/isDeprecated}} - Future> {{nickname}}({ {{#allParams}}{{#isPathParam}} + {{#useFreezed}} + {{#freezedUnionResponse}} + Future> {{nickname}}({ + {{/freezedUnionResponse}} + {{^freezedUnionResponse}} + Future> {{nickname}}({ + {{/freezedUnionResponse}} + {{/useFreezed}} + {{^useFreezed}} + Future> {{nickname}}({ {{/useFreezed}}{{#allParams}}{{#isPathParam}} {{#isDeprecated}}@Deprecated('{{paramName}} is deprecated') {{/isDeprecated}}required {{{dataType}}} {{paramName}},{{/isPathParam}}{{#isQueryParam}} {{#isDeprecated}}@Deprecated('{{paramName}} is deprecated') {{/isDeprecated}}{{#required}}{{^isNullable}}{{^defaultValue}}required {{/defaultValue}}{{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}}{{^isContainer}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isContainer}},{{/isQueryParam}}{{#isHeaderParam}} {{#isDeprecated}}@Deprecated('{{paramName}} is deprecated') {{/isDeprecated}}{{#required}}{{^isNullable}}{{^defaultValue}}required {{/defaultValue}}{{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}}{{^isContainer}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isContainer}},{{/isHeaderParam}}{{#isBodyParam}} @@ -116,7 +129,15 @@ class {{classname}} { ); {{#returnType}} - {{{.}}}? _responseData; + {{#useFreezed}} + {{#freezedUnionResponse}} + {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Data _responseData; + {{/freezedUnionResponse}} + {{^freezedUnionResponse}} + {{{returnType}}} _responseData; + {{/freezedUnionResponse}} + {{/useFreezed}} + {{^useFreezed}}{{{.}}}? _responseData;{{/useFreezed}} try { {{#includeLibraryTemplate}}api/deserialize{{/includeLibraryTemplate}} @@ -130,7 +151,17 @@ class {{classname}} { ); } + {{#useFreezed}} + {{#freezedUnionResponse}} + return Response<{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Data>( + {{/freezedUnionResponse}} + {{^freezedUnionResponse}} return Response<{{{returnType}}}>( + {{/freezedUnionResponse}} + {{/useFreezed}} + {{^useFreezed}} + return Response<{{{returnType}}}>( + {{/useFreezed}} data: _responseData, headers: _response.headers, isRedirect: _response.isRedirect, @@ -139,8 +170,41 @@ class {{classname}} { statusCode: _response.statusCode, statusMessage: _response.statusMessage, extra: _response.extra, - );{{/returnType}}{{^returnType}} - return _response;{{/returnType}} + );{{/returnType}} + {{^returnType}} + {{^useFreezed}} + return _response; + {{/useFreezed}} + {{#useFreezed}} + {{#freezedUnionResponse}} + {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Data _responseData; + try { + {{#includeLibraryTemplate}}api/deserialize{{/includeLibraryTemplate}} + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + return Response<{{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Data>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + {{/freezedUnionResponse}} + {{^freezedUnionResponse}} + return _response; + {{/freezedUnionResponse}} + {{/useFreezed}} + {{/returnType}} } {{/operation}} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/lib.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/lib.mustache index 63b1ce28e031..0205ed40b85e 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/lib.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/lib.mustache @@ -9,5 +9,6 @@ export 'package:{{pubName}}/{{sourceFolder}}/auth/oauth.dart'; {{#apiInfo}}{{#apis}}export 'package:{{pubName}}/{{sourceFolder}}/{{apiPackage}}/{{classFilename}}.dart'; {{/apis}}{{/apiInfo}} -{{#models}}{{#model}}export 'package:{{pubName}}/{{sourceFolder}}/{{modelPackage}}/{{classFilename}}.dart'; -{{/model}}{{/models}} +{{^useFreezed}}{{#models}}{{#model}}export 'package:{{pubName}}/{{sourceFolder}}/{{modelPackage}}/{{classFilename}}.dart'; +{{/model}}{{/models}}{{/useFreezed}} +{{#useFreezed}}export 'package:{{pubName}}/{{sourceFolder}}/{{modelPackage}}/models.dart';{{/useFreezed}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/model.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/model.mustache index 1917decaf6c6..6a9561375b01 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/model.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/model.mustache @@ -1,10 +1,12 @@ {{>header}} -// ignore_for_file: unused_element +// ignore_for_file: unused_element{{#useFreezed}}, invalid_annotation_target{{/useFreezed}} {{#models}} {{#model}} + {{^useFreezed}} {{#imports}} import '{{.}}'; {{/imports}} + {{/useFreezed}} {{#isEnum}}{{>enum}}{{/isEnum}}{{^isEnum}}{{>class}}{{/isEnum}} {{/model}} {{/models}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/pubspec.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/pubspec.mustache index b0ac707ecee7..0dad3bd86546 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/pubspec.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/pubspec.mustache @@ -11,7 +11,12 @@ publish_to: {{.}} environment: + {{^useFreezed}} sdk: '>={{^useJsonSerializable}}2.18.0{{/useJsonSerializable}}{{#useJsonSerializable}}3.5.0{{/useJsonSerializable}} <4.0.0' + {{/useFreezed}} + {{#useFreezed}} + sdk: '^3.0.0' + {{/useFreezed}} dependencies: dio: '^5.7.0' @@ -30,6 +35,10 @@ dependencies: {{/skipCopyWith}} json_annotation: '^4.9.0' {{/useJsonSerializable}} +{{#useFreezed}} + freezed_annotation: '^2.4.4' + json_annotation: '^4.9.0' +{{/useFreezed}} {{#useDateLibTimeMachine}} time_machine: ^0.9.17 {{/useDateLibTimeMachine}} @@ -46,4 +55,9 @@ dev_dependencies: {{/skipCopyWith}} json_serializable: '^6.9.3' {{/useJsonSerializable}} +{{#useFreezed}} + freezed: '^2.5.2' + json_serializable: '^6.8.0' + build_runner: any +{{/useFreezed}} test: '^1.16.0' diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/additional_templates/case_parse_json_using_discriminator_mapping_value.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/additional_templates/case_parse_json_using_discriminator_mapping_value.mustache new file mode 100644 index 000000000000..0c4e371b60ca --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/additional_templates/case_parse_json_using_discriminator_mapping_value.mustache @@ -0,0 +1,6 @@ +{{#mappedModels}} + case '{{mappingName}}': + return {{classname}}.as{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{modelName}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}( + {{#lambda.camelcase}}{{modelName}}{{/lambda.camelcase}}Value : {{modelName}}.fromJson(json), + ); +{{/mappedModels}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/additional_templates/case_parse_json_using_model_name.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/additional_templates/case_parse_json_using_model_name.mustache new file mode 100644 index 000000000000..96711921f042 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/additional_templates/case_parse_json_using_model_name.mustache @@ -0,0 +1,14 @@ +{{#anyOf}} + case '{{#DelModelNamePrefixSuffix}}{{{.}}}{{/DelModelNamePrefixSuffix}}': + deserializedModel = {{classname}}.as{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{{.}}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}( + {{#lambda.camelcase}}{{{.}}}{{/lambda.camelcase}}Value : {{#lambda.titlecase}}{{#PrimitiveInUnion}}{{{.}}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}.fromJson(json), + ); + break; +{{/anyOf}} +{{#oneOf}} + case '{{#DelModelNamePrefixSuffix}}{{{.}}}{{/DelModelNamePrefixSuffix}}': + deserializedModel = {{classname}}.as{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{{.}}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}( + {{#lambda.camelcase}}{{{.}}}{{/lambda.camelcase}}Value : {{#lambda.titlecase}}{{#PrimitiveInUnion}}{{{.}}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}.fromJson(json), + ); + break; +{{/oneOf}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/additional_templates/freezed_union_for_oneof_anyof.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/additional_templates/freezed_union_for_oneof_anyof.mustache new file mode 100644 index 000000000000..c7bb47d453a0 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/additional_templates/freezed_union_for_oneof_anyof.mustache @@ -0,0 +1,38 @@ +@freezed +sealed class {{classname}} with _${{classname}} { +const {{classname}}._(); + +{{#anyOf}} + const factory {{classname}}.as{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{{.}}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}({ + required {{#lambda.titlecase}}{{#PrimitiveInUnion}}{{{.}}}{{/PrimitiveInUnion}}{{/lambda.titlecase}} {{#lambda.camelcase}}{{{.}}}Value{{/lambda.camelcase}} + }) = {{classname}}As{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{{.}}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}; +{{/anyOf}} +{{#oneOf}} + const factory {{classname}}.as{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{{.}}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}({ + required {{#lambda.titlecase}}{{#PrimitiveInUnion}}{{{.}}}{{/PrimitiveInUnion}}{{/lambda.titlecase}} {{#lambda.camelcase}}{{{.}}}Value{{/lambda.camelcase}} + }) = {{classname}}As{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{{.}}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}; +{{/oneOf}} +{{! Sometimes discrintors are mentioned in parent classes}} +{{! TODO: Following block is doesn't handle duplicated mapping of models. Not sure how to handle that yet. For example red_apple and green_apple both mapping to Apple model.}} +{{^anyOf}} + {{^oneOf}} + {{#mappedModels}} + const factory {{classname}}.as{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{modelName}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}({ + required {{#lambda.titlecase}}{{#PrimitiveInUnion}}{{modelName}}{{/PrimitiveInUnion}}{{/lambda.titlecase}} {{#lambda.camelcase}}{{modelName}}Value{{/lambda.camelcase}} + }) = {{classname}}As{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{modelName}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}; + {{/mappedModels}} + {{/oneOf}} +{{/anyOf}} +const factory {{classname}}.unknown({ + @Default('Json does not satisfy any available types') String message, + required Map json, + + @Default(DeserializationErrorType.UnKnownType) + DeserializationErrorType errorType, + + @Default([{{#anyOf}}{{{.}}},{{/anyOf}}{{#oneOf}}{{{.}}},{{/oneOf}}]) + List possibleTypes, + + @Default(<{{classname}}>[]) + List<{{classname}}> deserializedModels, +}) = {{classname}}Unknown; \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/additional_templates/parse_json_iteratively.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/additional_templates/parse_json_iteratively.mustache new file mode 100644 index 000000000000..0cab7b060962 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/additional_templates/parse_json_iteratively.mustache @@ -0,0 +1,41 @@ +final fromJsonMethods = >[{{#anyOf}}{{#lambda.titlecase}}{{#PrimitiveFromJson}}{{{.}}}{{/PrimitiveFromJson}}{{/lambda.titlecase}}.fromJson,{{/anyOf}}{{#oneOf}}{{#lambda.titlecase}}{{#PrimitiveFromJson}}{{{.}}}{{/PrimitiveFromJson}}{{/lambda.titlecase}}.fromJson,{{/oneOf}}]; +final deserializedModels = <{{classname}}>[]; +for (final fromJsonMethod in fromJsonMethods) { + try { + final dynamic parsedModel= fromJsonMethod.call(json); + // Note following line won't be executed if already the above parsing fails. + {{#anyOf}} + if (parsedModel is {{#lambda.titlecase}}{{#PrimitiveInUnion}}{{{.}}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}) { + deserializedModel = {{classname}}.as{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{{.}}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}( + {{#lambda.camelcase}}{{{.}}}{{/lambda.camelcase}}Value : parsedModel, + ); + } else + {{/anyOf}} + {{#oneOf}} + if (parsedModel is {{#lambda.titlecase}}{{#PrimitiveInUnion}}{{{.}}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}) { + deserializedModel = {{classname}}.as{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{{.}}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}( + {{#lambda.camelcase}}{{{.}}}{{/lambda.camelcase}}Value : parsedModel, + ); + } else + {{/oneOf}} + { + deserializedModel = {{classname}}.unknown(json: json); + } + deserializedModels.add(deserializedModel); + } catch (e) { + // We are suppressing the deserialization error when the json could not + // be parsed into one of the model. Because we return [{{classname}}.unknown] + // if the deserialization fails. + } +} +// Return an unknown type when the incoming json parses into more than one models. +// Since we pass deserializedModels, clients can still use the deserialized model. +// EvenThough this is valid for AnyOf types, Dart doesn't have polymorphic types. +// So we still return this as an unknown type. +if(deserializedModels.length > 1){ + deserializedModel = {{classname}}.unknown( + json: json, + deserializedModels: deserializedModels, + errorType: DeserializationErrorType.MoreThanOneTypeSatisfied, + ); +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/additional_templates/to_json_oneof_anyof.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/additional_templates/to_json_oneof_anyof.mustache new file mode 100644 index 000000000000..d12c9e1b3365 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/additional_templates/to_json_oneof_anyof.mustache @@ -0,0 +1,21 @@ +Map toJson() { + return when( + {{#anyOf}} + as{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{{.}}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}: (as{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{{.}}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}) => as{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{{.}}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}.toJson(), + {{/anyOf}} + {{#oneOf}} + as{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{{.}}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}: (as{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{{.}}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}) => as{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{{.}}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}.toJson(), + {{/oneOf}} + {{! Sometimes discrintors are mentioned in parent classes}} + {{! TODO: Following block is doesn't handle duplicated mapping of models. Not sure how to handle that yet. For example red_apple and green_apple both mapping to Apple model.}} + {{^anyOf}} + {{^oneOf}} + {{#mappedModels}} + as{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{modelName}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}: (as{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{modelName}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}) => as{{#lambda.titlecase}}{{#PrimitiveInUnion}}{{#lambda.camelcase}}{{modelName}}{{/lambda.camelcase}}{{/PrimitiveInUnion}}{{/lambda.titlecase}}.toJson(), + {{/mappedModels}} + {{/oneOf}} + {{/anyOf}} + {{! adds an unknown case to handle one Of}} + unknown: (message, json, errorType, possibleTypes, deserializedModels) => {}, + ); +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/api/constructor.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/api/constructor.mustache new file mode 100644 index 000000000000..a772c3148eaa --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/api/constructor.mustache @@ -0,0 +1 @@ + const {{classname}}(this._dio); \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/api/deserialize.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/api/deserialize.mustache new file mode 100644 index 000000000000..4dae0a6476f4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/api/deserialize.mustache @@ -0,0 +1,38 @@ +{{#freezedUnionResponse}} + _responseData = {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Data.toUnionData(_response.statusCode, _response.data,); +{{/freezedUnionResponse}} +{{^freezedUnionResponse}} + {{#isResponseFile}} + _responseData = _response.data as {{{returnType}}}; + {{/isResponseFile}} + {{^isResponseFile}} + {{#returnSimpleType}} + {{#returnTypeIsPrimitive}} + _responseData = _response.data as {{{returnType}}}; + {{/returnTypeIsPrimitive}} + {{^returnTypeIsPrimitive}} + _responseData = {{{returnType}}}.fromJson(_response.data as Map); + {{/returnTypeIsPrimitive}} + {{/returnSimpleType}} + {{^returnSimpleType}} + {{#returnTypeIsPrimitive}} + _responseData = _response.data as {{{returnType}}}; + {{/returnTypeIsPrimitive}} + {{^returnTypeIsPrimitive}} + {{#isArray}} + {{#uniqueItems}} + final _responseDataAsSet = _response.data as List; + _responseData = _responseDataAsSet.map<{{{returnBaseType}}}>((dynamic e)=> {{{returnBaseType}}}.fromJson(e as Map)).toSet(); + {{/uniqueItems}} + {{^uniqueItems}} + final _responseDataAsList = _response.data as List; + _responseData = _responseDataAsList.map<{{{returnBaseType}}}>((dynamic e)=> {{{returnBaseType}}}.fromJson(e as Map)).toList(); + {{/uniqueItems}} + {{/isArray}} + {{#isMap}} + _responseData = _response.data as Map; + {{/isMap}} + {{/returnTypeIsPrimitive}} + {{/returnSimpleType}} + {{/isResponseFile}} +{{/freezedUnionResponse}} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/api/deserialize_union.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/api/deserialize_union.mustache new file mode 100644 index 000000000000..b04cd2195339 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/api/deserialize_union.mustache @@ -0,0 +1,53 @@ +{{#isFile}} + _responseData = responseData as {{{dataType}}}; +{{/isFile}} +{{^isFile}} + {{#simpleType}} + {{#primitiveType}} + {{#dataType}} + _responseData = responseData as {{{dataType}}}; + {{/dataType}} + {{^dataType}} + _responseData = responseData; + {{/dataType}} + {{/primitiveType}} + {{^primitiveType}} + {{#dataType}} + _responseData = {{{dataType}}}.fromJson(responseData as Map); + {{/dataType}} + {{^dataType}} + _responseData = responseData; + {{/dataType}} + {{/primitiveType}} + {{/simpleType}} + {{^simpleType}} + {{#primitiveType}} + _responseData = responseData as {{{dataType}}}; + {{/primitiveType}} + {{^primitiveType}} + {{#isModel}} + {{#isMap}} + _responseData = responseData as {{{dataType}}}; + {{/isMap}} + {{^isMap}} + _responseData = {{{dataType}}}.fromJson(responseData as Map); + {{/isMap}} + {{/isModel}} + {{^isModel}} + {{#isArray}} + {{#uniqueItems}} + final _responseDataAsSet = responseData as List; + _responseData = _responseDataAsSet.map<{{{baseType}}}>((dynamic e)=> {{{baseType}}}.fromJson(e as Map)).toSet(); + {{/uniqueItems}} + {{^uniqueItems}} + final _responseDataAsList = responseData as List; + _responseData = _responseDataAsList.map<{{{baseType}}}>((dynamic e)=> {{{baseType}}}.fromJson(e as Map)).toList(); + {{/uniqueItems}} + {{/isArray}} + {{#isMap}} + _responseData = responseData as Map; + {{/isMap}} + {{/isModel}} + {{/primitiveType}} + {{/simpleType}} +{{/isFile}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/api/imports.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/api/imports.mustache new file mode 100644 index 000000000000..ac933ec55504 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/api/imports.mustache @@ -0,0 +1,2 @@ +import 'dart:convert'; +import '../model/models.dart'; \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/api/query_param.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/api/query_param.mustache new file mode 100644 index 000000000000..7e5f88400403 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/api/query_param.mustache @@ -0,0 +1 @@ +{{{paramName}}}{{#isEnumRef}}.value{{/isEnumRef}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/api/serialize.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/api/serialize.mustache new file mode 100644 index 000000000000..359a9a5697fc --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/api/serialize.mustache @@ -0,0 +1,28 @@ +{{#hasFormParams}} + {{#isMultipart}} + _bodyData = FormData.fromMap({ + {{#formParams}} + {{^required}} + {{^isNullable}}if ({{{paramName}}} != null) {{/isNullable}} + {{/required}}r'{{{baseName}}}': + {{#isFile}}{{{paramName}}}{{#isArray}}.toList(){{/isArray}}{{/isFile}} + {{^isFile}}jsonEncode({{{paramName}}}){{/isFile}}, + {{/formParams}} + }); + {{/isMultipart}} + {{^isMultipart}} + _bodyData = { + {{#formParams}} + {{^required}}{{^isNullable}}if ({{{paramName}}} != null) {{/isNullable}}{{/required}}r'{{{baseName}}}': {{>serialization/freezed/api/query_param}}, + {{/formParams}} + }; + {{/isMultipart}} +{{/hasFormParams}} +{{#bodyParam}} + {{#isPrimitiveType}} + _bodyData = {{paramName}}{{#isFile}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}}.finalize(){{/isFile}}; + {{/isPrimitiveType}} + {{^isPrimitiveType}} + _bodyData=jsonEncode({{{paramName}}}); + {{/isPrimitiveType}} +{{/bodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/build.yaml.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/build.yaml.mustache new file mode 100644 index 000000000000..dee5edd67f90 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/build.yaml.mustache @@ -0,0 +1,11 @@ +targets: + $default: + builders: + freezed|freezed: + # This restricts freezed build runner to look + # files only inside models folder. + # If you prefer the build runner to scan the whole + # project for files then simply remove this build.yaml file + generate_for: + include: + - "lib/src/model/**.dart" \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/class.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/class.mustache new file mode 100644 index 000000000000..b3b1ebfa08d6 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/class.mustache @@ -0,0 +1,46 @@ +part of 'models.dart'; + +/// {{{description}}}{{^description}}{{classname}}{{/description}} +{{#hasVars}} + /// + /// Properties: + {{#allVars}} + /// * [{{{name}}}] {{#description}}- {{{.}}}{{/description}} + {{/allVars}} +{{/hasVars}} + +{{>serialization/freezed/class_factory}} + +{{>serialization/freezed/class_from_json}} + +{{>serialization/freezed/class_to_json}} + + +} + +{{! +extension for collection primitives in union +}} +{{>serialization/freezed/class_primitive_union_extensions}} + +{{! + Generate an enum for any variables that are declared as inline enums + isEnum is only true for inline variables that are enums. + If an enum is declared as a definition, isEnum is false and the enum is generated from the + enum.mustache template. +}} +{{#vars}} + {{^isModel}} + {{#enumName}} + {{^isContainer}} + {{>serialization/freezed/enum_inline}} + {{/isContainer}} + {{#isContainer}} + {{#mostInnerItems}} + + {{>serialization/freezed/enum_inline}} + {{/mostInnerItems}} + {{/isContainer}} + {{/enumName}} + {{/isModel}} +{{/vars}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/class_factory.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/class_factory.mustache new file mode 100644 index 000000000000..9a2647243094 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/class_factory.mustache @@ -0,0 +1,43 @@ +{{#vendorExtensions.x-is-pure}} + {{^hasDiscriminatorWithNonEmptyMapping}} + {{>serialization/freezed/class_factory_general}} + {{/hasDiscriminatorWithNonEmptyMapping}} + {{#hasDiscriminatorWithNonEmptyMapping}} + {{#discriminator}} + {{>serialization/freezed/additional_templates/freezed_union_for_oneof_anyof}} + {{/discriminator}} + {{^discriminator}} + {{#vendorExtensions.x-parent-discriminator}} + {{>serialization/freezed/additional_templates/freezed_union_for_oneof_anyof}} + {{/vendorExtensions.x-parent-discriminator}} + {{/discriminator}} + {{/hasDiscriminatorWithNonEmptyMapping}} +{{/vendorExtensions.x-is-pure}} + +{{^vendorExtensions.x-is-pure}} + {{#vendorExtensions.x-is-child}} + {{^hasDiscriminatorWithNonEmptyMapping}} + {{>serialization/freezed/class_factory_general}} + {{/hasDiscriminatorWithNonEmptyMapping}} + {{/vendorExtensions.x-is-child}} +{{/vendorExtensions.x-is-pure}} + +{{^vendorExtensions.x-is-pure}} + {{#hasDiscriminatorWithNonEmptyMapping}} + {{#discriminator}} + {{>serialization/freezed/additional_templates/freezed_union_for_oneof_anyof}} + {{/discriminator}} + {{^discriminator}} + {{#vendorExtensions.x-parent-discriminator}} + {{>serialization/freezed/additional_templates/freezed_union_for_oneof_anyof}} + {{/vendorExtensions.x-parent-discriminator}} + {{/discriminator}} + {{/hasDiscriminatorWithNonEmptyMapping}} +{{/vendorExtensions.x-is-pure}} +{{^vendorExtensions.x-is-pure}} + {{^vendorExtensions.x-is-child}} + {{^hasDiscriminatorWithNonEmptyMapping}} + {{>serialization/freezed/additional_templates/freezed_union_for_oneof_anyof}} + {{/hasDiscriminatorWithNonEmptyMapping}} + {{/vendorExtensions.x-is-child}} +{{/vendorExtensions.x-is-pure}} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/class_factory_general.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/class_factory_general.mustache new file mode 100644 index 000000000000..a625abfc8202 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/class_factory_general.mustache @@ -0,0 +1,12 @@ +@freezed +class {{classname}} with _${{classname}} { +const {{classname}}._(); + +const factory {{classname}}({ +{{#vars}} + {{#description}} + /// {{{.}}} + {{/description}} + @JsonKey(name: r'{{baseName}}') {{>serialization/freezed/variable_type}} {{name}}, +{{/vars}} +}) = _{{classname}}; \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/class_from_json.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/class_from_json.mustache new file mode 100644 index 000000000000..f9c12c8f8997 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/class_from_json.mustache @@ -0,0 +1,116 @@ +{{#vendorExtensions.x-is-pure}} + {{^hasDiscriminatorWithNonEmptyMapping}} + factory {{classname}}.fromJson(Map json) => _${{classname}}FromJson(json); + {{/hasDiscriminatorWithNonEmptyMapping}} + {{#hasDiscriminatorWithNonEmptyMapping}} + factory {{classname}}.fromJson(Map json) { + {{#discriminator}} + switch(json['{{propertyBaseName}}']){ + {{>serialization/freezed/additional_templates/case_parse_json_using_discriminator_mapping_value}} + } + return {{classname}}.unknown(json: json); + {{/discriminator}} + {{^discriminator}} + {{#vendorExtensions.x-parent-discriminator}} + // So we try to parse the json based on the discriminator value and try to + // return one of the valid model. Note: this approach tries + // to return one valid model and if more than one model + // is valid it then returns unknown type along with the json so the + // consumer can decide which model it is. + switch(json['{{propertyBaseName}}']){ + {{>serialization/freezed/additional_templates/case_parse_json_using_discriminator_mapping_value}} + default: + /// If deserializedModel is still null, then we try to parse + /// the json against all the models and try to return one of the valid model. + /// Note: this approach tries to return one valid model and if more than one model + /// is valid it then returns unknown type along with the json so + /// the consumer can decide which model it is. + {{classname}}? deserializedModel; + {{>serialization/freezed/additional_templates/parse_json_iteratively}} + return deserializedModel ?? {{classname}}.unknown(json: json); + } + {{/vendorExtensions.x-parent-discriminator}} + {{/discriminator}} + } + {{/hasDiscriminatorWithNonEmptyMapping}} +{{/vendorExtensions.x-is-pure}} +{{^vendorExtensions.x-is-pure}} + {{#vendorExtensions.x-is-child}} + {{^hasDiscriminatorWithNonEmptyMapping}} + factory {{classname}}.fromJson(Map json) => _${{classname}}FromJson(json); + {{/hasDiscriminatorWithNonEmptyMapping}} + {{/vendorExtensions.x-is-child}} +{{/vendorExtensions.x-is-pure}} + +{{^vendorExtensions.x-is-pure}} + {{#hasDiscriminatorWithNonEmptyMapping}} + factory {{classname}}.fromJson(Map json) { + {{#discriminator}} + switch(json['{{propertyBaseName}}']){ + {{>serialization/freezed/additional_templates/case_parse_json_using_discriminator_mapping_value}} + } + return {{classname}}.unknown(json: json); + {{/discriminator}} + {{^discriminator}} + {{#vendorExtensions.x-parent-discriminator}} + // So we try to parse the json based on the discriminator value and try to + // return one of the valid model. Note: this approach tries + // to return one valid model and if more than one model + // is valid it then returns unknown type along with the json so the + // consumer can decide which model it is. + switch(json['{{propertyBaseName}}']){ + {{>serialization/freezed/additional_templates/case_parse_json_using_discriminator_mapping_value}} + default: + /// If deserializedModel is still null, then we try to parse + /// the json against all the models and try to return one of the valid model. + /// Note: this approach tries to return one valid model and if more than one model + /// is valid it then returns unknown type along with the json so + /// the consumer can decide which model it is. + {{classname}}? deserializedModel; + {{>serialization/freezed/additional_templates/parse_json_iteratively}} + return deserializedModel ?? {{classname}}.unknown(json: json); + } + {{/vendorExtensions.x-parent-discriminator}} + {{/discriminator}} + } + {{/hasDiscriminatorWithNonEmptyMapping}} +{{/vendorExtensions.x-is-pure}} + +{{^vendorExtensions.x-is-pure}} + {{^vendorExtensions.x-is-child}} + {{^hasDiscriminatorWithNonEmptyMapping}} + factory {{classname}}.fromJson(Map json) { + {{#discriminator}} + {{classname}}? deserializedModel; + // A discriminator property is specified but no mapping + // is provided in the spec, so we expect the property to + // have the value of the name of the model. Model prefix & + // suffix are ignored, as this is not known by the api provider + switch(json['{{propertyBaseName}}']){ + {{>serialization/freezed/additional_templates/case_parse_json_using_model_name}} + default: + /// If deserializedModel is still null, then we try to parse + /// the json against all the models and try to return one of the valid model. + /// Note: this approach tries to return one valid model and if more than one model + /// is valid it then returns unknown type along with the json so + /// the consumer can decide which model it is. + {{>serialization/freezed/additional_templates/parse_json_iteratively}} + break; + } + return deserializedModel ?? {{classname}}.unknown(json: json); + {{/discriminator}} + {{^discriminator}} + // A discriminator property is not defined in the spec so + // we try to parse the json against all the models and try to + // return one of the valid model. Note: this approach tries + // to return one valid model and if more than one model + // is valid it then returns unknown type along with the json so + // the consumer can decide which model it is. + {{classname}}? deserializedModel; + {{>serialization/freezed/additional_templates/parse_json_iteratively}} + return deserializedModel ?? {{classname}}.unknown(json: json); + {{/discriminator}} + } + {{/hasDiscriminatorWithNonEmptyMapping}} + {{/vendorExtensions.x-is-child}} +{{/vendorExtensions.x-is-pure}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/class_primitive_union_extensions.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/class_primitive_union_extensions.mustache new file mode 100644 index 000000000000..a05e6c0727c6 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/class_primitive_union_extensions.mustache @@ -0,0 +1,16 @@ +{{^vendorExtensions.x-is-pure}} + {{^vendorExtensions.x-is-child}} + {{^hasDiscriminatorWithNonEmptyMapping}} + {{#anyOf}} + {{#PrimitiveCollectionsExtension}} + {{{.}}} + {{/PrimitiveCollectionsExtension}} + {{/anyOf}} + {{#oneOf}} + {{#PrimitiveCollectionsExtension}} + {{{.}}} + {{/PrimitiveCollectionsExtension}} + {{/oneOf}} + {{/hasDiscriminatorWithNonEmptyMapping}} + {{/vendorExtensions.x-is-child}} +{{/vendorExtensions.x-is-pure}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/class_to_json.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/class_to_json.mustache new file mode 100644 index 000000000000..31cdf88a01a5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/class_to_json.mustache @@ -0,0 +1,18 @@ +{{#hasDiscriminatorWithNonEmptyMapping}} + {{#discriminator}} + {{>serialization/freezed/additional_templates/to_json_oneof_anyof}} + {{/discriminator}} + {{^discriminator}} + {{#vendorExtensions.x-parent-discriminator}} + {{>serialization/freezed/additional_templates/to_json_oneof_anyof}} + {{/vendorExtensions.x-parent-discriminator}} + {{/discriminator}} +{{/hasDiscriminatorWithNonEmptyMapping}} + +{{^vendorExtensions.x-is-pure}} + {{^vendorExtensions.x-is-child}} + {{^hasDiscriminatorWithNonEmptyMapping}} + {{>serialization/freezed/additional_templates/to_json_oneof_anyof}} + {{/hasDiscriminatorWithNonEmptyMapping}} + {{/vendorExtensions.x-is-child}} +{{/vendorExtensions.x-is-pure}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/enum.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/enum.mustache new file mode 100644 index 000000000000..e5711b6f25cf --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/enum.mustache @@ -0,0 +1,13 @@ +part of 'models.dart'; + +{{#description}}/// {{{description}}}{{/description}} +@JsonEnum(valueField: 'value') +enum {{classname}} { + {{#allowableValues}} + {{#enumVars}} + {{{name}}}(value: {{#isString}}r{{/isString}}{{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/enumVars}} + const {{classname}}({required this.value}); + final {{dataType}} value; + {{/allowableValues}} +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/enum_inline.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/enum_inline.mustache new file mode 100644 index 000000000000..3c94941bfd9c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/enum_inline.mustache @@ -0,0 +1,14 @@ +{{#description}}/// {{{description}}}{{/description}} +{{#isDeprecated}} + @Deprecated('{{{enumName}}} has been deprecated') +{{/isDeprecated}} +@JsonEnum(valueField: 'value') +enum {{enumName}} { + {{#allowableValues}} + {{#enumVars}} + {{{name}}}(value: {{#isString}}r{{/isString}}{{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/enumVars}} + const {{enumName}}({required this.value}); + final {{baseType}} value; + {{/allowableValues}} +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/models.dart.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/models.dart.mustache new file mode 100644 index 000000000000..ff65bbd9cec3 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/models.dart.mustache @@ -0,0 +1,24 @@ +//ignore_for_file: invalid_annotation_target +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:dio/dio.dart'; +import 'dart:convert'; + +part 'models.freezed.dart'; +part 'models.g.dart'; + +part 'primitive_union_types.dart'; +{{#freezedUnionResponse}} +part 'response_models.dart'; +{{/freezedUnionResponse}} +{{! Add part deifinition for all models}} +{{#models}}{{#model}}part '{{classFilename}}.dart';{{/model}}{{/models}} + +/// A typedef used in the deserialization of OneOf and AnyOf +/// models when no discriminator mapping is provided. +typedef FromJsonMethodType = T Function(Map); + +/// Deserialization error types for OneOf and AnyOf types. +enum DeserializationErrorType { + MoreThanOneTypeSatisfied, + UnKnownType, +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/primitive_union_types.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/primitive_union_types.mustache new file mode 100644 index 000000000000..fafa083471b8 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/primitive_union_types.mustache @@ -0,0 +1,60 @@ +part of 'models.dart'; + +@freezed +class IntInUnion with _$IntInUnion{ + const factory IntInUnion({ + required int intValue + }) = _IntInUnion; + + factory IntInUnion.fromJson(Map json) => _$IntInUnionFromJson(json); +} + +@freezed +class StringInUnion with _$StringInUnion{ + const factory StringInUnion({ + required String stringValue + }) = _StringInUnion; + + factory StringInUnion.fromJson(Map json) => _$StringInUnionFromJson(json); +} +@freezed +class BoolInUnion with _$BoolInUnion{ + const factory BoolInUnion({ + required bool boolValue + }) = _BoolInUnion; + + factory BoolInUnion.fromJson(Map json) => _$BoolInUnionFromJson(json); +} + +@freezed +class DoubleInUnion with _$DoubleInUnion{ + const factory DoubleInUnion({ + required double doubleValue + }) = _DoubleInUnion; + + factory DoubleInUnion.fromJson(Map json) => _$DoubleInUnionFromJson(json); +} + +@freezed +class ObjectInUnion with _$ObjectInUnion { + const factory ObjectInUnion({required Object objectValue}) = _ObjectInUnion; + + factory ObjectInUnion.fromJson(Map json) => + _$ObjectInUnionFromJson(json); +} + +@freezed +class NumInUnion with _$NumInUnion{ + const factory NumInUnion({required num numValue}) = _NumInUnion; + + factory NumInUnion.fromJson(Map json) => _$NumInUnionFromJson(json); +} + +@freezed +class DateTimeInUnion with _$DateTimeInUnion { +const factory DateTimeInUnion({required DateTime dateTimeValue}) = +_DateTimeInUnion; + +factory DateTimeInUnion.fromJson(Map json) => +_$DateTimeInUnionFromJson(json); +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/response_models.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/response_models.mustache new file mode 100644 index 000000000000..82852bdf7249 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/response_models.mustache @@ -0,0 +1,40 @@ +part of 'models.dart'; + +{{#apiInfo}}{{#apis}} +{{#operations}} + {{#operation}} + @freezed + sealed class {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Data with _${{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Data { + const {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Data._(); + {{#responses}} + const factory {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Data.as{{code}}{{^returnType}}Void{{/returnType}}({ + required {{{dataType}}}{{^dataType}}Object?{{/dataType}} responseData, + }) = {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}DataAs{{code}}{{^returnType}}Void{{/returnType}}; + {{/responses}} + const factory {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Data.unknown({ + int? statusCode, + required Object? responseData, + }) = {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}ResponseUnknown; + + /// Converts the incoming response into the correct response code based freezed union case. + static {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Data toUnionData(int? statusCode, Object? responseData) { + + switch (statusCode) { + {{#responses}} + case {{code}}: + {{{dataType}}}{{^dataType}}Object?{{/dataType}} _responseData; + {{>serialization/freezed/api/deserialize_union}} + return {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Data.as{{code}}{{^returnType}}Void{{/returnType}}( + responseData: _responseData + ); + {{/responses}} + default: + return {{#lambda.titlecase}}{{nickname}}{{/lambda.titlecase}}Data.unknown( + responseData: responseData, + ); + } + } + } + {{/operation}} +{{/operations}} +{{/apis}}{{/apiInfo}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/test_instance.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/test_instance.mustache new file mode 100644 index 000000000000..1b32f6768164 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/test_instance.mustache @@ -0,0 +1,2 @@ + final {{{classname}}}? instance = /* {{{classname}}}(...) */ null; + // TODO add properties to the entity \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/variable_type.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/variable_type.mustache new file mode 100644 index 000000000000..e70ac3cdb41a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/freezed/variable_type.mustache @@ -0,0 +1,14 @@ +{{! +Required Nullable Result +true true required Type? +true false required Type +false true Type? +false false Type? +}} + +{{#required}} + {{#required}}required {{/required}}{{#isContainer}}{{baseType}}<{{#isMap}}String, {{/isMap}}{{#items}}{{>serialization/freezed/variable_type}}{{/items}}>{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}{{/isContainer}}{{#isNullable}}?{{/isNullable}} +{{/required}} +{{^required}} + {{#isContainer}}{{baseType}}<{{#isMap}}String, {{/isMap}}{{#items}}{{>serialization/freezed/variable_type}}{{/items}}>{{/isContainer}}{{^isContainer}}{{{datatypeWithEnum}}}{{/isContainer}}? +{{/required}} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/.gitignore b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/.gitignore new file mode 100644 index 000000000000..4298cdcbd1a2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/.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/openapi3/client/petstore/dart-dio/freezed/oneof/.openapi-generator-ignore b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/.openapi-generator/FILES new file mode 100644 index 000000000000..2fc04eeca8a5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/.openapi-generator/FILES @@ -0,0 +1,25 @@ +.gitignore +README.md +analysis_options.yaml +build.yaml +doc/Apple.md +doc/Banana.md +doc/DefaultApi.md +doc/Fruit.md +doc/Orange.md +lib/openapi.dart +lib/src/api.dart +lib/src/api/default_api.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/apple.dart +lib/src/model/banana.dart +lib/src/model/fruit.dart +lib/src/model/models.dart +lib/src/model/orange.dart +lib/src/model/primitive_union_types.dart +pubspec.yaml +test/orange_test.dart diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/.openapi-generator/VERSION new file mode 100644 index 000000000000..9e0e9bce84b2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.17.0-SNAPSHOT diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/README.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/README.md new file mode 100644 index 000000000000..433ce79b90c3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/README.md @@ -0,0 +1,86 @@ +# openapi (EXPERIMENTAL) +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 0.0.1 +- Generator version: 7.17.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.DartDioClientCodegen + +## 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().getDefaultApi(); + +try { + final response = await api.rootGet(); + print(response); +} catch on DioException (e) { + print("Exception when calling DefaultApi->rootGet: $e\n"); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +[*DefaultApi*](doc/DefaultApi.md) | [**rootGet**](doc/DefaultApi.md#rootget) | **GET** / | + + +## Documentation For Models + + - [Apple](doc/Apple.md) + - [Banana](doc/Banana.md) + - [Fruit](doc/Fruit.md) + - [Orange](doc/Orange.md) + + +## Documentation For Authorization + +Endpoints do not require authorization. + + +## Author + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/analysis_options.yaml b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/analysis_options.yaml new file mode 100644 index 000000000000..8ff047ce7675 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/analysis_options.yaml @@ -0,0 +1,11 @@ +analyzer: + language: + strict-inference: true + strict-raw-types: true + strict-casts: false + exclude: + - test/*.dart + - lib/src/model/*.g.dart + - lib/src/model/*.freezed.dart + errors: + deprecated_member_use_from_same_package: ignore diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/build.yaml b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/build.yaml new file mode 100644 index 000000000000..dee5edd67f90 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/build.yaml @@ -0,0 +1,11 @@ +targets: + $default: + builders: + freezed|freezed: + # This restricts freezed build runner to look + # files only inside models folder. + # If you prefer the build runner to scan the whole + # project for files then simply remove this build.yaml file + generate_for: + include: + - "lib/src/model/**.dart" \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/doc/Apple.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/doc/Apple.md new file mode 100644 index 000000000000..c7f711b87cef --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/doc/Apple.md @@ -0,0 +1,15 @@ +# openapi.model.Apple + +## Load the model package +```dart +import 'package:openapi/api.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/openapi3/client/petstore/dart-dio/freezed/oneof/doc/Banana.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/doc/Banana.md new file mode 100644 index 000000000000..bef8a58a4276 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/doc/Banana.md @@ -0,0 +1,15 @@ +# openapi.model.Banana + +## Load the model package +```dart +import 'package:openapi/api.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/openapi3/client/petstore/dart-dio/freezed/oneof/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/doc/DefaultApi.md new file mode 100644 index 000000000000..b010661371f9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/doc/DefaultApi.md @@ -0,0 +1,51 @@ +# openapi.api.DefaultApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**rootGet**](DefaultApi.md#rootget) | **GET** / | + + +# **rootGet** +> Fruit rootGet() + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getDefaultApi(); + +try { + final response = api.rootGet(); + print(response); +} catch on DioException (e) { + print('Exception when calling DefaultApi->rootGet: $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) + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/doc/Fruit.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/doc/Fruit.md new file mode 100644 index 000000000000..5239c1160576 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/doc/Fruit.md @@ -0,0 +1,18 @@ +# openapi.model.Fruit + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**color** | **String** | | [optional] +**kind** | **String** | | [optional] +**count** | **num** | | [optional] +**sweet** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/doc/Orange.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/doc/Orange.md new file mode 100644 index 000000000000..a07836f00534 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/doc/Orange.md @@ -0,0 +1,15 @@ +# openapi.model.Orange + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sweet** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/openapi.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/openapi.dart new file mode 100644 index 000000000000..581830866afb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/openapi.dart @@ -0,0 +1,15 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +export 'package:openapi/src/api.dart'; +export 'package:openapi/src/auth/api_key_auth.dart'; +export 'package:openapi/src/auth/basic_auth.dart'; +export 'package:openapi/src/auth/bearer_auth.dart'; +export 'package:openapi/src/auth/oauth.dart'; + + +export 'package:openapi/src/api/default_api.dart'; + + +export 'package:openapi/src/model/models.dart'; \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/api.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/api.dart new file mode 100644 index 000000000000..8943da413f65 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/api.dart @@ -0,0 +1,68 @@ +// +// 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/default_api.dart'; + +class Openapi { + static const String basePath = r'http://localhost'; + + 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 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); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/api/default_api.dart new file mode 100644 index 000000000000..f2a138a7077e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/api/default_api.dart @@ -0,0 +1,89 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'dart:convert'; +import '../model/models.dart'; +import 'package:dio/dio.dart'; + + +class DefaultApi { + + final Dio _dio; + + const DefaultApi(this._dio); + + /// rootGet + /// + /// + /// 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> rootGet({ + + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Fruit _responseData; + + + try { + _responseData = Fruit.fromJson(_response.data as Map); + + } 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, + ); + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/auth/api_key_auth.dart new file mode 100644 index 000000000000..ee16e3f0f92f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/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/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/auth/auth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/auth/auth.dart new file mode 100644 index 000000000000..f7ae9bf3f11e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/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/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/auth/basic_auth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/auth/basic_auth.dart new file mode 100644 index 000000000000..b65ccb5b71f7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/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']?.toLowerCase() == '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/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/auth/bearer_auth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/auth/bearer_auth.dart new file mode 100644 index 000000000000..8f46678761b2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/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']?.toLowerCase() == '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/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/auth/oauth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/auth/oauth.dart new file mode 100644 index 000000000000..337cf762b0ce --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/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/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/model/apple.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/model/apple.dart new file mode 100644 index 000000000000..28f19b8a5ddb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/model/apple.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Apple + /// + /// Properties: + /// * [kind] + + @freezed + class Apple with _$Apple { + const Apple._(); + + const factory Apple({ + @JsonKey(name: r'kind') + String? + kind, + }) = _Apple; + + + factory Apple.fromJson(Map json) => _$AppleFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/model/banana.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/model/banana.dart new file mode 100644 index 000000000000..e0b1850f002b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/model/banana.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Banana + /// + /// Properties: + /// * [count] + + @freezed + class Banana with _$Banana { + const Banana._(); + + const factory Banana({ + @JsonKey(name: r'count') + num? + count, + }) = _Banana; + + + factory Banana.fromJson(Map json) => _$BananaFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/model/fruit.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/model/fruit.dart new file mode 100644 index 000000000000..884ebb562460 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/model/fruit.dart @@ -0,0 +1,111 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Fruit + /// + /// Properties: + /// * [color] + /// * [kind] + /// * [count] + /// * [sweet] + + + + @freezed + sealed class Fruit with _$Fruit { + const Fruit._(); + + const factory Fruit.asApple({ + required Apple appleValue + }) = FruitAsApple; + const factory Fruit.asBanana({ + required Banana bananaValue + }) = FruitAsBanana; + const factory Fruit.asOrange({ + required Orange orangeValue + }) = FruitAsOrange; + const factory Fruit.unknown({ + @Default('Json does not satisfy any available types') String message, + required Map json, + + @Default(DeserializationErrorType.UnKnownType) + DeserializationErrorType errorType, + + @Default([Apple,Banana,Orange,]) + List possibleTypes, + + @Default([]) + List deserializedModels, + }) = FruitUnknown; + + + factory Fruit.fromJson(Map json) { + // A discriminator property is not defined in the spec so + // we try to parse the json against all the models and try to + // return one of the valid model. Note: this approach tries + // to return one valid model and if more than one model + // is valid it then returns unknown type along with the json so + // the consumer can decide which model it is. + Fruit? deserializedModel; + final fromJsonMethods = >[Apple.fromJson,Banana.fromJson,Orange.fromJson,]; + final deserializedModels = []; + for (final fromJsonMethod in fromJsonMethods) { + try { + final dynamic parsedModel= fromJsonMethod.call(json); + // Note following line won't be executed if already the above parsing fails. + if (parsedModel is Apple) { + deserializedModel = Fruit.asApple( + appleValue : parsedModel, + ); + } else + if (parsedModel is Banana) { + deserializedModel = Fruit.asBanana( + bananaValue : parsedModel, + ); + } else + if (parsedModel is Orange) { + deserializedModel = Fruit.asOrange( + orangeValue : parsedModel, + ); + } else + { + deserializedModel = Fruit.unknown(json: json); + } + deserializedModels.add(deserializedModel); + } catch (e) { + // We are suppressing the deserialization error when the json could not + // be parsed into one of the model. Because we return [Fruit.unknown] + // if the deserialization fails. + } + } + // Return an unknown type when the incoming json parses into more than one models. + // Since we pass deserializedModels, clients can still use the deserialized model. + // EvenThough this is valid for AnyOf types, Dart doesn't have polymorphic types. + // So we still return this as an unknown type. + if(deserializedModels.length > 1){ + deserializedModel = Fruit.unknown( + json: json, + deserializedModels: deserializedModels, + errorType: DeserializationErrorType.MoreThanOneTypeSatisfied, + ); + } return deserializedModel ?? Fruit.unknown(json: json); + } + + + Map toJson() { + return when( + asApple: (asApple) => asApple.toJson(), + asBanana: (asBanana) => asBanana.toJson(), + asOrange: (asOrange) => asOrange.toJson(), + unknown: (message, json, errorType, possibleTypes, deserializedModels) => {}, + ); + } + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/model/models.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/model/models.dart new file mode 100644 index 000000000000..2ca05d7e966a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/model/models.dart @@ -0,0 +1,20 @@ +//ignore_for_file: invalid_annotation_target +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:dio/dio.dart'; +import 'dart:convert'; + +part 'models.freezed.dart'; +part 'models.g.dart'; + +part 'primitive_union_types.dart'; +part 'apple.dart';part 'banana.dart';part 'fruit.dart';part 'orange.dart'; + +/// A typedef used in the deserialization of OneOf and AnyOf +/// models when no discriminator mapping is provided. +typedef FromJsonMethodType = T Function(Map); + +/// Deserialization error types for OneOf and AnyOf types. +enum DeserializationErrorType { + MoreThanOneTypeSatisfied, + UnKnownType, +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/model/orange.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/model/orange.dart new file mode 100644 index 000000000000..74af33183487 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/model/orange.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Orange + /// + /// Properties: + /// * [sweet] + + @freezed + class Orange with _$Orange { + const Orange._(); + + const factory Orange({ + @JsonKey(name: r'sweet') + bool? + sweet, + }) = _Orange; + + + factory Orange.fromJson(Map json) => _$OrangeFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/model/primitive_union_types.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/model/primitive_union_types.dart new file mode 100644 index 000000000000..fafa083471b8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/lib/src/model/primitive_union_types.dart @@ -0,0 +1,60 @@ +part of 'models.dart'; + +@freezed +class IntInUnion with _$IntInUnion{ + const factory IntInUnion({ + required int intValue + }) = _IntInUnion; + + factory IntInUnion.fromJson(Map json) => _$IntInUnionFromJson(json); +} + +@freezed +class StringInUnion with _$StringInUnion{ + const factory StringInUnion({ + required String stringValue + }) = _StringInUnion; + + factory StringInUnion.fromJson(Map json) => _$StringInUnionFromJson(json); +} +@freezed +class BoolInUnion with _$BoolInUnion{ + const factory BoolInUnion({ + required bool boolValue + }) = _BoolInUnion; + + factory BoolInUnion.fromJson(Map json) => _$BoolInUnionFromJson(json); +} + +@freezed +class DoubleInUnion with _$DoubleInUnion{ + const factory DoubleInUnion({ + required double doubleValue + }) = _DoubleInUnion; + + factory DoubleInUnion.fromJson(Map json) => _$DoubleInUnionFromJson(json); +} + +@freezed +class ObjectInUnion with _$ObjectInUnion { + const factory ObjectInUnion({required Object objectValue}) = _ObjectInUnion; + + factory ObjectInUnion.fromJson(Map json) => + _$ObjectInUnionFromJson(json); +} + +@freezed +class NumInUnion with _$NumInUnion{ + const factory NumInUnion({required num numValue}) = _NumInUnion; + + factory NumInUnion.fromJson(Map json) => _$NumInUnionFromJson(json); +} + +@freezed +class DateTimeInUnion with _$DateTimeInUnion { +const factory DateTimeInUnion({required DateTime dateTimeValue}) = +_DateTimeInUnion; + +factory DateTimeInUnion.fromJson(Map json) => +_$DateTimeInUnionFromJson(json); +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/pubspec.yaml new file mode 100644 index 000000000000..445bc9f8f04d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/pubspec.yaml @@ -0,0 +1,19 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client +homepage: homepage + + +environment: + sdk: '^3.0.0' + +dependencies: + dio: '^5.7.0' + freezed_annotation: '^2.4.4' + json_annotation: '^4.9.0' + +dev_dependencies: + freezed: '^2.5.2' + json_serializable: '^6.8.0' + build_runner: any + test: '^1.16.0' diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/test/apple_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/test/apple_test.dart new file mode 100644 index 000000000000..200492f8b1f7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/test/apple_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Apple +void main() { + final Apple? instance = /* Apple(...) */ null; + // TODO add properties to the entity + + group(Apple, () { + // String kind + test('to test the property `kind`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/test/banana_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/test/banana_test.dart new file mode 100644 index 000000000000..ae681c740af5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/test/banana_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Banana +void main() { + final Banana? instance = /* Banana(...) */ null; + // TODO add properties to the entity + + group(Banana, () { + // num count + test('to test the property `count`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/test/default_api_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/test/default_api_test.dart new file mode 100644 index 000000000000..07d256d2e554 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/test/default_api_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + + +/// tests for DefaultApi +void main() { + final instance = Openapi().getDefaultApi(); + + group(DefaultApi, () { + //Future rootGet() async + test('test rootGet', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/test/fruit_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/test/fruit_test.dart new file mode 100644 index 000000000000..8dfac99108f2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/test/fruit_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Fruit +void main() { + final Fruit? instance = /* Fruit(...) */ null; + // TODO add properties to the entity + + group(Fruit, () { + // String color + test('to test the property `color`', () async { + // TODO + }); + + // String kind + test('to test the property `kind`', () async { + // TODO + }); + + // num count + test('to test the property `count`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof/test/orange_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/test/orange_test.dart new file mode 100644 index 000000000000..f46011b6a10b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof/test/orange_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Orange +void main() { + final Orange? instance = /* Orange(...) */ null; + // TODO add properties to the entity + + group(Orange, () { + // bool sweet + test('to test the property `sweet`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/.gitignore b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/.gitignore new file mode 100644 index 000000000000..4298cdcbd1a2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/.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/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/.openapi-generator-ignore b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/.openapi-generator/FILES new file mode 100644 index 000000000000..cbcb26ac79e1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/.openapi-generator/FILES @@ -0,0 +1,63 @@ +.gitignore +README.md +analysis_options.yaml +build.yaml +doc/Addressable.md +doc/Animal.md +doc/Apple.md +doc/Banana.md +doc/Bar.md +doc/BarApi.md +doc/BarCreate.md +doc/BarRef.md +doc/BarRefOrValue.md +doc/Cat.md +doc/Dog.md +doc/Entity.md +doc/EntityRef.md +doc/Extensible.md +doc/Foo.md +doc/FooApi.md +doc/FooRef.md +doc/FooRefOrValue.md +doc/Fruit.md +doc/FruitType.md +doc/Pasta.md +doc/Pizza.md +doc/PizzaSpeziale.md +lib/openapi.dart +lib/src/api.dart +lib/src/api/bar_api.dart +lib/src/api/foo_api.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/addressable.dart +lib/src/model/animal.dart +lib/src/model/apple.dart +lib/src/model/banana.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/cat.dart +lib/src/model/dog.dart +lib/src/model/entity.dart +lib/src/model/entity_ref.dart +lib/src/model/extensible.dart +lib/src/model/foo.dart +lib/src/model/foo_ref.dart +lib/src/model/foo_ref_or_value.dart +lib/src/model/fruit.dart +lib/src/model/fruit_type.dart +lib/src/model/models.dart +lib/src/model/pasta.dart +lib/src/model/pizza.dart +lib/src/model/pizza_speziale.dart +lib/src/model/primitive_union_types.dart +pubspec.yaml +test/animal_test.dart +test/cat_test.dart +test/dog_test.dart diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/.openapi-generator/VERSION new file mode 100644 index 000000000000..9e0e9bce84b2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.17.0-SNAPSHOT diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/README.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/README.md new file mode 100644 index 000000000000..5ecec7840099 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/README.md @@ -0,0 +1,107 @@ +# openapi (EXPERIMENTAL) +This tests for a oneOf interface representation + + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 0.0.1 +- Generator version: 7.17.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.DartDioClientCodegen + +## 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().getBarApi(); +final BarCreate barCreate = ; // BarCreate | + +try { + final response = await api.createBar(barCreate); + print(response); +} catch on DioException (e) { + print("Exception when calling BarApi->createBar: $e\n"); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:8080* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +[*BarApi*](doc/BarApi.md) | [**createBar**](doc/BarApi.md#createbar) | **POST** /bar | Create a Bar +[*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 + + +## Documentation For Models + + - [Addressable](doc/Addressable.md) + - [Animal](doc/Animal.md) + - [Apple](doc/Apple.md) + - [Banana](doc/Banana.md) + - [Bar](doc/Bar.md) + - [BarCreate](doc/BarCreate.md) + - [BarRef](doc/BarRef.md) + - [BarRefOrValue](doc/BarRefOrValue.md) + - [Cat](doc/Cat.md) + - [Dog](doc/Dog.md) + - [Entity](doc/Entity.md) + - [EntityRef](doc/EntityRef.md) + - [Extensible](doc/Extensible.md) + - [Foo](doc/Foo.md) + - [FooRef](doc/FooRef.md) + - [FooRefOrValue](doc/FooRefOrValue.md) + - [Fruit](doc/Fruit.md) + - [FruitType](doc/FruitType.md) + - [Pasta](doc/Pasta.md) + - [Pizza](doc/Pizza.md) + - [PizzaSpeziale](doc/PizzaSpeziale.md) + + +## Documentation For Authorization + +Endpoints do not require authorization. + + +## Author + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/analysis_options.yaml b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/analysis_options.yaml new file mode 100644 index 000000000000..8ff047ce7675 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/analysis_options.yaml @@ -0,0 +1,11 @@ +analyzer: + language: + strict-inference: true + strict-raw-types: true + strict-casts: false + exclude: + - test/*.dart + - lib/src/model/*.g.dart + - lib/src/model/*.freezed.dart + errors: + deprecated_member_use_from_same_package: ignore diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/build.yaml b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/build.yaml new file mode 100644 index 000000000000..dee5edd67f90 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/build.yaml @@ -0,0 +1,11 @@ +targets: + $default: + builders: + freezed|freezed: + # This restricts freezed build runner to look + # files only inside models folder. + # If you prefer the build runner to scan the whole + # project for files then simply remove this build.yaml file + generate_for: + include: + - "lib/src/model/**.dart" \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Addressable.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Addressable.md new file mode 100644 index 000000000000..0fcd81b80382 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Addressable.md @@ -0,0 +1,16 @@ +# openapi.model.Addressable + +## Load the model package +```dart +import 'package:openapi/api.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/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Animal.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Animal.md new file mode 100644 index 000000000000..b30398312c77 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Animal.md @@ -0,0 +1,16 @@ +# openapi.model.Animal + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bark** | **bool** | | [optional] +**declawed** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Apple.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Apple.md new file mode 100644 index 000000000000..13b34241ef81 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Apple.md @@ -0,0 +1,15 @@ +# openapi.model.Apple + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **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/freezed/oneof_polymorphism_and_inheritance/doc/Banana.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Banana.md new file mode 100644 index 000000000000..4c5737d0c2e2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Banana.md @@ -0,0 +1,15 @@ +# openapi.model.Banana + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**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/freezed/oneof_polymorphism_and_inheritance/doc/Bar.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Bar.md new file mode 100644 index 000000000000..4cccc863a489 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Bar.md @@ -0,0 +1,22 @@ +# openapi.model.Bar + +## Load the model package +```dart +import 'package:openapi/api.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/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/BarApi.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/BarApi.md new file mode 100644 index 000000000000..a6f23c00210c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/BarApi.md @@ -0,0 +1,55 @@ +# openapi.api.BarApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://localhost:8080* + +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/api.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/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/BarCreate.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/BarCreate.md new file mode 100644 index 000000000000..c0b4ba6edc9a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/BarCreate.md @@ -0,0 +1,22 @@ +# openapi.model.BarCreate + +## Load the model package +```dart +import 'package:openapi/api.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/freezed/oneof_polymorphism_and_inheritance/doc/BarRef.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/BarRef.md new file mode 100644 index 000000000000..cab0e7e57386 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/BarRef.md @@ -0,0 +1,21 @@ +# openapi.model.BarRef + +## Load the model package +```dart +import 'package:openapi/api.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/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/BarRefOrValue.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/BarRefOrValue.md new file mode 100644 index 000000000000..f88727e11aa8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/BarRefOrValue.md @@ -0,0 +1,24 @@ +# openapi.model.BarRefOrValue + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | unique identifier | +**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 | +**name** | **String** | Name of the related entity. | [optional] +**atReferredType** | **String** | The actual type of the target instance when needed for disambiguation. | [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/freezed/oneof_polymorphism_and_inheritance/doc/Cat.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Cat.md new file mode 100644 index 000000000000..c1c078d2b65e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Cat.md @@ -0,0 +1,15 @@ +# openapi.model.Cat + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Dog.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Dog.md new file mode 100644 index 000000000000..c6cc069e2563 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Dog.md @@ -0,0 +1,15 @@ +# openapi.model.Dog + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bark** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Entity.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Entity.md new file mode 100644 index 000000000000..5ba2144b44fe --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Entity.md @@ -0,0 +1,19 @@ +# openapi.model.Entity + +## Load the model package +```dart +import 'package:openapi/api.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/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/EntityRef.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/EntityRef.md new file mode 100644 index 000000000000..80eae55f4145 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/EntityRef.md @@ -0,0 +1,21 @@ +# openapi.model.EntityRef + +## Load the model package +```dart +import 'package:openapi/api.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/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Extensible.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Extensible.md new file mode 100644 index 000000000000..7a781e578ea4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Extensible.md @@ -0,0 +1,17 @@ +# openapi.model.Extensible + +## Load the model package +```dart +import 'package:openapi/api.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/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Foo.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Foo.md new file mode 100644 index 000000000000..2627691fefe5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Foo.md @@ -0,0 +1,21 @@ +# openapi.model.Foo + +## Load the model package +```dart +import 'package:openapi/api.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/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/FooApi.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/FooApi.md new file mode 100644 index 000000000000..f1fe53aa31f2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/FooApi.md @@ -0,0 +1,93 @@ +# openapi.api.FooApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://localhost:8080* + +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/api.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/api.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/freezed/oneof_polymorphism_and_inheritance/doc/FooRef.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/FooRef.md new file mode 100644 index 000000000000..bfa62bd4f54b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/FooRef.md @@ -0,0 +1,22 @@ +# openapi.model.FooRef + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foorefPropA** | **String** | | [optional] +**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/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/FooRefOrValue.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/FooRefOrValue.md new file mode 100644 index 000000000000..9bc8dec10571 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/FooRefOrValue.md @@ -0,0 +1,24 @@ +# openapi.model.FooRefOrValue + +## Load the model package +```dart +import 'package:openapi/api.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 | +**foorefPropA** | **String** | | [optional] +**name** | **String** | Name of the related entity. | [optional] +**atReferredType** | **String** | The actual type of the target instance when needed for disambiguation. | [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/freezed/oneof_polymorphism_and_inheritance/doc/Fruit.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Fruit.md new file mode 100644 index 000000000000..91c1f1cf9b55 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Fruit.md @@ -0,0 +1,17 @@ +# openapi.model.Fruit + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fruitType** | [**FruitType**](FruitType.md) | | +**seeds** | **int** | | +**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/freezed/oneof_polymorphism_and_inheritance/doc/FruitType.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/FruitType.md new file mode 100644 index 000000000000..ce2329c986ad --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/FruitType.md @@ -0,0 +1,14 @@ +# openapi.model.FruitType + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Pasta.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Pasta.md new file mode 100644 index 000000000000..034ff420d323 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Pasta.md @@ -0,0 +1,20 @@ +# openapi.model.Pasta + +## Load the model package +```dart +import 'package:openapi/api.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/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Pizza.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Pizza.md new file mode 100644 index 000000000000..e4b040a6a79c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/Pizza.md @@ -0,0 +1,20 @@ +# openapi.model.Pizza + +## Load the model package +```dart +import 'package:openapi/api.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/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/PizzaSpeziale.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/PizzaSpeziale.md new file mode 100644 index 000000000000..4e3800773dca --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/doc/PizzaSpeziale.md @@ -0,0 +1,21 @@ +# openapi.model.PizzaSpeziale + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**toppings** | **String** | | [optional] +**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/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/openapi.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/openapi.dart new file mode 100644 index 000000000000..2dd7aa8bee7d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/openapi.dart @@ -0,0 +1,16 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +export 'package:openapi/src/api.dart'; +export 'package:openapi/src/auth/api_key_auth.dart'; +export 'package:openapi/src/auth/basic_auth.dart'; +export 'package:openapi/src/auth/bearer_auth.dart'; +export 'package:openapi/src/auth/oauth.dart'; + + +export 'package:openapi/src/api/bar_api.dart'; +export 'package:openapi/src/api/foo_api.dart'; + + +export 'package:openapi/src/model/models.dart'; \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/api.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/api.dart new file mode 100644 index 000000000000..791892de5ea4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/api.dart @@ -0,0 +1,75 @@ +// +// 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/bar_api.dart'; +import 'package:openapi/src/api/foo_api.dart'; + +class Openapi { + static const String basePath = r'http://localhost:8080'; + + 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 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 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); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/api/bar_api.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/api/bar_api.dart new file mode 100644 index 000000000000..625dff159bb3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/api/bar_api.dart @@ -0,0 +1,110 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'dart:convert'; +import '../model/models.dart'; +import 'package:dio/dio.dart'; + + +class BarApi { + + final Dio _dio; + + const BarApi(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({ + + required BarCreate barCreate, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/bar'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(barCreate); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Bar _responseData; + + + try { + _responseData = Bar.fromJson(_response.data as Map); + + } 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, + ); + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/api/foo_api.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/api/foo_api.dart new file mode 100644 index 000000000000..107218c14261 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/api/foo_api.dart @@ -0,0 +1,182 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'dart:convert'; +import '../model/models.dart'; +import 'package:dio/dio.dart'; + + +class FooApi { + + final Dio _dio; + + const FooApi(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({ + + Foo? foo, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/foo'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json;charset=utf-8', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(foo); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + FooRefOrValue _responseData; + + + try { + _responseData = FooRefOrValue.fromJson(_response.data as Map); + + } 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 _path = r'/foo'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + List _responseData; + + + try { + final _responseDataAsList = _response.data as List; + _responseData = _responseDataAsList.map((dynamic e)=> FooRefOrValue.fromJson(e as Map)).toList(); + + } 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, + ); + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/auth/api_key_auth.dart new file mode 100644 index 000000000000..ee16e3f0f92f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/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/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/auth/auth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/auth/auth.dart new file mode 100644 index 000000000000..f7ae9bf3f11e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/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/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/auth/basic_auth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/auth/basic_auth.dart new file mode 100644 index 000000000000..b65ccb5b71f7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/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']?.toLowerCase() == '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/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/auth/bearer_auth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/auth/bearer_auth.dart new file mode 100644 index 000000000000..8f46678761b2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/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']?.toLowerCase() == '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/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/auth/oauth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/auth/oauth.dart new file mode 100644 index 000000000000..337cf762b0ce --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/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/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/addressable.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/addressable.dart new file mode 100644 index 000000000000..986158c15a64 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/addressable.dart @@ -0,0 +1,40 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Base schema for addressable entities + /// + /// Properties: + /// * [href] - Hyperlink reference + /// * [id] - unique identifier + + @freezed + class Addressable with _$Addressable { + const Addressable._(); + + const factory Addressable({ + /// Hyperlink reference + @JsonKey(name: r'href') + String? + href, + /// unique identifier + @JsonKey(name: r'id') + String? + id, + }) = _Addressable; + + + factory Addressable.fromJson(Map json) => _$AddressableFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/animal.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/animal.dart new file mode 100644 index 000000000000..2f8aeff2012c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/animal.dart @@ -0,0 +1,100 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Animal + /// + /// Properties: + /// * [bark] + /// * [declawed] + + + + @freezed + sealed class Animal with _$Animal { + const Animal._(); + + const factory Animal.asCat({ + required Cat catValue + }) = AnimalAsCat; + const factory Animal.asDog({ + required Dog dogValue + }) = AnimalAsDog; + const factory Animal.unknown({ + @Default('Json does not satisfy any available types') String message, + required Map json, + + @Default(DeserializationErrorType.UnKnownType) + DeserializationErrorType errorType, + + @Default([Cat,Dog,]) + List possibleTypes, + + @Default([]) + List deserializedModels, + }) = AnimalUnknown; + + + factory Animal.fromJson(Map json) { + // A discriminator property is not defined in the spec so + // we try to parse the json against all the models and try to + // return one of the valid model. Note: this approach tries + // to return one valid model and if more than one model + // is valid it then returns unknown type along with the json so + // the consumer can decide which model it is. + Animal? deserializedModel; + final fromJsonMethods = >[Cat.fromJson,Dog.fromJson,]; + final deserializedModels = []; + for (final fromJsonMethod in fromJsonMethods) { + try { + final dynamic parsedModel= fromJsonMethod.call(json); + // Note following line won't be executed if already the above parsing fails. + if (parsedModel is Cat) { + deserializedModel = Animal.asCat( + catValue : parsedModel, + ); + } else + if (parsedModel is Dog) { + deserializedModel = Animal.asDog( + dogValue : parsedModel, + ); + } else + { + deserializedModel = Animal.unknown(json: json); + } + deserializedModels.add(deserializedModel); + } catch (e) { + // We are suppressing the deserialization error when the json could not + // be parsed into one of the model. Because we return [Animal.unknown] + // if the deserialization fails. + } + } + // Return an unknown type when the incoming json parses into more than one models. + // Since we pass deserializedModels, clients can still use the deserialized model. + // EvenThough this is valid for AnyOf types, Dart doesn't have polymorphic types. + // So we still return this as an unknown type. + if(deserializedModels.length > 1){ + deserializedModel = Animal.unknown( + json: json, + deserializedModels: deserializedModels, + errorType: DeserializationErrorType.MoreThanOneTypeSatisfied, + ); + } return deserializedModel ?? Animal.unknown(json: json); + } + + + Map toJson() { + return when( + asCat: (asCat) => asCat.toJson(), + asDog: (asDog) => asDog.toJson(), + unknown: (message, json, errorType, possibleTypes, deserializedModels) => {}, + ); + } + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/apple.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/apple.dart new file mode 100644 index 000000000000..14df49f70340 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/apple.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Apple + /// + /// Properties: + /// * [seeds] + + @freezed + class Apple with _$Apple { + const Apple._(); + + const factory Apple({ + @JsonKey(name: r'seeds') + required int + seeds, + }) = _Apple; + + + factory Apple.fromJson(Map json) => _$AppleFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/banana.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/banana.dart new file mode 100644 index 000000000000..b13824357890 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/banana.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Banana + /// + /// Properties: + /// * [length] + + @freezed + class Banana with _$Banana { + const Banana._(); + + const factory Banana({ + @JsonKey(name: r'length') + required int + length, + }) = _Banana; + + + factory Banana.fromJson(Map json) => _$BananaFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/bar.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/bar.dart new file mode 100644 index 000000000000..69db1d9ba3b6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/bar.dart @@ -0,0 +1,66 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.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 + + + @freezed + class Bar with _$Bar { + const Bar._(); + + const factory Bar({ + @JsonKey(name: r'id') + required String + id, + @JsonKey(name: r'barPropA') + String? + barPropA, + @JsonKey(name: r'fooPropB') + String? + fooPropB, + @JsonKey(name: r'foo') + FooRefOrValue? + foo, + /// Hyperlink reference + @JsonKey(name: r'href') + String? + href, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation') + String? + atSchemaLocation, + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType') + String? + atBaseType, + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type') + required String + atType, + }) = _Bar; + + factory Bar.fromJson(Map json) => _$BarFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/bar_create.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/bar_create.dart new file mode 100644 index 000000000000..d9ffbcecbf39 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/bar_create.dart @@ -0,0 +1,67 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.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 + + + @freezed + class BarCreate with _$BarCreate { + const BarCreate._(); + + const factory BarCreate({ + @JsonKey(name: r'barPropA') + String? + barPropA, + @JsonKey(name: r'fooPropB') + String? + fooPropB, + @JsonKey(name: r'foo') + FooRefOrValue? + foo, + /// Hyperlink reference + @JsonKey(name: r'href') + String? + href, + /// unique identifier + @JsonKey(name: r'id') + String? + id, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation') + String? + atSchemaLocation, + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType') + String? + atBaseType, + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type') + required String + atType, + }) = _BarCreate; + + factory BarCreate.fromJson(Map json) => _$BarCreateFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref.dart new file mode 100644 index 000000000000..0b4e45e7b4b8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref.dart @@ -0,0 +1,65 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// BarRef + /// + /// 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 + + + @freezed + class BarRef with _$BarRef { + const BarRef._(); + + const factory BarRef({ + /// Name of the related entity. + @JsonKey(name: r'name') + String? + name, + /// The actual type of the target instance when needed for disambiguation. + @JsonKey(name: r'@referredType') + String? + atReferredType, + /// Hyperlink reference + @JsonKey(name: r'href') + String? + href, + /// unique identifier + @JsonKey(name: r'id') + String? + id, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation') + String? + atSchemaLocation, + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType') + String? + atBaseType, + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type') + required String + atType, + }) = _BarRef; + + factory BarRef.fromJson(Map json) => _$BarRefFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref_or_value.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref_or_value.dart new file mode 100644 index 000000000000..677cb2400e47 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref_or_value.dart @@ -0,0 +1,108 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// BarRefOrValue + /// + /// Properties: + /// * [id] - unique identifier + /// * [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 + /// * [name] - Name of the related entity. + /// * [atReferredType] - The actual type of the target instance when needed for disambiguation. + + + + @freezed + sealed class BarRefOrValue with _$BarRefOrValue { + const BarRefOrValue._(); + + const factory BarRefOrValue.asBar({ + required Bar barValue + }) = BarRefOrValueAsBar; + const factory BarRefOrValue.asBarRef({ + required BarRef barRefValue + }) = BarRefOrValueAsBarRef; + const factory BarRefOrValue.unknown({ + @Default('Json does not satisfy any available types') String message, + required Map json, + + @Default(DeserializationErrorType.UnKnownType) + DeserializationErrorType errorType, + + @Default([Bar,BarRef,]) + List possibleTypes, + + @Default([]) + List deserializedModels, + }) = BarRefOrValueUnknown; + + + factory BarRefOrValue.fromJson(Map json) { + // A discriminator property is not defined in the spec so + // we try to parse the json against all the models and try to + // return one of the valid model. Note: this approach tries + // to return one valid model and if more than one model + // is valid it then returns unknown type along with the json so + // the consumer can decide which model it is. + BarRefOrValue? deserializedModel; + final fromJsonMethods = >[Bar.fromJson,BarRef.fromJson,]; + final deserializedModels = []; + for (final fromJsonMethod in fromJsonMethods) { + try { + final dynamic parsedModel= fromJsonMethod.call(json); + // Note following line won't be executed if already the above parsing fails. + if (parsedModel is Bar) { + deserializedModel = BarRefOrValue.asBar( + barValue : parsedModel, + ); + } else + if (parsedModel is BarRef) { + deserializedModel = BarRefOrValue.asBarRef( + barRefValue : parsedModel, + ); + } else + { + deserializedModel = BarRefOrValue.unknown(json: json); + } + deserializedModels.add(deserializedModel); + } catch (e) { + // We are suppressing the deserialization error when the json could not + // be parsed into one of the model. Because we return [BarRefOrValue.unknown] + // if the deserialization fails. + } + } + // Return an unknown type when the incoming json parses into more than one models. + // Since we pass deserializedModels, clients can still use the deserialized model. + // EvenThough this is valid for AnyOf types, Dart doesn't have polymorphic types. + // So we still return this as an unknown type. + if(deserializedModels.length > 1){ + deserializedModel = BarRefOrValue.unknown( + json: json, + deserializedModels: deserializedModels, + errorType: DeserializationErrorType.MoreThanOneTypeSatisfied, + ); + } return deserializedModel ?? BarRefOrValue.unknown(json: json); + } + + + Map toJson() { + return when( + asBar: (asBar) => asBar.toJson(), + asBarRef: (asBarRef) => asBarRef.toJson(), + unknown: (message, json, errorType, possibleTypes, deserializedModels) => {}, + ); + } + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/cat.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/cat.dart new file mode 100644 index 000000000000..0448cc5a570b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/cat.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Cat + /// + /// Properties: + /// * [declawed] + + @freezed + class Cat with _$Cat { + const Cat._(); + + const factory Cat({ + @JsonKey(name: r'declawed') + bool? + declawed, + }) = _Cat; + + + factory Cat.fromJson(Map json) => _$CatFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/dog.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/dog.dart new file mode 100644 index 000000000000..8efdc6314feb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/dog.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Dog + /// + /// Properties: + /// * [bark] + + @freezed + class Dog with _$Dog { + const Dog._(); + + const factory Dog({ + @JsonKey(name: r'bark') + bool? + bark, + }) = _Dog; + + + factory Dog.fromJson(Map json) => _$DogFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/entity.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/entity.dart new file mode 100644 index 000000000000..fcc0e5854817 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/entity.dart @@ -0,0 +1,102 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.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 + + + + @freezed + sealed class Entity with _$Entity { + const Entity._(); + + const factory Entity.asBar({ + required Bar barValue + }) = EntityAsBar; + const factory Entity.asBarCreate({ + required BarCreate barCreateValue + }) = EntityAsBarCreate; + const factory Entity.asFoo({ + required Foo fooValue + }) = EntityAsFoo; + const factory Entity.asPasta({ + required Pasta pastaValue + }) = EntityAsPasta; + const factory Entity.asPizza({ + required Pizza pizzaValue + }) = EntityAsPizza; + const factory Entity.asPizzaSpeziale({ + required PizzaSpeziale pizzaSpezialeValue + }) = EntityAsPizzaSpeziale; + const factory Entity.unknown({ + @Default('Json does not satisfy any available types') String message, + required Map json, + + @Default(DeserializationErrorType.UnKnownType) + DeserializationErrorType errorType, + + @Default([]) + List possibleTypes, + + @Default([]) + List deserializedModels, + }) = EntityUnknown; + + factory Entity.fromJson(Map json) { + switch(json['@type']){ + case 'Bar': + return Entity.asBar( + barValue : Bar.fromJson(json), + ); + case 'Bar_Create': + return Entity.asBarCreate( + barCreateValue : BarCreate.fromJson(json), + ); + case 'Foo': + return Entity.asFoo( + fooValue : Foo.fromJson(json), + ); + case 'Pasta': + return Entity.asPasta( + pastaValue : Pasta.fromJson(json), + ); + case 'Pizza': + return Entity.asPizza( + pizzaValue : Pizza.fromJson(json), + ); + case 'PizzaSpeziale': + return Entity.asPizzaSpeziale( + pizzaSpezialeValue : PizzaSpeziale.fromJson(json), + ); + } + return Entity.unknown(json: json); + } + + + Map toJson() { + return when( + asBar: (asBar) => asBar.toJson(), + asBarCreate: (asBarCreate) => asBarCreate.toJson(), + asFoo: (asFoo) => asFoo.toJson(), + asPasta: (asPasta) => asPasta.toJson(), + asPizza: (asPizza) => asPizza.toJson(), + asPizzaSpeziale: (asPizzaSpeziale) => asPizzaSpeziale.toJson(), + unknown: (message, json, errorType, possibleTypes, deserializedModels) => {}, + ); + } + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/entity_ref.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/entity_ref.dart new file mode 100644 index 000000000000..fee53b08ca87 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/entity_ref.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.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 + + + + @freezed + sealed class EntityRef with _$EntityRef { + const EntityRef._(); + + const factory EntityRef.asBarRef({ + required BarRef barRefValue + }) = EntityRefAsBarRef; + const factory EntityRef.asFooRef({ + required FooRef fooRefValue + }) = EntityRefAsFooRef; + const factory EntityRef.unknown({ + @Default('Json does not satisfy any available types') String message, + required Map json, + + @Default(DeserializationErrorType.UnKnownType) + DeserializationErrorType errorType, + + @Default([]) + List possibleTypes, + + @Default([]) + List deserializedModels, + }) = EntityRefUnknown; + + factory EntityRef.fromJson(Map json) { + switch(json['@type']){ + case 'BarRef': + return EntityRef.asBarRef( + barRefValue : BarRef.fromJson(json), + ); + case 'FooRef': + return EntityRef.asFooRef( + fooRefValue : FooRef.fromJson(json), + ); + } + return EntityRef.unknown(json: json); + } + + + Map toJson() { + return when( + asBarRef: (asBarRef) => asBarRef.toJson(), + asFooRef: (asFooRef) => asFooRef.toJson(), + unknown: (message, json, errorType, possibleTypes, deserializedModels) => {}, + ); + } + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/extensible.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/extensible.dart new file mode 100644 index 000000000000..dc0fdb3a2070 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/extensible.dart @@ -0,0 +1,45 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.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 + + @freezed + class Extensible with _$Extensible { + const Extensible._(); + + const factory Extensible({ + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation') + String? + atSchemaLocation, + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType') + String? + atBaseType, + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type') + required String + atType, + }) = _Extensible; + + + factory Extensible.fromJson(Map json) => _$ExtensibleFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/foo.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/foo.dart new file mode 100644 index 000000000000..f7800d15e550 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/foo.dart @@ -0,0 +1,63 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.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 + + + @freezed + class Foo with _$Foo { + const Foo._(); + + const factory Foo({ + @JsonKey(name: r'fooPropA') + String? + fooPropA, + @JsonKey(name: r'fooPropB') + String? + fooPropB, + /// Hyperlink reference + @JsonKey(name: r'href') + String? + href, + /// unique identifier + @JsonKey(name: r'id') + String? + id, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation') + String? + atSchemaLocation, + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType') + String? + atBaseType, + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type') + required String + atType, + }) = _Foo; + + factory Foo.fromJson(Map json) => _$FooFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref.dart new file mode 100644 index 000000000000..b28b7807623d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref.dart @@ -0,0 +1,69 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// FooRef + /// + /// Properties: + /// * [foorefPropA] + /// * [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 + + + @freezed + class FooRef with _$FooRef { + const FooRef._(); + + const factory FooRef({ + @JsonKey(name: r'foorefPropA') + String? + foorefPropA, + /// Name of the related entity. + @JsonKey(name: r'name') + String? + name, + /// The actual type of the target instance when needed for disambiguation. + @JsonKey(name: r'@referredType') + String? + atReferredType, + /// Hyperlink reference + @JsonKey(name: r'href') + String? + href, + /// unique identifier + @JsonKey(name: r'id') + String? + id, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation') + String? + atSchemaLocation, + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType') + String? + atBaseType, + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type') + required String + atType, + }) = _FooRef; + + factory FooRef.fromJson(Map json) => _$FooRefFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref_or_value.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref_or_value.dart new file mode 100644 index 000000000000..fd5fba328f05 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref_or_value.dart @@ -0,0 +1,125 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// FooRefOrValue + /// + /// 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 + /// * [foorefPropA] + /// * [name] - Name of the related entity. + /// * [atReferredType] - The actual type of the target instance when needed for disambiguation. + + + + @freezed + sealed class FooRefOrValue with _$FooRefOrValue { + const FooRefOrValue._(); + + const factory FooRefOrValue.asFoo({ + required Foo fooValue + }) = FooRefOrValueAsFoo; + const factory FooRefOrValue.asFooRef({ + required FooRef fooRefValue + }) = FooRefOrValueAsFooRef; + const factory FooRefOrValue.unknown({ + @Default('Json does not satisfy any available types') String message, + required Map json, + + @Default(DeserializationErrorType.UnKnownType) + DeserializationErrorType errorType, + + @Default([Foo,FooRef,]) + List possibleTypes, + + @Default([]) + List deserializedModels, + }) = FooRefOrValueUnknown; + + + factory FooRefOrValue.fromJson(Map json) { + FooRefOrValue? deserializedModel; + // A discriminator property is specified but no mapping + // is provided in the spec, so we expect the property to + // have the value of the name of the model. Model prefix & + // suffix are ignored, as this is not known by the api provider + switch(json['@type']){ + case 'Foo': + deserializedModel = FooRefOrValue.asFoo( + fooValue : Foo.fromJson(json), + ); + break; + case 'FooRef': + deserializedModel = FooRefOrValue.asFooRef( + fooRefValue : FooRef.fromJson(json), + ); + break; + default: + /// If deserializedModel is still null, then we try to parse + /// the json against all the models and try to return one of the valid model. + /// Note: this approach tries to return one valid model and if more than one model + /// is valid it then returns unknown type along with the json so + /// the consumer can decide which model it is. + final fromJsonMethods = >[Foo.fromJson,FooRef.fromJson,]; + final deserializedModels = []; + for (final fromJsonMethod in fromJsonMethods) { + try { + final dynamic parsedModel= fromJsonMethod.call(json); + // Note following line won't be executed if already the above parsing fails. + if (parsedModel is Foo) { + deserializedModel = FooRefOrValue.asFoo( + fooValue : parsedModel, + ); + } else + if (parsedModel is FooRef) { + deserializedModel = FooRefOrValue.asFooRef( + fooRefValue : parsedModel, + ); + } else + { + deserializedModel = FooRefOrValue.unknown(json: json); + } + deserializedModels.add(deserializedModel); + } catch (e) { + // We are suppressing the deserialization error when the json could not + // be parsed into one of the model. Because we return [FooRefOrValue.unknown] + // if the deserialization fails. + } + } + // Return an unknown type when the incoming json parses into more than one models. + // Since we pass deserializedModels, clients can still use the deserialized model. + // EvenThough this is valid for AnyOf types, Dart doesn't have polymorphic types. + // So we still return this as an unknown type. + if(deserializedModels.length > 1){ + deserializedModel = FooRefOrValue.unknown( + json: json, + deserializedModels: deserializedModels, + errorType: DeserializationErrorType.MoreThanOneTypeSatisfied, + ); + } break; + } + return deserializedModel ?? FooRefOrValue.unknown(json: json); + } + + + Map toJson() { + return when( + asFoo: (asFoo) => asFoo.toJson(), + asFooRef: (asFooRef) => asFooRef.toJson(), + unknown: (message, json, errorType, possibleTypes, deserializedModels) => {}, + ); + } + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/fruit.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/fruit.dart new file mode 100644 index 000000000000..963269e1a3c9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/fruit.dart @@ -0,0 +1,68 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Fruit + /// + /// Properties: + /// * [fruitType] + /// * [seeds] + /// * [length] + + + + @freezed + sealed class Fruit with _$Fruit { + const Fruit._(); + + const factory Fruit.asApple({ + required Apple appleValue + }) = FruitAsApple; + const factory Fruit.asBanana({ + required Banana bananaValue + }) = FruitAsBanana; + const factory Fruit.unknown({ + @Default('Json does not satisfy any available types') String message, + required Map json, + + @Default(DeserializationErrorType.UnKnownType) + DeserializationErrorType errorType, + + @Default([Apple,Banana,]) + List possibleTypes, + + @Default([]) + List deserializedModels, + }) = FruitUnknown; + + factory Fruit.fromJson(Map json) { + switch(json['fruitType']){ + case 'APPLE': + return Fruit.asApple( + appleValue : Apple.fromJson(json), + ); + case 'BANANA': + return Fruit.asBanana( + bananaValue : Banana.fromJson(json), + ); + } + return Fruit.unknown(json: json); + } + + + Map toJson() { + return when( + asApple: (asApple) => asApple.toJson(), + asBanana: (asBanana) => asBanana.toJson(), + unknown: (message, json, errorType, possibleTypes, deserializedModels) => {}, + ); + } + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/fruit_type.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/fruit_type.dart new file mode 100644 index 000000000000..cd394cc4803e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/fruit_type.dart @@ -0,0 +1,16 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + + +@JsonEnum(valueField: 'value') +enum FruitType { + APPLE(value: r'APPLE'), + BANANA(value: r'BANANA'), + unknownDefaultOpenApi(value: r'unknown_default_open_api'); + const FruitType({required this.value}); + final String value; +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/models.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/models.dart new file mode 100644 index 000000000000..97c279ce5e04 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/models.dart @@ -0,0 +1,20 @@ +//ignore_for_file: invalid_annotation_target +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:dio/dio.dart'; +import 'dart:convert'; + +part 'models.freezed.dart'; +part 'models.g.dart'; + +part 'primitive_union_types.dart'; +part 'addressable.dart';part 'animal.dart';part 'apple.dart';part 'banana.dart';part 'bar.dart';part 'bar_create.dart';part 'bar_ref.dart';part 'bar_ref_or_value.dart';part 'cat.dart';part 'dog.dart';part 'entity.dart';part 'entity_ref.dart';part 'extensible.dart';part 'foo.dart';part 'foo_ref.dart';part 'foo_ref_or_value.dart';part 'fruit.dart';part 'fruit_type.dart';part 'pasta.dart';part 'pizza.dart';part 'pizza_speziale.dart'; + +/// A typedef used in the deserialization of OneOf and AnyOf +/// models when no discriminator mapping is provided. +typedef FromJsonMethodType = T Function(Map); + +/// Deserialization error types for OneOf and AnyOf types. +enum DeserializationErrorType { + MoreThanOneTypeSatisfied, + UnKnownType, +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/pasta.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/pasta.dart new file mode 100644 index 000000000000..e29f49044d96 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/pasta.dart @@ -0,0 +1,59 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.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 + + + @freezed + class Pasta with _$Pasta { + const Pasta._(); + + const factory Pasta({ + @JsonKey(name: r'vendor') + String? + vendor, + /// Hyperlink reference + @JsonKey(name: r'href') + String? + href, + /// unique identifier + @JsonKey(name: r'id') + String? + id, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation') + String? + atSchemaLocation, + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType') + String? + atBaseType, + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type') + required String + atType, + }) = _Pasta; + + factory Pasta.fromJson(Map json) => _$PastaFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/pizza.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/pizza.dart new file mode 100644 index 000000000000..b1340e55336b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/pizza.dart @@ -0,0 +1,59 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.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 + + + @freezed + class Pizza with _$Pizza { + const Pizza._(); + + const factory Pizza({ + @JsonKey(name: r'pizzaSize') + num? + pizzaSize, + /// Hyperlink reference + @JsonKey(name: r'href') + String? + href, + /// unique identifier + @JsonKey(name: r'id') + String? + id, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation') + String? + atSchemaLocation, + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType') + String? + atBaseType, + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type') + required String + atType, + }) = _Pizza; + + factory Pizza.fromJson(Map json) => _$PizzaFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/pizza_speziale.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/pizza_speziale.dart new file mode 100644 index 000000000000..0d2456d49da4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/pizza_speziale.dart @@ -0,0 +1,63 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// PizzaSpeziale + /// + /// Properties: + /// * [toppings] + /// * [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 + + + @freezed + class PizzaSpeziale with _$PizzaSpeziale { + const PizzaSpeziale._(); + + const factory PizzaSpeziale({ + @JsonKey(name: r'toppings') + String? + toppings, + @JsonKey(name: r'pizzaSize') + num? + pizzaSize, + /// Hyperlink reference + @JsonKey(name: r'href') + String? + href, + /// unique identifier + @JsonKey(name: r'id') + String? + id, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation') + String? + atSchemaLocation, + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType') + String? + atBaseType, + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type') + required String + atType, + }) = _PizzaSpeziale; + + factory PizzaSpeziale.fromJson(Map json) => _$PizzaSpezialeFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/primitive_union_types.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/primitive_union_types.dart new file mode 100644 index 000000000000..fafa083471b8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/lib/src/model/primitive_union_types.dart @@ -0,0 +1,60 @@ +part of 'models.dart'; + +@freezed +class IntInUnion with _$IntInUnion{ + const factory IntInUnion({ + required int intValue + }) = _IntInUnion; + + factory IntInUnion.fromJson(Map json) => _$IntInUnionFromJson(json); +} + +@freezed +class StringInUnion with _$StringInUnion{ + const factory StringInUnion({ + required String stringValue + }) = _StringInUnion; + + factory StringInUnion.fromJson(Map json) => _$StringInUnionFromJson(json); +} +@freezed +class BoolInUnion with _$BoolInUnion{ + const factory BoolInUnion({ + required bool boolValue + }) = _BoolInUnion; + + factory BoolInUnion.fromJson(Map json) => _$BoolInUnionFromJson(json); +} + +@freezed +class DoubleInUnion with _$DoubleInUnion{ + const factory DoubleInUnion({ + required double doubleValue + }) = _DoubleInUnion; + + factory DoubleInUnion.fromJson(Map json) => _$DoubleInUnionFromJson(json); +} + +@freezed +class ObjectInUnion with _$ObjectInUnion { + const factory ObjectInUnion({required Object objectValue}) = _ObjectInUnion; + + factory ObjectInUnion.fromJson(Map json) => + _$ObjectInUnionFromJson(json); +} + +@freezed +class NumInUnion with _$NumInUnion{ + const factory NumInUnion({required num numValue}) = _NumInUnion; + + factory NumInUnion.fromJson(Map json) => _$NumInUnionFromJson(json); +} + +@freezed +class DateTimeInUnion with _$DateTimeInUnion { +const factory DateTimeInUnion({required DateTime dateTimeValue}) = +_DateTimeInUnion; + +factory DateTimeInUnion.fromJson(Map json) => +_$DateTimeInUnionFromJson(json); +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/pubspec.yaml new file mode 100644 index 000000000000..445bc9f8f04d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/pubspec.yaml @@ -0,0 +1,19 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client +homepage: homepage + + +environment: + sdk: '^3.0.0' + +dependencies: + dio: '^5.7.0' + freezed_annotation: '^2.4.4' + json_annotation: '^4.9.0' + +dev_dependencies: + freezed: '^2.5.2' + json_serializable: '^6.8.0' + build_runner: any + test: '^1.16.0' diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/addressable_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/addressable_test.dart new file mode 100644 index 000000000000..2c4a84f1cb39 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/addressable_test.dart @@ -0,0 +1,23 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Addressable +void main() { + final Addressable? instance = /* Addressable(...) */ null; + // TODO add properties to the entity + + group(Addressable, () { + // Hyperlink reference + // String href + test('to test the property `href`', () async { + // TODO + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/animal_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/animal_test.dart new file mode 100644 index 000000000000..f10b2b96ffe1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/animal_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Animal +void main() { + final Animal? instance = /* Animal(...) */ null; + // TODO add properties to the entity + + group(Animal, () { + // bool bark + test('to test the property `bark`', () async { + // TODO + }); + + // bool declawed + test('to test the property `declawed`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/apple_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/apple_test.dart new file mode 100644 index 000000000000..ff5cc46e59aa --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/apple_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Apple +void main() { + final Apple? instance = /* Apple(...) */ null; + // TODO add properties to the entity + + group(Apple, () { + // int seeds + test('to test the property `seeds`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/banana_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/banana_test.dart new file mode 100644 index 000000000000..6489e32ff77f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/banana_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Banana +void main() { + final Banana? instance = /* Banana(...) */ null; + // TODO add properties to the entity + + group(Banana, () { + // int length + test('to test the property `length`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/bar_api_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/bar_api_test.dart new file mode 100644 index 000000000000..73be91c446e0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/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 { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/bar_create_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/bar_create_test.dart new file mode 100644 index 000000000000..720b7afc6e94 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/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 BarCreate? instance = /* BarCreate(...) */ null; + // TODO add properties to the entity + + group(BarCreate, () { + // String barPropA + test('to test the property `barPropA`', () async { + // TODO + }); + + // String fooPropB + test('to test the property `fooPropB`', () async { + // TODO + }); + + // FooRefOrValue foo + test('to test the property `foo`', () async { + // TODO + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + // TODO + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + // TODO + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + // TODO + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + // TODO + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/bar_ref_or_value_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/bar_ref_or_value_test.dart new file mode 100644 index 000000000000..4f79824c2388 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/bar_ref_or_value_test.dart @@ -0,0 +1,68 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BarRefOrValue +void main() { + final BarRefOrValue? instance = /* BarRefOrValue(...) */ null; + // TODO add properties to the entity + + group(BarRefOrValue, () { + // unique identifier + // String id + test('to test the property `id`', () async { + // TODO + }); + + // String barPropA + test('to test the property `barPropA`', () async { + // TODO + }); + + // String fooPropB + test('to test the property `fooPropB`', () async { + // TODO + }); + + // FooRefOrValue foo + test('to test the property `foo`', () async { + // TODO + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + // TODO + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + // TODO + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + // TODO + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + // TODO + }); + + // Name of the related entity. + // String name + test('to test the property `name`', () async { + // TODO + }); + + // The actual type of the target instance when needed for disambiguation. + // String atReferredType + test('to test the property `atReferredType`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/bar_ref_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/bar_ref_test.dart new file mode 100644 index 000000000000..9d5acfcd10f6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/bar_ref_test.dart @@ -0,0 +1,53 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BarRef +void main() { + final BarRef? instance = /* BarRef(...) */ null; + // TODO add properties to the entity + + group(BarRef, () { + // Name of the related entity. + // String name + test('to test the property `name`', () async { + // TODO + }); + + // The actual type of the target instance when needed for disambiguation. + // String atReferredType + test('to test the property `atReferredType`', () async { + // TODO + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + // TODO + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + // TODO + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + // TODO + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + // TODO + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/bar_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/bar_test.dart new file mode 100644 index 000000000000..bacdc3d3b62d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/bar_test.dart @@ -0,0 +1,55 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Bar +void main() { + final Bar? instance = /* Bar(...) */ null; + // TODO add properties to the entity + + group(Bar, () { + // String id + test('to test the property `id`', () async { + // TODO + }); + + // String barPropA + test('to test the property `barPropA`', () async { + // TODO + }); + + // String fooPropB + test('to test the property `fooPropB`', () async { + // TODO + }); + + // FooRefOrValue foo + test('to test the property `foo`', () async { + // TODO + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + // TODO + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + // TODO + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + // TODO + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/cat_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/cat_test.dart new file mode 100644 index 000000000000..5db9e41691fd --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/cat_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Cat +void main() { + final Cat? instance = /* Cat(...) */ null; + // TODO add properties to the entity + + group(Cat, () { + // bool declawed + test('to test the property `declawed`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/dog_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/dog_test.dart new file mode 100644 index 000000000000..93f3e1cb3f76 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/dog_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Dog +void main() { + final Dog? instance = /* Dog(...) */ null; + // TODO add properties to the entity + + group(Dog, () { + // bool bark + test('to test the property `bark`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/entity_ref_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/entity_ref_test.dart new file mode 100644 index 000000000000..65fed045507a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/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 EntityRef? instance = /* EntityRef(...) */ null; + // TODO add properties to the entity + + group(EntityRef, () { + // Name of the related entity. + // String name + test('to test the property `name`', () async { + // TODO + }); + + // The actual type of the target instance when needed for disambiguation. + // String atReferredType + test('to test the property `atReferredType`', () async { + // TODO + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + // TODO + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + // TODO + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + // TODO + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + // TODO + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/entity_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/entity_test.dart new file mode 100644 index 000000000000..b34dd0ec767d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/entity_test.dart @@ -0,0 +1,41 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Entity +void main() { + final Entity? instance = /* Entity(...) */ null; + // TODO add properties to the entity + + group(Entity, () { + // Hyperlink reference + // String href + test('to test the property `href`', () async { + // TODO + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + // TODO + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + // TODO + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + // TODO + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/extensible_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/extensible_test.dart new file mode 100644 index 000000000000..df1f73c05b35 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/extensible_test.dart @@ -0,0 +1,29 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Extensible +void main() { + final Extensible? instance = /* Extensible(...) */ null; + // TODO 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 { + // TODO + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + // TODO + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/foo_api_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/foo_api_test.dart new file mode 100644 index 000000000000..40bc24e691ea --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/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 { + // TODO + }); + + // GET all Foos + // + //Future> getAllFoos() async + test('test getAllFoos', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/foo_ref_or_value_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/foo_ref_or_value_test.dart new file mode 100644 index 000000000000..584565158cc0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/foo_ref_or_value_test.dart @@ -0,0 +1,68 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FooRefOrValue +void main() { + final FooRefOrValue? instance = /* FooRefOrValue(...) */ null; + // TODO add properties to the entity + + group(FooRefOrValue, () { + // String fooPropA + test('to test the property `fooPropA`', () async { + // TODO + }); + + // String fooPropB + test('to test the property `fooPropB`', () async { + // TODO + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + // TODO + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + // TODO + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + // TODO + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + // TODO + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + // TODO + }); + + // String foorefPropA + test('to test the property `foorefPropA`', () async { + // TODO + }); + + // Name of the related entity. + // String name + test('to test the property `name`', () async { + // TODO + }); + + // The actual type of the target instance when needed for disambiguation. + // String atReferredType + test('to test the property `atReferredType`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/foo_ref_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/foo_ref_test.dart new file mode 100644 index 000000000000..53529ee1c1b1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/foo_ref_test.dart @@ -0,0 +1,58 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FooRef +void main() { + final FooRef? instance = /* FooRef(...) */ null; + // TODO add properties to the entity + + group(FooRef, () { + // String foorefPropA + test('to test the property `foorefPropA`', () async { + // TODO + }); + + // Name of the related entity. + // String name + test('to test the property `name`', () async { + // TODO + }); + + // The actual type of the target instance when needed for disambiguation. + // String atReferredType + test('to test the property `atReferredType`', () async { + // TODO + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + // TODO + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + // TODO + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + // TODO + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + // TODO + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/foo_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/foo_test.dart new file mode 100644 index 000000000000..e4ccad0f338a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/foo_test.dart @@ -0,0 +1,51 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Foo +void main() { + final Foo? instance = /* Foo(...) */ null; + // TODO add properties to the entity + + group(Foo, () { + // String fooPropA + test('to test the property `fooPropA`', () async { + // TODO + }); + + // String fooPropB + test('to test the property `fooPropB`', () async { + // TODO + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + // TODO + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + // TODO + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + // TODO + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + // TODO + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/fruit_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/fruit_test.dart new file mode 100644 index 000000000000..41ab86333d84 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/fruit_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Fruit +void main() { + final Fruit? instance = /* Fruit(...) */ null; + // TODO add properties to the entity + + group(Fruit, () { + // FruitType fruitType + test('to test the property `fruitType`', () async { + // TODO + }); + + // int seeds + test('to test the property `seeds`', () async { + // TODO + }); + + // int length + test('to test the property `length`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/fruit_type_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/fruit_type_test.dart new file mode 100644 index 000000000000..9bf9b6c2dd45 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/fruit_type_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FruitType +void main() { + + group(FruitType, () { + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/pasta_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/pasta_test.dart new file mode 100644 index 000000000000..c944fa0db8e7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/pasta_test.dart @@ -0,0 +1,46 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Pasta +void main() { + final Pasta? instance = /* Pasta(...) */ null; + // TODO add properties to the entity + + group(Pasta, () { + // String vendor + test('to test the property `vendor`', () async { + // TODO + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + // TODO + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + // TODO + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + // TODO + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + // TODO + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/pizza_speziale_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/pizza_speziale_test.dart new file mode 100644 index 000000000000..8f931321e11d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/pizza_speziale_test.dart @@ -0,0 +1,51 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for PizzaSpeziale +void main() { + final PizzaSpeziale? instance = /* PizzaSpeziale(...) */ null; + // TODO add properties to the entity + + group(PizzaSpeziale, () { + // String toppings + test('to test the property `toppings`', () async { + // TODO + }); + + // num pizzaSize + test('to test the property `pizzaSize`', () async { + // TODO + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + // TODO + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + // TODO + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + // TODO + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + // TODO + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/pizza_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/pizza_test.dart new file mode 100644 index 000000000000..f23c37b80e8b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_polymorphism_and_inheritance/test/pizza_test.dart @@ -0,0 +1,46 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Pizza +void main() { + final Pizza? instance = /* Pizza(...) */ null; + // TODO add properties to the entity + + group(Pizza, () { + // num pizzaSize + test('to test the property `pizzaSize`', () async { + // TODO + }); + + // Hyperlink reference + // String href + test('to test the property `href`', () async { + // TODO + }); + + // unique identifier + // String id + test('to test the property `id`', () async { + // TODO + }); + + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + // TODO + }); + + // When sub-classing, this defines the super-class + // String atBaseType + test('to test the property `atBaseType`', () async { + // TODO + }); + + // When sub-classing, this defines the sub-class Extensible name + // String atType + test('to test the property `atType`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/.gitignore b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/.gitignore new file mode 100644 index 000000000000..4298cdcbd1a2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/.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/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/.openapi-generator-ignore b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/.openapi-generator/FILES new file mode 100644 index 000000000000..f99d1b97b0b5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/.openapi-generator/FILES @@ -0,0 +1,20 @@ +.gitignore +README.md +analysis_options.yaml +build.yaml +doc/Child.md +doc/DefaultApi.md +doc/Example.md +lib/openapi.dart +lib/src/api.dart +lib/src/api/default_api.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/child.dart +lib/src/model/example.dart +lib/src/model/models.dart +lib/src/model/primitive_union_types.dart +pubspec.yaml diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/.openapi-generator/VERSION new file mode 100644 index 000000000000..9e0e9bce84b2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.17.0-SNAPSHOT diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/README.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/README.md new file mode 100644 index 000000000000..673e46a500a2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/README.md @@ -0,0 +1,84 @@ +# openapi (EXPERIMENTAL) +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 +- Generator version: 7.17.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.DartDioClientCodegen + +## 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().getDefaultApi(); + +try { + final response = await api.list(); + print(response); +} catch on DioException (e) { + print("Exception when calling DefaultApi->list: $e\n"); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://api.example.xyz/v1* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +[*DefaultApi*](doc/DefaultApi.md) | [**list**](doc/DefaultApi.md#list) | **GET** /example | + + +## Documentation For Models + + - [Child](doc/Child.md) + - [Example](doc/Example.md) + + +## Documentation For Authorization + +Endpoints do not require authorization. + + +## Author + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/analysis_options.yaml b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/analysis_options.yaml new file mode 100644 index 000000000000..8ff047ce7675 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/analysis_options.yaml @@ -0,0 +1,11 @@ +analyzer: + language: + strict-inference: true + strict-raw-types: true + strict-casts: false + exclude: + - test/*.dart + - lib/src/model/*.g.dart + - lib/src/model/*.freezed.dart + errors: + deprecated_member_use_from_same_package: ignore diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/build.yaml b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/build.yaml new file mode 100644 index 000000000000..dee5edd67f90 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/build.yaml @@ -0,0 +1,11 @@ +targets: + $default: + builders: + freezed|freezed: + # This restricts freezed build runner to look + # files only inside models folder. + # If you prefer the build runner to scan the whole + # project for files then simply remove this build.yaml file + generate_for: + include: + - "lib/src/model/**.dart" \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/doc/Child.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/doc/Child.md new file mode 100644 index 000000000000..bed0f2feec12 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/doc/Child.md @@ -0,0 +1,15 @@ +# openapi.model.Child + +## Load the model package +```dart +import 'package:openapi/api.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/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/doc/DefaultApi.md new file mode 100644 index 000000000000..c4077a67727b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/doc/DefaultApi.md @@ -0,0 +1,51 @@ +# openapi.api.DefaultApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://api.example.xyz/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**list**](DefaultApi.md#list) | **GET** /example | + + +# **list** +> Example list() + + + +### Example +```dart +import 'package:openapi/api.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 + +[**Example**](Example.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/doc/Example.md b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/doc/Example.md new file mode 100644 index 000000000000..bf49bb137a60 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/doc/Example.md @@ -0,0 +1,15 @@ +# openapi.model.Example + +## Load the model package +```dart +import 'package:openapi/api.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/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/openapi.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/openapi.dart new file mode 100644 index 000000000000..581830866afb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/openapi.dart @@ -0,0 +1,15 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +export 'package:openapi/src/api.dart'; +export 'package:openapi/src/auth/api_key_auth.dart'; +export 'package:openapi/src/auth/basic_auth.dart'; +export 'package:openapi/src/auth/bearer_auth.dart'; +export 'package:openapi/src/auth/oauth.dart'; + + +export 'package:openapi/src/api/default_api.dart'; + + +export 'package:openapi/src/model/models.dart'; \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/api.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/api.dart new file mode 100644 index 000000000000..295416c42814 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/api.dart @@ -0,0 +1,68 @@ +// +// 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/default_api.dart'; + +class Openapi { + static const String basePath = r'http://api.example.xyz/v1'; + + 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 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); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/api/default_api.dart new file mode 100644 index 000000000000..afce265c9b5b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/api/default_api.dart @@ -0,0 +1,89 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'dart:convert'; +import '../model/models.dart'; +import 'package:dio/dio.dart'; + + +class DefaultApi { + + final Dio _dio; + + const DefaultApi(this._dio); + + /// 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 [Example] 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 _path = r'/example'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Example _responseData; + + + try { + _responseData = Example.fromJson(_response.data as Map); + + } 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, + ); + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/auth/api_key_auth.dart new file mode 100644 index 000000000000..ee16e3f0f92f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/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/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/auth/auth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/auth/auth.dart new file mode 100644 index 000000000000..f7ae9bf3f11e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/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/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/auth/basic_auth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/auth/basic_auth.dart new file mode 100644 index 000000000000..b65ccb5b71f7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/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']?.toLowerCase() == '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/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/auth/bearer_auth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/auth/bearer_auth.dart new file mode 100644 index 000000000000..8f46678761b2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/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']?.toLowerCase() == '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/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/auth/oauth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/auth/oauth.dart new file mode 100644 index 000000000000..337cf762b0ce --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/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/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/model/child.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/model/child.dart new file mode 100644 index 000000000000..b75f2f2e357d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/model/child.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Child + /// + /// Properties: + /// * [name] + + @freezed + class Child with _$Child { + const Child._(); + + const factory Child({ + @JsonKey(name: r'name') + String? + name, + }) = _Child; + + + factory Child.fromJson(Map json) => _$ChildFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/model/example.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/model/example.dart new file mode 100644 index 000000000000..bbcd66fa1290 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/model/example.dart @@ -0,0 +1,99 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Example + /// + /// Properties: + /// * [name] + + + + @freezed + sealed class Example with _$Example { + const Example._(); + + const factory Example.asChild({ + required Child childValue + }) = ExampleAsChild; + const factory Example.asIntInUnion({ + required IntInUnion intValue + }) = ExampleAsIntInUnion; + const factory Example.unknown({ + @Default('Json does not satisfy any available types') String message, + required Map json, + + @Default(DeserializationErrorType.UnKnownType) + DeserializationErrorType errorType, + + @Default([Child,int,]) + List possibleTypes, + + @Default([]) + List deserializedModels, + }) = ExampleUnknown; + + + factory Example.fromJson(Map json) { + // A discriminator property is not defined in the spec so + // we try to parse the json against all the models and try to + // return one of the valid model. Note: this approach tries + // to return one valid model and if more than one model + // is valid it then returns unknown type along with the json so + // the consumer can decide which model it is. + Example? deserializedModel; + final fromJsonMethods = >[Child.fromJson,IntInUnion.fromJson,]; + final deserializedModels = []; + for (final fromJsonMethod in fromJsonMethods) { + try { + final dynamic parsedModel= fromJsonMethod.call(json); + // Note following line won't be executed if already the above parsing fails. + if (parsedModel is Child) { + deserializedModel = Example.asChild( + childValue : parsedModel, + ); + } else + if (parsedModel is IntInUnion) { + deserializedModel = Example.asIntInUnion( + intValue : parsedModel, + ); + } else + { + deserializedModel = Example.unknown(json: json); + } + deserializedModels.add(deserializedModel); + } catch (e) { + // We are suppressing the deserialization error when the json could not + // be parsed into one of the model. Because we return [Example.unknown] + // if the deserialization fails. + } + } + // Return an unknown type when the incoming json parses into more than one models. + // Since we pass deserializedModels, clients can still use the deserialized model. + // EvenThough this is valid for AnyOf types, Dart doesn't have polymorphic types. + // So we still return this as an unknown type. + if(deserializedModels.length > 1){ + deserializedModel = Example.unknown( + json: json, + deserializedModels: deserializedModels, + errorType: DeserializationErrorType.MoreThanOneTypeSatisfied, + ); + } return deserializedModel ?? Example.unknown(json: json); + } + + + Map toJson() { + return when( + asChild: (asChild) => asChild.toJson(), + asIntInUnion: (asIntInUnion) => asIntInUnion.toJson(), + unknown: (message, json, errorType, possibleTypes, deserializedModels) => {}, + ); + } + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/model/models.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/model/models.dart new file mode 100644 index 000000000000..3c4f94cac696 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/model/models.dart @@ -0,0 +1,20 @@ +//ignore_for_file: invalid_annotation_target +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:dio/dio.dart'; +import 'dart:convert'; + +part 'models.freezed.dart'; +part 'models.g.dart'; + +part 'primitive_union_types.dart'; +part 'child.dart';part 'example.dart'; + +/// A typedef used in the deserialization of OneOf and AnyOf +/// models when no discriminator mapping is provided. +typedef FromJsonMethodType = T Function(Map); + +/// Deserialization error types for OneOf and AnyOf types. +enum DeserializationErrorType { + MoreThanOneTypeSatisfied, + UnKnownType, +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/model/primitive_union_types.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/model/primitive_union_types.dart new file mode 100644 index 000000000000..fafa083471b8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/lib/src/model/primitive_union_types.dart @@ -0,0 +1,60 @@ +part of 'models.dart'; + +@freezed +class IntInUnion with _$IntInUnion{ + const factory IntInUnion({ + required int intValue + }) = _IntInUnion; + + factory IntInUnion.fromJson(Map json) => _$IntInUnionFromJson(json); +} + +@freezed +class StringInUnion with _$StringInUnion{ + const factory StringInUnion({ + required String stringValue + }) = _StringInUnion; + + factory StringInUnion.fromJson(Map json) => _$StringInUnionFromJson(json); +} +@freezed +class BoolInUnion with _$BoolInUnion{ + const factory BoolInUnion({ + required bool boolValue + }) = _BoolInUnion; + + factory BoolInUnion.fromJson(Map json) => _$BoolInUnionFromJson(json); +} + +@freezed +class DoubleInUnion with _$DoubleInUnion{ + const factory DoubleInUnion({ + required double doubleValue + }) = _DoubleInUnion; + + factory DoubleInUnion.fromJson(Map json) => _$DoubleInUnionFromJson(json); +} + +@freezed +class ObjectInUnion with _$ObjectInUnion { + const factory ObjectInUnion({required Object objectValue}) = _ObjectInUnion; + + factory ObjectInUnion.fromJson(Map json) => + _$ObjectInUnionFromJson(json); +} + +@freezed +class NumInUnion with _$NumInUnion{ + const factory NumInUnion({required num numValue}) = _NumInUnion; + + factory NumInUnion.fromJson(Map json) => _$NumInUnionFromJson(json); +} + +@freezed +class DateTimeInUnion with _$DateTimeInUnion { +const factory DateTimeInUnion({required DateTime dateTimeValue}) = +_DateTimeInUnion; + +factory DateTimeInUnion.fromJson(Map json) => +_$DateTimeInUnionFromJson(json); +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/pubspec.yaml new file mode 100644 index 000000000000..445bc9f8f04d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/pubspec.yaml @@ -0,0 +1,19 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client +homepage: homepage + + +environment: + sdk: '^3.0.0' + +dependencies: + dio: '^5.7.0' + freezed_annotation: '^2.4.4' + json_annotation: '^4.9.0' + +dev_dependencies: + freezed: '^2.5.2' + json_serializable: '^6.8.0' + build_runner: any + test: '^1.16.0' diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/test/child_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/test/child_test.dart new file mode 100644 index 000000000000..5c2504f58eb3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/test/child_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Child +void main() { + final Child? instance = /* Child(...) */ null; + // TODO add properties to the entity + + group(Child, () { + // String name + test('to test the property `name`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/test/default_api_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/test/default_api_test.dart new file mode 100644 index 000000000000..e4ec57077946 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/test/default_api_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + + +/// tests for DefaultApi +void main() { + final instance = Openapi().getDefaultApi(); + + group(DefaultApi, () { + //Future list() async + test('test list', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/test/example_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/test/example_test.dart new file mode 100644 index 000000000000..4cabaa4f7fce --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/oneof_primitive/test/example_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Example +void main() { + final Example? instance = /* Example(...) */ null; + // TODO add properties to the entity + + group(Example, () { + // String name + test('to test the property `name`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/.gitignore b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/.gitignore new file mode 100644 index 000000000000..4298cdcbd1a2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/.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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/.openapi-generator-ignore b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/.openapi-generator/FILES new file mode 100644 index 000000000000..a3f13932bea8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/.openapi-generator/FILES @@ -0,0 +1,128 @@ +.gitignore +README.md +analysis_options.yaml +build.yaml +doc/AdditionalPropertiesClass.md +doc/AllOfWithSingleRef.md +doc/Animal.md +doc/AnotherFakeApi.md +doc/ApiResponse.md +doc/ArrayOfArrayOfNumberOnly.md +doc/ArrayOfNumberOnly.md +doc/ArrayTest.md +doc/Capitalization.md +doc/Cat.md +doc/Category.md +doc/ChildWithNullable.md +doc/ClassModel.md +doc/DefaultApi.md +doc/DeprecatedObject.md +doc/Dog.md +doc/EnumArrays.md +doc/EnumTest.md +doc/FakeApi.md +doc/FakeBigDecimalMap200Response.md +doc/FakeClassnameTags123Api.md +doc/FileSchemaTestClass.md +doc/Foo.md +doc/FooGetDefaultResponse.md +doc/FormatTest.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/Order.md +doc/OuterComposite.md +doc/OuterEnum.md +doc/OuterEnumDefaultValue.md +doc/OuterEnumInteger.md +doc/OuterEnumIntegerDefaultValue.md +doc/OuterObjectWithEnumProperty.md +doc/ParentWithNullable.md +doc/Pet.md +doc/PetApi.md +doc/ReadOnlyFirst.md +doc/SingleRefType.md +doc/SpecialModelName.md +doc/StoreApi.md +doc/Tag.md +doc/TestInlineFreeformAdditionalPropertiesRequest.md +doc/User.md +doc/UserApi.md +lib/openapi.dart +lib/src/api.dart +lib/src/api/another_fake_api.dart +lib/src/api/default_api.dart +lib/src/api/fake_api.dart +lib/src/api/fake_classname_tags123_api.dart +lib/src/api/pet_api.dart +lib/src/api/store_api.dart +lib/src/api/user_api.dart +lib/src/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/all_of_with_single_ref.dart +lib/src/model/animal.dart +lib/src/model/api_response.dart +lib/src/model/array_of_array_of_number_only.dart +lib/src/model/array_of_number_only.dart +lib/src/model/array_test.dart +lib/src/model/capitalization.dart +lib/src/model/cat.dart +lib/src/model/category.dart +lib/src/model/child_with_nullable.dart +lib/src/model/class_model.dart +lib/src/model/deprecated_object.dart +lib/src/model/dog.dart +lib/src/model/enum_arrays.dart +lib/src/model/enum_test.dart +lib/src/model/fake_big_decimal_map200_response.dart +lib/src/model/file_schema_test_class.dart +lib/src/model/foo.dart +lib/src/model/foo_get_default_response.dart +lib/src/model/format_test.dart +lib/src/model/has_only_read_only.dart +lib/src/model/health_check_result.dart +lib/src/model/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/models.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/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_with_nullable.dart +lib/src/model/pet.dart +lib/src/model/primitive_union_types.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/test_inline_freeform_additional_properties_request.dart +lib/src/model/user.dart +pubspec.yaml diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/.openapi-generator/VERSION new file mode 100644 index 000000000000..9e0e9bce84b2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.17.0-SNAPSHOT diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/README.md new file mode 100644 index 000000000000..b50f9daf7ed9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/README.md @@ -0,0 +1,211 @@ +# 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 +- Generator version: 7.17.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.DartDioClientCodegen + +## 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 +[*DefaultApi*](doc/DefaultApi.md) | [**fooGet**](doc/DefaultApi.md#fooget) | **GET** /foo | +[*FakeApi*](doc/FakeApi.md) | [**fakeBigDecimalMap**](doc/FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap | +[*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) | [**testAdditionalPropertiesReference**](doc/FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties +[*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) | [**testInlineFreeformAdditionalProperties**](doc/FakeApi.md#testinlinefreeformadditionalproperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties +[*FakeApi*](doc/FakeApi.md) | [**testJsonFormData**](doc/FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +[*FakeApi*](doc/FakeApi.md) | [**testNullable**](doc/FakeApi.md#testnullable) | **POST** /fake/nullable | test nullable parent property +[*FakeApi*](doc/FakeApi.md) | [**testQueryParameterCollectionFormat**](doc/FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | +[*FakeApi*](doc/FakeApi.md) | [**testStringMapReference**](doc/FakeApi.md#teststringmapreference) | **POST** /fake/stringMap-reference | test referenced string map +[*FakeClassnameTags123Api*](doc/FakeClassnameTags123Api.md) | [**testClassname**](doc/FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case +[*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) + - [AllOfWithSingleRef](doc/AllOfWithSingleRef.md) + - [Animal](doc/Animal.md) + - [ApiResponse](doc/ApiResponse.md) + - [ArrayOfArrayOfNumberOnly](doc/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](doc/ArrayOfNumberOnly.md) + - [ArrayTest](doc/ArrayTest.md) + - [Capitalization](doc/Capitalization.md) + - [Cat](doc/Cat.md) + - [Category](doc/Category.md) + - [ChildWithNullable](doc/ChildWithNullable.md) + - [ClassModel](doc/ClassModel.md) + - [DeprecatedObject](doc/DeprecatedObject.md) + - [Dog](doc/Dog.md) + - [EnumArrays](doc/EnumArrays.md) + - [EnumTest](doc/EnumTest.md) + - [FakeBigDecimalMap200Response](doc/FakeBigDecimalMap200Response.md) + - [FileSchemaTestClass](doc/FileSchemaTestClass.md) + - [Foo](doc/Foo.md) + - [FooGetDefaultResponse](doc/FooGetDefaultResponse.md) + - [FormatTest](doc/FormatTest.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) + - [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) + - [ParentWithNullable](doc/ParentWithNullable.md) + - [Pet](doc/Pet.md) + - [ReadOnlyFirst](doc/ReadOnlyFirst.md) + - [SingleRefType](doc/SingleRefType.md) + - [SpecialModelName](doc/SpecialModelName.md) + - [Tag](doc/Tag.md) + - [TestInlineFreeformAdditionalPropertiesRequest](doc/TestInlineFreeformAdditionalPropertiesRequest.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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/analysis_options.yaml b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/analysis_options.yaml new file mode 100644 index 000000000000..8ff047ce7675 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/analysis_options.yaml @@ -0,0 +1,11 @@ +analyzer: + language: + strict-inference: true + strict-raw-types: true + strict-casts: false + exclude: + - test/*.dart + - lib/src/model/*.g.dart + - lib/src/model/*.freezed.dart + errors: + deprecated_member_use_from_same_package: ignore diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/build.yaml b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/build.yaml new file mode 100644 index 000000000000..dee5edd67f90 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/build.yaml @@ -0,0 +1,11 @@ +targets: + $default: + builders: + freezed|freezed: + # This restricts freezed build runner to look + # files only inside models folder. + # If you prefer the build runner to scan the whole + # project for files then simply remove this build.yaml file + generate_for: + include: + - "lib/src/model/**.dart" \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..863b8503db83 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/AdditionalPropertiesClass.md @@ -0,0 +1,16 @@ +# openapi.model.AdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapProperty** | **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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/AllOfWithSingleRef.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/AllOfWithSingleRef.md new file mode 100644 index 000000000000..4c6f3ab2fe11 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/AllOfWithSingleRef.md @@ -0,0 +1,16 @@ +# openapi.model.AllOfWithSingleRef + +## Load the model package +```dart +import 'package:openapi/api.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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Animal.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Animal.md new file mode 100644 index 000000000000..415b56e9bc2e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Animal.md @@ -0,0 +1,16 @@ +# openapi.model.Animal + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to 'red'] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/AnotherFakeApi.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/AnotherFakeApi.md new file mode 100644 index 000000000000..36a94e6bb703 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/AnotherFakeApi.md @@ -0,0 +1,57 @@ +# openapi.api.AnotherFakeApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**call123testSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags + + +# **call123testSpecialTags** +> ModelClient call123testSpecialTags(modelClient) + +To test special tags + +To test special tags and operation ID starting with number + +### Example +```dart +import 'package:openapi/api.dart'; + +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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ApiResponse.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ApiResponse.md new file mode 100644 index 000000000000..7ad5da0f89e4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ApiResponse.md @@ -0,0 +1,17 @@ +# openapi.model.ApiResponse + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..e5b9d669a436 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayArrayNumber** | [**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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ArrayOfNumberOnly.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..fe8e071eb45c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayNumber** | **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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ArrayTest.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ArrayTest.md new file mode 100644 index 000000000000..8ae11de10022 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ArrayTest.md @@ -0,0 +1,17 @@ +# openapi.model.ArrayTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayOfString** | **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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Capitalization.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Capitalization.md new file mode 100644 index 000000000000..4a07b4eb820d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Capitalization.md @@ -0,0 +1,20 @@ +# openapi.model.Capitalization + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**smallCamel** | **String** | | [optional] +**capitalCamel** | **String** | | [optional] +**smallSnake** | **String** | | [optional] +**capitalSnake** | **String** | | [optional] +**sCAETHFlowPoints** | **String** | | [optional] +**ATT_NAME** | **String** | Name of the pet | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Cat.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Cat.md new file mode 100644 index 000000000000..6552eea4b435 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Cat.md @@ -0,0 +1,17 @@ +# openapi.model.Cat + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to 'red'] +**declawed** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Category.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Category.md new file mode 100644 index 000000000000..ae6bc52e89d8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Category.md @@ -0,0 +1,16 @@ +# openapi.model.Category + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **String** | | [default to 'default-name'] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ChildWithNullable.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ChildWithNullable.md new file mode 100644 index 000000000000..770494fcf4cc --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ChildWithNullable.md @@ -0,0 +1,17 @@ +# openapi.model.ChildWithNullable + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | | [optional] +**nullableProperty** | **String** | | [optional] +**otherProperty** | **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/freezed/petstore_client_lib_fake/doc/ClassModel.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ClassModel.md new file mode 100644 index 000000000000..13ae5d3a4708 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ClassModel.md @@ -0,0 +1,15 @@ +# openapi.model.ClassModel + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/DefaultApi.md new file mode 100644 index 000000000000..6abd2b44f9c4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/DefaultApi.md @@ -0,0 +1,51 @@ +# openapi.api.DefaultApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fooGet**](DefaultApi.md#fooget) | **GET** /foo | + + +# **fooGet** +> FooGetDefaultResponse fooGet() + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getDefaultApi(); + +try { + final response = api.fooGet(); + print(response); +} catch on DioException (e) { + print('Exception when calling DefaultApi->fooGet: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/DeprecatedObject.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/DeprecatedObject.md new file mode 100644 index 000000000000..bf2ef67a26fc --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/DeprecatedObject.md @@ -0,0 +1,15 @@ +# openapi.model.DeprecatedObject + +## Load the model package +```dart +import 'package:openapi/api.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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Dog.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Dog.md new file mode 100644 index 000000000000..d36439b767bb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Dog.md @@ -0,0 +1,17 @@ +# openapi.model.Dog + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to 'red'] +**breed** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/EnumArrays.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/EnumArrays.md new file mode 100644 index 000000000000..1d4fd1363b59 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/EnumArrays.md @@ -0,0 +1,16 @@ +# openapi.model.EnumArrays + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justSymbol** | **String** | | [optional] +**arrayEnum** | **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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/EnumTest.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/EnumTest.md new file mode 100644 index 000000000000..7c24fe2347b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/EnumTest.md @@ -0,0 +1,22 @@ +# openapi.model.EnumTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumString** | **String** | | [optional] +**enumStringRequired** | **String** | | +**enumInteger** | **int** | | [optional] +**enumNumber** | **double** | | [optional] +**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] +**outerEnumInteger** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] +**outerEnumDefaultValue** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] +**outerEnumIntegerDefaultValue** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/FakeApi.md new file mode 100644 index 000000000000..1b5e1ca297c8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/FakeApi.md @@ -0,0 +1,1028 @@ +# openapi.api.FakeApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fakeBigDecimalMap**](FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap | +[**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 | +[**testAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties +[**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 +[**testInlineFreeformAdditionalProperties**](FakeApi.md#testinlinefreeformadditionalproperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties +[**testJsonFormData**](FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +[**testNullable**](FakeApi.md#testnullable) | **POST** /fake/nullable | test nullable parent property +[**testQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | +[**testStringMapReference**](FakeApi.md#teststringmapreference) | **POST** /fake/stringMap-reference | test referenced string map + + +# **fakeBigDecimalMap** +> FakeBigDecimalMap200Response fakeBigDecimalMap() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); + +try { + final response = api.fakeBigDecimalMap(); + print(response); +} catch on DioException (e) { + print('Exception when calling FakeApi->fakeBigDecimalMap: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **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) + +# **fakeHealthGet** +> HealthCheckResult fakeHealthGet() + +Health check endpoint + +### Example +```dart +import 'package:openapi/api.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/api.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/api.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/api.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/api.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/api.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/api.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) + +# **testAdditionalPropertiesReference** +> testAdditionalPropertiesReference(requestBody) + +test referenced additionalProperties + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final Map requestBody = Object; // Map | request body + +try { + api.testAdditionalPropertiesReference(requestBody); +} catch on DioException (e) { + print('Exception when calling FakeApi->testAdditionalPropertiesReference: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**Map<String, Object>**](Object.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) + +# **testBodyWithBinary** +> testBodyWithBinary(body) + + + +For this test, the body has to be a binary file. + +### Example +```dart +import 'package:openapi/api.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/api.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/api.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/api.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/api.dart'; +// TODO Configure HTTP basic authorization: http_basic_test +//defaultApiClient.getAuthentication('http_basic_test').username = 'YOUR_USERNAME' +//defaultApiClient.getAuthentication('http_basic_test').password = 'YOUR_PASSWORD'; + +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/api.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 '-efg'] + **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] + **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to '-efg'] + **enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] + **enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] + **enumQueryModelArray** | [**List<ModelEnumClass>**](ModelEnumClass.md)| | [optional] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to '$'] + **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to '-efg'] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testGroupParameters** +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```dart +import 'package:openapi/api.dart'; + +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/api.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) + +# **testInlineFreeformAdditionalProperties** +> testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest) + +test inline free-form additionalProperties + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = ; // TestInlineFreeformAdditionalPropertiesRequest | request body + +try { + api.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); +} catch on DioException (e) { + print('Exception when calling FakeApi->testInlineFreeformAdditionalProperties: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **testInlineFreeformAdditionalPropertiesRequest** | [**TestInlineFreeformAdditionalPropertiesRequest**](TestInlineFreeformAdditionalPropertiesRequest.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testJsonFormData** +> testJsonFormData(param, param2) + +test json serialization of form data + + + +### Example +```dart +import 'package:openapi/api.dart'; + +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) + +# **testNullable** +> testNullable(childWithNullable) + +test nullable parent property + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final ChildWithNullable childWithNullable = ; // ChildWithNullable | request body + +try { + api.testNullable(childWithNullable); +} catch on DioException (e) { + print('Exception when calling FakeApi->testNullable: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **childWithNullable** | [**ChildWithNullable**](ChildWithNullable.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) + +# **testQueryParameterCollectionFormat** +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) + + + +To test the collection format in query parameters + +### Example +```dart +import 'package:openapi/api.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) + +# **testStringMapReference** +> testStringMapReference(requestBody) + +test referenced string map + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final Map requestBody = ; // Map | request body + +try { + api.testStringMapReference(requestBody); +} catch on DioException (e) { + print('Exception when calling FakeApi->testStringMapReference: $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) + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/FakeBigDecimalMap200Response.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/FakeBigDecimalMap200Response.md new file mode 100644 index 000000000000..281dfc44fd8c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/FakeBigDecimalMap200Response.md @@ -0,0 +1,16 @@ +# openapi.model.FakeBigDecimalMap200Response + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**someId** | **num** | | [optional] +**someMap** | **Map<String, num>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..645aebf399f0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/FakeClassnameTags123Api.md @@ -0,0 +1,61 @@ +# openapi.api.FakeClassnameTags123Api + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case + + +# **testClassname** +> ModelClient testClassname(modelClient) + +To test class name in snake case + +To test class name in snake case + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key_query +//defaultApiClient.getAuthentication('api_key_query').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key_query').apiKeyPrefix = 'Bearer'; + +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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/FileSchemaTestClass.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/FileSchemaTestClass.md new file mode 100644 index 000000000000..d14ac319d294 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/FileSchemaTestClass.md @@ -0,0 +1,16 @@ +# openapi.model.FileSchemaTestClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**ModelFile**](ModelFile.md) | | [optional] +**files** | [**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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Foo.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Foo.md new file mode 100644 index 000000000000..185b76e3f5b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Foo.md @@ -0,0 +1,15 @@ +# openapi.model.Foo + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [default to 'bar'] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/FooGetDefaultResponse.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/FooGetDefaultResponse.md new file mode 100644 index 000000000000..10d0133abd95 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/FooGetDefaultResponse.md @@ -0,0 +1,15 @@ +# openapi.model.FooGetDefaultResponse + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/FormatTest.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/FormatTest.md new file mode 100644 index 000000000000..83b60545eb61 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/FormatTest.md @@ -0,0 +1,30 @@ +# openapi.model.FormatTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | | [optional] +**int32** | **int** | | [optional] +**int64** | **int** | | [optional] +**number** | **num** | | +**float** | **double** | | [optional] +**double_** | **double** | | [optional] +**decimal** | **double** | | [optional] +**string** | **String** | | [optional] +**byte** | **String** | | +**binary** | [**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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/HasOnlyReadOnly.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/HasOnlyReadOnly.md new file mode 100644 index 000000000000..32cae937155d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/HasOnlyReadOnly.md @@ -0,0 +1,16 @@ +# openapi.model.HasOnlyReadOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] +**foo** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/HealthCheckResult.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/HealthCheckResult.md new file mode 100644 index 000000000000..4d6aeb75d965 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/HealthCheckResult.md @@ -0,0 +1,15 @@ +# openapi.model.HealthCheckResult + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nullableMessage** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/MapTest.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/MapTest.md new file mode 100644 index 000000000000..197fe780a25a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/MapTest.md @@ -0,0 +1,18 @@ +# openapi.model.MapTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapMapOfString** | [**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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..66d0d39c42be --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,17 @@ +# openapi.model.MixedPropertiesAndAdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **String** | | [optional] +**dateTime** | [**DateTime**](DateTime.md) | | [optional] +**map** | [**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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Model200Response.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Model200Response.md new file mode 100644 index 000000000000..5aa3fb97c32e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Model200Response.md @@ -0,0 +1,16 @@ +# openapi.model.Model200Response + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | [optional] +**class_** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ModelClient.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ModelClient.md new file mode 100644 index 000000000000..f7b922f4a398 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ModelClient.md @@ -0,0 +1,15 @@ +# openapi.model.ModelClient + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ModelEnumClass.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ModelEnumClass.md new file mode 100644 index 000000000000..ebaafb44c7f7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ModelEnumClass.md @@ -0,0 +1,14 @@ +# openapi.model.ModelEnumClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ModelFile.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ModelFile.md new file mode 100644 index 000000000000..4be260e93f6e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ModelFile.md @@ -0,0 +1,15 @@ +# openapi.model.ModelFile + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sourceURI** | **String** | Test capitalization | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ModelList.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ModelList.md new file mode 100644 index 000000000000..283aa1f6b711 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ModelList.md @@ -0,0 +1,15 @@ +# openapi.model.ModelList + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**n123list** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ModelReturn.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ModelReturn.md new file mode 100644 index 000000000000..bc02df7a3692 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ModelReturn.md @@ -0,0 +1,15 @@ +# openapi.model.ModelReturn + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**return_** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Name.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Name.md new file mode 100644 index 000000000000..25f49ea946b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Name.md @@ -0,0 +1,18 @@ +# openapi.model.Name + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | +**snakeCase** | **int** | | [optional] +**property** | **String** | | [optional] +**n123number** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/NullableClass.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/NullableClass.md new file mode 100644 index 000000000000..70ac1091d417 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/NullableClass.md @@ -0,0 +1,26 @@ +# openapi.model.NullableClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integerProp** | **int** | | [optional] +**numberProp** | **num** | | [optional] +**booleanProp** | **bool** | | [optional] +**stringProp** | **String** | | [optional] +**dateProp** | [**DateTime**](DateTime.md) | | [optional] +**datetimeProp** | [**DateTime**](DateTime.md) | | [optional] +**arrayNullableProp** | **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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/NumberOnly.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/NumberOnly.md new file mode 100644 index 000000000000..d8096a3db37a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/NumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.NumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justNumber** | **num** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ObjectWithDeprecatedFields.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..dda2836d8d54 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ObjectWithDeprecatedFields.md @@ -0,0 +1,18 @@ +# openapi.model.ObjectWithDeprecatedFields + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **String** | | [optional] +**id** | **num** | | [optional] +**deprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] +**bars** | **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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Order.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Order.md new file mode 100644 index 000000000000..bde5ffe51a2c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Order.md @@ -0,0 +1,20 @@ +# openapi.model.Order + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**petId** | **int** | | [optional] +**quantity** | **int** | | [optional] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] +**status** | **String** | Order Status | [optional] +**complete** | **bool** | | [optional] [default to false] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/OuterComposite.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/OuterComposite.md new file mode 100644 index 000000000000..04bab7eff5d1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/OuterComposite.md @@ -0,0 +1,17 @@ +# openapi.model.OuterComposite + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | **num** | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/OuterEnum.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/OuterEnum.md new file mode 100644 index 000000000000..af62ad87ab2e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/OuterEnum.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnum + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/OuterEnumDefaultValue.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..c1bf8b0dec44 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/OuterEnumDefaultValue.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumDefaultValue + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/OuterEnumInteger.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/OuterEnumInteger.md new file mode 100644 index 000000000000..8c80a9e5c85f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/OuterEnumInteger.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumInteger + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..eb8b55d70249 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumIntegerDefaultValue + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/OuterObjectWithEnumProperty.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/OuterObjectWithEnumProperty.md new file mode 100644 index 000000000000..eab2ae8f66b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/OuterObjectWithEnumProperty.md @@ -0,0 +1,15 @@ +# openapi.model.OuterObjectWithEnumProperty + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**value** | [**OuterEnumInteger**](OuterEnumInteger.md) | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ParentWithNullable.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ParentWithNullable.md new file mode 100644 index 000000000000..17aa5ca02941 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ParentWithNullable.md @@ -0,0 +1,16 @@ +# openapi.model.ParentWithNullable + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | | [optional] +**nullableProperty** | **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/freezed/petstore_client_lib_fake/doc/Pet.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Pet.md new file mode 100644 index 000000000000..3cd230bfb213 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Pet.md @@ -0,0 +1,20 @@ +# openapi.model.Pet + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/PetApi.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/PetApi.md new file mode 100644 index 000000000000..5fc7fbd2657f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/PetApi.md @@ -0,0 +1,439 @@ +# openapi.api.PetApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**uploadFileWithRequiredFile**](PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) + + +# **addPet** +> addPet(pet) + +Add a new pet to the store + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +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/api.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/api.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/api.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/api.dart'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; + +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/api.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/api.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/api.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/api.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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ReadOnlyFirst.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ReadOnlyFirst.md new file mode 100644 index 000000000000..8f612e8ba19f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/ReadOnlyFirst.md @@ -0,0 +1,16 @@ +# openapi.model.ReadOnlyFirst + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] +**baz** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/SingleRefType.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/SingleRefType.md new file mode 100644 index 000000000000..0dc93840cd7f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/SingleRefType.md @@ -0,0 +1,14 @@ +# openapi.model.SingleRefType + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/SpecialModelName.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/SpecialModelName.md new file mode 100644 index 000000000000..5fcfa98e0b36 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/SpecialModelName.md @@ -0,0 +1,15 @@ +# openapi.model.SpecialModelName + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/StoreApi.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/StoreApi.md new file mode 100644 index 000000000000..42028947229f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/StoreApi.md @@ -0,0 +1,188 @@ +# openapi.api.StoreApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example +```dart +import 'package:openapi/api.dart'; + +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/api.dart'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; + +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/api.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/api.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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Tag.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Tag.md new file mode 100644 index 000000000000..c219f987c19c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/Tag.md @@ -0,0 +1,16 @@ +# openapi.model.Tag + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/TestInlineFreeformAdditionalPropertiesRequest.md new file mode 100644 index 000000000000..e2b2f1fd4468 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/TestInlineFreeformAdditionalPropertiesRequest.md @@ -0,0 +1,15 @@ +# openapi.model.TestInlineFreeformAdditionalPropertiesRequest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**someProperty** | **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/freezed/petstore_client_lib_fake/doc/User.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/User.md new file mode 100644 index 000000000000..fa87e64d8595 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/User.md @@ -0,0 +1,22 @@ +# openapi.model.User + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**username** | **String** | | [optional] +**firstName** | **String** | | [optional] +**lastName** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**userStatus** | **int** | User Status | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/UserApi.md b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/UserApi.md new file mode 100644 index 000000000000..49b79d76b8a1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/doc/UserApi.md @@ -0,0 +1,359 @@ +# openapi.api.UserApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UserApi.md#createuser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + +# **createUser** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +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/api.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/api.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/api.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/api.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/api.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/api.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/api.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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/openapi.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/openapi.dart new file mode 100644 index 000000000000..53e0ea635366 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/openapi.dart @@ -0,0 +1,21 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +export 'package:openapi/src/api.dart'; +export 'package:openapi/src/auth/api_key_auth.dart'; +export 'package:openapi/src/auth/basic_auth.dart'; +export 'package:openapi/src/auth/bearer_auth.dart'; +export 'package:openapi/src/auth/oauth.dart'; + + +export 'package:openapi/src/api/another_fake_api.dart'; +export 'package:openapi/src/api/default_api.dart'; +export 'package:openapi/src/api/fake_api.dart'; +export 'package:openapi/src/api/fake_classname_tags123_api.dart'; +export 'package:openapi/src/api/pet_api.dart'; +export 'package:openapi/src/api/store_api.dart'; +export 'package:openapi/src/api/user_api.dart'; + + +export 'package:openapi/src/model/models.dart'; \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api.dart new file mode 100644 index 000000000000..835b76584b2d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api.dart @@ -0,0 +1,110 @@ +// +// 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/default_api.dart'; +import 'package:openapi/src/api/fake_api.dart'; +import 'package:openapi/src/api/fake_classname_tags123_api.dart'; +import 'package:openapi/src/api/pet_api.dart'; +import 'package:openapi/src/api/store_api.dart'; +import 'package:openapi/src/api/user_api.dart'; + +class Openapi { + static const String basePath = r'http://petstore.swagger.io:80/v2'; + + final Dio dio; + 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 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 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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/another_fake_api.dart new file mode 100644 index 000000000000..0848266271ea --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/another_fake_api.dart @@ -0,0 +1,110 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'dart:convert'; +import '../model/models.dart'; +import 'package:dio/dio.dart'; + + +class AnotherFakeApi { + + final Dio _dio; + + const AnotherFakeApi(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({ + + required ModelClient modelClient, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/another-fake/dummy'; + final _options = Options( + method: r'PATCH', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(modelClient); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ModelClient _responseData; + + + try { + _responseData = ModelClient.fromJson(_response.data as Map); + + } 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, + ); + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/default_api.dart new file mode 100644 index 000000000000..1d8e607e18f3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/default_api.dart @@ -0,0 +1,89 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'dart:convert'; +import '../model/models.dart'; +import 'package:dio/dio.dart'; + + +class DefaultApi { + + final Dio _dio; + + const DefaultApi(this._dio); + + /// fooGet + /// + /// + /// 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 [FooGetDefaultResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> fooGet({ + + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/foo'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + FooGetDefaultResponse _responseData; + + + try { + _responseData = FooGetDefaultResponse.fromJson(_response.data as Map); + + } 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, + ); + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/fake_api.dart new file mode 100644 index 000000000000..33ae292a61e7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/fake_api.dart @@ -0,0 +1,1769 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'dart:convert'; +import '../model/models.dart'; +import 'package:dio/dio.dart'; + + +class FakeApi { + + final Dio _dio; + + const FakeApi(this._dio); + + /// fakeBigDecimalMap + /// for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + /// + /// 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 [FakeBigDecimalMap200Response] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeBigDecimalMap({ + + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/BigDecimalMap'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + FakeBigDecimalMap200Response _responseData; + + + try { + _responseData = FakeBigDecimalMap200Response.fromJson(_response.data as Map); + + } 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, + ); + } + + /// 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 _path = r'/fake/health'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + HealthCheckResult _responseData; + + + try { + _responseData = HealthCheckResult.fromJson(_response.data as Map); + + } 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, + String? query1, + String? header1, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/http-signature-test'; + final _options = Options( + method: r'GET', + headers: { + if (header1 != null) r'header_1': header1, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'signature', + 'name': 'http_signature_test', + }, + ], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (query1 != null) r'query_1': query1, + }; + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(pet); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + 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({ + + bool? body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/outer/boolean'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = body; + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + bool _responseData; + + + try { + _responseData = _response.data as 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({ + + OuterComposite? outerComposite, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/outer/composite'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(outerComposite); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + OuterComposite _responseData; + + + try { + _responseData = OuterComposite.fromJson(_response.data as Map); + + } 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({ + + num? body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/outer/number'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = body; + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + num _responseData; + + + try { + _responseData = _response.data as 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({ + + String? body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/outer/string'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = body; + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + String _responseData; + + + try { + _responseData = _response.data as 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 { + final _path = r'/fake/property/enum-int'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(outerObjectWithEnumProperty); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + OuterObjectWithEnumProperty _responseData; + + + try { + _responseData = OuterObjectWithEnumProperty.fromJson(_response.data as Map); + + } 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 referenced 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> testAdditionalPropertiesReference({ + + required Map requestBody, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/additionalProperties-reference'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(requestBody); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// 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({ + + MultipartFile? body, + 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: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'image/png', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = body?.finalize(); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + 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 { + final _path = r'/fake/body-with-file-schema'; + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(fileSchemaTestClass); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + 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 { + final _path = r'/fake/body-with-query-params'; + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'query': query, + }; + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(user); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// To test \"client\" model + /// To test \"client\" model + /// + /// 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 { + final _path = r'/fake'; + final _options = Options( + method: r'PATCH', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(modelClient); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ModelClient _responseData; + + + try { + _responseData = ModelClient.fromJson(_response.data as Map); + + } 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, + int? integer, + int? int32, + int? int64, + double? float, + String? string, + MultipartFile? binary, + DateTime? date, + DateTime? dateTime, + String? password, + String? callback, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'basic', + 'name': 'http_basic_test', + }, + ], + ...?extra, + }, + contentType: 'application/x-www-form-urlencoded', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = { + if (integer != null) r'integer': integer, + if (int32 != null) r'int32': int32, + if (int64 != null) r'int64': int64, + r'number': number, + if (float != null) r'float': float, + r'double': double_, + if (string != null) r'string': string, + r'pattern_without_delimiter': patternWithoutDelimiter, + r'byte': byte, + if (binary != null) r'binary': binary, + if (date != null) r'date': date, + if (dateTime != null) r'dateTime': dateTime, + if (password != null) r'password': password, + if (callback != null) r'callback': callback, + }; + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + 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) + /// * [enumQueryStringArray] - Query parameter enum test (string array) + /// * [enumQueryString] - Query parameter enum test (string) + /// * [enumQueryInteger] - Query parameter enum test (double) + /// * [enumQueryDouble] - Query parameter enum test (double) + /// * [enumQueryModelArray] + /// * [enumFormStringArray] - Form parameter enum test (string array) + /// * [enumFormString] - Form parameter enum test (string) + /// * [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({ + + List? enumHeaderStringArray, + String? enumHeaderString = '-efg', + List? enumQueryStringArray, + String? enumQueryString = '-efg', + int? enumQueryInteger, + double? enumQueryDouble, + List? enumQueryModelArray, + List? enumFormStringArray, + String? enumFormString, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'GET', + headers: { + if (enumHeaderStringArray != null) r'enum_header_string_array': enumHeaderStringArray, + if (enumHeaderString != null) r'enum_header_string': enumHeaderString, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/x-www-form-urlencoded', + 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, + }; + + dynamic _bodyData; + + try { + _bodyData = { + if (enumFormStringArray != null) r'enum_form_string_array': enumFormStringArray, + if (enumFormString != null) r'enum_form_string': enumFormString, + }; + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Fake endpoint to test group parameters (optional) + /// Fake endpoint to test group parameters (optional) + /// + /// 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, + int? stringGroup, + bool? booleanGroup, + int? int64Group, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'DELETE', + headers: { + r'required_boolean_group': requiredBooleanGroup, + if (booleanGroup != null) r'boolean_group': booleanGroup, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'bearer_test', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'required_string_group': requiredStringGroup, + r'required_int64_group': requiredInt64Group, + if (stringGroup != null) r'string_group': stringGroup, + if (int64Group != null) r'int64_group': int64Group, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test inline additionalProperties + /// + /// + /// 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 { + final _path = r'/fake/inline-additionalProperties'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(requestBody); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test inline free-form additionalProperties + /// + /// + /// Parameters: + /// * [testInlineFreeformAdditionalPropertiesRequest] - 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> testInlineFreeformAdditionalProperties({ + + required TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/inline-freeform-additionalProperties'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(testInlineFreeformAdditionalPropertiesRequest); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + 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 { + final _path = r'/fake/jsonFormData'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/x-www-form-urlencoded', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = { + r'param': param, + r'param2': param2, + }; + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test nullable parent property + /// + /// + /// Parameters: + /// * [childWithNullable] - 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> testNullable({ + + required ChildWithNullable childWithNullable, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/nullable'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(childWithNullable); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + 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, + Map? language, + 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: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + 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, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test referenced string map + /// + /// + /// 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> testStringMapReference({ + + required Map requestBody, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/stringMap-reference'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(requestBody); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/fake_classname_tags123_api.dart new file mode 100644 index 000000000000..e4df96000116 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/fake_classname_tags123_api.dart @@ -0,0 +1,117 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'dart:convert'; +import '../model/models.dart'; +import 'package:dio/dio.dart'; + + +class FakeClassnameTags123Api { + + final Dio _dio; + + const FakeClassnameTags123Api(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({ + + required ModelClient modelClient, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake_classname_test'; + final _options = Options( + method: r'PATCH', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'apiKey', + 'name': 'api_key_query', + 'keyName': 'api_key_query', + 'where': 'query', + }, + ], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(modelClient); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ModelClient _responseData; + + + try { + _responseData = ModelClient.fromJson(_response.data as Map); + + } 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, + ); + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/pet_api.dart new file mode 100644 index 000000000000..353d3b783c25 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/pet_api.dart @@ -0,0 +1,765 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'dart:convert'; +import '../model/models.dart'; +import 'package:dio/dio.dart'; + + +class PetApi { + + final Dio _dio; + + const PetApi(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({ + + required Pet pet, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(pet); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + 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, + String? apiKey, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); + final _options = Options( + method: r'DELETE', + headers: { + if (apiKey != null) r'api_key': apiKey, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + 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 _path = r'/pet/findByStatus'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'status': status, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + List _responseData; + + + try { + final _responseDataAsList = _response.data as List; + _responseData = _responseDataAsList.map((dynamic e)=> Pet.fromJson(e as Map)).toList(); + + } 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 _path = r'/pet/findByTags'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'tags': tags, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Set _responseData; + + + try { + final _responseDataAsSet = _response.data as List; + _responseData = _responseDataAsSet.map((dynamic e)=> Pet.fromJson(e as Map)).toSet(); + + } 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 _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'apiKey', + 'name': 'api_key', + 'keyName': 'api_key', + 'where': 'header', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Pet _responseData; + + + try { + _responseData = Pet.fromJson(_response.data as Map); + + } 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 { + final _path = r'/pet'; + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(pet); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + 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, + String? name, + String? status, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: 'application/x-www-form-urlencoded', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = { + if (name != null) r'name': name, + if (status != null) r'status': status, + }; + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + 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, + String? additionalMetadata, + MultipartFile? file, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/{petId}/uploadImage'.replaceAll('{' r'petId' '}', petId.toString()); + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: 'multipart/form-data', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = FormData.fromMap({ + if (additionalMetadata != null) + r'additionalMetadata': + + jsonEncode(additionalMetadata), + if (file != null) + r'file': + file + , + }); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ApiResponse _responseData; + + + try { + _responseData = ApiResponse.fromJson(_response.data as Map); + + } 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, + String? additionalMetadata, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/{petId}/uploadImageWithRequiredFile'.replaceAll('{' r'petId' '}', petId.toString()); + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: 'multipart/form-data', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = FormData.fromMap({ + if (additionalMetadata != null) + r'additionalMetadata': + + jsonEncode(additionalMetadata), +r'requiredFile': + requiredFile + , + }); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ApiResponse _responseData; + + + try { + _responseData = ApiResponse.fromJson(_response.data as Map); + + } 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, + ); + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/store_api.dart new file mode 100644 index 000000000000..37987c684ef2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/store_api.dart @@ -0,0 +1,309 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'dart:convert'; +import '../model/models.dart'; +import 'package:dio/dio.dart'; + + +class StoreApi { + + final Dio _dio; + + const StoreApi(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, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/store/order/{order_id}'.replaceAll('{' r'order_id' '}', orderId.toString()); + final _options = Options( + method: r'DELETE', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + 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 _path = r'/store/inventory'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'apiKey', + 'name': 'api_key', + 'keyName': 'api_key', + 'where': 'header', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Map _responseData; + + + try { + _responseData = _response.data as Map; + + } 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 _path = r'/store/order/{order_id}'.replaceAll('{' r'order_id' '}', orderId.toString()); + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Order _responseData; + + + try { + _responseData = Order.fromJson(_response.data as Map); + + } 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 { + final _path = r'/store/order'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(order); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Order _responseData; + + + try { + _responseData = Order.fromJson(_response.data as Map); + + } 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, + ); + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/user_api.dart new file mode 100644 index 000000000000..a68b3f17dad1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/api/user_api.dart @@ -0,0 +1,536 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +import 'dart:convert'; +import '../model/models.dart'; +import 'package:dio/dio.dart'; + + +class UserApi { + + final Dio _dio; + + const UserApi(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({ + + required User user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(user); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + 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 { + final _path = r'/user/createWithArray'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(user); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + 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 { + final _path = r'/user/createWithList'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(user); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + 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 _path = r'/user/{username}'.replaceAll('{' r'username' '}', username.toString()); + final _options = Options( + method: r'DELETE', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + 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 _path = r'/user/{username}'.replaceAll('{' r'username' '}', username.toString()); + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + User _responseData; + + + try { + _responseData = User.fromJson(_response.data as Map); + + } 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 _path = r'/user/login'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'username': username, + r'password': password, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + String _responseData; + + + try { + _responseData = _response.data as String; + + } catch (error, 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 _path = r'/user/logout'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + 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 { + final _path = r'/user/{username}'.replaceAll('{' r'username' '}', username.toString()); + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData=jsonEncode(user); + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/auth/api_key_auth.dart new file mode 100644 index 000000000000..ee16e3f0f92f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/auth/auth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/auth/auth.dart new file mode 100644 index 000000000000..f7ae9bf3f11e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/auth/basic_auth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/auth/basic_auth.dart new file mode 100644 index 000000000000..b65ccb5b71f7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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']?.toLowerCase() == '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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/auth/bearer_auth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/auth/bearer_auth.dart new file mode 100644 index 000000000000..8f46678761b2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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']?.toLowerCase() == '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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/auth/oauth.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/auth/oauth.dart new file mode 100644 index 000000000000..337cf762b0ce --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/auth/oauth.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/auth.dart'; + +class OAuthInterceptor extends AuthInterceptor { + final Map tokens = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final authInfo = getAuthInfo(options, (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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/additional_properties_class.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/additional_properties_class.dart new file mode 100644 index 000000000000..9cdb358a3bfd --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/additional_properties_class.dart @@ -0,0 +1,44 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// AdditionalPropertiesClass + /// + /// Properties: + /// * [mapProperty] + /// * [mapOfMapProperty] + + @freezed + class AdditionalPropertiesClass with _$AdditionalPropertiesClass { + const AdditionalPropertiesClass._(); + + const factory AdditionalPropertiesClass({ + @JsonKey(name: r'map_property') + Map? + mapProperty, + @JsonKey(name: r'map_of_map_property') + Map? +>? + mapOfMapProperty, + }) = _AdditionalPropertiesClass; + + + factory AdditionalPropertiesClass.fromJson(Map json) => _$AdditionalPropertiesClassFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/all_of_with_single_ref.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/all_of_with_single_ref.dart new file mode 100644 index 000000000000..857a695716b1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/all_of_with_single_ref.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// AllOfWithSingleRef + /// + /// Properties: + /// * [username] + /// * [singleRefType] + + @freezed + class AllOfWithSingleRef with _$AllOfWithSingleRef { + const AllOfWithSingleRef._(); + + const factory AllOfWithSingleRef({ + @JsonKey(name: r'username') + String? + username, + @JsonKey(name: r'SingleRefType') + SingleRefType? + singleRefType, + }) = _AllOfWithSingleRef; + + + factory AllOfWithSingleRef.fromJson(Map json) => _$AllOfWithSingleRefFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/animal.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/animal.dart new file mode 100644 index 000000000000..30b413209090 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/animal.dart @@ -0,0 +1,67 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Animal + /// + /// Properties: + /// * [className] + /// * [color] + + @freezed + sealed class Animal with _$Animal { + const Animal._(); + + const factory Animal.asCat({ + required Cat catValue + }) = AnimalAsCat; + const factory Animal.asDog({ + required Dog dogValue + }) = AnimalAsDog; + const factory Animal.unknown({ + @Default('Json does not satisfy any available types') String message, + required Map json, + + @Default(DeserializationErrorType.UnKnownType) + DeserializationErrorType errorType, + + @Default([]) + List possibleTypes, + + @Default([]) + List deserializedModels, + }) = AnimalUnknown; + + + factory Animal.fromJson(Map json) { + switch(json['className']){ + case 'CAT': + return Animal.asCat( + catValue : Cat.fromJson(json), + ); + case 'DOG': + return Animal.asDog( + dogValue : Dog.fromJson(json), + ); + } + return Animal.unknown(json: json); + } + + + + Map toJson() { + return when( + asCat: (asCat) => asCat.toJson(), + asDog: (asDog) => asDog.toJson(), + unknown: (message, json, errorType, possibleTypes, deserializedModels) => {}, + ); + } + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/api_response.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/api_response.dart new file mode 100644 index 000000000000..2316f402fe13 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/api_response.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// ApiResponse + /// + /// Properties: + /// * [code] + /// * [type] + /// * [message] + + @freezed + class ApiResponse with _$ApiResponse { + const ApiResponse._(); + + const factory ApiResponse({ + @JsonKey(name: r'code') + int? + code, + @JsonKey(name: r'type') + String? + type, + @JsonKey(name: r'message') + String? + message, + }) = _ApiResponse; + + + factory ApiResponse.fromJson(Map json) => _$ApiResponseFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/array_of_array_of_number_only.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/array_of_array_of_number_only.dart new file mode 100644 index 000000000000..8a55642b0b5d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/array_of_array_of_number_only.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// ArrayOfArrayOfNumberOnly + /// + /// Properties: + /// * [arrayArrayNumber] + + @freezed + class ArrayOfArrayOfNumberOnly with _$ArrayOfArrayOfNumberOnly { + const ArrayOfArrayOfNumberOnly._(); + + const factory ArrayOfArrayOfNumberOnly({ + @JsonKey(name: r'ArrayArrayNumber') + List< + List< + num? +>? +>? + arrayArrayNumber, + }) = _ArrayOfArrayOfNumberOnly; + + + factory ArrayOfArrayOfNumberOnly.fromJson(Map json) => _$ArrayOfArrayOfNumberOnlyFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/array_of_number_only.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/array_of_number_only.dart new file mode 100644 index 000000000000..1a9ff7348fa3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/array_of_number_only.dart @@ -0,0 +1,36 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// ArrayOfNumberOnly + /// + /// Properties: + /// * [arrayNumber] + + @freezed + class ArrayOfNumberOnly with _$ArrayOfNumberOnly { + const ArrayOfNumberOnly._(); + + const factory ArrayOfNumberOnly({ + @JsonKey(name: r'ArrayNumber') + List< + num? +>? + arrayNumber, + }) = _ArrayOfNumberOnly; + + + factory ArrayOfNumberOnly.fromJson(Map json) => _$ArrayOfNumberOnlyFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/array_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/array_test.dart new file mode 100644 index 000000000000..6648e6d8b607 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/array_test.dart @@ -0,0 +1,52 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// ArrayTest + /// + /// Properties: + /// * [arrayOfString] + /// * [arrayArrayOfInteger] + /// * [arrayArrayOfModel] + + @freezed + class ArrayTest with _$ArrayTest { + const ArrayTest._(); + + const factory ArrayTest({ + @JsonKey(name: r'array_of_string') + List< + String? +>? + arrayOfString, + @JsonKey(name: r'array_array_of_integer') + List< + List< + int? +>? +>? + arrayArrayOfInteger, + @JsonKey(name: r'array_array_of_model') + List< + List< + ReadOnlyFirst? +>? +>? + arrayArrayOfModel, + }) = _ArrayTest; + + + factory ArrayTest.fromJson(Map json) => _$ArrayTestFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/capitalization.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/capitalization.dart new file mode 100644 index 000000000000..7446ec95c104 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/capitalization.dart @@ -0,0 +1,55 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Capitalization + /// + /// Properties: + /// * [smallCamel] + /// * [capitalCamel] + /// * [smallSnake] + /// * [capitalSnake] + /// * [sCAETHFlowPoints] + /// * [ATT_NAME] - Name of the pet + + @freezed + class Capitalization with _$Capitalization { + const Capitalization._(); + + const factory Capitalization({ + @JsonKey(name: r'smallCamel') + String? + smallCamel, + @JsonKey(name: r'CapitalCamel') + String? + capitalCamel, + @JsonKey(name: r'small_Snake') + String? + smallSnake, + @JsonKey(name: r'Capital_Snake') + String? + capitalSnake, + @JsonKey(name: r'SCA_ETH_Flow_Points') + String? + sCAETHFlowPoints, + /// Name of the pet + @JsonKey(name: r'ATT_NAME') + String? + ATT_NAME, + }) = _Capitalization; + + + factory Capitalization.fromJson(Map json) => _$CapitalizationFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/cat.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/cat.dart new file mode 100644 index 000000000000..b9fb961b58f3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/cat.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Cat + /// + /// Properties: + /// * [className] + /// * [color] + /// * [declawed] + + + @freezed + class Cat with _$Cat { + const Cat._(); + + const factory Cat({ + @JsonKey(name: r'className') + required String + className, + @JsonKey(name: r'color') + String? + color, + @JsonKey(name: r'declawed') + bool? + declawed, + }) = _Cat; + + factory Cat.fromJson(Map json) => _$CatFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/category.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/category.dart new file mode 100644 index 000000000000..7c1fda5de175 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/category.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Category + /// + /// Properties: + /// * [id] + /// * [name] + + @freezed + class Category with _$Category { + const Category._(); + + const factory Category({ + @JsonKey(name: r'id') + int? + id, + @JsonKey(name: r'name') + required String + name, + }) = _Category; + + + factory Category.fromJson(Map json) => _$CategoryFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/child_with_nullable.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/child_with_nullable.dart new file mode 100644 index 000000000000..99ccb6be3c59 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/child_with_nullable.dart @@ -0,0 +1,49 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// ChildWithNullable + /// + /// Properties: + /// * [type] + /// * [nullableProperty] + /// * [otherProperty] + + + @freezed + class ChildWithNullable with _$ChildWithNullable { + const ChildWithNullable._(); + + const factory ChildWithNullable({ + @JsonKey(name: r'type') + ChildWithNullableTypeEnum? + type, + @JsonKey(name: r'nullableProperty') + String? + nullableProperty, + @JsonKey(name: r'otherProperty') + String? + otherProperty, + }) = _ChildWithNullable; + + factory ChildWithNullable.fromJson(Map json) => _$ChildWithNullableFromJson(json); + + + + + + +} + + + + @JsonEnum(valueField: 'value') + enum ChildWithNullableTypeEnum { + childWithNullable(value: r'ChildWithNullable'), + unknownDefaultOpenApi(value: r'unknown_default_open_api'); + const ChildWithNullableTypeEnum({required this.value}); + final String value; + } diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/class_model.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/class_model.dart new file mode 100644 index 000000000000..ee248ecb7dfb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/class_model.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Model for testing model with \"_class\" property + /// + /// Properties: + /// * [class_] + + @freezed + class ClassModel with _$ClassModel { + const ClassModel._(); + + const factory ClassModel({ + @JsonKey(name: r'_class') + String? + class_, + }) = _ClassModel; + + + factory ClassModel.fromJson(Map json) => _$ClassModelFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/deprecated_object.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/deprecated_object.dart new file mode 100644 index 000000000000..0b72b6a9ccc0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/deprecated_object.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// DeprecatedObject + /// + /// Properties: + /// * [name] + + @freezed + class DeprecatedObject with _$DeprecatedObject { + const DeprecatedObject._(); + + const factory DeprecatedObject({ + @JsonKey(name: r'name') + String? + name, + }) = _DeprecatedObject; + + + factory DeprecatedObject.fromJson(Map json) => _$DeprecatedObjectFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/dog.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/dog.dart new file mode 100644 index 000000000000..2add58483508 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/dog.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Dog + /// + /// Properties: + /// * [className] + /// * [color] + /// * [breed] + + + @freezed + class Dog with _$Dog { + const Dog._(); + + const factory Dog({ + @JsonKey(name: r'className') + required String + className, + @JsonKey(name: r'color') + String? + color, + @JsonKey(name: r'breed') + String? + breed, + }) = _Dog; + + factory Dog.fromJson(Map json) => _$DogFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/enum_arrays.dart new file mode 100644 index 000000000000..97e7a751b331 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/enum_arrays.dart @@ -0,0 +1,57 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// EnumArrays + /// + /// Properties: + /// * [justSymbol] + /// * [arrayEnum] + + @freezed + class EnumArrays with _$EnumArrays { + const EnumArrays._(); + + const factory EnumArrays({ + @JsonKey(name: r'just_symbol') + EnumArraysJustSymbolEnum? + justSymbol, + @JsonKey(name: r'array_enum') + List< + EnumArraysArrayEnumEnum? +>? + arrayEnum, + }) = _EnumArrays; + + + factory EnumArrays.fromJson(Map json) => _$EnumArraysFromJson(json); + + + + + + +} + + + + @JsonEnum(valueField: 'value') + enum EnumArraysJustSymbolEnum { + greaterThanEqual(value: r'>='), + dollar(value: r'$'), + unknownDefaultOpenApi(value: r'unknown_default_open_api'); + const EnumArraysJustSymbolEnum({required this.value}); + final String value; + } + + @JsonEnum(valueField: 'value') + enum EnumArraysArrayEnumEnum { + fish(value: r'fish'), + crab(value: r'crab'), + unknownDefaultOpenApi(value: r'unknown_default_open_api'); + const EnumArraysArrayEnumEnum({required this.value}); + final String value; + } diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/enum_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/enum_test.dart new file mode 100644 index 000000000000..e2827b647e75 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/enum_test.dart @@ -0,0 +1,96 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// EnumTest + /// + /// Properties: + /// * [enumString] + /// * [enumStringRequired] + /// * [enumInteger] + /// * [enumNumber] + /// * [outerEnum] + /// * [outerEnumInteger] + /// * [outerEnumDefaultValue] + /// * [outerEnumIntegerDefaultValue] + + @freezed + class EnumTest with _$EnumTest { + const EnumTest._(); + + const factory EnumTest({ + @JsonKey(name: r'enum_string') + EnumTestEnumStringEnum? + enumString, + @JsonKey(name: r'enum_string_required') + required EnumTestEnumStringRequiredEnum + enumStringRequired, + @JsonKey(name: r'enum_integer') + EnumTestEnumIntegerEnum? + enumInteger, + @JsonKey(name: r'enum_number') + EnumTestEnumNumberEnum? + enumNumber, + @JsonKey(name: r'outerEnum') + OuterEnum? + outerEnum, + @JsonKey(name: r'outerEnumInteger') + OuterEnumInteger? + outerEnumInteger, + @JsonKey(name: r'outerEnumDefaultValue') + OuterEnumDefaultValue? + outerEnumDefaultValue, + @JsonKey(name: r'outerEnumIntegerDefaultValue') + OuterEnumIntegerDefaultValue? + outerEnumIntegerDefaultValue, + }) = _EnumTest; + + + factory EnumTest.fromJson(Map json) => _$EnumTestFromJson(json); + + + + + + +} + + + + @JsonEnum(valueField: 'value') + enum EnumTestEnumStringEnum { + UPPER(value: r'UPPER'), + lower(value: r'lower'), + empty(value: r''), + unknownDefaultOpenApi(value: r'unknown_default_open_api'); + const EnumTestEnumStringEnum({required this.value}); + final String value; + } + @JsonEnum(valueField: 'value') + enum EnumTestEnumStringRequiredEnum { + UPPER(value: r'UPPER'), + lower(value: r'lower'), + empty(value: r''), + unknownDefaultOpenApi(value: r'unknown_default_open_api'); + const EnumTestEnumStringRequiredEnum({required this.value}); + final String value; + } + @JsonEnum(valueField: 'value') + enum EnumTestEnumIntegerEnum { + number1(value: 1), + numberNegative1(value: -1), + unknownDefaultOpenApi(value: 11184809); + const EnumTestEnumIntegerEnum({required this.value}); + final int value; + } + @JsonEnum(valueField: 'value') + enum EnumTestEnumNumberEnum { + number1Period1(value: '1.1'), + numberNegative1Period2(value: '-1.2'), + unknownDefaultOpenApi(value: '11184809'); + const EnumTestEnumNumberEnum({required this.value}); + final double value; + } diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/fake_big_decimal_map200_response.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/fake_big_decimal_map200_response.dart new file mode 100644 index 000000000000..22c9785245d6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/fake_big_decimal_map200_response.dart @@ -0,0 +1,40 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// FakeBigDecimalMap200Response + /// + /// Properties: + /// * [someId] + /// * [someMap] + + @freezed + class FakeBigDecimalMap200Response with _$FakeBigDecimalMap200Response { + const FakeBigDecimalMap200Response._(); + + const factory FakeBigDecimalMap200Response({ + @JsonKey(name: r'someId') + num? + someId, + @JsonKey(name: r'someMap') + Map? + someMap, + }) = _FakeBigDecimalMap200Response; + + + factory FakeBigDecimalMap200Response.fromJson(Map json) => _$FakeBigDecimalMap200ResponseFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/file_schema_test_class.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/file_schema_test_class.dart new file mode 100644 index 000000000000..d2bef63869e6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/file_schema_test_class.dart @@ -0,0 +1,40 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// FileSchemaTestClass + /// + /// Properties: + /// * [file] + /// * [files] + + @freezed + class FileSchemaTestClass with _$FileSchemaTestClass { + const FileSchemaTestClass._(); + + const factory FileSchemaTestClass({ + @JsonKey(name: r'file') + ModelFile? + file, + @JsonKey(name: r'files') + List< + ModelFile? +>? + files, + }) = _FileSchemaTestClass; + + + factory FileSchemaTestClass.fromJson(Map json) => _$FileSchemaTestClassFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/foo.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/foo.dart new file mode 100644 index 000000000000..ffa9c45cc003 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/foo.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Foo + /// + /// Properties: + /// * [bar] + + @freezed + class Foo with _$Foo { + const Foo._(); + + const factory Foo({ + @JsonKey(name: r'bar') + String? + bar, + }) = _Foo; + + + factory Foo.fromJson(Map json) => _$FooFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/foo_get_default_response.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/foo_get_default_response.dart new file mode 100644 index 000000000000..4a0bb7e0caca --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/foo_get_default_response.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// FooGetDefaultResponse + /// + /// Properties: + /// * [string] + + @freezed + class FooGetDefaultResponse with _$FooGetDefaultResponse { + const FooGetDefaultResponse._(); + + const factory FooGetDefaultResponse({ + @JsonKey(name: r'string') + Foo? + string, + }) = _FooGetDefaultResponse; + + + factory FooGetDefaultResponse.fromJson(Map json) => _$FooGetDefaultResponseFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/format_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/format_test.dart new file mode 100644 index 000000000000..e4170c523c24 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/format_test.dart @@ -0,0 +1,96 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.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. + + @freezed + class FormatTest with _$FormatTest { + const FormatTest._(); + + const factory FormatTest({ + @JsonKey(name: r'integer') + int? + integer, + @JsonKey(name: r'int32') + int? + int32, + @JsonKey(name: r'int64') + int? + int64, + @JsonKey(name: r'number') + required num + number, + @JsonKey(name: r'float') + double? + float, + @JsonKey(name: r'double') + double? + double_, + @JsonKey(name: r'decimal') + double? + decimal, + @JsonKey(name: r'string') + String? + string, + @JsonKey(name: r'byte') + required String + byte, + @JsonKey(name: r'binary') + MultipartFile? + binary, + @JsonKey(name: r'date') + required DateTime + date, + @JsonKey(name: r'dateTime') + DateTime? + dateTime, + @JsonKey(name: r'uuid') + String? + uuid, + @JsonKey(name: r'password') + required String + password, + /// A string that is a 10 digit number. Can have leading zeros. + @JsonKey(name: r'pattern_with_digits') + 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') + String? + patternWithDigitsAndDelimiter, + }) = _FormatTest; + + + factory FormatTest.fromJson(Map json) => _$FormatTestFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/has_only_read_only.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/has_only_read_only.dart new file mode 100644 index 000000000000..08118cf5d4da --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/has_only_read_only.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// HasOnlyReadOnly + /// + /// Properties: + /// * [bar] + /// * [foo] + + @freezed + class HasOnlyReadOnly with _$HasOnlyReadOnly { + const HasOnlyReadOnly._(); + + const factory HasOnlyReadOnly({ + @JsonKey(name: r'bar') + String? + bar, + @JsonKey(name: r'foo') + String? + foo, + }) = _HasOnlyReadOnly; + + + factory HasOnlyReadOnly.fromJson(Map json) => _$HasOnlyReadOnlyFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/health_check_result.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/health_check_result.dart new file mode 100644 index 000000000000..6be0435894b2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/health_check_result.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.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] + + @freezed + class HealthCheckResult with _$HealthCheckResult { + const HealthCheckResult._(); + + const factory HealthCheckResult({ + @JsonKey(name: r'NullableMessage') + String? + nullableMessage, + }) = _HealthCheckResult; + + + factory HealthCheckResult.fromJson(Map json) => _$HealthCheckResultFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/map_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/map_test.dart new file mode 100644 index 000000000000..4ae39f268d4d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/map_test.dart @@ -0,0 +1,65 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// MapTest + /// + /// Properties: + /// * [mapMapOfString] + /// * [mapOfEnumString] + /// * [directMap] + /// * [indirectMap] + + @freezed + class MapTest with _$MapTest { + const MapTest._(); + + const factory MapTest({ + @JsonKey(name: r'map_map_of_string') + Map? +>? + mapMapOfString, + @JsonKey(name: r'map_of_enum_string') + Map? + mapOfEnumString, + @JsonKey(name: r'direct_map') + Map? + directMap, + @JsonKey(name: r'indirect_map') + Map? + indirectMap, + }) = _MapTest; + + + factory MapTest.fromJson(Map json) => _$MapTestFromJson(json); + + + + + + +} + + + + + @JsonEnum(valueField: 'value') + enum MapTestMapOfEnumStringEnum { + UPPER(value: r'UPPER'), + lower(value: r'lower'), + unknownDefaultOpenApi(value: r'unknown_default_open_api'); + const MapTestMapOfEnumStringEnum({required this.value}); + final String value; + } diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/mixed_properties_and_additional_properties_class.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/mixed_properties_and_additional_properties_class.dart new file mode 100644 index 000000000000..b54a0a41c1fc --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/mixed_properties_and_additional_properties_class.dart @@ -0,0 +1,44 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// MixedPropertiesAndAdditionalPropertiesClass + /// + /// Properties: + /// * [uuid] + /// * [dateTime] + /// * [map] + + @freezed + class MixedPropertiesAndAdditionalPropertiesClass with _$MixedPropertiesAndAdditionalPropertiesClass { + const MixedPropertiesAndAdditionalPropertiesClass._(); + + const factory MixedPropertiesAndAdditionalPropertiesClass({ + @JsonKey(name: r'uuid') + String? + uuid, + @JsonKey(name: r'dateTime') + DateTime? + dateTime, + @JsonKey(name: r'map') + Map? + map, + }) = _MixedPropertiesAndAdditionalPropertiesClass; + + + factory MixedPropertiesAndAdditionalPropertiesClass.fromJson(Map json) => _$MixedPropertiesAndAdditionalPropertiesClassFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/model200_response.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/model200_response.dart new file mode 100644 index 000000000000..6fb47a0d7d18 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/model200_response.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Model for testing model name starting with number + /// + /// Properties: + /// * [name] + /// * [class_] + + @freezed + class Model200Response with _$Model200Response { + const Model200Response._(); + + const factory Model200Response({ + @JsonKey(name: r'name') + int? + name, + @JsonKey(name: r'class') + String? + class_, + }) = _Model200Response; + + + factory Model200Response.fromJson(Map json) => _$Model200ResponseFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/model_client.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/model_client.dart new file mode 100644 index 000000000000..ded67be9adbf --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/model_client.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// ModelClient + /// + /// Properties: + /// * [client] + + @freezed + class ModelClient with _$ModelClient { + const ModelClient._(); + + const factory ModelClient({ + @JsonKey(name: r'client') + String? + client, + }) = _ModelClient; + + + factory ModelClient.fromJson(Map json) => _$ModelClientFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/model_enum_class.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/model_enum_class.dart new file mode 100644 index 000000000000..46f700a2c015 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/model_enum_class.dart @@ -0,0 +1,17 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + + +@JsonEnum(valueField: 'value') +enum ModelEnumClass { + abc(value: r'_abc'), + efg(value: r'-efg'), + leftParenthesisXyzRightParenthesis(value: r'(xyz)'), + unknownDefaultOpenApi(value: r'unknown_default_open_api'); + const ModelEnumClass({required this.value}); + final String value; +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/model_file.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/model_file.dart new file mode 100644 index 000000000000..590ac4d93fd2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/model_file.dart @@ -0,0 +1,35 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Must be named `File` for test. + /// + /// Properties: + /// * [sourceURI] - Test capitalization + + @freezed + class ModelFile with _$ModelFile { + const ModelFile._(); + + const factory ModelFile({ + /// Test capitalization + @JsonKey(name: r'sourceURI') + String? + sourceURI, + }) = _ModelFile; + + + factory ModelFile.fromJson(Map json) => _$ModelFileFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/model_list.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/model_list.dart new file mode 100644 index 000000000000..47ec10080325 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/model_list.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// ModelList + /// + /// Properties: + /// * [n123list] + + @freezed + class ModelList with _$ModelList { + const ModelList._(); + + const factory ModelList({ + @JsonKey(name: r'123-list') + String? + n123list, + }) = _ModelList; + + + factory ModelList.fromJson(Map json) => _$ModelListFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/model_return.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/model_return.dart new file mode 100644 index 000000000000..2423aeecc969 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/model_return.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Model for testing reserved words + /// + /// Properties: + /// * [return_] + + @freezed + class ModelReturn with _$ModelReturn { + const ModelReturn._(); + + const factory ModelReturn({ + @JsonKey(name: r'return') + int? + return_, + }) = _ModelReturn; + + + factory ModelReturn.fromJson(Map json) => _$ModelReturnFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/models.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/models.dart new file mode 100644 index 000000000000..1591d5519c42 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/models.dart @@ -0,0 +1,20 @@ +//ignore_for_file: invalid_annotation_target +import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:dio/dio.dart'; +import 'dart:convert'; + +part 'models.freezed.dart'; +part 'models.g.dart'; + +part 'primitive_union_types.dart'; +part 'additional_properties_class.dart';part 'all_of_with_single_ref.dart';part 'animal.dart';part 'api_response.dart';part 'array_of_array_of_number_only.dart';part 'array_of_number_only.dart';part 'array_test.dart';part 'capitalization.dart';part 'cat.dart';part 'category.dart';part 'child_with_nullable.dart';part 'class_model.dart';part 'deprecated_object.dart';part 'dog.dart';part 'enum_arrays.dart';part 'enum_test.dart';part 'fake_big_decimal_map200_response.dart';part 'file_schema_test_class.dart';part 'foo.dart';part 'foo_get_default_response.dart';part 'format_test.dart';part 'has_only_read_only.dart';part 'health_check_result.dart';part 'map_test.dart';part 'mixed_properties_and_additional_properties_class.dart';part 'model200_response.dart';part 'model_client.dart';part 'model_enum_class.dart';part 'model_file.dart';part 'model_list.dart';part 'model_return.dart';part 'name.dart';part 'nullable_class.dart';part 'number_only.dart';part 'object_with_deprecated_fields.dart';part 'order.dart';part 'outer_composite.dart';part 'outer_enum.dart';part 'outer_enum_default_value.dart';part 'outer_enum_integer.dart';part 'outer_enum_integer_default_value.dart';part 'outer_object_with_enum_property.dart';part 'parent_with_nullable.dart';part 'pet.dart';part 'read_only_first.dart';part 'single_ref_type.dart';part 'special_model_name.dart';part 'tag.dart';part 'test_inline_freeform_additional_properties_request.dart';part 'user.dart'; + +/// A typedef used in the deserialization of OneOf and AnyOf +/// models when no discriminator mapping is provided. +typedef FromJsonMethodType = T Function(Map); + +/// Deserialization error types for OneOf and AnyOf types. +enum DeserializationErrorType { + MoreThanOneTypeSatisfied, + UnKnownType, +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/name.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/name.dart new file mode 100644 index 000000000000..7a676910ee89 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/name.dart @@ -0,0 +1,46 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Model for testing model name same as property name + /// + /// Properties: + /// * [name] + /// * [snakeCase] + /// * [property] + /// * [n123number] + + @freezed + class Name with _$Name { + const Name._(); + + const factory Name({ + @JsonKey(name: r'name') + required int + name, + @JsonKey(name: r'snake_case') + int? + snakeCase, + @JsonKey(name: r'property') + String? + property, + @JsonKey(name: r'123Number') + int? + n123number, + }) = _Name; + + + factory Name.fromJson(Map json) => _$NameFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/nullable_class.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/nullable_class.dart new file mode 100644 index 000000000000..9ce927fb2514 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/nullable_class.dart @@ -0,0 +1,90 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// NullableClass + /// + /// Properties: + /// * [integerProp] + /// * [numberProp] + /// * [booleanProp] + /// * [stringProp] + /// * [dateProp] + /// * [datetimeProp] + /// * [arrayNullableProp] + /// * [arrayAndItemsNullableProp] + /// * [arrayItemsNullable] + /// * [objectNullableProp] + /// * [objectAndItemsNullableProp] + /// * [objectItemsNullable] + + @freezed + class NullableClass with _$NullableClass { + const NullableClass._(); + + const factory NullableClass({ + @JsonKey(name: r'integer_prop') + int? + integerProp, + @JsonKey(name: r'number_prop') + num? + numberProp, + @JsonKey(name: r'boolean_prop') + bool? + booleanProp, + @JsonKey(name: r'string_prop') + String? + stringProp, + @JsonKey(name: r'date_prop') + DateTime? + dateProp, + @JsonKey(name: r'datetime_prop') + DateTime? + datetimeProp, + @JsonKey(name: r'array_nullable_prop') + List< + Object? +>? + arrayNullableProp, + @JsonKey(name: r'array_and_items_nullable_prop') + List< + Object? +>? + arrayAndItemsNullableProp, + @JsonKey(name: r'array_items_nullable') + List< + Object? +>? + arrayItemsNullable, + @JsonKey(name: r'object_nullable_prop') + Map? + objectNullableProp, + @JsonKey(name: r'object_and_items_nullable_prop') + Map? + objectAndItemsNullableProp, + @JsonKey(name: r'object_items_nullable') + Map? + objectItemsNullable, + }) = _NullableClass; + + + factory NullableClass.fromJson(Map json) => _$NullableClassFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/number_only.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/number_only.dart new file mode 100644 index 000000000000..c688bfb5aca8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/number_only.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// NumberOnly + /// + /// Properties: + /// * [justNumber] + + @freezed + class NumberOnly with _$NumberOnly { + const NumberOnly._(); + + const factory NumberOnly({ + @JsonKey(name: r'JustNumber') + num? + justNumber, + }) = _NumberOnly; + + + factory NumberOnly.fromJson(Map json) => _$NumberOnlyFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/object_with_deprecated_fields.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/object_with_deprecated_fields.dart new file mode 100644 index 000000000000..501a4b4f67ce --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/object_with_deprecated_fields.dart @@ -0,0 +1,48 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// ObjectWithDeprecatedFields + /// + /// Properties: + /// * [uuid] + /// * [id] + /// * [deprecatedRef] + /// * [bars] + + @freezed + class ObjectWithDeprecatedFields with _$ObjectWithDeprecatedFields { + const ObjectWithDeprecatedFields._(); + + const factory ObjectWithDeprecatedFields({ + @JsonKey(name: r'uuid') + String? + uuid, + @JsonKey(name: r'id') + num? + id, + @JsonKey(name: r'deprecatedRef') + DeprecatedObject? + deprecatedRef, + @JsonKey(name: r'bars') + List< + String? +>? + bars, + }) = _ObjectWithDeprecatedFields; + + + factory ObjectWithDeprecatedFields.fromJson(Map json) => _$ObjectWithDeprecatedFieldsFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/order.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/order.dart new file mode 100644 index 000000000000..0c154903884c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/order.dart @@ -0,0 +1,64 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Order + /// + /// Properties: + /// * [id] + /// * [petId] + /// * [quantity] + /// * [shipDate] + /// * [status] - Order Status + /// * [complete] + + @freezed + class Order with _$Order { + const Order._(); + + const factory Order({ + @JsonKey(name: r'id') + int? + id, + @JsonKey(name: r'petId') + int? + petId, + @JsonKey(name: r'quantity') + int? + quantity, + @JsonKey(name: r'shipDate') + DateTime? + shipDate, + /// Order Status + @JsonKey(name: r'status') + OrderStatusEnum? + status, + @JsonKey(name: r'complete') + bool? + complete, + }) = _Order; + + + factory Order.fromJson(Map json) => _$OrderFromJson(json); + + + + + + +} + + + /// Order Status + @JsonEnum(valueField: 'value') + enum OrderStatusEnum { + placed(value: r'placed'), + approved(value: r'approved'), + delivered(value: r'delivered'), + unknownDefaultOpenApi(value: r'unknown_default_open_api'); + const OrderStatusEnum({required this.value}); + final String value; + } diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/outer_composite.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/outer_composite.dart new file mode 100644 index 000000000000..9ca4d9bafe7e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/outer_composite.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// OuterComposite + /// + /// Properties: + /// * [myNumber] + /// * [myString] + /// * [myBoolean] + + @freezed + class OuterComposite with _$OuterComposite { + const OuterComposite._(); + + const factory OuterComposite({ + @JsonKey(name: r'my_number') + num? + myNumber, + @JsonKey(name: r'my_string') + String? + myString, + @JsonKey(name: r'my_boolean') + bool? + myBoolean, + }) = _OuterComposite; + + + factory OuterComposite.fromJson(Map json) => _$OuterCompositeFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/outer_enum.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/outer_enum.dart new file mode 100644 index 000000000000..d1fbeffabb32 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/outer_enum.dart @@ -0,0 +1,17 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + + +@JsonEnum(valueField: 'value') +enum OuterEnum { + placed(value: r'placed'), + approved(value: r'approved'), + delivered(value: r'delivered'), + unknownDefaultOpenApi(value: r'unknown_default_open_api'); + const OuterEnum({required this.value}); + final String value; +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/outer_enum_default_value.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/outer_enum_default_value.dart new file mode 100644 index 000000000000..40b234a78af5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/outer_enum_default_value.dart @@ -0,0 +1,17 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + + +@JsonEnum(valueField: 'value') +enum OuterEnumDefaultValue { + placed(value: r'placed'), + approved(value: r'approved'), + delivered(value: r'delivered'), + unknownDefaultOpenApi(value: r'unknown_default_open_api'); + const OuterEnumDefaultValue({required this.value}); + final String value; +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/outer_enum_integer.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/outer_enum_integer.dart new file mode 100644 index 000000000000..ed4e09fba4bf --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/outer_enum_integer.dart @@ -0,0 +1,17 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + + +@JsonEnum(valueField: 'value') +enum OuterEnumInteger { + number0(value: 0), + number1(value: 1), + number2(value: 2), + unknownDefaultOpenApi(value: 11184809); + const OuterEnumInteger({required this.value}); + final int value; +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/outer_enum_integer_default_value.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/outer_enum_integer_default_value.dart new file mode 100644 index 000000000000..cc4104b1dd49 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/outer_enum_integer_default_value.dart @@ -0,0 +1,17 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + + +@JsonEnum(valueField: 'value') +enum OuterEnumIntegerDefaultValue { + number0(value: 0), + number1(value: 1), + number2(value: 2), + unknownDefaultOpenApi(value: 11184809); + const OuterEnumIntegerDefaultValue({required this.value}); + final int value; +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/outer_object_with_enum_property.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/outer_object_with_enum_property.dart new file mode 100644 index 000000000000..09aa8e0241fa --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/outer_object_with_enum_property.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// OuterObjectWithEnumProperty + /// + /// Properties: + /// * [value] + + @freezed + class OuterObjectWithEnumProperty with _$OuterObjectWithEnumProperty { + const OuterObjectWithEnumProperty._(); + + const factory OuterObjectWithEnumProperty({ + @JsonKey(name: r'value') + required OuterEnumInteger + value, + }) = _OuterObjectWithEnumProperty; + + + factory OuterObjectWithEnumProperty.fromJson(Map json) => _$OuterObjectWithEnumPropertyFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/parent_with_nullable.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/parent_with_nullable.dart new file mode 100644 index 000000000000..1daa3ecabd9b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/parent_with_nullable.dart @@ -0,0 +1,66 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// ParentWithNullable + /// + /// Properties: + /// * [type] + /// * [nullableProperty] + + @freezed + sealed class ParentWithNullable with _$ParentWithNullable { + const ParentWithNullable._(); + + const factory ParentWithNullable.asChildWithNullable({ + required ChildWithNullable childWithNullableValue + }) = ParentWithNullableAsChildWithNullable; + const factory ParentWithNullable.unknown({ + @Default('Json does not satisfy any available types') String message, + required Map json, + + @Default(DeserializationErrorType.UnKnownType) + DeserializationErrorType errorType, + + @Default([]) + List possibleTypes, + + @Default([]) + List deserializedModels, + }) = ParentWithNullableUnknown; + + + factory ParentWithNullable.fromJson(Map json) { + switch(json['type']){ + case 'ChildWithNullable': + return ParentWithNullable.asChildWithNullable( + childWithNullableValue : ChildWithNullable.fromJson(json), + ); + } + return ParentWithNullable.unknown(json: json); + } + + + + Map toJson() { + return when( + asChildWithNullable: (asChildWithNullable) => asChildWithNullable.toJson(), + unknown: (message, json, errorType, possibleTypes, deserializedModels) => {}, + ); + } + + +} + + + + @JsonEnum(valueField: 'value') + enum ParentWithNullableTypeEnum { + childWithNullable(value: r'ChildWithNullable'), + unknownDefaultOpenApi(value: r'unknown_default_open_api'); + const ParentWithNullableTypeEnum({required this.value}); + final String value; + } diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/pet.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/pet.dart new file mode 100644 index 000000000000..422bbbfab974 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/pet.dart @@ -0,0 +1,68 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Pet + /// + /// Properties: + /// * [id] + /// * [category] + /// * [name] + /// * [photoUrls] + /// * [tags] + /// * [status] - pet status in the store + + @freezed + class Pet with _$Pet { + const Pet._(); + + const factory Pet({ + @JsonKey(name: r'id') + int? + id, + @JsonKey(name: r'category') + Category? + category, + @JsonKey(name: r'name') + required String + name, + @JsonKey(name: r'photoUrls') + required Set< + String? +> + photoUrls, + @JsonKey(name: r'tags') + List< + Tag? +>? + tags, + /// pet status in the store + @JsonKey(name: r'status') + PetStatusEnum? + status, + }) = _Pet; + + + factory Pet.fromJson(Map json) => _$PetFromJson(json); + + + + + + +} + + + /// pet status in the store + @JsonEnum(valueField: 'value') + enum PetStatusEnum { + available(value: r'available'), + pending(value: r'pending'), + sold(value: r'sold'), + unknownDefaultOpenApi(value: r'unknown_default_open_api'); + const PetStatusEnum({required this.value}); + final String value; + } diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/primitive_union_types.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/primitive_union_types.dart new file mode 100644 index 000000000000..fafa083471b8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/primitive_union_types.dart @@ -0,0 +1,60 @@ +part of 'models.dart'; + +@freezed +class IntInUnion with _$IntInUnion{ + const factory IntInUnion({ + required int intValue + }) = _IntInUnion; + + factory IntInUnion.fromJson(Map json) => _$IntInUnionFromJson(json); +} + +@freezed +class StringInUnion with _$StringInUnion{ + const factory StringInUnion({ + required String stringValue + }) = _StringInUnion; + + factory StringInUnion.fromJson(Map json) => _$StringInUnionFromJson(json); +} +@freezed +class BoolInUnion with _$BoolInUnion{ + const factory BoolInUnion({ + required bool boolValue + }) = _BoolInUnion; + + factory BoolInUnion.fromJson(Map json) => _$BoolInUnionFromJson(json); +} + +@freezed +class DoubleInUnion with _$DoubleInUnion{ + const factory DoubleInUnion({ + required double doubleValue + }) = _DoubleInUnion; + + factory DoubleInUnion.fromJson(Map json) => _$DoubleInUnionFromJson(json); +} + +@freezed +class ObjectInUnion with _$ObjectInUnion { + const factory ObjectInUnion({required Object objectValue}) = _ObjectInUnion; + + factory ObjectInUnion.fromJson(Map json) => + _$ObjectInUnionFromJson(json); +} + +@freezed +class NumInUnion with _$NumInUnion{ + const factory NumInUnion({required num numValue}) = _NumInUnion; + + factory NumInUnion.fromJson(Map json) => _$NumInUnionFromJson(json); +} + +@freezed +class DateTimeInUnion with _$DateTimeInUnion { +const factory DateTimeInUnion({required DateTime dateTimeValue}) = +_DateTimeInUnion; + +factory DateTimeInUnion.fromJson(Map json) => +_$DateTimeInUnionFromJson(json); +} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/read_only_first.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/read_only_first.dart new file mode 100644 index 000000000000..0cb1ccb1957f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/read_only_first.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// ReadOnlyFirst + /// + /// Properties: + /// * [bar] + /// * [baz] + + @freezed + class ReadOnlyFirst with _$ReadOnlyFirst { + const ReadOnlyFirst._(); + + const factory ReadOnlyFirst({ + @JsonKey(name: r'bar') + String? + bar, + @JsonKey(name: r'baz') + String? + baz, + }) = _ReadOnlyFirst; + + + factory ReadOnlyFirst.fromJson(Map json) => _$ReadOnlyFirstFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/single_ref_type.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/single_ref_type.dart new file mode 100644 index 000000000000..098b49b176e0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/single_ref_type.dart @@ -0,0 +1,16 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + + +@JsonEnum(valueField: 'value') +enum SingleRefType { + admin(value: r'admin'), + user(value: r'user'), + unknownDefaultOpenApi(value: r'unknown_default_open_api'); + const SingleRefType({required this.value}); + final String value; +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/special_model_name.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/special_model_name.dart new file mode 100644 index 000000000000..1bc8e76e305a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/special_model_name.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// SpecialModelName + /// + /// Properties: + /// * [dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket] + + @freezed + class SpecialModelName with _$SpecialModelName { + const SpecialModelName._(); + + const factory SpecialModelName({ + @JsonKey(name: r'$special[property.name]') + int? + dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket, + }) = _SpecialModelName; + + + factory SpecialModelName.fromJson(Map json) => _$SpecialModelNameFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/tag.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/tag.dart new file mode 100644 index 000000000000..7271f893b90e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/tag.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// Tag + /// + /// Properties: + /// * [id] + /// * [name] + + @freezed + class Tag with _$Tag { + const Tag._(); + + const factory Tag({ + @JsonKey(name: r'id') + int? + id, + @JsonKey(name: r'name') + String? + name, + }) = _Tag; + + + factory Tag.fromJson(Map json) => _$TagFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/test_inline_freeform_additional_properties_request.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/test_inline_freeform_additional_properties_request.dart new file mode 100644 index 000000000000..e26649fa48f1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/test_inline_freeform_additional_properties_request.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// TestInlineFreeformAdditionalPropertiesRequest + /// + /// Properties: + /// * [someProperty] + + @freezed + class TestInlineFreeformAdditionalPropertiesRequest with _$TestInlineFreeformAdditionalPropertiesRequest { + const TestInlineFreeformAdditionalPropertiesRequest._(); + + const factory TestInlineFreeformAdditionalPropertiesRequest({ + @JsonKey(name: r'someProperty') + String? + someProperty, + }) = _TestInlineFreeformAdditionalPropertiesRequest; + + + factory TestInlineFreeformAdditionalPropertiesRequest.fromJson(Map json) => _$TestInlineFreeformAdditionalPropertiesRequestFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/user.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/user.dart new file mode 100644 index 000000000000..4e7ed7742c3f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/lib/src/model/user.dart @@ -0,0 +1,63 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element, invalid_annotation_target +part of 'models.dart'; + +/// User + /// + /// Properties: + /// * [id] + /// * [username] + /// * [firstName] + /// * [lastName] + /// * [email] + /// * [password] + /// * [phone] + /// * [userStatus] - User Status + + @freezed + class User with _$User { + const User._(); + + const factory User({ + @JsonKey(name: r'id') + int? + id, + @JsonKey(name: r'username') + String? + username, + @JsonKey(name: r'firstName') + String? + firstName, + @JsonKey(name: r'lastName') + String? + lastName, + @JsonKey(name: r'email') + String? + email, + @JsonKey(name: r'password') + String? + password, + @JsonKey(name: r'phone') + String? + phone, + /// User Status + @JsonKey(name: r'userStatus') + int? + userStatus, + }) = _User; + + + factory User.fromJson(Map json) => _$UserFromJson(json); + + + + + + +} + + + diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/pubspec.yaml new file mode 100644 index 000000000000..445bc9f8f04d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/pubspec.yaml @@ -0,0 +1,19 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client +homepage: homepage + + +environment: + sdk: '^3.0.0' + +dependencies: + dio: '^5.7.0' + freezed_annotation: '^2.4.4' + json_annotation: '^4.9.0' + +dev_dependencies: + freezed: '^2.5.2' + json_serializable: '^6.8.0' + build_runner: any + test: '^1.16.0' diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/additional_properties_class_test.dart new file mode 100644 index 000000000000..fd8299fb998f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 AdditionalPropertiesClass? instance = /* AdditionalPropertiesClass(...) */ null; + // TODO add properties to the entity + + group(AdditionalPropertiesClass, () { + // Map mapProperty + test('to test the property `mapProperty`', () async { + // TODO + }); + + // Map> mapOfMapProperty + test('to test the property `mapOfMapProperty`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/all_of_with_single_ref_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/all_of_with_single_ref_test.dart new file mode 100644 index 000000000000..ad5da909f6e3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 AllOfWithSingleRef? instance = /* AllOfWithSingleRef(...) */ null; + // TODO add properties to the entity + + group(AllOfWithSingleRef, () { + // String username + test('to test the property `username`', () async { + // TODO + }); + + // SingleRefType singleRefType + test('to test the property `singleRefType`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/animal_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/animal_test.dart new file mode 100644 index 000000000000..83c65b22bfc3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/animal_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Animal +void main() { + final Animal? instance = /* Animal(...) */ null; + // TODO add properties to the entity + + group(Animal, () { + // String className + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/another_fake_api_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/another_fake_api_test.dart new file mode 100644 index 000000000000..ddafef2a831b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/api_response_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/api_response_test.dart new file mode 100644 index 000000000000..9487afd7f58c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 ApiResponse? instance = /* ApiResponse(...) */ null; + // TODO add properties to the entity + + group(ApiResponse, () { + // int code + test('to test the property `code`', () async { + // TODO + }); + + // String type + test('to test the property `type`', () async { + // TODO + }); + + // String message + test('to test the property `message`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/array_of_array_of_number_only_test.dart new file mode 100644 index 000000000000..79c0d3f3bba8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 ArrayOfArrayOfNumberOnly? instance = /* ArrayOfArrayOfNumberOnly(...) */ null; + // TODO add properties to the entity + + group(ArrayOfArrayOfNumberOnly, () { + // List> arrayArrayNumber + test('to test the property `arrayArrayNumber`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/array_of_number_only_test.dart new file mode 100644 index 000000000000..d80be97cf147 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 ArrayOfNumberOnly? instance = /* ArrayOfNumberOnly(...) */ null; + // TODO add properties to the entity + + group(ArrayOfNumberOnly, () { + // List arrayNumber + test('to test the property `arrayNumber`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/array_test_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/array_test_test.dart new file mode 100644 index 000000000000..bfe7c84fd122 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 ArrayTest? instance = /* ArrayTest(...) */ null; + // TODO add properties to the entity + + group(ArrayTest, () { + // List arrayOfString + test('to test the property `arrayOfString`', () async { + // TODO + }); + + // List> arrayArrayOfInteger + test('to test the property `arrayArrayOfInteger`', () async { + // TODO + }); + + // List> arrayArrayOfModel + test('to test the property `arrayArrayOfModel`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/capitalization_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/capitalization_test.dart new file mode 100644 index 000000000000..156b0ee4993c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/capitalization_test.dart @@ -0,0 +1,42 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Capitalization +void main() { + final Capitalization? instance = /* Capitalization(...) */ null; + // TODO add properties to the entity + + group(Capitalization, () { + // String smallCamel + test('to test the property `smallCamel`', () async { + // TODO + }); + + // String capitalCamel + test('to test the property `capitalCamel`', () async { + // TODO + }); + + // String smallSnake + test('to test the property `smallSnake`', () async { + // TODO + }); + + // String capitalSnake + test('to test the property `capitalSnake`', () async { + // TODO + }); + + // String sCAETHFlowPoints + test('to test the property `sCAETHFlowPoints`', () async { + // TODO + }); + + // Name of the pet + // String ATT_NAME + test('to test the property `ATT_NAME`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/cat_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/cat_test.dart new file mode 100644 index 000000000000..0a8811bd37f7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/cat_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Cat +void main() { + final Cat? instance = /* Cat(...) */ null; + // TODO add properties to the entity + + group(Cat, () { + // String className + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + // bool declawed + test('to test the property `declawed`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/category_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/category_test.dart new file mode 100644 index 000000000000..0ed6921ae7fc --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/category_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Category +void main() { + final Category? instance = /* Category(...) */ null; + // TODO add properties to the entity + + group(Category, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name (default value: 'default-name') + test('to test the property `name`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/child_with_nullable_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/child_with_nullable_test.dart new file mode 100644 index 000000000000..ce2afd9a8a6e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/child_with_nullable_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ChildWithNullable +void main() { + final ChildWithNullable? instance = /* ChildWithNullable(...) */ null; + // TODO add properties to the entity + + group(ChildWithNullable, () { + // String type + test('to test the property `type`', () async { + // TODO + }); + + // String nullableProperty + test('to test the property `nullableProperty`', () async { + // TODO + }); + + // String otherProperty + test('to test the property `otherProperty`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/class_model_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/class_model_test.dart new file mode 100644 index 000000000000..e2dda7bab74e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 ClassModel? instance = /* ClassModel(...) */ null; + // TODO add properties to the entity + + group(ClassModel, () { + // String class_ + test('to test the property `class_`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/default_api_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/default_api_test.dart new file mode 100644 index 000000000000..f079565f9785 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/default_api_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + + +/// tests for DefaultApi +void main() { + final instance = Openapi().getDefaultApi(); + + group(DefaultApi, () { + //Future fooGet() async + test('test fooGet', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/deprecated_object_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/deprecated_object_test.dart new file mode 100644 index 000000000000..1b2214668577 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 DeprecatedObject? instance = /* DeprecatedObject(...) */ null; + // TODO add properties to the entity + + group(DeprecatedObject, () { + // String name + test('to test the property `name`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/dog_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/dog_test.dart new file mode 100644 index 000000000000..98097bd4bf25 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/dog_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Dog +void main() { + final Dog? instance = /* Dog(...) */ null; + // TODO add properties to the entity + + group(Dog, () { + // String className + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + // String breed + test('to test the property `breed`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/enum_arrays_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/enum_arrays_test.dart new file mode 100644 index 000000000000..30d12204ba17 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 EnumArrays? instance = /* EnumArrays(...) */ null; + // TODO add properties to the entity + + group(EnumArrays, () { + // String justSymbol + test('to test the property `justSymbol`', () async { + // TODO + }); + + // List arrayEnum + test('to test the property `arrayEnum`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/enum_test_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/enum_test_test.dart new file mode 100644 index 000000000000..befb9901ce9d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 EnumTest? instance = /* EnumTest(...) */ null; + // TODO add properties to the entity + + group(EnumTest, () { + // String enumString + test('to test the property `enumString`', () async { + // TODO + }); + + // String enumStringRequired + test('to test the property `enumStringRequired`', () async { + // TODO + }); + + // int enumInteger + test('to test the property `enumInteger`', () async { + // TODO + }); + + // double enumNumber + test('to test the property `enumNumber`', () async { + // TODO + }); + + // OuterEnum outerEnum + test('to test the property `outerEnum`', () async { + // TODO + }); + + // OuterEnumInteger outerEnumInteger + test('to test the property `outerEnumInteger`', () async { + // TODO + }); + + // OuterEnumDefaultValue outerEnumDefaultValue + test('to test the property `outerEnumDefaultValue`', () async { + // TODO + }); + + // OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue + test('to test the property `outerEnumIntegerDefaultValue`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/fake_api_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/fake_api_test.dart new file mode 100644 index 000000000000..67950bf50ce9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/fake_api_test.dart @@ -0,0 +1,183 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + + +/// tests for FakeApi +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 + test('test fakeHealthGet', () async { + // TODO + }); + + // test http signature authentication + // + //Future fakeHttpSignatureTest(Pet pet, { String query1, String header1 }) async + test('test fakeHttpSignatureTest', () async { + // TODO + }); + + // Test serialization of outer boolean types + // + //Future fakeOuterBooleanSerialize({ bool body }) async + test('test fakeOuterBooleanSerialize', () async { + // TODO + }); + + // Test serialization of object with outer number type + // + //Future fakeOuterCompositeSerialize({ OuterComposite outerComposite }) async + test('test fakeOuterCompositeSerialize', () async { + // TODO + }); + + // Test serialization of outer number types + // + //Future fakeOuterNumberSerialize({ num body }) async + test('test fakeOuterNumberSerialize', () async { + // TODO + }); + + // Test serialization of outer string types + // + //Future fakeOuterStringSerialize({ String body }) async + test('test fakeOuterStringSerialize', () async { + // TODO + }); + + // Test serialization of enum (int) properties with examples + // + //Future fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty) async + test('test fakePropertyEnumIntegerSerialize', () async { + // TODO + }); + + // test referenced additionalProperties + // + // + // + //Future testAdditionalPropertiesReference(Map requestBody) async + test('test testAdditionalPropertiesReference', () async { + // TODO + }); + + // For this test, the body has to be a binary file. + // + //Future testBodyWithBinary(MultipartFile body) async + test('test testBodyWithBinary', () async { + // TODO + }); + + // For this test, the body for this request must reference a schema named `File`. + // + //Future testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) async + test('test testBodyWithFileSchema', () async { + // TODO + }); + + //Future testBodyWithQueryParams(String query, User user) async + test('test testBodyWithQueryParams', () async { + // TODO + }); + + // To test \"client\" model + // + // To test \"client\" model + // + //Future testClientModel(ModelClient modelClient) async + test('test testClientModel', () async { + // TODO + }); + + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + // + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + // + //Future testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async + test('test testEndpointParameters', () async { + // TODO + }); + + // To test enum parameters + // + // To test enum parameters + // + //Future testEnumParameters({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumQueryModelArray, List enumFormStringArray, String enumFormString }) async + test('test testEnumParameters', () async { + // TODO + }); + + // Fake endpoint to test group parameters (optional) + // + // Fake endpoint to test group parameters (optional) + // + //Future testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group }) async + test('test testGroupParameters', () async { + // TODO + }); + + // test inline additionalProperties + // + // + // + //Future testInlineAdditionalProperties(Map requestBody) async + test('test testInlineAdditionalProperties', () async { + // TODO + }); + + // test inline free-form additionalProperties + // + // + // + //Future testInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) async + test('test testInlineFreeformAdditionalProperties', () async { + // TODO + }); + + // test json serialization of form data + // + // + // + //Future testJsonFormData(String param, String param2) async + test('test testJsonFormData', () async { + // TODO + }); + + // test nullable parent property + // + // + // + //Future testNullable(ChildWithNullable childWithNullable) async + test('test testNullable', () async { + // TODO + }); + + // 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 { + // TODO + }); + + // test referenced string map + // + // + // + //Future testStringMapReference(Map requestBody) async + test('test testStringMapReference', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/fake_big_decimal_map200_response_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/fake_big_decimal_map200_response_test.dart new file mode 100644 index 000000000000..1279b8d0ff25 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/fake_big_decimal_map200_response_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FakeBigDecimalMap200Response +void main() { + final FakeBigDecimalMap200Response? instance = /* FakeBigDecimalMap200Response(...) */ null; + // TODO add properties to the entity + + group(FakeBigDecimalMap200Response, () { + // num someId + test('to test the property `someId`', () async { + // TODO + }); + + // Map someMap + test('to test the property `someMap`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/fake_classname_tags123_api_test.dart new file mode 100644 index 000000000000..3075147f52fd --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/file_schema_test_class_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/file_schema_test_class_test.dart new file mode 100644 index 000000000000..2ccd0d450ce7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 FileSchemaTestClass? instance = /* FileSchemaTestClass(...) */ null; + // TODO add properties to the entity + + group(FileSchemaTestClass, () { + // ModelFile file + test('to test the property `file`', () async { + // TODO + }); + + // List files + test('to test the property `files`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/foo_get_default_response_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/foo_get_default_response_test.dart new file mode 100644 index 000000000000..4282326fe61f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/foo_get_default_response_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FooGetDefaultResponse +void main() { + final FooGetDefaultResponse? instance = /* FooGetDefaultResponse(...) */ null; + // TODO add properties to the entity + + group(FooGetDefaultResponse, () { + // Foo string + test('to test the property `string`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/foo_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/foo_test.dart new file mode 100644 index 000000000000..28ae9a5b5e13 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/foo_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Foo +void main() { + final Foo? instance = /* Foo(...) */ null; + // TODO add properties to the entity + + group(Foo, () { + // String bar (default value: 'bar') + test('to test the property `bar`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/format_test_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/format_test_test.dart new file mode 100644 index 000000000000..b08838d81a37 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 FormatTest? instance = /* FormatTest(...) */ null; + // TODO add properties to the entity + + group(FormatTest, () { + // int integer + test('to test the property `integer`', () async { + // TODO + }); + + // int int32 + test('to test the property `int32`', () async { + // TODO + }); + + // int int64 + test('to test the property `int64`', () async { + // TODO + }); + + // num number + test('to test the property `number`', () async { + // TODO + }); + + // double float + test('to test the property `float`', () async { + // TODO + }); + + // double double_ + test('to test the property `double_`', () async { + // TODO + }); + + // double decimal + test('to test the property `decimal`', () async { + // TODO + }); + + // String string + test('to test the property `string`', () async { + // TODO + }); + + // String byte + test('to test the property `byte`', () async { + // TODO + }); + + // MultipartFile binary + test('to test the property `binary`', () async { + // TODO + }); + + // DateTime date + test('to test the property `date`', () async { + // TODO + }); + + // DateTime dateTime + test('to test the property `dateTime`', () async { + // TODO + }); + + // String uuid + test('to test the property `uuid`', () async { + // TODO + }); + + // String password + test('to test the property `password`', () async { + // TODO + }); + + // A string that is a 10 digit number. Can have leading zeros. + // String patternWithDigits + test('to test the property `patternWithDigits`', () async { + // TODO + }); + + // A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + // String patternWithDigitsAndDelimiter + test('to test the property `patternWithDigitsAndDelimiter`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/has_only_read_only_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/has_only_read_only_test.dart new file mode 100644 index 000000000000..d72429a31bb5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 HasOnlyReadOnly? instance = /* HasOnlyReadOnly(...) */ null; + // TODO add properties to the entity + + group(HasOnlyReadOnly, () { + // String bar + test('to test the property `bar`', () async { + // TODO + }); + + // String foo + test('to test the property `foo`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/health_check_result_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/health_check_result_test.dart new file mode 100644 index 000000000000..b2b48337b76c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 HealthCheckResult? instance = /* HealthCheckResult(...) */ null; + // TODO add properties to the entity + + group(HealthCheckResult, () { + // String nullableMessage + test('to test the property `nullableMessage`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/map_test_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/map_test_test.dart new file mode 100644 index 000000000000..909415df7540 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 MapTest? instance = /* MapTest(...) */ null; + // TODO add properties to the entity + + group(MapTest, () { + // Map> mapMapOfString + test('to test the property `mapMapOfString`', () async { + // TODO + }); + + // Map mapOfEnumString + test('to test the property `mapOfEnumString`', () async { + // TODO + }); + + // Map directMap + test('to test the property `directMap`', () async { + // TODO + }); + + // Map indirectMap + test('to test the property `indirectMap`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart new file mode 100644 index 000000000000..0115f01ed6be --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 MixedPropertiesAndAdditionalPropertiesClass? instance = /* MixedPropertiesAndAdditionalPropertiesClass(...) */ null; + // TODO add properties to the entity + + group(MixedPropertiesAndAdditionalPropertiesClass, () { + // String uuid + test('to test the property `uuid`', () async { + // TODO + }); + + // DateTime dateTime + test('to test the property `dateTime`', () async { + // TODO + }); + + // Map map + test('to test the property `map`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/model200_response_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/model200_response_test.dart new file mode 100644 index 000000000000..de8cf3037b6b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 Model200Response? instance = /* Model200Response(...) */ null; + // TODO add properties to the entity + + group(Model200Response, () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // String class_ + test('to test the property `class_`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/model_client_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/model_client_test.dart new file mode 100644 index 000000000000..44faf62f15b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 ModelClient? instance = /* ModelClient(...) */ null; + // TODO add properties to the entity + + group(ModelClient, () { + // String client + test('to test the property `client`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/model_enum_class_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/model_enum_class_test.dart new file mode 100644 index 000000000000..03e5855bf004 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/model_file_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/model_file_test.dart new file mode 100644 index 000000000000..8ea65f6ccb41 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 ModelFile? instance = /* ModelFile(...) */ null; + // TODO add properties to the entity + + group(ModelFile, () { + // Test capitalization + // String sourceURI + test('to test the property `sourceURI`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/model_list_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/model_list_test.dart new file mode 100644 index 000000000000..f748eee993ac --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 ModelList? instance = /* ModelList(...) */ null; + // TODO add properties to the entity + + group(ModelList, () { + // String n123list + test('to test the property `n123list`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/model_return_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/model_return_test.dart new file mode 100644 index 000000000000..cfc17807c151 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 ModelReturn? instance = /* ModelReturn(...) */ null; + // TODO add properties to the entity + + group(ModelReturn, () { + // int return_ + test('to test the property `return_`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/name_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/name_test.dart new file mode 100644 index 000000000000..4f3f7f633728 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/name_test.dart @@ -0,0 +1,31 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Name +void main() { + final Name? instance = /* Name(...) */ null; + // TODO add properties to the entity + + group(Name, () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // int snakeCase + test('to test the property `snakeCase`', () async { + // TODO + }); + + // String property + test('to test the property `property`', () async { + // TODO + }); + + // int n123number + test('to test the property `n123number`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/nullable_class_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/nullable_class_test.dart new file mode 100644 index 000000000000..0ab76167983b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 NullableClass? instance = /* NullableClass(...) */ null; + // TODO add properties to the entity + + group(NullableClass, () { + // int integerProp + test('to test the property `integerProp`', () async { + // TODO + }); + + // num numberProp + test('to test the property `numberProp`', () async { + // TODO + }); + + // bool booleanProp + test('to test the property `booleanProp`', () async { + // TODO + }); + + // String stringProp + test('to test the property `stringProp`', () async { + // TODO + }); + + // DateTime dateProp + test('to test the property `dateProp`', () async { + // TODO + }); + + // DateTime datetimeProp + test('to test the property `datetimeProp`', () async { + // TODO + }); + + // List arrayNullableProp + test('to test the property `arrayNullableProp`', () async { + // TODO + }); + + // List arrayAndItemsNullableProp + test('to test the property `arrayAndItemsNullableProp`', () async { + // TODO + }); + + // List arrayItemsNullable + test('to test the property `arrayItemsNullable`', () async { + // TODO + }); + + // Map objectNullableProp + test('to test the property `objectNullableProp`', () async { + // TODO + }); + + // Map objectAndItemsNullableProp + test('to test the property `objectAndItemsNullableProp`', () async { + // TODO + }); + + // Map objectItemsNullable + test('to test the property `objectItemsNullable`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/number_only_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/number_only_test.dart new file mode 100644 index 000000000000..12b19c59dfb7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 NumberOnly? instance = /* NumberOnly(...) */ null; + // TODO add properties to the entity + + group(NumberOnly, () { + // num justNumber + test('to test the property `justNumber`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/object_with_deprecated_fields_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/object_with_deprecated_fields_test.dart new file mode 100644 index 000000000000..e197bd0ad807 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 ObjectWithDeprecatedFields? instance = /* ObjectWithDeprecatedFields(...) */ null; + // TODO add properties to the entity + + group(ObjectWithDeprecatedFields, () { + // String uuid + test('to test the property `uuid`', () async { + // TODO + }); + + // num id + test('to test the property `id`', () async { + // TODO + }); + + // DeprecatedObject deprecatedRef + test('to test the property `deprecatedRef`', () async { + // TODO + }); + + // List bars + test('to test the property `bars`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/order_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/order_test.dart new file mode 100644 index 000000000000..45b02097daed --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/order_test.dart @@ -0,0 +1,42 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Order +void main() { + final Order? instance = /* Order(...) */ null; + // TODO add properties to the entity + + group(Order, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // int petId + test('to test the property `petId`', () async { + // TODO + }); + + // int quantity + test('to test the property `quantity`', () async { + // TODO + }); + + // DateTime shipDate + test('to test the property `shipDate`', () async { + // TODO + }); + + // Order Status + // String status + test('to test the property `status`', () async { + // TODO + }); + + // bool complete (default value: false) + test('to test the property `complete`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/outer_composite_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/outer_composite_test.dart new file mode 100644 index 000000000000..a5f0172ba21c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 OuterComposite? instance = /* OuterComposite(...) */ null; + // TODO add properties to the entity + + group(OuterComposite, () { + // num myNumber + test('to test the property `myNumber`', () async { + // TODO + }); + + // String myString + test('to test the property `myString`', () async { + // TODO + }); + + // bool myBoolean + test('to test the property `myBoolean`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/outer_enum_default_value_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/outer_enum_default_value_test.dart new file mode 100644 index 000000000000..502c8326be58 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/outer_enum_integer_default_value_test.dart new file mode 100644 index 000000000000..c535fe8ac354 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/outer_enum_integer_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/outer_enum_integer_test.dart new file mode 100644 index 000000000000..d945bc8c489d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/outer_enum_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/outer_enum_test.dart new file mode 100644 index 000000000000..8e11eb02fb8a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart new file mode 100644 index 000000000000..3d72c6188e17 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 OuterObjectWithEnumProperty? instance = /* OuterObjectWithEnumProperty(...) */ null; + // TODO add properties to the entity + + group(OuterObjectWithEnumProperty, () { + // OuterEnumInteger value + test('to test the property `value`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/parent_with_nullable_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/parent_with_nullable_test.dart new file mode 100644 index 000000000000..b501d4220624 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/parent_with_nullable_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ParentWithNullable +void main() { + final ParentWithNullable? instance = /* ParentWithNullable(...) */ null; + // TODO add properties to the entity + + group(ParentWithNullable, () { + // String type + test('to test the property `type`', () async { + // TODO + }); + + // String nullableProperty + test('to test the property `nullableProperty`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/pet_api_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/pet_api_test.dart new file mode 100644 index 000000000000..85a28bcfbe53 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 { + // TODO + }); + + // Deletes a pet + // + // + // + //Future deletePet(int petId, { String apiKey }) async + test('test deletePet', () async { + // TODO + }); + + // Finds Pets by status + // + // Multiple status values can be provided with comma separated strings + // + //Future> findPetsByStatus(List status) async + test('test findPetsByStatus', () async { + // TODO + }); + + // Finds Pets by tags + // + // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + // + //Future> findPetsByTags(Set tags) async + test('test findPetsByTags', () async { + // TODO + }); + + // Find pet by ID + // + // Returns a single pet + // + //Future getPetById(int petId) async + test('test getPetById', () async { + // TODO + }); + + // Update an existing pet + // + // + // + //Future updatePet(Pet pet) async + test('test updatePet', () async { + // TODO + }); + + // Updates a pet in the store with form data + // + // + // + //Future updatePetWithForm(int petId, { String name, String status }) async + test('test updatePetWithForm', () async { + // TODO + }); + + // uploads an image + // + // + // + //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async + test('test uploadFile', () async { + // TODO + }); + + // uploads an image (required) + // + // + // + //Future uploadFileWithRequiredFile(int petId, MultipartFile requiredFile, { String additionalMetadata }) async + test('test uploadFileWithRequiredFile', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/pet_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/pet_test.dart new file mode 100644 index 000000000000..20b5e3e06735 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/pet_test.dart @@ -0,0 +1,42 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Pet +void main() { + final Pet? instance = /* Pet(...) */ null; + // TODO add properties to the entity + + group(Pet, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // Category category + test('to test the property `category`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // Set photoUrls + test('to test the property `photoUrls`', () async { + // TODO + }); + + // List tags + test('to test the property `tags`', () async { + // TODO + }); + + // pet status in the store + // String status + test('to test the property `status`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/read_only_first_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/read_only_first_test.dart new file mode 100644 index 000000000000..bcefd75befb6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 ReadOnlyFirst? instance = /* ReadOnlyFirst(...) */ null; + // TODO add properties to the entity + + group(ReadOnlyFirst, () { + // String bar + test('to test the property `bar`', () async { + // TODO + }); + + // String baz + test('to test the property `baz`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/single_ref_type_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/single_ref_type_test.dart new file mode 100644 index 000000000000..5cd85add393e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/special_model_name_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/special_model_name_test.dart new file mode 100644 index 000000000000..23b58324ef99 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 SpecialModelName? instance = /* SpecialModelName(...) */ null; + // TODO add properties to the entity + + group(SpecialModelName, () { + // int dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket + test('to test the property `dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/store_api_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/store_api_test.dart new file mode 100644 index 000000000000..08f7f738043b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 { + // TODO + }); + + // Returns pet inventories by status + // + // Returns a map of status codes to quantities + // + //Future> getInventory() async + test('test getInventory', () async { + // TODO + }); + + // Find purchase order by ID + // + // For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + // + //Future getOrderById(int orderId) async + test('test getOrderById', () async { + // TODO + }); + + // Place an order for a pet + // + // + // + //Future placeOrder(Order order) async + test('test placeOrder', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/tag_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/tag_test.dart new file mode 100644 index 000000000000..ffe49b3179c3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/tag_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Tag +void main() { + final Tag? instance = /* Tag(...) */ null; + // TODO add properties to the entity + + group(Tag, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/test_inline_freeform_additional_properties_request_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/test_inline_freeform_additional_properties_request_test.dart new file mode 100644 index 000000000000..8c60d3f11f36 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/test_inline_freeform_additional_properties_request_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for TestInlineFreeformAdditionalPropertiesRequest +void main() { + final TestInlineFreeformAdditionalPropertiesRequest? instance = /* TestInlineFreeformAdditionalPropertiesRequest(...) */ null; + // TODO add properties to the entity + + group(TestInlineFreeformAdditionalPropertiesRequest, () { + // String someProperty + test('to test the property `someProperty`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/user_api_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/user_api_test.dart new file mode 100644 index 000000000000..4bf28b67623b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/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 { + // TODO + }); + + // Creates list of users with given input array + // + // + // + //Future createUsersWithArrayInput(List user) async + test('test createUsersWithArrayInput', () async { + // TODO + }); + + // Creates list of users with given input array + // + // + // + //Future createUsersWithListInput(List user) async + test('test createUsersWithListInput', () async { + // TODO + }); + + // Delete user + // + // This can only be done by the logged in user. + // + //Future deleteUser(String username) async + test('test deleteUser', () async { + // TODO + }); + + // Get user by user name + // + // + // + //Future getUserByName(String username) async + test('test getUserByName', () async { + // TODO + }); + + // Logs user into the system + // + // + // + //Future loginUser(String username, String password) async + test('test loginUser', () async { + // TODO + }); + + // Logs out current logged in user session + // + // + // + //Future logoutUser() async + test('test logoutUser', () async { + // TODO + }); + + // Updated user + // + // This can only be done by the logged in user. + // + //Future updateUser(String username, User user) async + test('test updateUser', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/user_test.dart b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/user_test.dart new file mode 100644 index 000000000000..847b14196b93 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/freezed/petstore_client_lib_fake/test/user_test.dart @@ -0,0 +1,52 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for User +void main() { + final User? instance = /* User(...) */ null; + // TODO add properties to the entity + + group(User, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String username + test('to test the property `username`', () async { + // TODO + }); + + // String firstName + test('to test the property `firstName`', () async { + // TODO + }); + + // String lastName + test('to test the property `lastName`', () async { + // TODO + }); + + // String email + test('to test the property `email`', () async { + // TODO + }); + + // String password + test('to test the property `password`', () async { + // TODO + }); + + // String phone + test('to test the property `phone`', () async { + // TODO + }); + + // User Status + // int userStatus + test('to test the property `userStatus`', () async { + // TODO + }); + + }); +}