diff --git a/bin/configs/dart-dio-echo-server-dio-built_value.yaml b/bin/configs/dart-dio-echo-server-dio-built_value.yaml new file mode 100644 index 000000000000..8f6297608196 --- /dev/null +++ b/bin/configs/dart-dio-echo-server-dio-built_value.yaml @@ -0,0 +1,18 @@ +generatorName: dart-dio +outputDir: samples/client/echo_api/dart/dart-dio-built_value +inputSpec: modules/openapi-generator/src/test/resources/3_0/dart/echo_api.yaml +templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio +typeMappings: + Client: "ModelClient" + File: "ModelFile" + EnumClass: "ModelEnumClass" +additionalProperties: + hideGenerationTimestamp: "true" + enumUnknownDefaultCase: "true" + serializationLibrary: "built_value" + networkingLibrary: "dio" + artifactId: echo-api-dart-dio-built_value +reservedWordsMappings: + class: "classField" + + diff --git a/bin/configs/dart-dio-echo-server-dio-json_serializable.yaml b/bin/configs/dart-dio-echo-server-dio-json_serializable.yaml new file mode 100644 index 000000000000..4f1e21d959f1 --- /dev/null +++ b/bin/configs/dart-dio-echo-server-dio-json_serializable.yaml @@ -0,0 +1,18 @@ +generatorName: dart-dio +outputDir: samples/client/echo_api/dart/dart-dio-json_serializable +inputSpec: modules/openapi-generator/src/test/resources/3_0/dart/echo_api.yaml +templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio +typeMappings: + Client: "ModelClient" + File: "ModelFile" + EnumClass: "ModelEnumClass" +additionalProperties: + hideGenerationTimestamp: "true" + enumUnknownDefaultCase: "true" + serializationLibrary: "json_serializable" + networkingLibrary: "dio" + artifactId: echo-api-dart-dio-json_serializable +reservedWordsMappings: + class: "classField" + + diff --git a/bin/configs/dart-dio-echo-server-http-built_value.yaml b/bin/configs/dart-dio-echo-server-http-built_value.yaml new file mode 100644 index 000000000000..b4b74b5422b0 --- /dev/null +++ b/bin/configs/dart-dio-echo-server-http-built_value.yaml @@ -0,0 +1,17 @@ +generatorName: dart-dio +outputDir: samples/client/echo_api/dart/dart-http-built_value +inputSpec: modules/openapi-generator/src/test/resources/3_0/dart/echo_api.yaml +templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio +typeMappings: + Client: "ModelClient" + File: "ModelFile" + EnumClass: "ModelEnumClass" +additionalProperties: + hideGenerationTimestamp: "true" + enumUnknownDefaultCase: "true" + serializationLibrary: "built_value" + networkingLibrary: "http" + artifactId: echo-api-dart-http-built_value +reservedWordsMappings: + class: "classField" + diff --git a/bin/configs/dart-dio-echo-server-http-json_serializable.yaml b/bin/configs/dart-dio-echo-server-http-json_serializable.yaml new file mode 100644 index 000000000000..d2aaa4ca7420 --- /dev/null +++ b/bin/configs/dart-dio-echo-server-http-json_serializable.yaml @@ -0,0 +1,18 @@ +generatorName: dart-dio +outputDir: samples/client/echo_api/dart/dart-http-json_serializable +inputSpec: modules/openapi-generator/src/test/resources/3_0/dart/echo_api.yaml +templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio +typeMappings: + Client: "ModelClient" + File: "ModelFile" + EnumClass: "ModelEnumClass" +additionalProperties: + hideGenerationTimestamp: "true" + enumUnknownDefaultCase: "true" + serializationLibrary: "json_serializable" + networkingLibrary: "http" + artifactId: echo-api-dart-dio-json_serializable +reservedWordsMappings: + class: "classField" + + diff --git a/bin/configs/dart-dio-oneof-polymorphism-and-inheritance.yaml b/bin/configs/dart-dio-oneof-polymorphism-and-inheritance.yaml deleted file mode 100644 index d3d5b622bc0f..000000000000 --- a/bin/configs/dart-dio-oneof-polymorphism-and-inheritance.yaml +++ /dev/null @@ -1,11 +0,0 @@ -generatorName: dart-dio -outputDir: samples/openapi3/client/petstore/dart-dio/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" diff --git a/bin/configs/dart-dio-oneof-primitive.yaml b/bin/configs/dart-dio-oneof-primitive.yaml deleted file mode 100644 index 29130b5dc468..000000000000 --- a/bin/configs/dart-dio-oneof-primitive.yaml +++ /dev/null @@ -1,11 +0,0 @@ -generatorName: dart-dio -outputDir: samples/openapi3/client/petstore/dart-dio/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" diff --git a/bin/configs/dart-dio-oneof.yaml b/bin/configs/dart-dio-oneof.yaml deleted file mode 100644 index 865312cdd493..000000000000 --- a/bin/configs/dart-dio-oneof.yaml +++ /dev/null @@ -1,11 +0,0 @@ -generatorName: dart-dio -outputDir: samples/openapi3/client/petstore/dart-dio/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" - enumUnknownDefaultCase: "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 084528423653..9aa19bbca47f 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 @@ -58,6 +58,7 @@ public class DartDioClientCodegen extends AbstractDartCodegen { private final Logger LOGGER = LoggerFactory.getLogger(DartDioClientCodegen.class); public static final String DATE_LIBRARY = "dateLibrary"; + public static final String NETWORKING_LIBRARY = "networkingLibrary"; public static final String DATE_LIBRARY_CORE = "core"; public static final String DATE_LIBRARY_TIME_MACHINE = "timemachine"; public static final String DATE_LIBRARY_DEFAULT = DATE_LIBRARY_CORE; @@ -66,7 +67,12 @@ public class DartDioClientCodegen extends AbstractDartCodegen { public static final String SERIALIZATION_LIBRARY_JSON_SERIALIZABLE = "json_serializable"; public static final String SERIALIZATION_LIBRARY_DEFAULT = SERIALIZATION_LIBRARY_BUILT_VALUE; + public static final String NETWORKING_LIBRARY_DIO = "dio"; + public static final String NETWORKING_LIBRARY_HTTP = "http"; + public static final String NETWORKING_LIBRARY_DEFAULT = NETWORKING_LIBRARY_DIO; + private static final String DIO_IMPORT = "package:dio/dio.dart"; + private static final String HTTP_IMPORT = "package:http/http.dart"; public static final String FINAL_PROPERTIES = "finalProperties"; public static final String FINAL_PROPERTIES_DEFAULT_VALUE = "true"; @@ -74,6 +80,8 @@ public class DartDioClientCodegen extends AbstractDartCodegen { private String dateLibrary; + private String networkingLibrary; + private String clientName; private TemplateManager templateManager; @@ -102,6 +110,7 @@ public DartDioClientCodegen() { embeddedTemplateDir = "dart/libraries/dio"; this.setTemplateDir(embeddedTemplateDir); + //SERIALIZATION_LIBRARY options supportedLibraries.put(SERIALIZATION_LIBRARY_BUILT_VALUE, "[DEFAULT] built_value"); supportedLibraries.put(SERIALIZATION_LIBRARY_JSON_SERIALIZABLE, "[BETA] json_serializable"); final CliOption serializationLibrary = CliOption.newString(CodegenConstants.SERIALIZATION_LIBRARY, "Specify serialization library"); @@ -109,6 +118,17 @@ public DartDioClientCodegen() { serializationLibrary.setDefault(SERIALIZATION_LIBRARY_DEFAULT); cliOptions.add(serializationLibrary); + //NETWORKING_LIBRARY options + final CliOption networkingOption = CliOption.newString(NETWORKING_LIBRARY, "Specify networking library"); + networkingOption.setDefault(NETWORKING_LIBRARY_DEFAULT); + + final Map networkingOptions = new HashMap<>(); + networkingOptions.put(NETWORKING_LIBRARY_DIO, "[DEFAULT] Dio"); + networkingOptions.put(NETWORKING_LIBRARY_HTTP, "[BETA] http"); + networkingOption.setEnum(networkingOptions); + cliOptions.add(networkingOption); + + //FINAL_PROPERTIES option final CliOption finalProperties = CliOption.newBoolean(FINAL_PROPERTIES, "Whether properties are marked as final when using Json Serializable for serialization"); finalProperties.setDefault("true"); cliOptions.add(finalProperties); @@ -132,6 +152,14 @@ public void setDateLibrary(String library) { this.dateLibrary = library; } + public String getNetworkingLibrary() { + return networkingLibrary; + } + + public void setNetworkingLibrary(String networkingLibrary) { + this.networkingLibrary = networkingLibrary; + } + public String getClientName() { return clientName; } @@ -147,7 +175,7 @@ public String getName() { @Override public String getHelp() { - return "Generates a Dart Dio client library with null-safety."; + return "Generates a Dart client library with null-safety."; } @Override @@ -174,6 +202,12 @@ public void processOpts() { } setDateLibrary(additionalProperties.get(DATE_LIBRARY).toString()); + if (!additionalProperties.containsKey(NETWORKING_LIBRARY)) { + additionalProperties.put(NETWORKING_LIBRARY, NETWORKING_LIBRARY_DEFAULT); + LOGGER.debug("Networking library not set, using default {}", NETWORKING_LIBRARY_DEFAULT); + } + setNetworkingLibrary(additionalProperties.get(NETWORKING_LIBRARY).toString()); + if (!additionalProperties.containsKey(FINAL_PROPERTIES)) { additionalProperties.put(FINAL_PROPERTIES, Boolean.parseBoolean(FINAL_PROPERTIES_DEFAULT_VALUE)); LOGGER.debug("finalProperties not set, using default {}", FINAL_PROPERTIES_DEFAULT_VALUE); @@ -198,16 +232,99 @@ public void processOpts() { final String srcFolder = libPath + sourceFolder; supportingFiles.add(new SupportingFile("api_client.mustache", srcFolder, "api.dart")); - - final String authFolder = srcFolder + File.separator + "auth"; - supportingFiles.add(new SupportingFile("auth/api_key_auth.mustache", authFolder, "api_key_auth.dart")); - supportingFiles.add(new SupportingFile("auth/basic_auth.mustache", authFolder, "basic_auth.dart")); - supportingFiles.add(new SupportingFile("auth/bearer_auth.mustache", authFolder, "bearer_auth.dart")); - supportingFiles.add(new SupportingFile("auth/oauth.mustache", authFolder, "oauth.dart")); - supportingFiles.add(new SupportingFile("auth/auth.mustache", authFolder, "auth.dart")); + + //model exports + supportingFiles.add(new SupportingFile("model_exports.mustache", srcFolder + File.separator + modelPackage(), "_exports.dart")); + //api exports + supportingFiles.add(new SupportingFile("api_exports.mustache", srcFolder + File.separator + apiPackage(), "_exports.dart")); + + TemplateManagerOptions templateManagerOptions = new TemplateManagerOptions(isEnableMinimalUpdate(), isSkipOverwrite()); + TemplatePathLocator commonTemplateLocator = new CommonTemplateContentLocator(); + TemplatePathLocator generatorTemplateLocator = new GeneratorTemplateContentLocator(this); + templateManager = new TemplateManager( + templateManagerOptions, + getTemplatingEngine(), + new TemplatePathLocator[]{generatorTemplateLocator, commonTemplateLocator} + ); configureSerializationLibrary(srcFolder); configureDateLibrary(srcFolder); + configureNetworkingLibrary(srcFolder); + + + // A lambda which allows for easy includes of interescting networking and serialization library specific + // templates without having to change the main template files. + additionalProperties.put("includeSubTemplate", (Mustache.Lambda) (fragment, writer) -> { + MustacheEngineAdapter engine = ((MustacheEngineAdapter) getTemplatingEngine()); + String templateFile = networkingLibrary + "-" + library + "/" + fragment.execute() + ".mustache"; + Template tmpl = engine.getCompiler() + .withLoader(name -> engine.findTemplate(templateManager, name)) + .defaultValue("") + .compile(templateManager.getFullTemplateContents(templateFile)); + + fragment.executeTemplate(tmpl, writer); + }); + } + + private void configureNetworkingLibrary(String srcFolder) { + switch (networkingLibrary) { + case NETWORKING_LIBRARY_DIO: + additionalProperties.put("useDio", "true"); + configureNetworkingLibraryDio(srcFolder); + break; + case NETWORKING_LIBRARY_HTTP: + additionalProperties.put("useHttp", "true"); + configureNetworkingLibraryHttp(srcFolder); + break; + default: + break; + } + + // A lambda which allows for easy includes of networking library specific + // templates without having to change the main template files. + additionalProperties.put("includeNetworkingLibraryTemplate", (Mustache.Lambda) (fragment, writer) -> { + MustacheEngineAdapter engine = ((MustacheEngineAdapter) getTemplatingEngine()); + String templateFile = "networking/" + networkingLibrary + "/" + fragment.execute() + ".mustache"; + Template tmpl = engine.getCompiler() + .withLoader(name -> engine.findTemplate(templateManager, name)) + .defaultValue("") + .compile(templateManager.getFullTemplateContents(templateFile)); + + fragment.executeTemplate(tmpl, writer); + }); + + + + } + + private void configureNetworkingLibraryDio(String srcFolder) { + imports.put("MultipartFile", DIO_IMPORT); + + final String authFolder = srcFolder + File.separator + "auth"; + final String authMustacheFolder = "networking/dio/auth"; + supportingFiles.add(new SupportingFile("networking/dio/api_util.mustache", srcFolder, "api_util.dart")); + + supportingFiles.add(new SupportingFile(authMustacheFolder + File.separator + "_exports.mustache", authFolder, "_exports.dart")); + supportingFiles.add(new SupportingFile(authMustacheFolder + File.separator + "api_key_auth.mustache", authFolder, "api_key_auth.dart")); + supportingFiles.add(new SupportingFile(authMustacheFolder + File.separator + "authentication.mustache", authFolder, "auth.dart")); + supportingFiles.add(new SupportingFile(authMustacheFolder + File.separator + "basic_auth.mustache", authFolder, "basic_auth.dart")); + supportingFiles.add(new SupportingFile(authMustacheFolder + File.separator + "bearer_auth.mustache", authFolder, "bearer_auth.dart")); + supportingFiles.add(new SupportingFile(authMustacheFolder + File.separator + "oauth.mustache", authFolder, "oauth.dart")); + } + + private void configureNetworkingLibraryHttp(String srcFolder) { + imports.put("MultipartFile", HTTP_IMPORT); + + final String authFolder = srcFolder + File.separator + "auth"; + final String authMustacheFolder = "networking/http/auth"; + supportingFiles.add(new SupportingFile("networking/http/api_util.mustache", srcFolder, "api_util.dart")); + + supportingFiles.add(new SupportingFile(authMustacheFolder + File.separator + "_exports.mustache", authFolder, "_exports.dart")); + supportingFiles.add(new SupportingFile(authMustacheFolder + File.separator + "api_key_auth.mustache", authFolder, "api_key_auth.dart")); + supportingFiles.add(new SupportingFile(authMustacheFolder + File.separator + "authentication.mustache", authFolder, "auth.dart")); + supportingFiles.add(new SupportingFile(authMustacheFolder + File.separator + "basic_auth.mustache", authFolder, "basic_auth.dart")); + supportingFiles.add(new SupportingFile(authMustacheFolder + File.separator + "bearer_auth.mustache", authFolder, "bearer_auth.dart")); + supportingFiles.add(new SupportingFile(authMustacheFolder + File.separator + "oauth.mustache", authFolder, "oauth.dart")); } private void configureSerializationLibrary(String srcFolder) { @@ -223,15 +340,7 @@ private void configureSerializationLibrary(String srcFolder) { break; } - TemplateManagerOptions templateManagerOptions = new TemplateManagerOptions(isEnableMinimalUpdate(), isSkipOverwrite()); - TemplatePathLocator commonTemplateLocator = new CommonTemplateContentLocator(); - TemplatePathLocator generatorTemplateLocator = new GeneratorTemplateContentLocator(this); - templateManager = new TemplateManager( - templateManagerOptions, - getTemplatingEngine(), - new TemplatePathLocator[]{generatorTemplateLocator, commonTemplateLocator} - ); - + // A lambda which allows for easy includes of serialization library specific // templates without having to change the main template files. additionalProperties.put("includeLibraryTemplate", (Mustache.Lambda) (fragment, writer) -> { @@ -247,8 +356,7 @@ private void configureSerializationLibrary(String srcFolder) { } private void configureSerializationLibraryBuiltValue(String srcFolder) { - supportingFiles.add(new SupportingFile("serialization/built_value/serializers.mustache", srcFolder, "serializers.dart")); - supportingFiles.add(new SupportingFile("serialization/built_value/api_util.mustache", srcFolder, "api_util.dart")); + supportingFiles.add(new SupportingFile("serialization/built_value/serializers.mustache", srcFolder, "serializers.dart")); typeMapping.put("Array", "BuiltList"); typeMapping.put("array", "BuiltList"); @@ -265,7 +373,6 @@ private void configureSerializationLibraryBuiltValue(String srcFolder) { imports.put("BuiltMap", "package:built_collection/built_collection.dart"); imports.put("JsonObject", "package:built_value/json_object.dart"); imports.put("Uint8List", "dart:typed_data"); - imports.put("MultipartFile", DIO_IMPORT); } private void configureSerializationLibraryJsonSerializable(String srcFolder) { @@ -277,9 +384,8 @@ private void configureSerializationLibraryJsonSerializable(String srcFolder) { // just the binary / file handling languageSpecificPrimitives.add("Object"); imports.put("Uint8List", "dart:typed_data"); - imports.put("MultipartFile", DIO_IMPORT); } - + private void configureDateLibrary(String srcFolder) { switch (dateLibrary) { case DATE_LIBRARY_TIME_MACHINE: diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/README.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/README.mustache index 3efaca1cb660..e5356c38ceac 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/README.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/README.mustache @@ -1,4 +1,4 @@ -# {{pubName}} (EXPERIMENTAL) +# {{pubName}} {{#appDescriptionWithNewLines}} {{{.}}} {{/appDescriptionWithNewLines}} @@ -20,7 +20,12 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) ## Requirements * Dart 2.12.0 or later OR Flutter 1.26.0 or later +{{#useDio}} * Dio 4.0.0+ +{{/useDio}} +{{#useHttp}} +* http 0.13.5+ +{{/useHttp}} {{#useDateLibTimeMachine}} * timemachine option currently **DOES NOT** support sound null-safety and may not work {{/useDateLibTimeMachine}} 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 892cbafd4694..175710771450 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 @@ -1,8 +1,6 @@ {{>header}} -import 'dart:async'; - -{{#includeLibraryTemplate}}api/imports{{/includeLibraryTemplate}} -import 'package:dio/dio.dart'; +//ignore: unused_import +{{#includeSubTemplate}}api_imports{{/includeSubTemplate}} {{#operations}} {{#imports}}import '{{.}}'; @@ -10,137 +8,11 @@ import 'package:dio/dio.dart'; class {{classname}} { - final Dio _dio; - -{{#includeLibraryTemplate}}api/constructor{{/includeLibraryTemplate}} - - {{#operation}} - /// {{summary}}{{^summary}}{{nickname}}{{/summary}} - /// {{notes}} - /// - /// Parameters: - {{#allParams}} - /// * [{{paramName}}] {{#description}}- {{{.}}}{{/description}} - {{/allParams}} - /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation - /// * [headers] - Can be used to add additional headers to the request - /// * [extras] - Can be used to add flags to the request - /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response - /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress - /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress - /// - /// Returns a [Future]{{#returnType}} containing a [Response] with a [{{{.}}}] as data{{/returnType}} - /// Throws [DioError] if API call or serialization fails - {{#externalDocs}} - /// {{description}} - /// Also see [{{summary}} Documentation]({{url}}) - {{/externalDocs}} - {{#isDeprecated}} - @Deprecated('This operation has been deprecated') - {{/isDeprecated}} - Future> {{nickname}}({ {{#allParams}}{{#isPathParam}} - required {{{dataType}}} {{paramName}},{{/isPathParam}}{{#isQueryParam}} - {{#required}}{{^isNullable}}{{^defaultValue}}required {{/defaultValue}}{{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}}{{^isContainer}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isContainer}},{{/isQueryParam}}{{#isHeaderParam}} - {{#required}}{{^isNullable}}{{^defaultValue}}required {{/defaultValue}}{{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}}{{^isContainer}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isContainer}},{{/isHeaderParam}}{{#isBodyParam}} - {{#required}}{{^isNullable}}required {{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}},{{/isBodyParam}}{{#isFormParam}} - {{#required}}{{^isNullable}}required {{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}},{{/isFormParam}}{{/allParams}} - CancelToken? cancelToken, - Map? headers, - Map? extra, - ValidateStatus? validateStatus, - ProgressCallback? onSendProgress, - ProgressCallback? onReceiveProgress, - }) async { - final _path = r'{{{path}}}'{{#pathParams}}.replaceAll('{' r'{{{baseName}}}' '}', {{{paramName}}}.toString()){{/pathParams}}; - final _options = Options( - method: r'{{#lambda.uppercase}}{{httpMethod}}{{/lambda.uppercase}}', - {{#isResponseFile}} - responseType: ResponseType.bytes, - {{/isResponseFile}} - headers: { - {{#httpUserAgent}} - r'User-Agent': r'{{{.}}}', - {{/httpUserAgent}} - {{#headerParams}} - {{^required}}{{^isNullable}}if ({{{paramName}}} != null) {{/isNullable}}{{/required}}r'{{baseName}}': {{paramName}}, - {{/headerParams}} - ...?headers, - }, - extra: { - 'secure': >[{{^hasAuthMethods}}],{{/hasAuthMethods}}{{#hasAuthMethods}} - {{#authMethods}}{ - 'type': '{{type}}',{{#scheme}} - 'scheme': '{{.}}',{{/scheme}} - 'name': '{{name}}',{{#isApiKey}} - 'keyName': '{{keyParamName}}', - 'where': '{{#isKeyInQuery}}query{{/isKeyInQuery}}{{#isKeyInHeader}}header{{/isKeyInHeader}}',{{/isApiKey}} - },{{/authMethods}} - ],{{/hasAuthMethods}} - ...?extra, - },{{#hasConsumes}} - contentType: '{{#prioritizedContentTypes}}{{#-first}}{{{mediaType}}}{{/-first}}{{/prioritizedContentTypes}}',{{/hasConsumes}} - validateStatus: validateStatus, - );{{#hasQueryParams}} - - final _queryParameters = { - {{#queryParams}} - {{^required}}{{^isNullable}}if ({{{paramName}}} != null) {{/isNullable}}{{/required}}r'{{baseName}}': {{#includeLibraryTemplate}}api/query_param{{/includeLibraryTemplate}}, - {{/queryParams}} - };{{/hasQueryParams}}{{#hasBodyOrFormParams}} - - dynamic _bodyData; - - try { -{{#includeLibraryTemplate}}api/serialize{{/includeLibraryTemplate}} - } catch(error, stackTrace) { - throw DioError( - requestOptions: _options.compose( - _dio.options, - _path,{{#hasQueryParams}} - queryParameters: _queryParameters,{{/hasQueryParams}} - ), - type: DioErrorType.other, - error: error, - )..stackTrace = stackTrace; - }{{/hasBodyOrFormParams}} - - final _response = await _dio.request( - _path,{{#hasBodyOrFormParams}} - data: _bodyData,{{/hasBodyOrFormParams}} - options: _options,{{#hasQueryParams}} - queryParameters: _queryParameters,{{/hasQueryParams}} - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - {{#returnType}} - - {{{returnType}}} _responseData; +{{#includeSubTemplate}}api_fields{{/includeSubTemplate}} - try { -{{#includeLibraryTemplate}}api/deserialize{{/includeLibraryTemplate}} - } catch (error, stackTrace) { - throw DioError( - requestOptions: _response.requestOptions, - response: _response, - type: DioErrorType.other, - error: error, - )..stackTrace = stackTrace; - } +{{#includeSubTemplate}}api_constructor{{/includeSubTemplate}} - return Response<{{{returnType}}}>( - data: _responseData, - headers: _response.headers, - isRedirect: _response.isRedirect, - requestOptions: _response.requestOptions, - redirects: _response.redirects, - statusCode: _response.statusCode, - statusMessage: _response.statusMessage, - extra: _response.extra, - );{{/returnType}}{{^returnType}} - return _response;{{/returnType}} - } +{{#includeNetworkingLibraryTemplate}}api{{/includeNetworkingLibraryTemplate}} - {{/operation}} } {{/operations}} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_client.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_client.mustache index 0903a48759e1..37a5eef0a9c3 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_client.mustache @@ -1,72 +1 @@ -{{>header}} -import 'package:dio/dio.dart';{{#useBuiltValue}} -import 'package:built_value/serializer.dart'; -import 'package:{{pubName}}/{{sourceFolder}}/serializers.dart';{{/useBuiltValue}} -import 'package:{{pubName}}/{{sourceFolder}}/auth/api_key_auth.dart'; -import 'package:{{pubName}}/{{sourceFolder}}/auth/basic_auth.dart'; -import 'package:{{pubName}}/{{sourceFolder}}/auth/bearer_auth.dart'; -import 'package:{{pubName}}/{{sourceFolder}}/auth/oauth.dart'; -{{#apiInfo}}{{#apis}}import 'package:{{pubName}}/{{sourceFolder}}/{{apiPackage}}/{{classFilename}}.dart'; -{{/apis}}{{/apiInfo}} -class {{clientName}} { - static const String basePath = r'{{{basePath}}}'; - - final Dio dio; -{{#useBuiltValue}} - final Serializers serializers; - -{{/useBuiltValue}} - {{clientName}}({ - Dio? dio,{{#useBuiltValue}} - Serializers? serializers,{{/useBuiltValue}} - String? basePathOverride, - List? interceptors, - }) : {{#useBuiltValue}}this.serializers = serializers ?? standardSerializers,{{/useBuiltValue}} - this.dio = dio ?? - Dio(BaseOptions( - baseUrl: basePathOverride ?? basePath, - connectTimeout: 5000, - receiveTimeout: 3000, - )) { - if (interceptors == null) { - this.dio.interceptors.addAll([ - OAuthInterceptor(), - BasicAuthInterceptor(), - BearerAuthInterceptor(), - ApiKeyAuthInterceptor(), - ]); - } else { - this.dio.interceptors.addAll(interceptors); - } - } - - void setOAuthToken(String name, String token) { - if (this.dio.interceptors.any((i) => i is OAuthInterceptor)) { - (this.dio.interceptors.firstWhere((i) => i is OAuthInterceptor) as OAuthInterceptor).tokens[name] = token; - } - } - - void setBearerAuth(String name, String token) { - if (this.dio.interceptors.any((i) => i is BearerAuthInterceptor)) { - (this.dio.interceptors.firstWhere((i) => i is BearerAuthInterceptor) as BearerAuthInterceptor).tokens[name] = token; - } - } - - void setBasicAuth(String name, String username, String password) { - if (this.dio.interceptors.any((i) => i is BasicAuthInterceptor)) { - (this.dio.interceptors.firstWhere((i) => i is BasicAuthInterceptor) as BasicAuthInterceptor).authInfo[name] = BasicAuthInfo(username, password); - } - } - - void setApiKey(String name, String apiKey) { - if (this.dio.interceptors.any((i) => i is ApiKeyAuthInterceptor)) { - (this.dio.interceptors.firstWhere((element) => element is ApiKeyAuthInterceptor) as ApiKeyAuthInterceptor).apiKeys[name] = apiKey; - } - }{{#apiInfo}}{{#apis}} - - /// Get {{classname}} instance, base route and serializer can be overridden by a given but be careful, - /// by doing that all interceptors will not be executed - {{classname}} get{{classname}}() { - return {{classname}}(dio{{#useBuiltValue}}, serializers{{/useBuiltValue}}); - }{{/apis}}{{/apiInfo}} -} +{{#includeNetworkingLibraryTemplate}}api_client{{/includeNetworkingLibraryTemplate}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_exports.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_exports.mustache new file mode 100644 index 000000000000..59ba81a3b42b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/api_exports.mustache @@ -0,0 +1,2 @@ +{{#apiInfo}}{{#apis}}export '{{classFilename}}.dart'; +{{/apis}}{{/apiInfo}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/api/constructor.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-built_value/api_constructor.mustache similarity index 59% rename from modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/api/constructor.mustache rename to modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-built_value/api_constructor.mustache index e823414cc755..7b451db73866 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/api/constructor.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-built_value/api_constructor.mustache @@ -1,3 +1 @@ - final Serializers _serializers; - const {{classname}}(this._dio, this._serializers); \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-built_value/api_constructor_call.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-built_value/api_constructor_call.mustache new file mode 100644 index 000000000000..7bf1b1669637 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-built_value/api_constructor_call.mustache @@ -0,0 +1 @@ +dio, serializers diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-built_value/api_fields.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-built_value/api_fields.mustache new file mode 100644 index 000000000000..6307350b0108 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-built_value/api_fields.mustache @@ -0,0 +1,2 @@ + final Dio _dio; + final Serializers _serializers; diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-built_value/api_imports.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-built_value/api_imports.mustache new file mode 100644 index 000000000000..79c60fbc994f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-built_value/api_imports.mustache @@ -0,0 +1,2 @@ +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/api/constructor.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-json_serializable/api_constructor.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/api/constructor.mustache rename to modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-json_serializable/api_constructor.mustache diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-json_serializable/api_constructor_call.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-json_serializable/api_constructor_call.mustache new file mode 100644 index 000000000000..9a0ed73d5960 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-json_serializable/api_constructor_call.mustache @@ -0,0 +1 @@ +dio diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-json_serializable/api_fields.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-json_serializable/api_fields.mustache new file mode 100644 index 000000000000..179e7d0d57b4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-json_serializable/api_fields.mustache @@ -0,0 +1 @@ + final Dio _dio; \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-json_serializable/api_imports.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-json_serializable/api_imports.mustache new file mode 100644 index 000000000000..02d6d8b8e0fa --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/dio-json_serializable/api_imports.mustache @@ -0,0 +1,3 @@ +import 'dart:convert'; +import 'package:dio/dio.dart'; +import 'package:{{pubName}}/src/deserialize.dart'; diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-built_value/api_constructor.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-built_value/api_constructor.mustache new file mode 100644 index 000000000000..9e804ecbe079 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-built_value/api_constructor.mustache @@ -0,0 +1 @@ + const {{classname}}(this._client, this._basePath, this._serializers); \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-built_value/api_constructor_call.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-built_value/api_constructor_call.mustache new file mode 100644 index 000000000000..96bcb4d934a0 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-built_value/api_constructor_call.mustache @@ -0,0 +1 @@ +client, actualBasePath, serializers \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-built_value/api_fields.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-built_value/api_fields.mustache new file mode 100644 index 000000000000..d97d5fe41e2e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-built_value/api_fields.mustache @@ -0,0 +1,3 @@ + final Client _client; + final Serializers _serializers; + final String _basePath; diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-built_value/api_imports.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-built_value/api_imports.mustache new file mode 100644 index 000000000000..08b4eed13340 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-built_value/api_imports.mustache @@ -0,0 +1,2 @@ +import 'package:built_value/serializer.dart'; +import 'package:http/http.dart'; \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-json_serializable/api_constructor.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-json_serializable/api_constructor.mustache new file mode 100644 index 000000000000..e34ae0a90486 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-json_serializable/api_constructor.mustache @@ -0,0 +1 @@ + const {{classname}}(this._client, this._basePath); \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-json_serializable/api_constructor_call.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-json_serializable/api_constructor_call.mustache new file mode 100644 index 000000000000..76f2e3393461 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-json_serializable/api_constructor_call.mustache @@ -0,0 +1 @@ +client, actualBasePath \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-json_serializable/api_fields.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-json_serializable/api_fields.mustache new file mode 100644 index 000000000000..f7b96eb3dfca --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-json_serializable/api_fields.mustache @@ -0,0 +1,2 @@ + final Client _client; + final String _basePath; diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/api/imports.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-json_serializable/api_imports.mustache similarity index 68% rename from modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/api/imports.mustache rename to modules/openapi-generator/src/main/resources/dart/libraries/dio/http-json_serializable/api_imports.mustache index f2b20f7171b5..7f179bc4da68 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/api/imports.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/http-json_serializable/api_imports.mustache @@ -1,3 +1,3 @@ -// ignore: unused_import +import 'package:http/http.dart'; import 'dart:convert'; import 'package:{{pubName}}/src/deserialize.dart'; \ No newline at end of file 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 1ac711810617..0739ad99bb08 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 @@ -1,12 +1,7 @@ {{>header}} export 'package:{{pubName}}/{{sourceFolder}}/api.dart'; -export 'package:{{pubName}}/{{sourceFolder}}/auth/api_key_auth.dart'; -export 'package:{{pubName}}/{{sourceFolder}}/auth/basic_auth.dart'; -export 'package:{{pubName}}/{{sourceFolder}}/auth/oauth.dart'; -{{#useBuiltValue}}export 'package:{{pubName}}/{{sourceFolder}}/serializers.dart'; -{{#useDateLibCore}}export 'package:{{pubName}}/{{sourceFolder}}/{{modelPackage}}/date.dart';{{/useDateLibCore}}{{/useBuiltValue}} +export 'package:{{pubName}}/{{sourceFolder}}/auth/_exports.dart'; +{{#useBuiltValue}}export 'package:{{pubName}}/{{sourceFolder}}/serializers.dart';{{/useBuiltValue}} -{{#apiInfo}}{{#apis}}export 'package:{{pubName}}/{{sourceFolder}}/{{apiPackage}}/{{classFilename}}.dart'; -{{/apis}}{{/apiInfo}} -{{#models}}{{#model}}export 'package:{{pubName}}/{{sourceFolder}}/{{modelPackage}}/{{classFilename}}.dart'; -{{/model}}{{/models}} \ No newline at end of file +export 'package:{{pubName}}/{{sourceFolder}}/{{apiPackage}}/_exports.dart'; +export 'package:{{pubName}}/{{sourceFolder}}/{{modelPackage}}/_exports.dart'; \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/model_exports.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/model_exports.mustache new file mode 100644 index 000000000000..312df1a275d5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/model_exports.mustache @@ -0,0 +1,7 @@ +{{#models}}{{#model}}export '{{classFilename}}.dart'; +{{/model}}{{/models}} +{{#useBuiltValue}} +{{#useDateLibCore}} +export 'date.dart'; +{{/useDateLibCore}} +{{/useBuiltValue}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/api.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/api.mustache new file mode 100644 index 000000000000..2bf8e31334e7 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/api.mustache @@ -0,0 +1,106 @@ + {{#operation}} +{{>networking/dio/operation_header}} + Future> {{nickname}}({ {{#allParams}}{{#isPathParam}} + required {{{dataType}}} {{paramName}},{{/isPathParam}}{{#isQueryParam}} + {{#required}}{{^isNullable}}{{^defaultValue}}required {{/defaultValue}}{{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}}{{^isContainer}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isContainer}},{{/isQueryParam}}{{#isHeaderParam}} + {{#required}}{{^isNullable}}{{^defaultValue}}required {{/defaultValue}}{{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}}{{^isContainer}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isContainer}},{{/isHeaderParam}}{{#isBodyParam}} + {{#required}}{{^isNullable}}required {{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}},{{/isBodyParam}}{{#isFormParam}} + {{#required}}{{^isNullable}}required {{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}},{{/isFormParam}}{{/allParams}} + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'{{{path}}}'{{#pathParams}}.replaceAll('{' r'{{{baseName}}}' '}', {{{paramName}}}.toString()){{/pathParams}}; + final _options = Options( + method: r'{{#lambda.uppercase}}{{httpMethod}}{{/lambda.uppercase}}', + {{#isResponseFile}} + responseType: ResponseType.bytes, + {{/isResponseFile}} + headers: { + {{#httpUserAgent}} + r'User-Agent': r'{{{.}}}', + {{/httpUserAgent}} + {{#headerParams}} + {{^required}}{{^isNullable}}if ({{{paramName}}} != null) {{/isNullable}}{{/required}}r'{{baseName}}': {{paramName}}, + {{/headerParams}} + ...?headers, + }, + extra: { + 'secure': >[{{^hasAuthMethods}}],{{/hasAuthMethods}}{{#hasAuthMethods}} + {{#authMethods}}{ + 'type': '{{type}}',{{#scheme}} + 'scheme': '{{.}}',{{/scheme}} + 'name': '{{name}}',{{#isApiKey}} + 'keyName': '{{keyParamName}}', + 'where': '{{#isKeyInQuery}}query{{/isKeyInQuery}}{{#isKeyInHeader}}header{{/isKeyInHeader}}',{{/isApiKey}} + },{{/authMethods}} + ],{{/hasAuthMethods}} + ...?extra, + },{{#hasConsumes}} + contentType: '{{#prioritizedContentTypes}}{{#-first}}{{{mediaType}}}{{/-first}}{{/prioritizedContentTypes}}',{{/hasConsumes}} + validateStatus: validateStatus, + );{{#hasQueryParams}} + + final _queryParameters = { + {{#queryParams}} + {{^required}}{{^isNullable}}if ({{{paramName}}} != null) {{/isNullable}}{{/required}}r'{{baseName}}': {{#includeLibraryTemplate}}api/query_param{{/includeLibraryTemplate}}, + {{/queryParams}} + };{{/hasQueryParams}}{{#hasBodyOrFormParams}} + + dynamic _bodyData; + + try { +{{#includeLibraryTemplate}}api/serialize{{/includeLibraryTemplate}} + } catch(error, stackTrace) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path,{{#hasQueryParams}} + queryParameters: _queryParameters,{{/hasQueryParams}} + ), + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + }{{/hasBodyOrFormParams}} + + final _response = await _dio.request( + _path,{{#hasBodyOrFormParams}} + data: _bodyData,{{/hasBodyOrFormParams}} + options: _options,{{#hasQueryParams}} + queryParameters: _queryParameters,{{/hasQueryParams}} + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + {{#returnType}} + + {{{returnType}}} _responseData; + + try { +{{#includeLibraryTemplate}}api/deserialize{{/includeLibraryTemplate}} + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response<{{{returnType}}}>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + );{{/returnType}}{{^returnType}} + return _response;{{/returnType}} + } + + {{/operation}} \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/api.dart b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/api_client.mustache similarity index 65% rename from samples/openapi3/client/petstore/dart-dio/oneof/lib/src/api.dart rename to modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/api_client.mustache index ba9424a2d2a1..419103aff950 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/api.dart +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/api_client.mustache @@ -1,28 +1,24 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// - -import 'package:dio/dio.dart'; +{{>header}} +import 'package:dio/dio.dart';{{#useBuiltValue}} import 'package:built_value/serializer.dart'; -import 'package:openapi/src/serializers.dart'; -import 'package:openapi/src/auth/api_key_auth.dart'; -import 'package:openapi/src/auth/basic_auth.dart'; -import 'package:openapi/src/auth/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'; +import 'package:{{pubName}}/{{sourceFolder}}/serializers.dart';{{/useBuiltValue}} +import 'package:{{pubName}}/{{sourceFolder}}/auth/_exports.dart'; +{{#apiInfo}}{{#apis}}import 'package:{{pubName}}/{{sourceFolder}}/{{apiPackage}}/{{classFilename}}.dart'; +{{/apis}}{{/apiInfo}} +class {{clientName}} { + static const String basePath = r'{{{basePath}}}'; final Dio dio; +{{#useBuiltValue}} final Serializers serializers; - Openapi({ - Dio? dio, - Serializers? serializers, +{{/useBuiltValue}} + {{clientName}}({ + Dio? dio,{{#useBuiltValue}} + Serializers? serializers,{{/useBuiltValue}} String? basePathOverride, List? interceptors, - }) : this.serializers = serializers ?? standardSerializers, + }) : {{#useBuiltValue}}this.serializers = serializers ?? standardSerializers,{{/useBuiltValue}} this.dio = dio ?? Dio(BaseOptions( baseUrl: basePathOverride ?? basePath, @@ -63,11 +59,11 @@ class Openapi { if (this.dio.interceptors.any((i) => i is ApiKeyAuthInterceptor)) { (this.dio.interceptors.firstWhere((element) => element is ApiKeyAuthInterceptor) as ApiKeyAuthInterceptor).apiKeys[name] = apiKey; } - } + }{{#apiInfo}}{{#apis}} - /// Get DefaultApi instance, base route and serializer can be overridden by a given but be careful, + /// Get {{classname}} instance, base route and serializer can be overridden by a given but be careful, /// by doing that all interceptors will not be executed - DefaultApi getDefaultApi() { - return DefaultApi(dio, serializers); - } + {{classname}} get{{classname}}() { + return {{classname}}({{#includeSubTemplate}}api_constructor_call{{/includeSubTemplate}}); + }{{/apis}}{{/apiInfo}} } diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/api_util.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/api_util.mustache similarity index 98% rename from modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/api_util.mustache rename to modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/api_util.mustache index 45432b0042dc..4de858f4faf7 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/api_util.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/api_util.mustache @@ -2,9 +2,10 @@ import 'dart:convert'; import 'dart:typed_data'; +import 'package:dio/dio.dart'; +{{#useBuiltValue}} import 'package:built_collection/built_collection.dart'; import 'package:built_value/serializer.dart'; -import 'package:dio/dio.dart'; /// Format the given form parameter object into something that Dio can handle. /// Returns primitive or String. @@ -72,3 +73,4 @@ ListParam encodeCollectionQueryParameter( } throw ArgumentError('Invalid value passed to encodeCollectionQueryParameter'); } +{{/useBuiltValue}} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/auth/_exports.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/auth/_exports.mustache new file mode 100644 index 000000000000..1f9fc7a36702 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/auth/_exports.mustache @@ -0,0 +1,7 @@ +{{>header}} + +export 'api_key_auth.dart'; +export 'auth.dart'; +export 'basic_auth.dart'; +export 'bearer_auth.dart'; +export 'oauth.dart'; \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/api_key_auth.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/auth/api_key_auth.mustache similarity index 92% rename from modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/api_key_auth.mustache rename to modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/auth/api_key_auth.mustache index 5d9da99bd5d8..eb7f64f7df8b 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/api_key_auth.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/auth/api_key_auth.mustache @@ -1,7 +1,7 @@ {{>header}} import 'package:dio/dio.dart'; -import 'package:{{pubName}}/{{sourceFolder}}/auth/auth.dart'; +import 'auth.dart'; class ApiKeyAuthInterceptor extends AuthInterceptor { final Map apiKeys = {}; diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/auth.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/auth/authentication.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/auth.mustache rename to modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/auth/authentication.mustache diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/basic_auth.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/auth/basic_auth.mustache similarity index 94% rename from modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/basic_auth.mustache rename to modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/auth/basic_auth.mustache index c2a4426937da..002a27a853da 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/basic_auth.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/auth/basic_auth.mustache @@ -2,7 +2,7 @@ import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:{{pubName}}/{{sourceFolder}}/auth/auth.dart'; +import 'auth.dart'; class BasicAuthInfo { final String username; diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/bearer_auth.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/auth/bearer_auth.mustache similarity index 90% rename from modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/bearer_auth.mustache rename to modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/auth/bearer_auth.mustache index b4bce45ca61f..a9bad3f5d54b 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/bearer_auth.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/auth/bearer_auth.mustache @@ -1,6 +1,6 @@ {{>header}} import 'package:dio/dio.dart'; -import 'package:{{pubName}}/{{sourceFolder}}/auth/auth.dart'; +import 'auth.dart'; class BearerAuthInterceptor extends AuthInterceptor { final Map tokens = {}; diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/oauth.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/auth/oauth.mustache similarity index 90% rename from modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/oauth.mustache rename to modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/auth/oauth.mustache index e5af801f39be..d4218d2a0f3a 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/auth/oauth.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/auth/oauth.mustache @@ -1,6 +1,6 @@ {{>header}} import 'package:dio/dio.dart'; -import 'package:{{pubName}}/{{sourceFolder}}/auth/auth.dart'; +import 'auth.dart'; class OAuthInterceptor extends AuthInterceptor { final Map tokens = {}; diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/operation_header.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/operation_header.mustache new file mode 100644 index 000000000000..cee8509d4225 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/dio/operation_header.mustache @@ -0,0 +1,23 @@ + /// {{summary}}{{^summary}}{{nickname}}{{/summary}} + /// {{notes}} + /// + /// Parameters: + {{#allParams}} + /// * [{{paramName}}] {{#description}}- {{{.}}}{{/description}} + {{/allParams}} + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future]{{#returnType}} containing a [Response] with a [{{{.}}}] as data{{/returnType}} + /// Throws [DioError] if API call or serialization fails + {{#externalDocs}} + /// {{description}} + /// Also see [{{summary}} Documentation]({{url}}) + {{/externalDocs}} + {{#isDeprecated}} + @Deprecated('This operation has been deprecated') + {{/isDeprecated}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/api.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/api.mustache new file mode 100644 index 000000000000..2ac416863fa1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/api.mustache @@ -0,0 +1,104 @@ + {{#operation}} + +{{>networking/http/operation_header}} + Future<{{{returnType}}}{{^returnType}}void{{/returnType}}> {{nickname}}({ {{#allParams}}{{#isPathParam}} + required {{{dataType}}} {{paramName}},{{/isPathParam}}{{#isQueryParam}} + {{#required}}{{^isNullable}}{{^defaultValue}}required {{/defaultValue}}{{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}}{{^isContainer}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isContainer}},{{/isQueryParam}}{{#isHeaderParam}} + {{#required}}{{^isNullable}}{{^defaultValue}}required {{/defaultValue}}{{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}}{{^isContainer}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}{{/isContainer}},{{/isHeaderParam}}{{#isBodyParam}} + {{#required}}{{^isNullable}}required {{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}},{{/isBodyParam}}{{#isFormParam}} + {{#required}}{{^isNullable}}required {{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}?{{/isNullable}}{{/required}}{{^required}}?{{/required}} {{paramName}},{{/isFormParam}}{{/allParams}} + Map? headers, + }) async { + final _path = r'{{{path}}}'{{#pathParams}}.replaceAll('{' r'{{{baseName}}}' '}', {{{paramName}}}.toString()){{/pathParams}}; + final _uri = Uri.parse(_basePath + _path); + + final _options = Options( + method: r'{{#lambda.uppercase}}{{httpMethod}}{{/lambda.uppercase}}', + {{#isResponseFile}} + responseType: ResponseType.bytes, + {{/isResponseFile}} + headers: { + {{#httpUserAgent}} + r'User-Agent': r'{{{.}}}', + {{/httpUserAgent}} + {{#headerParams}} + {{^required}}{{^isNullable}}if ({{{paramName}}} != null) {{/isNullable}}{{/required}}r'{{baseName}}': {{paramName}}, + {{/headerParams}} + ...?headers, + }, + extra: { + 'secure': >[{{^hasAuthMethods}}],{{/hasAuthMethods}}{{#hasAuthMethods}} + {{#authMethods}}{ + 'type': '{{type}}',{{#scheme}} + 'scheme': '{{.}}',{{/scheme}} + 'name': '{{name}}',{{#isApiKey}} + 'keyName': '{{keyParamName}}', + 'where': '{{#isKeyInQuery}}query{{/isKeyInQuery}}{{#isKeyInHeader}}header{{/isKeyInHeader}}',{{/isApiKey}} + },{{/authMethods}} + ],{{/hasAuthMethods}} + ...?extra, + },{{#hasConsumes}} + contentType: '{{#prioritizedContentTypes}}{{#-first}}{{{mediaType}}}{{/-first}}{{/prioritizedContentTypes}}',{{/hasConsumes}} + validateStatus: validateStatus, + );{{#hasQueryParams}} + + final _queryParameters = { + {{#queryParams}} + {{^required}}{{^isNullable}}if ({{{paramName}}} != null) {{/isNullable}}{{/required}}r'{{baseName}}': {{#includeLibraryTemplate}}api/query_param{{/includeLibraryTemplate}}, + {{/queryParams}} + };{{/hasQueryParams}}{{#hasBodyOrFormParams}} + + dynamic _bodyData; + + try { +{{#includeLibraryTemplate}}api/serialize{{/includeLibraryTemplate}} + } catch(error, stackTrace) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path,{{#hasQueryParams}} + queryParameters: _queryParameters,{{/hasQueryParams}} + ), + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + }{{/hasBodyOrFormParams}} + + final _response = await _dio.request( + _path,{{#hasBodyOrFormParams}} + data: _bodyData,{{/hasBodyOrFormParams}} + options: _options,{{#hasQueryParams}} + queryParameters: _queryParameters,{{/hasQueryParams}} + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + {{#returnType}} + + {{{returnType}}} _responseData; + + try { +{{#includeLibraryTemplate}}api/deserialize{{/includeLibraryTemplate}} + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + return Response<{{{returnType}}}>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + );{{/returnType}}{{^returnType}} + return _response;{{/returnType}} + } + + {{/operation}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/api_client.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/api_client.mustache new file mode 100644 index 000000000000..db613d6babf1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/api_client.mustache @@ -0,0 +1,31 @@ +{{>header}} +import 'package:http/http.dart' as http;{{#useBuiltValue}} +import 'package:built_value/serializer.dart'; +import 'package:{{pubName}}/{{sourceFolder}}/serializers.dart';{{/useBuiltValue}} +import 'package:{{pubName}}/{{sourceFolder}}/auth/_exports.dart'; +{{#apiInfo}}{{#apis}}import 'package:{{pubName}}/{{sourceFolder}}/{{apiPackage}}/{{classFilename}}.dart'; +{{/apis}}{{/apiInfo}} +class {{clientName}} { + static const String basePath = r'{{{basePath}}}'; + + final http.Client client; + final String actualBasePath; +{{#useBuiltValue}} + final Serializers serializers; + +{{/useBuiltValue}} + {{clientName}}({ + http.Client? client,{{#useBuiltValue}} + Serializers? serializers,{{/useBuiltValue}} + String? basePathOverride, + }) : {{#useBuiltValue}}this.serializers = serializers ?? standardSerializers,{{/useBuiltValue}} + this.client = client ?? http.Client(), + this.actualBasePath = basePathOverride ?? basePath; + {{#apiInfo}}{{#apis}} + + /// Get {{classname}} instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + {{classname}} get{{classname}}() { + return {{classname}}({{#includeSubTemplate}}api_constructor_call{{/includeSubTemplate}}); + }{{/apis}}{{/apiInfo}} +} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/api_client_helper.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/api_client_helper.mustache new file mode 100644 index 000000000000..b340a9745757 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/api_client_helper.mustache @@ -0,0 +1,251 @@ +{{>header}} +{{>part_of}} +class ApiClient { + ApiClient({this.basePath = '{{{basePath}}}', this.authentication,}); + + final String basePath; + final Authentication? authentication; + + var _client = Client(); + final _defaultHeaderMap = {}; + + /// Returns the current HTTP [Client] instance to use in this class. + /// + /// The return value is guaranteed to never be null. + Client get client => _client; + + /// Requests to use a new HTTP [Client] in this class. + set client(Client newClient) { + _client = newClient; + } + + Map get defaultHeaderMap => _defaultHeaderMap; + + void addDefaultHeader(String key, String value) { + _defaultHeaderMap[key] = value; + } + + // We don't use a Map for queryParams. + // If collectionFormat is 'multi', a key might appear multiple times. + Future invokeAPI( + String path, + String method, + List queryParams, + Object? body, + Map headerParams, + Map formParams, + String? contentType, + ) async { + await authentication?.applyToParams(queryParams, headerParams); + + headerParams.addAll(_defaultHeaderMap); + if (contentType != null) { + headerParams['Content-Type'] = contentType; + } + + final urlEncodedQueryParams = queryParams.map((param) => '$param'); + final queryString = urlEncodedQueryParams.isNotEmpty ? '?${urlEncodedQueryParams.join('&')}' : ''; + final uri = Uri.parse('$basePath$path$queryString'); + + try { + // Special case for uploading a single file which isn't a 'multipart/form-data'. + if ( + body is MultipartFile && (contentType == null || + !contentType.toLowerCase().startsWith('multipart/form-data')) + ) { + final request = StreamedRequest(method, uri); + request.headers.addAll(headerParams); + request.contentLength = body.length; + body.finalize().listen( + request.sink.add, + onDone: request.sink.close, + // ignore: avoid_types_on_closure_parameters + onError: (Object error, StackTrace trace) => request.sink.close(), + cancelOnError: true, + ); + final response = await _client.send(request); + return Response.fromStream(response); + } + + if (body is MultipartRequest) { + final request = MultipartRequest(method, uri); + request.fields.addAll(body.fields); + request.files.addAll(body.files); + request.headers.addAll(body.headers); + request.headers.addAll(headerParams); + final response = await _client.send(request); + return Response.fromStream(response); + } + + final msgBody = contentType == 'application/x-www-form-urlencoded' + ? formParams + : await serializeAsync(body); + final nullableHeaderParams = headerParams.isEmpty ? null : headerParams; + + switch(method) { + case 'POST': return await _client.post(uri, headers: nullableHeaderParams, body: msgBody,); + case 'PUT': return await _client.put(uri, headers: nullableHeaderParams, body: msgBody,); + case 'DELETE': return await _client.delete(uri, headers: nullableHeaderParams, body: msgBody,); + case 'PATCH': return await _client.patch(uri, headers: nullableHeaderParams, body: msgBody,); + case 'HEAD': return await _client.head(uri, headers: nullableHeaderParams,); + case 'GET': return await _client.get(uri, headers: nullableHeaderParams,); + } + } on SocketException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'Socket operation failed: $method $path', + error, + trace, + ); + } on TlsException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'TLS/SSL communication failed: $method $path', + error, + trace, + ); + } on IOException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'I/O operation failed: $method $path', + error, + trace, + ); + } on ClientException catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'HTTP connection failed: $method $path', + error, + trace, + ); + } on Exception catch (error, trace) { + throw ApiException.withInner( + HttpStatus.badRequest, + 'Exception occurred: $method $path', + error, + trace, + ); + } + + throw ApiException( + HttpStatus.badRequest, + 'Invalid HTTP operation: $method $path', + ); + } +{{#native_serialization}} + + Future deserializeAsync(String json, String targetType, {bool growable = false,}) async => + // ignore: deprecated_member_use_from_same_package + deserialize(json, targetType, growable: growable); + + @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use deserializeAsync() instead.') + dynamic deserialize(String json, String targetType, {bool growable = false,}) { + // Remove all spaces. Necessary for regular expressions as well. + targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments + + // If the expected target type is String, nothing to do... + return targetType == 'String' + ? json + : _deserialize(jsonDecode(json), targetType, growable: growable); + } +{{/native_serialization}} + + // ignore: deprecated_member_use_from_same_package + Future serializeAsync(Object? value) async => serialize(value); + + @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.') + String serialize(Object? value) => value == null ? '' : json.encode(value); + +{{#native_serialization}} + static dynamic _deserialize(dynamic value, String targetType, {bool growable = false}) { + try { + switch (targetType) { + case 'String': + return value is String ? value : value.toString(); + case 'int': + return value is int ? value : int.parse('$value'); + case 'double': + return value is double ? value : double.parse('$value'); + case 'bool': + if (value is bool) { + return value; + } + final valueString = '$value'.toLowerCase(); + return valueString == 'true' || valueString == '1'; + case 'DateTime': + return value is DateTime ? value : DateTime.tryParse(value); + {{#models}} + {{#model}} + case '{{{classname}}}': + {{#isEnum}} + {{#native_serialization}}return {{{classname}}}TypeTransformer().decode(value);{{/native_serialization}} + {{/isEnum}} + {{^isEnum}} + return {{{classname}}}.fromJson(value); + {{/isEnum}} + {{/model}} + {{/models}} + default: + dynamic match; + if (value is List && (match = _regList.firstMatch(targetType)?.group(1)) != null) { + return value + .map((dynamic v) => _deserialize(v, match, growable: growable,)) + .toList(growable: growable); + } + if (value is Set && (match = _regSet.firstMatch(targetType)?.group(1)) != null) { + return value + .map((dynamic v) => _deserialize(v, match, growable: growable,)) + .toSet(); + } + if (value is Map && (match = _regMap.firstMatch(targetType)?.group(1)) != null) { + return Map.fromIterables( + value.keys.cast(), + value.values.map((dynamic v) => _deserialize(v, match, growable: growable,)), + ); + } + } + } on Exception catch (error, trace) { + throw ApiException.withInner(HttpStatus.internalServerError, 'Exception during deserialization.', error, trace,); + } + throw ApiException(HttpStatus.internalServerError, 'Could not find a suitable class for deserialization',); + } +{{/native_serialization}} +} +{{#native_serialization}} + +/// Primarily intended for use in an isolate. +class DeserializationMessage { + const DeserializationMessage({ + required this.json, + required this.targetType, + this.growable = false, + }); + + /// The JSON value to deserialize. + final String json; + + /// Target type to deserialize to. + final String targetType; + + /// Whether to make deserialized lists or maps growable. + final bool growable; +} + +/// Primarily intended for use in an isolate. +Future deserializeAsync(DeserializationMessage message) async { + // Remove all spaces. Necessary for regular expressions as well. + final targetType = message.targetType.replaceAll(' ', ''); + + // If the expected target type is String, nothing to do... + return targetType == 'String' + ? message.json + : ApiClient._deserialize( + jsonDecode(message.json), + targetType, + growable: message.growable, + ); +} +{{/native_serialization}} + +/// Primarily intended for use in an isolate. +Future serializeAsync(Object? value) async => value == null ? '' : json.encode(value); diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/api_exception.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/api_exception.mustache new file mode 100644 index 000000000000..aeb7aa9ce226 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/api_exception.mustache @@ -0,0 +1,23 @@ +{{>header}} +{{>part_of}} +class ApiException implements Exception { + ApiException(this.code, this.message); + + ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); + + int code = 0; + String? message; + Exception? innerException; + StackTrace? stackTrace; + + @override + String toString() { + if (message == null) { + return 'ApiException'; + } + if (innerException == null) { + return 'ApiException $code: $message'; + } + return 'ApiException $code: $message (Inner exception: $innerException)\n\n$stackTrace'; + } +} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/api_util.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/api_util.mustache new file mode 100644 index 000000000000..dce0a60260b2 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/api_util.mustache @@ -0,0 +1,59 @@ +{{>header}} +import 'dart:convert'; +import 'package:http/http.dart'; +import 'package:intl/intl.dart'; + +const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; +const _dateEpochMarker = 'epoch'; +final _dateFormatter = DateFormat('yyyy-MM-dd'); +final _regList = RegExp(r'^List<(.*)>$'); +final _regSet = RegExp(r'^Set<(.*)>$'); +final _regMap = RegExp(r'^Map$'); + +class QueryParam { + const QueryParam(this.name, this.value); + + final String name; + final String value; + + @override + String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value)}'; +} + +/* +// Ported from the Java version. +Iterable _queryParams(String collectionFormat, String name, dynamic value,) { + // Assertions to run in debug mode only. + assert(name.isNotEmpty, 'Parameter cannot be an empty string.'); + + final params = []; + + if (value is List) { + if (collectionFormat == 'multi') { + return value.map((dynamic v) => QueryParam(name, parameterToString(v)),); + } + + // Default collection format is 'csv'. + if (collectionFormat.isEmpty) { + collectionFormat = 'csv'; // ignore: parameter_assignments + } + + final delimiter = _delimiters[collectionFormat] ?? ','; + + params.add(QueryParam(name, value.map(parameterToString).join(delimiter),)); + } else if (value != null) { + params.add(QueryParam(name, parameterToString(value))); + } + + return params; +} +*/ + +/// Returns the decoded body as UTF-8 if the given headers indicate an 'application/json' +/// content type. Otherwise, returns the decoded body as decoded by dart:http package. +Future decodeBodyBytes(Response response) async { + final contentType = response.headers['content-type']; + return contentType != null && contentType.toLowerCase().startsWith('application/json') + ? response.bodyBytes.isEmpty ? '' : utf8.decode(response.bodyBytes) + : response.body; +} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/_exports.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/_exports.mustache new file mode 100644 index 000000000000..a6be733bbf0d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/_exports.mustache @@ -0,0 +1,7 @@ +{{>networking/http/auth/header}} + +export 'api_key_auth.dart'; +export 'auth.dart'; +export 'basic_auth.dart'; +export 'bearer_auth.dart'; +export 'oauth.dart'; \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/api_key_auth.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/api_key_auth.mustache new file mode 100644 index 000000000000..d02f32ebea18 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/api_key_auth.mustache @@ -0,0 +1,33 @@ +{{>networking/http/auth/header}} +{{>networking/http/auth/imports}} + +import 'auth.dart'; + +class ApiKeyAuth implements Authentication { + ApiKeyAuth(this.location, this.paramName); + + final String location; + final String paramName; + + String apiKeyPrefix = ''; + String apiKey = ''; + + @override + Future applyToParams(List queryParams, Map headerParams,) async { + final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; + + if (paramValue.isNotEmpty) { + if (location == 'query') { + queryParams.add(QueryParam(paramName, paramValue)); + } else if (location == 'header') { + headerParams[paramName] = paramValue; + } else if (location == 'cookie') { + headerParams.update( + 'Cookie', + (existingCookie) => '$existingCookie; $paramName=$paramValue', + ifAbsent: () => '$paramName=$paramValue', + ); + } + } + } +} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/authentication.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/authentication.mustache new file mode 100644 index 000000000000..6de932fa5538 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/authentication.mustache @@ -0,0 +1,8 @@ +{{>networking/http/auth/header}} +{{>networking/http/auth/imports}} + +// ignore: one_member_abstracts +abstract class Authentication { + /// Apply authentication settings to header and query params. + Future applyToParams(List queryParams, Map headerParams); +} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/basic_auth.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/basic_auth.mustache new file mode 100644 index 000000000000..ad36f6bd485c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/basic_auth.mustache @@ -0,0 +1,19 @@ +{{>networking/http/auth/header}} +{{>networking/http/auth/imports}} + +import 'auth.dart'; + +class HttpBasicAuth implements Authentication { + HttpBasicAuth({this.username = '', this.password = ''}); + + String username; + String password; + + @override + Future applyToParams(List queryParams, Map headerParams,) async { + if (username.isNotEmpty && password.isNotEmpty) { + final credentials = '$username:$password'; + headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; + } + } +} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/bearer_auth.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/bearer_auth.mustache new file mode 100644 index 000000000000..10a44f6567fa --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/bearer_auth.mustache @@ -0,0 +1,26 @@ +{{>networking/http/auth/header}} +{{>networking/http/auth/imports}} + +import 'auth.dart'; + + +typedef HttpBearerAuthProvider = String? Function(); + +class HttpBearerAuth implements Authentication { + HttpBearerAuth(); + + HttpBearerAuthProvider? accessTokenProvider; + + @override + Future applyToParams(List queryParams, Map headerParams,) async { + final provider = accessTokenProvider; + if (provider == null) { + return; + } + + final accessToken = provider(); + if (accessToken != null && accessToken.isNotEmpty) { + headerParams['Authorization'] = 'Bearer $accessToken'; + } + } +} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/header.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/header.mustache new file mode 100644 index 000000000000..a6c2e54ed951 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/header.mustache @@ -0,0 +1 @@ +{{>header}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/imports.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/imports.mustache new file mode 100644 index 000000000000..7a8f3d5e3d29 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/imports.mustache @@ -0,0 +1,2 @@ +import 'package:{{pubName}}/{{sourceFolder}}/api_util.dart'; +import 'dart:convert'; diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/oauth.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/oauth.mustache new file mode 100644 index 000000000000..99430d958977 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/auth/oauth.mustache @@ -0,0 +1,18 @@ +{{>networking/http/auth/header}} +{{>networking/http/auth/imports}} + +import 'auth.dart'; + + +class OAuth implements Authentication { + OAuth({this.accessToken = ''}); + + String accessToken; + + @override + Future applyToParams(List queryParams, Map headerParams,) async { + if (accessToken.isNotEmpty) { + headerParams['Authorization'] = 'Bearer $accessToken'; + } + } +} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/operation_header.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/operation_header.mustache new file mode 100644 index 000000000000..67652c422777 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/networking/http/operation_header.mustache @@ -0,0 +1,19 @@ + /// {{summary}}{{^summary}}{{nickname}}{{/summary}} + /// {{notes}} + /// + /// Parameters: + {{#allParams}} + /// * [{{paramName}}] {{#description}}- {{{.}}}{{/description}} + {{/allParams}} + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// + /// Throws [DioError] if API call or serialization fails + {{#externalDocs}} + /// {{description}} + /// Also see [{{summary}} Documentation]({{url}}) + {{/externalDocs}} + {{#isDeprecated}} + @Deprecated('This operation has been deprecated') + {{/isDeprecated}} \ 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 4faed4e3dc45..bc7408951422 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 @@ -12,7 +12,15 @@ environment: {{/useJsonSerializable}} dependencies: + +{{#useDio}} dio: '>=4.0.1 <5.0.0' +{{/useDio}} +{{#useHttp}} + http: '>=0.13.5 <2.0.0' + intl: '^0.17.0' + meta: '^1.1.8' +{{/useHttp}} {{#useBuiltValue}} one_of: '>=1.5.0 <2.0.0' one_of_serializer: '>=1.5.0 <2.0.0' diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/api/imports.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/api/imports.mustache deleted file mode 100644 index 2f62fbda4267..000000000000 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/api/imports.mustache +++ /dev/null @@ -1 +0,0 @@ -import 'package:built_value/serializer.dart'; \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/class.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/class.mustache index 6fe97cc9e4af..54a809d05bf9 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/class.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/class.mustache @@ -55,15 +55,21 @@ class {{{classname}}} { {{/vars}} + + {{#vars}} + {{#-first}} @override bool operator ==(Object other) => identical(this, other) || other is {{{classname}}} && - {{#vars}} + {{/-first}} + other.{{{name}}} == {{{name}}}{{^-last}} &&{{/-last}}{{#-last}};{{/-last}} {{/vars}} + {{#vars}} + {{#-first}} @override int get hashCode => - {{#vars}} + {{/-first}} {{#isNullable}}({{{name}}} == null ? 0 : {{{name}}}.hashCode){{/isNullable}}{{^isNullable}}{{{name}}}.hashCode{{/isNullable}}{{^-last}} +{{/-last}}{{#-last}};{{/-last}} {{/vars}} diff --git a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/dart_constructor.mustache b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/dart_constructor.mustache index 3b99f0c54016..332aa591838c 100644 --- a/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/dart_constructor.mustache +++ b/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/json_serializable/dart_constructor.mustache @@ -1,11 +1,9 @@ /// Returns a new [{{{classname}}}] instance. - {{{classname}}}({ - {{#vars}} + {{{classname}}}({{#vars}}{{#-first}}{ {{/-first}} {{! A field is required in Dart when it is required && !defaultValue in OAS }} - {{#required}}{{^defaultValue}}required {{/defaultValue}}{{/required}} this.{{{name}}}{{#defaultValue}} = {{#isEnum}}{{^isContainer}}const {{{enumName}}}._({{/isContainer}}{{/isEnum}}{{{defaultValue}}}{{#isEnum}}{{^isContainer}}){{/isContainer}}{{/isEnum}}{{/defaultValue}}, - {{/vars}} - }); \ No newline at end of file + {{#required}}{{^defaultValue}}required {{/defaultValue}}{{/required}} this.{{{name}}}{{#defaultValue}} = {{#isEnum}}{{^isContainer}}const {{{enumName}}}._({{/isContainer}}{{/isEnum}}{{{defaultValue}}}{{#isEnum}}{{^isContainer}}){{/isContainer}}{{/isEnum}}{{/defaultValue}}, + {{#-last}} }{{/-last}}{{/vars}}); \ No newline at end of file diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioClientOptionsTest.java index 2292d1109898..812dd1ff7644 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/dio/DartDioClientOptionsTest.java @@ -50,6 +50,7 @@ protected void verifyOptions() { verify(clientCodegen).setSourceFolder(DartDioClientOptionsProvider.SOURCE_FOLDER_VALUE); verify(clientCodegen).setUseEnumExtension(Boolean.parseBoolean(DartDioClientOptionsProvider.USE_ENUM_EXTENSION)); verify(clientCodegen).setDateLibrary(DartDioClientCodegen.DATE_LIBRARY_DEFAULT); + verify(clientCodegen).setNetworkingLibrary(DartDioClientCodegen.NETWORKING_LIBRARY_DEFAULT); verify(clientCodegen).setLibrary(DartDioClientCodegen.SERIALIZATION_LIBRARY_DEFAULT); verify(clientCodegen).setEnumUnknownDefaultCase(Boolean.parseBoolean(DartDioClientOptionsProvider.ENUM_UNKNOWN_DEFAULT_CASE_VALUE)); } diff --git a/modules/openapi-generator/src/test/resources/3_0/dart/echo_api.yaml b/modules/openapi-generator/src/test/resources/3_0/dart/echo_api.yaml new file mode 100644 index 000000000000..67127803291d --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/dart/echo_api.yaml @@ -0,0 +1,970 @@ +# +# Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +openapi: 3.0.3 +info: + title: Echo Server API + description: Echo Server API + contact: + email: team@openapitools.org + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + version: 0.1.0 +servers: + - url: http://localhost:3000/ +paths: + # Path usually starts with parameter type such as path, query, header, form + # For body/form parameters, path starts with "/echo" so the the echo server + # will response with the same body in the HTTP request. + # + # path parameter tests + /path/string/{path_string}/integer/{path_integer}: + get: + tags: + - path + summary: Test path parameter(s) + description: Test path parameter(s) + operationId: tests/path/string/{path_string}/integer/{path_integer} + parameters: + - in: path + name: path_string + required: true + schema: + type: string + - in: path + name: path_integer + required: true + schema: + type: integer + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + # query parameter tests + /query/integer/boolean/string: + get: + tags: + - query + summary: Test query parameter(s) + description: Test query parameter(s) + operationId: test/query/integer/boolean/string + parameters: + - in: query + name: integer_query + style: form #default + explode: true #default + schema: + type: integer + - in: query + name: boolean_query + style: form #default + explode: true #default + schema: + type: boolean + - in: query + name: string_query + style: form #default + explode: true #default + schema: + type: string + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + /query/style_form/explode_true/array_string: + get: + tags: + - query + summary: Test query parameter(s) + description: Test query parameter(s) + operationId: test/query/style_form/explode_true/array_string + parameters: + - in: query + name: query_object + style: form #default + explode: true #default + schema: + type: object + properties: + values: + type: array + items: + type: string + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + /query/style_form/explode_true/object: + get: + tags: + - query + summary: Test query parameter(s) + description: Test query parameter(s) + operationId: test/query/style_form/explode_true/object + parameters: + - in: query + name: query_object + style: form #default + explode: true #default + schema: + $ref: '#/components/schemas/Pet' + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + /echo/body/Pet: + post: + tags: + - body + summary: Test body parameter(s) + description: Test body parameter(s) + operationId: test/echo/body/Pet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + schemas: + fruit: + title: fruit + properties: + color: + type: string + oneOf: + - $ref: '#/components/schemas/apple' + - $ref: '#/components/schemas/banana' + # additionalProperties: + # type: string + # uncomment this when https://github.com/swagger-api/swagger-parser/issues/1252 is resolved + apple: + title: apple + type: object + properties: + kind: + type: string + banana: + title: banana + type: object + properties: + count: + type: number + ExampleNonPrimitive: + oneOf: + - type: string + format: uuid + - type: string + format: date-time + - type: integer + - type: number + + Child: + type: object + properties: + name: + type: string + Example: + oneOf: + - $ref: '#/components/schemas/Child' + - type: integer + format: int32 + Addressable: + type: object + properties: + href: + type: string + description: Hyperlink reference + id: + type: string + description: unique identifier + description: Base schema for addressable entities + Extensible: + type: object + properties: + "@schemaLocation": + type: string + description: A URI to a JSON-Schema file that defines additional attributes + and relationships + "@baseType": + type: string + description: When sub-classing, this defines the super-class + "@type": + type: string + description: When sub-classing, this defines the sub-class Extensible name + required: + - '@type' + Entity: + type: object + discriminator: + propertyName: '@type' + allOf: + - "$ref": "#/components/schemas/Addressable" + - "$ref": "#/components/schemas/Extensible" + EntityRef: + type: object + discriminator: + propertyName: '@type' + description: Entity reference schema to be use for all entityRef class. + properties: + name: + type: string + description: Name of the related entity. + '@referredType': + type: string + description: The actual type of the target instance when needed for disambiguation. + allOf: + - $ref: '#/components/schemas/Addressable' + - "$ref": "#/components/schemas/Extensible" + FooRefOrValue: + type: object + oneOf: + - $ref: "#/components/schemas/Foo" + - $ref: "#/components/schemas/FooRef" + discriminator: + propertyName: "@type" + Foo: + type: object + properties: + fooPropA: + type: string + fooPropB: + type: string + allOf: + - $ref: '#/components/schemas/Entity' + FooRef: + type: object + properties: + foorefPropA: + type: string + allOf: + - $ref: '#/components/schemas/EntityRef' + BarRef: + type: object + allOf: + - $ref: '#/components/schemas/EntityRef' + Bar_Create: + type: object + properties: + barPropA: + type: string + fooPropB: + type: string + foo: + $ref: '#/components/schemas/FooRefOrValue' + allOf: + - $ref: '#/components/schemas/Entity' + Bar: + type: object + required: + - id + properties: + id: + type: string + barPropA: + type: string + fooPropB: + type: string + foo: + $ref: '#/components/schemas/FooRefOrValue' + allOf: + - $ref: '#/components/schemas/Entity' + BarRefOrValue: + type: object + oneOf: + - $ref: "#/components/schemas/Bar" + - $ref: "#/components/schemas/BarRef" + Pizza: + type: object + properties: + pizzaSize: + type: number + allOf: + - $ref: '#/components/schemas/Entity' + Pasta: + type: object + properties: + vendor: + type: string + allOf: + - $ref: '#/components/schemas/Entity' + PizzaSpeziale: + type: object + properties: + toppings: + type: string + allOf: + - $ref: '#/components/schemas/Pizza' + + Category: + type: object + properties: + id: + type: integer + format: int64 + example: 1 + name: + type: string + example: Dogs + xml: + name: category + Tag: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: tag + Pet: + required: + - name + - photoUrls + type: object + properties: + id: + type: integer + format: int64 + example: 10 + name: + type: string + example: doggie + category: + $ref: '#/components/schemas/Category' + photoUrls: + type: array + xml: + wrapped: true + items: + type: string + xml: + name: photoUrl + tags: + type: array + xml: + wrapped: true + items: + $ref: '#/components/schemas/Tag' + status: + type: string + description: pet status in the store + enum: + - available + - pending + - sold + xml: + name: pet + Order: + type: object + properties: + id: + type: integer + format: int64 + petId: + type: integer + format: int64 + quantity: + type: integer + format: int32 + shipDate: + type: string + format: date-time + status: + type: string + description: Order Status + enum: + - placed + - approved + - delivered + complete: + type: boolean + default: false + xml: + name: Order + User: + type: object + properties: + id: + type: integer + format: int64 + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + type: integer + format: int32 + description: User Status + xml: + name: User + ApiResponse: + type: object + properties: + code: + type: integer + format: int32 + type: + type: string + message: + type: string + Return: + description: Model for testing reserved words + properties: + return: + type: integer + format: int32 + xml: + name: Return + Name: + description: Model for testing model name same as property name + required: + - name + properties: + name: + type: integer + format: int32 + snake_case: + readOnly: true + type: integer + format: int32 + property: + type: string + 123Number: + type: integer + readOnly: true + xml: + name: Name + 200_response: + description: Model for testing model name starting with number + properties: + name: + type: integer + format: int32 + class: + type: string + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - type: object + properties: + breed: + type: string + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - type: object + properties: + declawed: + type: boolean + Animal: + type: object + discriminator: + propertyName: className + required: + - className + properties: + className: + type: string + color: + type: string + default: red + AnimalFarm: + type: array + items: + $ref: '#/components/schemas/Animal' + format_test: + type: object + required: + - number + - byte + - date + - password + properties: + integer: + type: integer + maximum: 100 + minimum: 10 + int32: + type: integer + format: int32 + maximum: 200 + minimum: 20 + int64: + type: integer + format: int64 + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + type: number + format: float + maximum: 987.6 + minimum: 54.3 + double: + type: number + format: double + maximum: 123.4 + minimum: 67.8 + decimal: + type: string + format: number + string: + type: string + pattern: '/[a-z]/i' + byte: + type: string + format: byte + binary: + type: string + format: binary + date: + type: string + format: date + dateTime: + type: string + format: date-time + uuid: + type: string + format: uuid + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + password: + type: string + format: password + maxLength: 64 + minLength: 10 + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + type: string + pattern: '^\d{10}$' + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + type: string + pattern: '/^image_\d{1,3}$/i' + EnumClass: + type: string + default: '-efg' + enum: + - _abc + - '-efg' + - (xyz) + Enum_Test: + type: object + required: + - enum_string_required + properties: + enum_string: + type: string + enum: + - UPPER + - lower + - '' + enum_string_required: + type: string + enum: + - UPPER + - lower + - '' + enum_integer: + type: integer + format: int32 + enum: + - 1 + - -1 + enum_number: + type: number + format: double + enum: + - 1.1 + - -1.2 + outerEnum: + $ref: '#/components/schemas/OuterEnum' + outerEnumInteger: + $ref: '#/components/schemas/OuterEnumInteger' + outerEnumDefaultValue: + $ref: '#/components/schemas/OuterEnumDefaultValue' + outerEnumIntegerDefaultValue: + $ref: '#/components/schemas/OuterEnumIntegerDefaultValue' + AdditionalPropertiesClass: + type: object + properties: + map_property: + type: object + additionalProperties: + type: string + map_of_map_property: + type: object + additionalProperties: + type: object + additionalProperties: + type: string + MixedPropertiesAndAdditionalPropertiesClass: + type: object + properties: + uuid: + type: string + format: uuid + dateTime: + type: string + format: date-time + map: + type: object + additionalProperties: + $ref: '#/components/schemas/Animal' + List: + type: object + properties: + 123-list: + type: string + Client: + type: object + properties: + client: + type: string + ReadOnlyFirst: + type: object + properties: + bar: + type: string + readOnly: true + baz: + type: string + hasOnlyReadOnly: + type: object + properties: + bar: + type: string + readOnly: true + foo: + type: string + readOnly: true + Capitalization: + type: object + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + MapTest: + type: object + properties: + map_map_of_string: + type: object + additionalProperties: + type: object + additionalProperties: + type: string + map_of_enum_string: + type: object + additionalProperties: + type: string + enum: + - UPPER + - lower + direct_map: + type: object + additionalProperties: + type: boolean + indirect_map: + $ref: '#/components/schemas/StringBooleanMap' + ArrayTest: + type: object + properties: + array_of_string: + type: array + items: + type: string + minItems: 0 + maxItems: 3 + array_array_of_integer: + type: array + items: + type: array + items: + type: integer + format: int64 + array_array_of_model: + type: array + items: + type: array + items: + $ref: '#/components/schemas/ReadOnlyFirst' + NumberOnly: + type: object + properties: + JustNumber: + type: number + ArrayOfNumberOnly: + type: object + properties: + ArrayNumber: + type: array + items: + type: number + ArrayOfArrayOfNumberOnly: + type: object + properties: + ArrayArrayNumber: + type: array + items: + type: array + items: + type: number + EnumArrays: + type: object + properties: + just_symbol: + type: string + enum: + - '>=' + - $ + array_enum: + type: array + items: + type: string + enum: + - fish + - crab + OuterEnum: + nullable: true + type: string + enum: + - placed + - approved + - delivered + OuterEnumInteger: + type: integer + enum: + - 0 + - 1 + - 2 + example: 2 + OuterEnumDefaultValue: + type: string + enum: + - placed + - approved + - delivered + default: placed + OuterEnumIntegerDefaultValue: + type: integer + enum: + - 0 + - 1 + - 2 + default: 0 + OuterComposite: + type: object + properties: + my_number: + $ref: '#/components/schemas/OuterNumber' + my_string: + $ref: '#/components/schemas/OuterString' + my_boolean: + $ref: '#/components/schemas/OuterBoolean' + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + StringBooleanMap: + additionalProperties: + type: boolean + FileSchemaTestClass: + type: object + properties: + file: + $ref: '#/components/schemas/File' + files: + type: array + items: + $ref: '#/components/schemas/File' + File: + type: object + description: Must be named `File` for test. + properties: + sourceURI: + description: Test capitalization + type: string + _special_model.name_: + properties: + '$special[property.name]': + type: integer + format: int64 + xml: + name: '$special[model.name]' + HealthCheckResult: + type: object + properties: + NullableMessage: + nullable: true + type: string + description: Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + NullableClass: + type: object + properties: + integer_prop: + type: integer + nullable: true + number_prop: + type: number + nullable: true + boolean_prop: + type: boolean + nullable: true + string_prop: + type: string + nullable: true + date_prop: + type: string + format: date + nullable: true + datetime_prop: + type: string + format: date-time + nullable: true + array_nullable_prop: + type: array + nullable: true + items: + type: object + array_and_items_nullable_prop: + type: array + nullable: true + items: + type: object + nullable: true + array_items_nullable: + type: array + items: + type: object + nullable: true + object_nullable_prop: + type: object + nullable: true + additionalProperties: + type: object + object_and_items_nullable_prop: + type: object + nullable: true + additionalProperties: + type: object + nullable: true + object_items_nullable: + type: object + additionalProperties: + type: object + nullable: true + additionalProperties: + type: object + nullable: true + OuterObjectWithEnumProperty: + type: object + example: + value: 2 + required: + - value + properties: + value: + $ref: '#/components/schemas/OuterEnumInteger' + DeprecatedObject: + type: object + deprecated: true + properties: + name: + type: string + ObjectWithDeprecatedFields: + type: object + properties: + uuid: + type: string + id: + type: number + deprecated: true + deprecatedRef: + $ref: '#/components/schemas/DeprecatedObject' + bars: + type: array + deprecated: true + items: + $ref: '#/components/schemas/Bar' + AllOfWithSingleRef: + type: object + properties: + username: + type: string + SingleRefType: + allOf: + - $ref: '#/components/schemas/SingleRefType' + SingleRefType: + type: string + title: SingleRefType + enum: + - admin + - user \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/.gitignore b/samples/client/echo_api/dart/dart-dio-built_value/.gitignore similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof/.gitignore rename to samples/client/echo_api/dart/dart-dio-built_value/.gitignore diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/.openapi-generator-ignore b/samples/client/echo_api/dart/dart-dio-built_value/.openapi-generator-ignore similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof/.openapi-generator-ignore rename to samples/client/echo_api/dart/dart-dio-built_value/.openapi-generator-ignore diff --git a/samples/client/echo_api/dart/dart-dio-built_value/.openapi-generator/FILES b/samples/client/echo_api/dart/dart-dio-built_value/.openapi-generator/FILES new file mode 100644 index 000000000000..eb91ad816446 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/.openapi-generator/FILES @@ -0,0 +1,158 @@ +.gitignore +README.md +analysis_options.yaml +doc/AdditionalPropertiesClass.md +doc/Addressable.md +doc/AllOfWithSingleRef.md +doc/Animal.md +doc/ApiResponse.md +doc/Apple.md +doc/ArrayOfArrayOfNumberOnly.md +doc/ArrayOfNumberOnly.md +doc/ArrayTest.md +doc/Banana.md +doc/Bar.md +doc/BarCreate.md +doc/BarRef.md +doc/BarRefOrValue.md +doc/BodyApi.md +doc/Capitalization.md +doc/Cat.md +doc/CatAllOf.md +doc/Category.md +doc/Child.md +doc/ClassModel.md +doc/DeprecatedObject.md +doc/Dog.md +doc/DogAllOf.md +doc/Entity.md +doc/EntityRef.md +doc/EnumArrays.md +doc/EnumTest.md +doc/Example.md +doc/ExampleNonPrimitive.md +doc/Extensible.md +doc/FileSchemaTestClass.md +doc/Foo.md +doc/FooRef.md +doc/FooRefOrValue.md +doc/FormatTest.md +doc/Fruit.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/Pasta.md +doc/PathApi.md +doc/Pet.md +doc/Pizza.md +doc/PizzaSpeziale.md +doc/QueryApi.md +doc/ReadOnlyFirst.md +doc/SingleRefType.md +doc/SpecialModelName.md +doc/Tag.md +doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md +doc/User.md +lib/openapi.dart +lib/src/api.dart +lib/src/api/_exports.dart +lib/src/api/body_api.dart +lib/src/api/path_api.dart +lib/src/api/query_api.dart +lib/src/api_util.dart +lib/src/auth/_exports.dart +lib/src/auth/api_key_auth.dart +lib/src/auth/auth.dart +lib/src/auth/basic_auth.dart +lib/src/auth/bearer_auth.dart +lib/src/auth/oauth.dart +lib/src/date_serializer.dart +lib/src/model/_exports.dart +lib/src/model/additional_properties_class.dart +lib/src/model/addressable.dart +lib/src/model/all_of_with_single_ref.dart +lib/src/model/animal.dart +lib/src/model/api_response.dart +lib/src/model/apple.dart +lib/src/model/array_of_array_of_number_only.dart +lib/src/model/array_of_number_only.dart +lib/src/model/array_test.dart +lib/src/model/banana.dart +lib/src/model/bar.dart +lib/src/model/bar_create.dart +lib/src/model/bar_ref.dart +lib/src/model/bar_ref_or_value.dart +lib/src/model/capitalization.dart +lib/src/model/cat.dart +lib/src/model/cat_all_of.dart +lib/src/model/category.dart +lib/src/model/child.dart +lib/src/model/class_model.dart +lib/src/model/date.dart +lib/src/model/deprecated_object.dart +lib/src/model/dog.dart +lib/src/model/dog_all_of.dart +lib/src/model/entity.dart +lib/src/model/entity_ref.dart +lib/src/model/enum_arrays.dart +lib/src/model/enum_test.dart +lib/src/model/example.dart +lib/src/model/example_non_primitive.dart +lib/src/model/extensible.dart +lib/src/model/file_schema_test_class.dart +lib/src/model/foo.dart +lib/src/model/foo_ref.dart +lib/src/model/foo_ref_or_value.dart +lib/src/model/format_test.dart +lib/src/model/fruit.dart +lib/src/model/has_only_read_only.dart +lib/src/model/health_check_result.dart +lib/src/model/map_test.dart +lib/src/model/mixed_properties_and_additional_properties_class.dart +lib/src/model/model200_response.dart +lib/src/model/model_client.dart +lib/src/model/model_enum_class.dart +lib/src/model/model_file.dart +lib/src/model/model_list.dart +lib/src/model/model_return.dart +lib/src/model/name.dart +lib/src/model/nullable_class.dart +lib/src/model/number_only.dart +lib/src/model/object_with_deprecated_fields.dart +lib/src/model/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/pasta.dart +lib/src/model/pet.dart +lib/src/model/pizza.dart +lib/src/model/pizza_speziale.dart +lib/src/model/read_only_first.dart +lib/src/model/single_ref_type.dart +lib/src/model/special_model_name.dart +lib/src/model/tag.dart +lib/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart +lib/src/model/user.dart +lib/src/serializers.dart +pubspec.yaml diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/.openapi-generator/VERSION b/samples/client/echo_api/dart/dart-dio-built_value/.openapi-generator/VERSION similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof/.openapi-generator/VERSION rename to samples/client/echo_api/dart/dart-dio-built_value/.openapi-generator/VERSION diff --git a/samples/client/echo_api/dart/dart-dio-built_value/README.md b/samples/client/echo_api/dart/dart-dio-built_value/README.md new file mode 100644 index 000000000000..ed9a0096600c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/README.md @@ -0,0 +1,153 @@ +# openapi +Echo Server API + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 0.1.0 +- Build package: org.openapitools.codegen.languages.DartDioClientCodegen + +## Requirements + +* Dart 2.12.0 or later OR Flutter 1.26.0 or later +* Dio 4.0.0+ + +## 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().getBodyApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store + +try { + final response = await api.testEchoBodyPet(pet); + print(response); +} catch on DioError (e) { + print("Exception when calling BodyApi->testEchoBodyPet: $e\n"); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:3000* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +[*BodyApi*](doc/BodyApi.md) | [**testEchoBodyPet**](doc/BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s) +[*PathApi*](doc/PathApi.md) | [**testsPathStringPathStringIntegerPathInteger**](doc/PathApi.md#testspathstringpathstringintegerpathinteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) +[*QueryApi*](doc/QueryApi.md) | [**testQueryIntegerBooleanString**](doc/QueryApi.md#testqueryintegerbooleanstring) | **GET** /query/integer/boolean/string | Test query parameter(s) +[*QueryApi*](doc/QueryApi.md) | [**testQueryStyleFormExplodeTrueArrayString**](doc/QueryApi.md#testquerystyleformexplodetruearraystring) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) +[*QueryApi*](doc/QueryApi.md) | [**testQueryStyleFormExplodeTrueObject**](doc/QueryApi.md#testquerystyleformexplodetrueobject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) + + +## Documentation For Models + + - [AdditionalPropertiesClass](doc/AdditionalPropertiesClass.md) + - [Addressable](doc/Addressable.md) + - [AllOfWithSingleRef](doc/AllOfWithSingleRef.md) + - [Animal](doc/Animal.md) + - [ApiResponse](doc/ApiResponse.md) + - [Apple](doc/Apple.md) + - [ArrayOfArrayOfNumberOnly](doc/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](doc/ArrayOfNumberOnly.md) + - [ArrayTest](doc/ArrayTest.md) + - [Banana](doc/Banana.md) + - [Bar](doc/Bar.md) + - [BarCreate](doc/BarCreate.md) + - [BarRef](doc/BarRef.md) + - [BarRefOrValue](doc/BarRefOrValue.md) + - [Capitalization](doc/Capitalization.md) + - [Cat](doc/Cat.md) + - [CatAllOf](doc/CatAllOf.md) + - [Category](doc/Category.md) + - [Child](doc/Child.md) + - [ClassModel](doc/ClassModel.md) + - [DeprecatedObject](doc/DeprecatedObject.md) + - [Dog](doc/Dog.md) + - [DogAllOf](doc/DogAllOf.md) + - [Entity](doc/Entity.md) + - [EntityRef](doc/EntityRef.md) + - [EnumArrays](doc/EnumArrays.md) + - [EnumTest](doc/EnumTest.md) + - [Example](doc/Example.md) + - [ExampleNonPrimitive](doc/ExampleNonPrimitive.md) + - [Extensible](doc/Extensible.md) + - [FileSchemaTestClass](doc/FileSchemaTestClass.md) + - [Foo](doc/Foo.md) + - [FooRef](doc/FooRef.md) + - [FooRefOrValue](doc/FooRefOrValue.md) + - [FormatTest](doc/FormatTest.md) + - [Fruit](doc/Fruit.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) + - [Pasta](doc/Pasta.md) + - [Pet](doc/Pet.md) + - [Pizza](doc/Pizza.md) + - [PizzaSpeziale](doc/PizzaSpeziale.md) + - [ReadOnlyFirst](doc/ReadOnlyFirst.md) + - [SingleRefType](doc/SingleRefType.md) + - [SpecialModelName](doc/SpecialModelName.md) + - [Tag](doc/Tag.md) + - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) + - [User](doc/User.md) + + +## Documentation For Authorization + + All endpoints do not require authorization. + + +## Author + +team@openapitools.org + diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/analysis_options.yaml b/samples/client/echo_api/dart/dart-dio-built_value/analysis_options.yaml similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof/analysis_options.yaml rename to samples/client/echo_api/dart/dart-dio-built_value/analysis_options.yaml diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/AdditionalPropertiesClass.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..f9f7857894d0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/doc/AdditionalPropertiesClass.md @@ -0,0 +1,16 @@ +# openapi.model.AdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapProperty** | **BuiltMap<String, String>** | | [optional] +**mapOfMapProperty** | [**BuiltMap<String, BuiltMap<String, String>>**](BuiltMap.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/Addressable.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Addressable.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/Addressable.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/Addressable.md diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/AllOfWithSingleRef.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/AllOfWithSingleRef.md new file mode 100644 index 000000000000..4c6f3ab2fe11 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/Animal.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Animal.md new file mode 100644 index 000000000000..415b56e9bc2e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/ApiResponse.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/ApiResponse.md new file mode 100644 index 000000000000..7ad5da0f89e4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/oneof/doc/Apple.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Apple.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof/doc/Apple.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/Apple.md diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/ArrayOfArrayOfNumberOnly.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..d1a272ab6023 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/doc/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayArrayNumber** | [**BuiltList<BuiltList<num>>**](BuiltList.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/ArrayOfNumberOnly.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..94b60f272fd4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/doc/ArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayNumber** | **BuiltList<num>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/ArrayTest.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/ArrayTest.md new file mode 100644 index 000000000000..0813d4fa93c6 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/doc/ArrayTest.md @@ -0,0 +1,17 @@ +# openapi.model.ArrayTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayOfString** | **BuiltList<String>** | | [optional] +**arrayArrayOfInteger** | [**BuiltList<BuiltList<int>>**](BuiltList.md) | | [optional] +**arrayArrayOfModel** | [**BuiltList<BuiltList<ReadOnlyFirst>>**](BuiltList.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/doc/Banana.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Banana.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof/doc/Banana.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/Banana.md diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/Bar.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Bar.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/Bar.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/Bar.md diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/BarCreate.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/BarCreate.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/BarCreate.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/BarCreate.md diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/BarRef.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/BarRef.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/BarRef.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/BarRef.md diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/BarRefOrValue.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/BarRefOrValue.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/BarRefOrValue.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/BarRefOrValue.md diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/BarApi.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/BodyApi.md similarity index 54% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/BarApi.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/BodyApi.md index 3ef168ecf34b..145854fc8d28 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/BarApi.md +++ b/samples/client/echo_api/dart/dart-dio-built_value/doc/BodyApi.md @@ -1,34 +1,36 @@ -# openapi.api.BarApi +# openapi.api.BodyApi ## Load the API package ```dart import 'package:openapi/api.dart'; ``` -All URIs are relative to *http://localhost:8080* +All URIs are relative to *http://localhost:3000* Method | HTTP request | Description ------------- | ------------- | ------------- -[**createBar**](BarApi.md#createbar) | **POST** /bar | Create a Bar +[**testEchoBodyPet**](BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s) -# **createBar** -> Bar createBar(barCreate) +# **testEchoBodyPet** +> Pet testEchoBodyPet(pet) -Create a Bar +Test body parameter(s) + +Test body parameter(s) ### Example ```dart import 'package:openapi/api.dart'; -final api = Openapi().getBarApi(); -final BarCreate barCreate = ; // BarCreate | +final api = Openapi().getBodyApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store try { - final response = api.createBar(barCreate); + final response = api.testEchoBodyPet(pet); print(response); } catch on DioError (e) { - print('Exception when calling BarApi->createBar: $e\n'); + print('Exception when calling BodyApi->testEchoBodyPet: $e\n'); } ``` @@ -36,11 +38,11 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **barCreate** | [**BarCreate**](BarCreate.md)| | + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] ### Return type -[**Bar**](Bar.md) +[**Pet**](Pet.md) ### Authorization diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/Capitalization.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Capitalization.md new file mode 100644 index 000000000000..4a07b4eb820d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/Cat.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Cat.md new file mode 100644 index 000000000000..6552eea4b435 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/CatAllOf.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/CatAllOf.md new file mode 100644 index 000000000000..36b2ae0e8ab3 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/doc/CatAllOf.md @@ -0,0 +1,15 @@ +# openapi.model.CatAllOf + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/Category.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Category.md new file mode 100644 index 000000000000..98d0b14be7b1 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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** | | [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/oneof_primitive/doc/Child.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Child.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_primitive/doc/Child.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/Child.md diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/ClassModel.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/ClassModel.md new file mode 100644 index 000000000000..9b80d4f71eea --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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 +------------ | ------------- | ------------- | ------------- +**classField** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/DeprecatedObject.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/DeprecatedObject.md new file mode 100644 index 000000000000..bf2ef67a26fc --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/Dog.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Dog.md new file mode 100644 index 000000000000..d36439b767bb --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/DogAllOf.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/DogAllOf.md new file mode 100644 index 000000000000..97a7c8fba492 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/doc/DogAllOf.md @@ -0,0 +1,15 @@ +# openapi.model.DogAllOf + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/Entity.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Entity.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/Entity.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/Entity.md diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/EntityRef.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/EntityRef.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/EntityRef.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/EntityRef.md diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/EnumArrays.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/EnumArrays.md new file mode 100644 index 000000000000..06170bb8f51d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/doc/EnumArrays.md @@ -0,0 +1,16 @@ +# openapi.model.EnumArrays + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justSymbol** | **String** | | [optional] +**arrayEnum** | **BuiltList<String>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/EnumTest.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/EnumTest.md new file mode 100644 index 000000000000..7c24fe2347b4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/oneof_primitive/doc/Example.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Example.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_primitive/doc/Example.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/Example.md diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/ExampleNonPrimitive.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/ExampleNonPrimitive.md new file mode 100644 index 000000000000..2b63a98c6ad9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/doc/ExampleNonPrimitive.md @@ -0,0 +1,14 @@ +# openapi.model.ExampleNonPrimitive + +## 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/oneof_polymorphism_and_inheritance/doc/Extensible.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Extensible.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/Extensible.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/Extensible.md diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/FileSchemaTestClass.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/FileSchemaTestClass.md new file mode 100644 index 000000000000..105fece87f1d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/doc/FileSchemaTestClass.md @@ -0,0 +1,16 @@ +# openapi.model.FileSchemaTestClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**ModelFile**](ModelFile.md) | | [optional] +**files** | [**BuiltList<ModelFile>**](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/oneof_polymorphism_and_inheritance/doc/Foo.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Foo.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/Foo.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/Foo.md diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/FooRef.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/FooRef.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/FooRef.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/FooRef.md diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/FooRefOrValue.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/FooRefOrValue.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/FooRefOrValue.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/FooRefOrValue.md diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/FormatTest.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/FormatTest.md new file mode 100644 index 000000000000..f811264ca2ba --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/doc/FormatTest.md @@ -0,0 +1,30 @@ +# openapi.model.FormatTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | | [optional] +**int32** | **int** | | [optional] +**int64** | **int** | | [optional] +**number** | **num** | | +**float** | **double** | | [optional] +**double_** | **double** | | [optional] +**decimal** | **double** | | [optional] +**string** | **String** | | [optional] +**byte** | **String** | | +**binary** | [**Uint8List**](Uint8List.md) | | [optional] +**date** | [**Date**](Date.md) | | +**dateTime** | [**DateTime**](DateTime.md) | | [optional] +**uuid** | **String** | | [optional] +**password** | **String** | | +**patternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] +**patternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/doc/Fruit.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Fruit.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof/doc/Fruit.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/Fruit.md diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/HasOnlyReadOnly.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/HasOnlyReadOnly.md new file mode 100644 index 000000000000..32cae937155d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/HealthCheckResult.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/HealthCheckResult.md new file mode 100644 index 000000000000..4d6aeb75d965 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/MapTest.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/MapTest.md new file mode 100644 index 000000000000..4ad87df64232 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/doc/MapTest.md @@ -0,0 +1,18 @@ +# openapi.model.MapTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapMapOfString** | [**BuiltMap<String, BuiltMap<String, String>>**](BuiltMap.md) | | [optional] +**mapOfEnumString** | **BuiltMap<String, String>** | | [optional] +**directMap** | **BuiltMap<String, bool>** | | [optional] +**indirectMap** | **BuiltMap<String, bool>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..b1a4c4ccc401 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/doc/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,17 @@ +# openapi.model.MixedPropertiesAndAdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **String** | | [optional] +**dateTime** | [**DateTime**](DateTime.md) | | [optional] +**map** | [**BuiltMap<String, Animal>**](Animal.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/Model200Response.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Model200Response.md new file mode 100644 index 000000000000..e8b088ca1afa --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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] +**classField** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/ModelClient.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/ModelClient.md new file mode 100644 index 000000000000..f7b922f4a398 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/ModelEnumClass.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/ModelEnumClass.md new file mode 100644 index 000000000000..ebaafb44c7f7 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/ModelFile.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/ModelFile.md new file mode 100644 index 000000000000..4be260e93f6e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/ModelList.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/ModelList.md new file mode 100644 index 000000000000..283aa1f6b711 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/ModelReturn.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/ModelReturn.md new file mode 100644 index 000000000000..bc02df7a3692 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/Name.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Name.md new file mode 100644 index 000000000000..25f49ea946b4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/NullableClass.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/NullableClass.md new file mode 100644 index 000000000000..4ce8d5e17576 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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** | [**Date**](Date.md) | | [optional] +**datetimeProp** | [**DateTime**](DateTime.md) | | [optional] +**arrayNullableProp** | [**BuiltList<JsonObject>**](JsonObject.md) | | [optional] +**arrayAndItemsNullableProp** | [**BuiltList<JsonObject>**](JsonObject.md) | | [optional] +**arrayItemsNullable** | [**BuiltList<JsonObject>**](JsonObject.md) | | [optional] +**objectNullableProp** | [**BuiltMap<String, JsonObject>**](JsonObject.md) | | [optional] +**objectAndItemsNullableProp** | [**BuiltMap<String, JsonObject>**](JsonObject.md) | | [optional] +**objectItemsNullable** | [**BuiltMap<String, JsonObject>**](JsonObject.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/NumberOnly.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/NumberOnly.md new file mode 100644 index 000000000000..d8096a3db37a --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/ObjectWithDeprecatedFields.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..00d3cc694525 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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** | [**BuiltList<Bar>**](Bar.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/Order.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Order.md new file mode 100644 index 000000000000..bde5ffe51a2c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/OuterComposite.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/OuterComposite.md new file mode 100644 index 000000000000..04bab7eff5d1 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/OuterEnum.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/OuterEnum.md new file mode 100644 index 000000000000..af62ad87ab2e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/OuterEnumDefaultValue.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..c1bf8b0dec44 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/OuterEnumInteger.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/OuterEnumInteger.md new file mode 100644 index 000000000000..8c80a9e5c85f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/OuterEnumIntegerDefaultValue.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..eb8b55d70249 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/OuterObjectWithEnumProperty.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/OuterObjectWithEnumProperty.md new file mode 100644 index 000000000000..eab2ae8f66b4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/oneof_polymorphism_and_inheritance/doc/Pasta.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Pasta.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/Pasta.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/Pasta.md diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/PathApi.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/PathApi.md new file mode 100644 index 000000000000..ae663a2f7f04 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/doc/PathApi.md @@ -0,0 +1,59 @@ +# openapi.api.PathApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testsPathStringPathStringIntegerPathInteger**](PathApi.md#testspathstringpathstringintegerpathinteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) + + +# **testsPathStringPathStringIntegerPathInteger** +> String testsPathStringPathStringIntegerPathInteger(pathString, pathInteger) + +Test path parameter(s) + +Test path parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getPathApi(); +final String pathString = pathString_example; // String | +final int pathInteger = 56; // int | + +try { + final response = api.testsPathStringPathStringIntegerPathInteger(pathString, pathInteger); + print(response); +} catch on DioError (e) { + print('Exception when calling PathApi->testsPathStringPathStringIntegerPathInteger: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pathString** | **String**| | + **pathInteger** | **int**| | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/Pet.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Pet.md new file mode 100644 index 000000000000..455b9330ff8e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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] +**name** | **String** | | +**category** | [**Category**](Category.md) | | [optional] +**photoUrls** | **BuiltList<String>** | | +**tags** | [**BuiltList<Tag>**](Tag.md) | | [optional] +**status** | **String** | pet status in the store | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/Pizza.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Pizza.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/Pizza.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/Pizza.md diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/PizzaSpeziale.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/PizzaSpeziale.md similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/PizzaSpeziale.md rename to samples/client/echo_api/dart/dart-dio-built_value/doc/PizzaSpeziale.md diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/QueryApi.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/QueryApi.md new file mode 100644 index 000000000000..f92f9532a113 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/doc/QueryApi.md @@ -0,0 +1,149 @@ +# openapi.api.QueryApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testQueryIntegerBooleanString**](QueryApi.md#testqueryintegerbooleanstring) | **GET** /query/integer/boolean/string | Test query parameter(s) +[**testQueryStyleFormExplodeTrueArrayString**](QueryApi.md#testquerystyleformexplodetruearraystring) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) +[**testQueryStyleFormExplodeTrueObject**](QueryApi.md#testquerystyleformexplodetrueobject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) + + +# **testQueryIntegerBooleanString** +> String testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getQueryApi(); +final int integerQuery = 56; // int | +final bool booleanQuery = true; // bool | +final String stringQuery = stringQuery_example; // String | + +try { + final response = api.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery); + print(response); +} catch on DioError (e) { + print('Exception when calling QueryApi->testQueryIntegerBooleanString: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integerQuery** | **int**| | [optional] + **booleanQuery** | **bool**| | [optional] + **stringQuery** | **String**| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testQueryStyleFormExplodeTrueArrayString** +> String testQueryStyleFormExplodeTrueArrayString(queryObject) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getQueryApi(); +final TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject = ; // TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter | + +try { + final response = api.testQueryStyleFormExplodeTrueArrayString(queryObject); + print(response); +} catch on DioError (e) { + print('Exception when calling QueryApi->testQueryStyleFormExplodeTrueArrayString: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](.md)| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testQueryStyleFormExplodeTrueObject** +> String testQueryStyleFormExplodeTrueObject(queryObject) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getQueryApi(); +final Pet queryObject = ; // Pet | + +try { + final response = api.testQueryStyleFormExplodeTrueObject(queryObject); + print(response); +} catch on DioError (e) { + print('Exception when calling QueryApi->testQueryStyleFormExplodeTrueObject: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | [**Pet**](.md)| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/ReadOnlyFirst.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/ReadOnlyFirst.md new file mode 100644 index 000000000000..8f612e8ba19f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/SingleRefType.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/SingleRefType.md new file mode 100644 index 000000000000..0dc93840cd7f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/SpecialModelName.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/SpecialModelName.md new file mode 100644 index 000000000000..5fcfa98e0b36 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/Tag.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/Tag.md new file mode 100644 index 000000000000..c219f987c19c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md new file mode 100644 index 000000000000..9ee07596a0df --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md @@ -0,0 +1,15 @@ +# openapi.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**values** | **BuiltList<String>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-built_value/doc/User.md b/samples/client/echo_api/dart/dart-dio-built_value/doc/User.md new file mode 100644 index 000000000000..fa87e64d8595 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/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/client/echo_api/dart/dart-dio-built_value/lib/openapi.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/openapi.dart new file mode 100644 index 000000000000..0b94909a8fee --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/openapi.dart @@ -0,0 +1,10 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +export 'package:openapi/src/api.dart'; +export 'package:openapi/src/auth/_exports.dart'; +export 'package:openapi/src/serializers.dart'; + +export 'package:openapi/src/api/_exports.dart'; +export 'package:openapi/src/model/_exports.dart'; diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/api.dart similarity index 57% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/api.dart index 0bb368eace08..3f0a5bda8d57 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/api.dart @@ -5,15 +5,13 @@ import 'package:dio/dio.dart'; import 'package:built_value/serializer.dart'; import 'package:openapi/src/serializers.dart'; -import 'package:openapi/src/auth/api_key_auth.dart'; -import 'package:openapi/src/auth/basic_auth.dart'; -import 'package:openapi/src/auth/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'; +import 'package:openapi/src/auth/_exports.dart'; +import 'package:openapi/src/api/body_api.dart'; +import 'package:openapi/src/api/path_api.dart'; +import 'package:openapi/src/api/query_api.dart'; class Openapi { - static const String basePath = r'http://localhost:8080'; + static const String basePath = r'http://localhost:3000'; final Dio dio; final Serializers serializers; @@ -44,37 +42,54 @@ class Openapi { 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; + (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; + (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); + (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; + (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, + /// Get BodyApi 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, serializers); + BodyApi getBodyApi() { + return BodyApi(dio, serializers); } - /// Get FooApi instance, base route and serializer can be overridden by a given but be careful, + /// Get PathApi 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, serializers); + PathApi getPathApi() { + return PathApi(dio, serializers); + } + + /// Get QueryApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + QueryApi getQueryApi() { + return QueryApi(dio, serializers); } } diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/api/_exports.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/api/_exports.dart new file mode 100644 index 000000000000..f06d548e0d23 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/api/_exports.dart @@ -0,0 +1,3 @@ +export 'body_api.dart'; +export 'path_api.dart'; +export 'query_api.dart'; diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api/bar_api.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/api/body_api.dart similarity index 76% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api/bar_api.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/api/body_api.dart index 4afe604a5578..ca1e12b1cb49 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api/bar_api.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/api/body_api.dart @@ -2,27 +2,23 @@ // AUTO-GENERATED FILE, DO NOT MODIFY! // -import 'dart:async'; - +//ignore: unused_import import 'package:built_value/serializer.dart'; import 'package:dio/dio.dart'; -import 'package:openapi/src/model/bar.dart'; -import 'package:openapi/src/model/bar_create.dart'; - -class BarApi { +import 'package:openapi/src/model/pet.dart'; +class BodyApi { final Dio _dio; - final Serializers _serializers; - const BarApi(this._dio, this._serializers); + const BodyApi(this._dio, this._serializers); - /// Create a Bar - /// + /// Test body parameter(s) + /// Test body parameter(s) /// /// Parameters: - /// * [barCreate] + /// * [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 @@ -30,10 +26,11 @@ class BarApi { /// * [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 + /// Returns a [Future] containing a [Response] with a [Pet] as data /// Throws [DioError] if API call or serialization fails - Future> createBar({ - required BarCreate barCreate, + + Future> testEchoBodyPet({ + Pet? pet, CancelToken? cancelToken, Map? headers, Map? extra, @@ -41,7 +38,7 @@ class BarApi { ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { - final _path = r'/bar'; + final _path = r'/echo/body/Pet'; final _options = Options( method: r'POST', headers: { @@ -58,12 +55,13 @@ class BarApi { dynamic _bodyData; try { - const _type = FullType(BarCreate); - _bodyData = _serializers.serialize(barCreate, specifiedType: _type); - - } catch(error, stackTrace) { + const _type = FullType(Pet); + _bodyData = pet == null + ? null + : _serializers.serialize(pet, specifiedType: _type); + } catch (error, stackTrace) { throw DioError( - requestOptions: _options.compose( + requestOptions: _options.compose( _dio.options, _path, ), @@ -81,15 +79,14 @@ class BarApi { onReceiveProgress: onReceiveProgress, ); - Bar _responseData; + Pet _responseData; try { - const _responseType = FullType(Bar); + const _responseType = FullType(Pet); _responseData = _serializers.deserialize( _response.data!, specifiedType: _responseType, - ) as Bar; - + ) as Pet; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, @@ -99,7 +96,7 @@ class BarApi { )..stackTrace = stackTrace; } - return Response( + return Response( data: _responseData, headers: _response.headers, isRedirect: _response.isRedirect, @@ -110,5 +107,4 @@ class BarApi { extra: _response.extra, ); } - } diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/api/default_api.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/api/path_api.dart similarity index 74% rename from samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/api/default_api.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/api/path_api.dart index 8d500cb70aad..d895d14e9976 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/api/default_api.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/api/path_api.dart @@ -2,25 +2,22 @@ // AUTO-GENERATED FILE, DO NOT MODIFY! // -import 'dart:async'; - +//ignore: unused_import import 'package:built_value/serializer.dart'; import 'package:dio/dio.dart'; -import 'package:openapi/src/model/example.dart'; - -class DefaultApi { - +class PathApi { final Dio _dio; - final Serializers _serializers; - const DefaultApi(this._dio, this._serializers); + const PathApi(this._dio, this._serializers); - /// list - /// + /// Test path parameter(s) + /// Test path parameter(s) /// /// Parameters: + /// * [pathString] + /// * [pathInteger] /// * [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 @@ -28,9 +25,12 @@ class DefaultApi { /// * [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 + /// Returns a [Future] containing a [Response] with a [String] as data /// Throws [DioError] if API call or serialization fails - Future> list({ + + Future> testsPathStringPathStringIntegerPathInteger({ + required String pathString, + required int pathInteger, CancelToken? cancelToken, Map? headers, Map? extra, @@ -38,7 +38,9 @@ class DefaultApi { ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { - final _path = r'/example'; + final _path = r'/path/string/{path_string}/integer/{path_integer}' + .replaceAll('{' r'path_string' '}', pathString.toString()) + .replaceAll('{' r'path_integer' '}', pathInteger.toString()); final _options = Options( method: r'GET', headers: { @@ -59,15 +61,10 @@ class DefaultApi { onReceiveProgress: onReceiveProgress, ); - Example _responseData; + String _responseData; try { - const _responseType = FullType(Example); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, - ) as Example; - + _responseData = _response.data as String; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, @@ -77,7 +74,7 @@ class DefaultApi { )..stackTrace = stackTrace; } - return Response( + return Response( data: _responseData, headers: _response.headers, isRedirect: _response.isRedirect, @@ -88,5 +85,4 @@ class DefaultApi { extra: _response.extra, ); } - } diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/api/query_api.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/api/query_api.dart new file mode 100644 index 000000000000..a224d04fd7c9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/api/query_api.dart @@ -0,0 +1,262 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +//ignore: unused_import +import 'package:built_value/serializer.dart'; +import 'package:dio/dio.dart'; + +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/src/model/pet.dart'; +import 'package:openapi/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart'; + +class QueryApi { + final Dio _dio; + final Serializers _serializers; + + const QueryApi(this._dio, this._serializers); + + /// Test query parameter(s) + /// Test query parameter(s) + /// + /// Parameters: + /// * [integerQuery] + /// * [booleanQuery] + /// * [stringQuery] + /// * [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 [DioError] if API call or serialization fails + + Future> testQueryIntegerBooleanString({ + int? integerQuery, + bool? booleanQuery, + String? stringQuery, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/query/integer/boolean/string'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (integerQuery != null) + r'integer_query': encodeQueryParameter( + _serializers, integerQuery, const FullType(int)), + if (booleanQuery != null) + r'boolean_query': encodeQueryParameter( + _serializers, booleanQuery, const FullType(bool)), + if (stringQuery != null) + r'string_query': encodeQueryParameter( + _serializers, stringQuery, const FullType(String)), + }; + + 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 DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + 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 query parameter(s) + /// Test query parameter(s) + /// + /// Parameters: + /// * [queryObject] + /// * [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 [DioError] if API call or serialization fails + + Future> testQueryStyleFormExplodeTrueArrayString({ + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? queryObject, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/query/style_form/explode_true/array_string'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (queryObject != null) + r'query_object': encodeQueryParameter( + _serializers, + queryObject, + const FullType( + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter)), + }; + + 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 DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + 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 query parameter(s) + /// Test query parameter(s) + /// + /// Parameters: + /// * [queryObject] + /// * [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 [DioError] if API call or serialization fails + + Future> testQueryStyleFormExplodeTrueObject({ + Pet? queryObject, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/query/style_form/explode_true/object'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (queryObject != null) + r'query_object': encodeQueryParameter( + _serializers, queryObject, const FullType(Pet)), + }; + + 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 DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + 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/oneof/lib/src/api_util.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/api_util.dart similarity index 95% rename from samples/openapi3/client/petstore/dart-dio/oneof/lib/src/api_util.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/api_util.dart index ed3bb12f25b8..c903dbd2804b 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/api_util.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/api_util.dart @@ -5,14 +5,15 @@ import 'dart:convert'; import 'dart:typed_data'; +import 'package:dio/dio.dart'; import 'package:built_collection/built_collection.dart'; import 'package:built_value/serializer.dart'; -import 'package:dio/dio.dart'; /// Format the given form parameter object into something that Dio can handle. /// Returns primitive or String. /// Returns List/Map if the value is BuildList/BuiltMap. -dynamic encodeFormParameter(Serializers serializers, dynamic value, FullType type) { +dynamic encodeFormParameter( + Serializers serializers, dynamic value, FullType type) { if (value == null) { return ''; } diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/auth/_exports.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/auth/_exports.dart new file mode 100644 index 000000000000..01c9ad2dfa7e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/auth/_exports.dart @@ -0,0 +1,9 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +export 'api_key_auth.dart'; +export 'auth.dart'; +export 'basic_auth.dart'; +export 'bearer_auth.dart'; +export 'oauth.dart'; diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/auth/api_key_auth.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/auth/api_key_auth.dart similarity index 85% rename from samples/openapi3/client/petstore/dart-dio/oneof/lib/src/auth/api_key_auth.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/auth/api_key_auth.dart index ee16e3f0f92f..c67c514ee94e 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/auth/api_key_auth.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/auth/api_key_auth.dart @@ -2,16 +2,16 @@ // AUTO-GENERATED FILE, DO NOT MODIFY! // - import 'package:dio/dio.dart'; -import 'package:openapi/src/auth/auth.dart'; +import 'auth.dart'; class ApiKeyAuthInterceptor extends AuthInterceptor { final Map apiKeys = {}; @override void onRequest(RequestOptions options, RequestInterceptorHandler handler) { - final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'apiKey'); + 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; diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/auth/auth.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/auth/auth.dart similarity index 80% rename from samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/auth/auth.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/auth/auth.dart index f7ae9bf3f11e..c6fcca595cb3 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/auth/auth.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/auth/auth.dart @@ -8,7 +8,8 @@ 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) { + 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(); diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/auth/basic_auth.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/auth/basic_auth.dart similarity index 68% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/auth/basic_auth.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/auth/basic_auth.dart index b6e6dce04f9c..6cea35ca3665 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/auth/basic_auth.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/auth/basic_auth.dart @@ -5,7 +5,7 @@ import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:openapi/src/auth/auth.dart'; +import 'auth.dart'; class BasicAuthInfo { final String username; @@ -22,12 +22,17 @@ class BasicAuthInterceptor extends AuthInterceptor { RequestOptions options, RequestInterceptorHandler handler, ) { - final metadataAuthInfo = getAuthInfo(options, (secure) => (secure['type'] == 'http' && secure['scheme'] == 'basic') || secure['type'] == 'basic'); + final metadataAuthInfo = getAuthInfo( + options, + (secure) => + (secure['type'] == 'http' && secure['scheme'] == 'basic') || + secure['type'] == 'basic'); for (final info in metadataAuthInfo) { final authName = info['name'] as String; final basicAuthInfo = authInfo[authName]; if (basicAuthInfo != null) { - final basicAuth = 'Basic ${base64Encode(utf8.encode('${basicAuthInfo.username}:${basicAuthInfo.password}'))}'; + final basicAuth = + 'Basic ${base64Encode(utf8.encode('${basicAuthInfo.username}:${basicAuthInfo.password}'))}'; options.headers['Authorization'] = basicAuth; break; } diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/auth/bearer_auth.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/auth/bearer_auth.dart similarity index 76% rename from samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/auth/bearer_auth.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/auth/bearer_auth.dart index 1d4402b376c0..38729451f23e 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/auth/bearer_auth.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/auth/bearer_auth.dart @@ -3,7 +3,7 @@ // import 'package:dio/dio.dart'; -import 'package:openapi/src/auth/auth.dart'; +import 'auth.dart'; class BearerAuthInterceptor extends AuthInterceptor { final Map tokens = {}; @@ -13,7 +13,8 @@ class BearerAuthInterceptor extends AuthInterceptor { RequestOptions options, RequestInterceptorHandler handler, ) { - final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'http' && secure['scheme'] == 'bearer'); + final authInfo = getAuthInfo(options, + (secure) => secure['type'] == 'http' && secure['scheme'] == 'bearer'); for (final info in authInfo) { final token = tokens[info['name']]; if (token != null) { diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/auth/oauth.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/auth/oauth.dart similarity index 76% rename from samples/openapi3/client/petstore/dart-dio/oneof/lib/src/auth/oauth.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/auth/oauth.dart index 337cf762b0ce..54aa4706ef69 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/auth/oauth.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/auth/oauth.dart @@ -3,7 +3,7 @@ // import 'package:dio/dio.dart'; -import 'package:openapi/src/auth/auth.dart'; +import 'auth.dart'; class OAuthInterceptor extends AuthInterceptor { final Map tokens = {}; @@ -13,7 +13,8 @@ class OAuthInterceptor extends AuthInterceptor { RequestOptions options, RequestInterceptorHandler handler, ) { - final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'oauth' || secure['type'] == 'oauth2'); + final authInfo = getAuthInfo(options, + (secure) => secure['type'] == 'oauth' || secure['type'] == 'oauth2'); for (final info in authInfo) { final token = tokens[info['name']]; if (token != null) { diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/date_serializer.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/date_serializer.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/date_serializer.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/date_serializer.dart index db3c5c437db1..deacc6525d19 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/date_serializer.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/date_serializer.dart @@ -7,7 +7,6 @@ import 'package:built_value/serializer.dart'; import 'package:openapi/src/model/date.dart'; class DateSerializer implements PrimitiveSerializer { - const DateSerializer(); @override diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/_exports.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/_exports.dart new file mode 100644 index 000000000000..d1f1f4450e41 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/_exports.dart @@ -0,0 +1,69 @@ +export 'additional_properties_class.dart'; +export 'addressable.dart'; +export 'all_of_with_single_ref.dart'; +export 'animal.dart'; +export 'api_response.dart'; +export 'apple.dart'; +export 'array_of_array_of_number_only.dart'; +export 'array_of_number_only.dart'; +export 'array_test.dart'; +export 'banana.dart'; +export 'bar.dart'; +export 'bar_create.dart'; +export 'bar_ref.dart'; +export 'bar_ref_or_value.dart'; +export 'capitalization.dart'; +export 'cat.dart'; +export 'cat_all_of.dart'; +export 'category.dart'; +export 'child.dart'; +export 'class_model.dart'; +export 'deprecated_object.dart'; +export 'dog.dart'; +export 'dog_all_of.dart'; +export 'entity.dart'; +export 'entity_ref.dart'; +export 'enum_arrays.dart'; +export 'enum_test.dart'; +export 'example.dart'; +export 'example_non_primitive.dart'; +export 'extensible.dart'; +export 'file_schema_test_class.dart'; +export 'foo.dart'; +export 'foo_ref.dart'; +export 'foo_ref_or_value.dart'; +export 'format_test.dart'; +export 'fruit.dart'; +export 'has_only_read_only.dart'; +export 'health_check_result.dart'; +export 'map_test.dart'; +export 'mixed_properties_and_additional_properties_class.dart'; +export 'model200_response.dart'; +export 'model_client.dart'; +export 'model_enum_class.dart'; +export 'model_file.dart'; +export 'model_list.dart'; +export 'model_return.dart'; +export 'name.dart'; +export 'nullable_class.dart'; +export 'number_only.dart'; +export 'object_with_deprecated_fields.dart'; +export 'order.dart'; +export 'outer_composite.dart'; +export 'outer_enum.dart'; +export 'outer_enum_default_value.dart'; +export 'outer_enum_integer.dart'; +export 'outer_enum_integer_default_value.dart'; +export 'outer_object_with_enum_property.dart'; +export 'pasta.dart'; +export 'pet.dart'; +export 'pizza.dart'; +export 'pizza_speziale.dart'; +export 'read_only_first.dart'; +export 'single_ref_type.dart'; +export 'special_model_name.dart'; +export 'tag.dart'; +export 'test_query_style_form_explode_true_array_string_query_object_parameter.dart'; +export 'user.dart'; + +export 'date.dart'; diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/additional_properties_class.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/additional_properties_class.dart new file mode 100644 index 000000000000..34022add8e5e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/additional_properties_class.dart @@ -0,0 +1,145 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'additional_properties_class.g.dart'; + +/// AdditionalPropertiesClass +/// +/// Properties: +/// * [mapProperty] +/// * [mapOfMapProperty] +@BuiltValue() +abstract class AdditionalPropertiesClass + implements + Built { + @BuiltValueField(wireName: r'map_property') + BuiltMap? get mapProperty; + + @BuiltValueField(wireName: r'map_of_map_property') + BuiltMap>? get mapOfMapProperty; + + AdditionalPropertiesClass._(); + + factory AdditionalPropertiesClass( + [void updates(AdditionalPropertiesClassBuilder b)]) = + _$AdditionalPropertiesClass; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(AdditionalPropertiesClassBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$AdditionalPropertiesClassSerializer(); +} + +class _$AdditionalPropertiesClassSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [ + AdditionalPropertiesClass, + _$AdditionalPropertiesClass + ]; + + @override + final String wireName = r'AdditionalPropertiesClass'; + + Iterable _serializeProperties( + Serializers serializers, + AdditionalPropertiesClass object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.mapProperty != null) { + yield r'map_property'; + yield serializers.serialize( + object.mapProperty, + specifiedType: + const FullType(BuiltMap, [FullType(String), FullType(String)]), + ); + } + if (object.mapOfMapProperty != null) { + yield r'map_of_map_property'; + yield serializers.serialize( + object.mapOfMapProperty, + specifiedType: const FullType(BuiltMap, [ + FullType(String), + FullType(BuiltMap, [FullType(String), FullType(String)]) + ]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + AdditionalPropertiesClass object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AdditionalPropertiesClassBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'map_property': + final valueDes = serializers.deserialize( + value, + specifiedType: + const FullType(BuiltMap, [FullType(String), FullType(String)]), + ) as BuiltMap; + result.mapProperty.replace(valueDes); + break; + case r'map_of_map_property': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [ + FullType(String), + FullType(BuiltMap, [FullType(String), FullType(String)]) + ]), + ) as BuiltMap>; + result.mapOfMapProperty.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + AdditionalPropertiesClass deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = AdditionalPropertiesClassBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/addressable.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/addressable.dart similarity index 91% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/addressable.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/addressable.dart index 0ab0936d5673..22e9ab761489 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/addressable.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/addressable.dart @@ -14,7 +14,7 @@ part 'addressable.g.dart'; /// * [href] - Hyperlink reference /// * [id] - unique identifier @BuiltValue(instantiable: false) -abstract class Addressable { +abstract class Addressable { /// Hyperlink reference @BuiltValueField(wireName: r'href') String? get href; @@ -61,7 +61,9 @@ class _$AddressableSerializer implements PrimitiveSerializer { Addressable object, { FullType specifiedType = FullType.unspecified, }) { - return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); } @override @@ -70,16 +72,19 @@ class _$AddressableSerializer implements PrimitiveSerializer { Object serialized, { FullType specifiedType = FullType.unspecified, }) { - return serializers.deserialize(serialized, specifiedType: FullType($Addressable)) as $Addressable; + return serializers.deserialize(serialized, + specifiedType: FullType($Addressable)) as $Addressable; } } /// a concrete implementation of [Addressable], since [Addressable] is not instantiable @BuiltValue(instantiable: true) -abstract class $Addressable implements Addressable, Built<$Addressable, $AddressableBuilder> { +abstract class $Addressable + implements Addressable, Built<$Addressable, $AddressableBuilder> { $Addressable._(); - factory $Addressable([void Function($AddressableBuilder)? updates]) = _$$Addressable; + factory $Addressable([void Function($AddressableBuilder)? updates]) = + _$$Addressable; @BuiltValueHook(initializeBuilder: true) static void _defaults($AddressableBuilder b) => b; @@ -158,4 +163,3 @@ class _$$AddressableSerializer implements PrimitiveSerializer<$Addressable> { return result.build(); } } - diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/all_of_with_single_ref.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/all_of_with_single_ref.dart new file mode 100644 index 000000000000..cd9f8aaebec8 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/all_of_with_single_ref.dart @@ -0,0 +1,132 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/single_ref_type.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'all_of_with_single_ref.g.dart'; + +/// AllOfWithSingleRef +/// +/// Properties: +/// * [username] +/// * [singleRefType] +@BuiltValue() +abstract class AllOfWithSingleRef + implements Built { + @BuiltValueField(wireName: r'username') + String? get username; + + @BuiltValueField(wireName: r'SingleRefType') + SingleRefType? get singleRefType; + + AllOfWithSingleRef._(); + + factory AllOfWithSingleRef([void updates(AllOfWithSingleRefBuilder b)]) = + _$AllOfWithSingleRef; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(AllOfWithSingleRefBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$AllOfWithSingleRefSerializer(); +} + +class _$AllOfWithSingleRefSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [AllOfWithSingleRef, _$AllOfWithSingleRef]; + + @override + final String wireName = r'AllOfWithSingleRef'; + + Iterable _serializeProperties( + Serializers serializers, + AllOfWithSingleRef object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.username != null) { + yield r'username'; + yield serializers.serialize( + object.username, + specifiedType: const FullType(String), + ); + } + if (object.singleRefType != null) { + yield r'SingleRefType'; + yield serializers.serialize( + object.singleRefType, + specifiedType: const FullType(SingleRefType), + ); + } + } + + @override + Object serialize( + Serializers serializers, + AllOfWithSingleRef object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AllOfWithSingleRefBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'username': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.username = valueDes; + break; + case r'SingleRefType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(SingleRefType), + ) as SingleRefType; + result.singleRefType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + AllOfWithSingleRef deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = AllOfWithSingleRefBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/animal.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/animal.dart new file mode 100644 index 000000000000..94952e4b6e0b --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/animal.dart @@ -0,0 +1,211 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/dog.dart'; +import 'package:openapi/src/model/cat.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'animal.g.dart'; + +/// Animal +/// +/// Properties: +/// * [className] +/// * [color] +@BuiltValue(instantiable: false) +abstract class Animal { + @BuiltValueField(wireName: r'className') + String get className; + + @BuiltValueField(wireName: r'color') + String? get color; + + static const String discriminatorFieldName = r'className'; + + static const Map discriminatorMapping = { + r'Cat': Cat, + r'Dog': Dog, + }; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$AnimalSerializer(); +} + +extension AnimalDiscriminatorExt on Animal { + String? get discriminatorValue { + if (this is Cat) { + return r'Cat'; + } + if (this is Dog) { + return r'Dog'; + } + return null; + } +} + +extension AnimalBuilderDiscriminatorExt on AnimalBuilder { + String? get discriminatorValue { + if (this is CatBuilder) { + return r'Cat'; + } + if (this is DogBuilder) { + return r'Dog'; + } + return null; + } +} + +class _$AnimalSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Animal]; + + @override + final String wireName = r'Animal'; + + Iterable _serializeProperties( + Serializers serializers, + Animal object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'className'; + yield serializers.serialize( + object.className, + specifiedType: const FullType(String), + ); + if (object.color != null) { + yield r'color'; + yield serializers.serialize( + object.color, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Animal object, { + FullType specifiedType = FullType.unspecified, + }) { + if (object is Cat) { + return serializers.serialize(object, specifiedType: FullType(Cat))!; + } + if (object is Dog) { + return serializers.serialize(object, specifiedType: FullType(Dog))!; + } + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + @override + Animal deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(Animal.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], + specifiedType: FullType(String)) as String; + switch (discValue) { + case r'Cat': + return serializers.deserialize(serialized, specifiedType: FullType(Cat)) + as Cat; + case r'Dog': + return serializers.deserialize(serialized, specifiedType: FullType(Dog)) + as Dog; + default: + return serializers.deserialize(serialized, + specifiedType: FullType($Animal)) as $Animal; + } + } +} + +/// a concrete implementation of [Animal], since [Animal] is not instantiable +@BuiltValue(instantiable: true) +abstract class $Animal implements Animal, Built<$Animal, $AnimalBuilder> { + $Animal._(); + + factory $Animal([void Function($AnimalBuilder)? updates]) = _$$Animal; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($AnimalBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$Animal> get serializer => _$$AnimalSerializer(); +} + +class _$$AnimalSerializer implements PrimitiveSerializer<$Animal> { + @override + final Iterable types = const [$Animal, _$$Animal]; + + @override + final String wireName = r'$Animal'; + + @override + Object serialize( + Serializers serializers, + $Animal object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(Animal))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AnimalBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'className': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.className = valueDes; + break; + case r'color': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.color = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $Animal deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $AnimalBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/api_response.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/api_response.dart new file mode 100644 index 000000000000..14e9ccff7852 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/api_response.dart @@ -0,0 +1,145 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'api_response.g.dart'; + +/// ApiResponse +/// +/// Properties: +/// * [code] +/// * [type] +/// * [message] +@BuiltValue() +abstract class ApiResponse implements Built { + @BuiltValueField(wireName: r'code') + int? get code; + + @BuiltValueField(wireName: r'type') + String? get type; + + @BuiltValueField(wireName: r'message') + String? get message; + + ApiResponse._(); + + factory ApiResponse([void updates(ApiResponseBuilder b)]) = _$ApiResponse; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ApiResponseBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ApiResponseSerializer(); +} + +class _$ApiResponseSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ApiResponse, _$ApiResponse]; + + @override + final String wireName = r'ApiResponse'; + + Iterable _serializeProperties( + Serializers serializers, + ApiResponse object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.code != null) { + yield r'code'; + yield serializers.serialize( + object.code, + specifiedType: const FullType(int), + ); + } + if (object.type != null) { + yield r'type'; + yield serializers.serialize( + object.type, + specifiedType: const FullType(String), + ); + } + if (object.message != null) { + yield r'message'; + yield serializers.serialize( + object.message, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ApiResponse object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ApiResponseBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'code': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.code = valueDes; + break; + case r'type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.type = valueDes; + break; + case r'message': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.message = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ApiResponse deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ApiResponseBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/model/apple.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/apple.dart similarity index 95% rename from samples/openapi3/client/petstore/dart-dio/oneof/lib/src/model/apple.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/apple.dart index 02ca94190b96..fa77c28e614c 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/model/apple.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/apple.dart @@ -11,7 +11,7 @@ part 'apple.g.dart'; /// Apple /// /// Properties: -/// * [kind] +/// * [kind] @BuiltValue() abstract class Apple implements Built { @BuiltValueField(wireName: r'kind') @@ -55,7 +55,9 @@ class _$AppleSerializer implements PrimitiveSerializer { Apple object, { FullType specifiedType = FullType.unspecified, }) { - return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); } void _deserializeProperties( @@ -105,4 +107,3 @@ class _$AppleSerializer implements PrimitiveSerializer { return result.build(); } } - diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/array_of_array_of_number_only.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/array_of_array_of_number_only.dart new file mode 100644 index 000000000000..0f51b17b901d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/array_of_array_of_number_only.dart @@ -0,0 +1,123 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'array_of_array_of_number_only.g.dart'; + +/// ArrayOfArrayOfNumberOnly +/// +/// Properties: +/// * [arrayArrayNumber] +@BuiltValue() +abstract class ArrayOfArrayOfNumberOnly + implements + Built { + @BuiltValueField(wireName: r'ArrayArrayNumber') + BuiltList>? get arrayArrayNumber; + + ArrayOfArrayOfNumberOnly._(); + + factory ArrayOfArrayOfNumberOnly( + [void updates(ArrayOfArrayOfNumberOnlyBuilder b)]) = + _$ArrayOfArrayOfNumberOnly; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ArrayOfArrayOfNumberOnlyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$ArrayOfArrayOfNumberOnlySerializer(); +} + +class _$ArrayOfArrayOfNumberOnlySerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [ + ArrayOfArrayOfNumberOnly, + _$ArrayOfArrayOfNumberOnly + ]; + + @override + final String wireName = r'ArrayOfArrayOfNumberOnly'; + + Iterable _serializeProperties( + Serializers serializers, + ArrayOfArrayOfNumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.arrayArrayNumber != null) { + yield r'ArrayArrayNumber'; + yield serializers.serialize( + object.arrayArrayNumber, + specifiedType: const FullType(BuiltList, [ + FullType(BuiltList, [FullType(num)]) + ]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ArrayOfArrayOfNumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ArrayOfArrayOfNumberOnlyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'ArrayArrayNumber': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [ + FullType(BuiltList, [FullType(num)]) + ]), + ) as BuiltList>; + result.arrayArrayNumber.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ArrayOfArrayOfNumberOnly deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ArrayOfArrayOfNumberOnlyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/array_of_number_only.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/array_of_number_only.dart new file mode 100644 index 000000000000..5aeb707cbb32 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/array_of_number_only.dart @@ -0,0 +1,114 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'array_of_number_only.g.dart'; + +/// ArrayOfNumberOnly +/// +/// Properties: +/// * [arrayNumber] +@BuiltValue() +abstract class ArrayOfNumberOnly + implements Built { + @BuiltValueField(wireName: r'ArrayNumber') + BuiltList? get arrayNumber; + + ArrayOfNumberOnly._(); + + factory ArrayOfNumberOnly([void updates(ArrayOfNumberOnlyBuilder b)]) = + _$ArrayOfNumberOnly; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ArrayOfNumberOnlyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$ArrayOfNumberOnlySerializer(); +} + +class _$ArrayOfNumberOnlySerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [ArrayOfNumberOnly, _$ArrayOfNumberOnly]; + + @override + final String wireName = r'ArrayOfNumberOnly'; + + Iterable _serializeProperties( + Serializers serializers, + ArrayOfNumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.arrayNumber != null) { + yield r'ArrayNumber'; + yield serializers.serialize( + object.arrayNumber, + specifiedType: const FullType(BuiltList, [FullType(num)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ArrayOfNumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ArrayOfNumberOnlyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'ArrayNumber': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(num)]), + ) as BuiltList; + result.arrayNumber.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ArrayOfNumberOnly deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ArrayOfNumberOnlyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/array_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/array_test.dart new file mode 100644 index 000000000000..e0fe071b45ef --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/array_test.dart @@ -0,0 +1,155 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/read_only_first.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'array_test.g.dart'; + +/// ArrayTest +/// +/// Properties: +/// * [arrayOfString] +/// * [arrayArrayOfInteger] +/// * [arrayArrayOfModel] +@BuiltValue() +abstract class ArrayTest implements Built { + @BuiltValueField(wireName: r'array_of_string') + BuiltList? get arrayOfString; + + @BuiltValueField(wireName: r'array_array_of_integer') + BuiltList>? get arrayArrayOfInteger; + + @BuiltValueField(wireName: r'array_array_of_model') + BuiltList>? get arrayArrayOfModel; + + ArrayTest._(); + + factory ArrayTest([void updates(ArrayTestBuilder b)]) = _$ArrayTest; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ArrayTestBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ArrayTestSerializer(); +} + +class _$ArrayTestSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ArrayTest, _$ArrayTest]; + + @override + final String wireName = r'ArrayTest'; + + Iterable _serializeProperties( + Serializers serializers, + ArrayTest object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.arrayOfString != null) { + yield r'array_of_string'; + yield serializers.serialize( + object.arrayOfString, + specifiedType: const FullType(BuiltList, [FullType(String)]), + ); + } + if (object.arrayArrayOfInteger != null) { + yield r'array_array_of_integer'; + yield serializers.serialize( + object.arrayArrayOfInteger, + specifiedType: const FullType(BuiltList, [ + FullType(BuiltList, [FullType(int)]) + ]), + ); + } + if (object.arrayArrayOfModel != null) { + yield r'array_array_of_model'; + yield serializers.serialize( + object.arrayArrayOfModel, + specifiedType: const FullType(BuiltList, [ + FullType(BuiltList, [FullType(ReadOnlyFirst)]) + ]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ArrayTest object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ArrayTestBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'array_of_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(String)]), + ) as BuiltList; + result.arrayOfString.replace(valueDes); + break; + case r'array_array_of_integer': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [ + FullType(BuiltList, [FullType(int)]) + ]), + ) as BuiltList>; + result.arrayArrayOfInteger.replace(valueDes); + break; + case r'array_array_of_model': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [ + FullType(BuiltList, [FullType(ReadOnlyFirst)]) + ]), + ) as BuiltList>; + result.arrayArrayOfModel.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ArrayTest deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ArrayTestBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/model/banana.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/banana.dart similarity index 95% rename from samples/openapi3/client/petstore/dart-dio/oneof/lib/src/model/banana.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/banana.dart index bf2d632ee114..00c090ee8727 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/model/banana.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/banana.dart @@ -11,7 +11,7 @@ part 'banana.g.dart'; /// Banana /// /// Properties: -/// * [count] +/// * [count] @BuiltValue() abstract class Banana implements Built { @BuiltValueField(wireName: r'count') @@ -55,7 +55,9 @@ class _$BananaSerializer implements PrimitiveSerializer { Banana object, { FullType specifiedType = FullType.unspecified, }) { - return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); } void _deserializeProperties( @@ -105,4 +107,3 @@ class _$BananaSerializer implements PrimitiveSerializer { return result.build(); } } - diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/bar.dart similarity index 97% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/bar.dart index cb769550b4f2..23a1ec95e2eb 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/bar.dart @@ -13,10 +13,10 @@ part 'bar.g.dart'; /// Bar /// /// Properties: -/// * [id] -/// * [barPropA] -/// * [fooPropB] -/// * [foo] +/// * [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 @@ -37,7 +37,7 @@ abstract class Bar implements Entity, Built { factory Bar([void updates(BarBuilder b)]) = _$Bar; @BuiltValueHook(initializeBuilder: true) - static void _defaults(BarBuilder b) => b..atType=b.discriminatorValue; + static void _defaults(BarBuilder b) => b..atType = b.discriminatorValue; @BuiltValueSerializer(custom: true) static Serializer get serializer => _$BarSerializer(); @@ -216,4 +216,3 @@ class _$BarSerializer implements PrimitiveSerializer { return result.build(); } } - diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar_create.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/bar_create.dart similarity index 97% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar_create.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/bar_create.dart index 8942b6433f5e..4b5e4b3bc19e 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar_create.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/bar_create.dart @@ -13,9 +13,9 @@ part 'bar_create.g.dart'; /// BarCreate /// /// Properties: -/// * [barPropA] -/// * [fooPropB] -/// * [foo] +/// * [barPropA] +/// * [fooPropB] +/// * [foo] /// * [href] - Hyperlink reference /// * [id] - unique identifier /// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships @@ -37,7 +37,7 @@ abstract class BarCreate implements Entity, Built { factory BarCreate([void updates(BarCreateBuilder b)]) = _$BarCreate; @BuiltValueHook(initializeBuilder: true) - static void _defaults(BarCreateBuilder b) => b..atType=b.discriminatorValue; + static void _defaults(BarCreateBuilder b) => b..atType = b.discriminatorValue; @BuiltValueSerializer(custom: true) static Serializer get serializer => _$BarCreateSerializer(); @@ -216,4 +216,3 @@ class _$BarCreateSerializer implements PrimitiveSerializer { return result.build(); } } - diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/bar_ref.dart similarity index 98% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/bar_ref.dart index 2b9d2727a448..bab8e6727c8a 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/bar_ref.dart @@ -24,7 +24,7 @@ abstract class BarRef implements EntityRef, Built { factory BarRef([void updates(BarRefBuilder b)]) = _$BarRef; @BuiltValueHook(initializeBuilder: true) - static void _defaults(BarRefBuilder b) => b..atType=b.discriminatorValue; + static void _defaults(BarRefBuilder b) => b..atType = b.discriminatorValue; @BuiltValueSerializer(custom: true) static Serializer get serializer => _$BarRefSerializer(); @@ -189,4 +189,3 @@ class _$BarRefSerializer implements PrimitiveSerializer { return result.build(); } } - diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref_or_value.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/bar_ref_or_value.dart similarity index 71% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref_or_value.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/bar_ref_or_value.dart index 4af61384ab76..21c31dd3ed64 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/bar_ref_or_value.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/bar_ref_or_value.dart @@ -20,7 +20,8 @@ part 'bar_ref_or_value.g.dart'; /// * [atBaseType] - When sub-classing, this defines the super-class /// * [atType] - When sub-classing, this defines the sub-class Extensible name @BuiltValue() -abstract class BarRefOrValue implements Built { +abstract class BarRefOrValue + implements Built { /// One Of [Bar], [BarRef] OneOf get oneOf; @@ -33,13 +34,39 @@ abstract class BarRefOrValue implements Built b; @BuiltValueSerializer(custom: true) - static Serializer get serializer => _$BarRefOrValueSerializer(); + static Serializer get serializer => + _$BarRefOrValueSerializer(); +} + +extension BarRefOrValueDiscriminatorExt on BarRefOrValue { + String? get discriminatorValue { + if (this is Bar) { + return r'Bar'; + } + if (this is BarRef) { + return r'BarRef'; + } + return null; + } +} + +extension BarRefOrValueBuilderDiscriminatorExt on BarRefOrValueBuilder { + String? get discriminatorValue { + if (this is BarBuilder) { + return r'Bar'; + } + if (this is BarRefBuilder) { + return r'BarRef'; + } + return null; + } } extension BarRefOrValueDiscriminatorExt on BarRefOrValue { @@ -76,8 +103,7 @@ class _$BarRefOrValueSerializer implements PrimitiveSerializer { Serializers serializers, BarRefOrValue object, { FullType specifiedType = FullType.unspecified, - }) sync* { - } + }) sync* {} @override Object serialize( @@ -86,7 +112,8 @@ class _$BarRefOrValueSerializer implements PrimitiveSerializer { FullType specifiedType = FullType.unspecified, }) { final oneOf = object.oneOf; - return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + return serializers.serialize(oneOf.value, + specifiedType: FullType(oneOf.valueType))!; } @override @@ -98,10 +125,15 @@ class _$BarRefOrValueSerializer implements PrimitiveSerializer { final result = BarRefOrValueBuilder(); Object? oneOfDataSrc; final serializedList = (serialized as Iterable).toList(); - final discIndex = serializedList.indexOf(BarRefOrValue.discriminatorFieldName) + 1; - final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + final discIndex = + serializedList.indexOf(BarRefOrValue.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], + specifiedType: FullType(String)) as String; oneOfDataSrc = serialized; - final oneOfTypes = [Bar, BarRef, ]; + final oneOfTypes = [ + Bar, + BarRef, + ]; Object oneOfResult; Type oneOfType; switch (discValue) { @@ -120,10 +152,13 @@ class _$BarRefOrValueSerializer implements PrimitiveSerializer { oneOfType = BarRef; break; default: - throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + throw UnsupportedError( + "Couldn't deserialize oneOf for the discriminator value: ${discValue}"); } - result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + result.oneOf = OneOfDynamic( + typeIndex: oneOfTypes.indexOf(oneOfType), + types: oneOfTypes, + value: oneOfResult); return result.build(); } } - diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/capitalization.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/capitalization.dart new file mode 100644 index 000000000000..cbd4bf8cf926 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/capitalization.dart @@ -0,0 +1,204 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'capitalization.g.dart'; + +/// Capitalization +/// +/// Properties: +/// * [smallCamel] +/// * [capitalCamel] +/// * [smallSnake] +/// * [capitalSnake] +/// * [sCAETHFlowPoints] +/// * [ATT_NAME] - Name of the pet +@BuiltValue() +abstract class Capitalization + implements Built { + @BuiltValueField(wireName: r'smallCamel') + String? get smallCamel; + + @BuiltValueField(wireName: r'CapitalCamel') + String? get capitalCamel; + + @BuiltValueField(wireName: r'small_Snake') + String? get smallSnake; + + @BuiltValueField(wireName: r'Capital_Snake') + String? get capitalSnake; + + @BuiltValueField(wireName: r'SCA_ETH_Flow_Points') + String? get sCAETHFlowPoints; + + /// Name of the pet + @BuiltValueField(wireName: r'ATT_NAME') + String? get ATT_NAME; + + Capitalization._(); + + factory Capitalization([void updates(CapitalizationBuilder b)]) = + _$Capitalization; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(CapitalizationBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$CapitalizationSerializer(); +} + +class _$CapitalizationSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [Capitalization, _$Capitalization]; + + @override + final String wireName = r'Capitalization'; + + Iterable _serializeProperties( + Serializers serializers, + Capitalization object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.smallCamel != null) { + yield r'smallCamel'; + yield serializers.serialize( + object.smallCamel, + specifiedType: const FullType(String), + ); + } + if (object.capitalCamel != null) { + yield r'CapitalCamel'; + yield serializers.serialize( + object.capitalCamel, + specifiedType: const FullType(String), + ); + } + if (object.smallSnake != null) { + yield r'small_Snake'; + yield serializers.serialize( + object.smallSnake, + specifiedType: const FullType(String), + ); + } + if (object.capitalSnake != null) { + yield r'Capital_Snake'; + yield serializers.serialize( + object.capitalSnake, + specifiedType: const FullType(String), + ); + } + if (object.sCAETHFlowPoints != null) { + yield r'SCA_ETH_Flow_Points'; + yield serializers.serialize( + object.sCAETHFlowPoints, + specifiedType: const FullType(String), + ); + } + if (object.ATT_NAME != null) { + yield r'ATT_NAME'; + yield serializers.serialize( + object.ATT_NAME, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Capitalization object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required CapitalizationBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'smallCamel': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.smallCamel = valueDes; + break; + case r'CapitalCamel': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.capitalCamel = valueDes; + break; + case r'small_Snake': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.smallSnake = valueDes; + break; + case r'Capital_Snake': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.capitalSnake = valueDes; + break; + case r'SCA_ETH_Flow_Points': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.sCAETHFlowPoints = valueDes; + break; + case r'ATT_NAME': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.ATT_NAME = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Capitalization deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = CapitalizationBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/cat.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/cat.dart new file mode 100644 index 000000000000..ecc7facb059f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/cat.dart @@ -0,0 +1,138 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/animal.dart'; +import 'package:openapi/src/model/cat_all_of.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'cat.g.dart'; + +/// Cat +/// +/// Properties: +/// * [className] +/// * [color] +/// * [declawed] +@BuiltValue() +abstract class Cat implements Animal, CatAllOf, Built { + Cat._(); + + factory Cat([void updates(CatBuilder b)]) = _$Cat; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(CatBuilder b) => b + ..className = b.discriminatorValue + ..color = 'red'; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$CatSerializer(); +} + +class _$CatSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Cat, _$Cat]; + + @override + final String wireName = r'Cat'; + + Iterable _serializeProperties( + Serializers serializers, + Cat object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'className'; + yield serializers.serialize( + object.className, + specifiedType: const FullType(String), + ); + if (object.color != null) { + yield r'color'; + yield serializers.serialize( + object.color, + specifiedType: const FullType(String), + ); + } + if (object.declawed != null) { + yield r'declawed'; + yield serializers.serialize( + object.declawed, + specifiedType: const FullType(bool), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Cat object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required CatBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'className': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.className = valueDes; + break; + case r'color': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.color = valueDes; + break; + case r'declawed': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) as bool; + result.declawed = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Cat deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = CatBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/cat_all_of.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/cat_all_of.dart new file mode 100644 index 000000000000..18fd5b5ec591 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/cat_all_of.dart @@ -0,0 +1,144 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'cat_all_of.g.dart'; + +/// CatAllOf +/// +/// Properties: +/// * [declawed] +@BuiltValue(instantiable: false) +abstract class CatAllOf { + @BuiltValueField(wireName: r'declawed') + bool? get declawed; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$CatAllOfSerializer(); +} + +class _$CatAllOfSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [CatAllOf]; + + @override + final String wireName = r'CatAllOf'; + + Iterable _serializeProperties( + Serializers serializers, + CatAllOf object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.declawed != null) { + yield r'declawed'; + yield serializers.serialize( + object.declawed, + specifiedType: const FullType(bool), + ); + } + } + + @override + Object serialize( + Serializers serializers, + CatAllOf object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + @override + CatAllOf deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.deserialize(serialized, + specifiedType: FullType($CatAllOf)) as $CatAllOf; + } +} + +/// a concrete implementation of [CatAllOf], since [CatAllOf] is not instantiable +@BuiltValue(instantiable: true) +abstract class $CatAllOf + implements CatAllOf, Built<$CatAllOf, $CatAllOfBuilder> { + $CatAllOf._(); + + factory $CatAllOf([void Function($CatAllOfBuilder)? updates]) = _$$CatAllOf; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($CatAllOfBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$CatAllOf> get serializer => _$$CatAllOfSerializer(); +} + +class _$$CatAllOfSerializer implements PrimitiveSerializer<$CatAllOf> { + @override + final Iterable types = const [$CatAllOf, _$$CatAllOf]; + + @override + final String wireName = r'$CatAllOf'; + + @override + Object serialize( + Serializers serializers, + $CatAllOf object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(CatAllOf))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required CatAllOfBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'declawed': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) as bool; + result.declawed = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $CatAllOf deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $CatAllOfBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/category.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/category.dart new file mode 100644 index 000000000000..b580e36fc4dc --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/category.dart @@ -0,0 +1,127 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'category.g.dart'; + +/// Category +/// +/// Properties: +/// * [id] +/// * [name] +@BuiltValue() +abstract class Category implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'name') + String? get name; + + Category._(); + + factory Category([void updates(CategoryBuilder b)]) = _$Category; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(CategoryBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$CategorySerializer(); +} + +class _$CategorySerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Category, _$Category]; + + @override + final String wireName = r'Category'; + + Iterable _serializeProperties( + Serializers serializers, + Category object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Category object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required CategoryBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Category deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = CategoryBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/model/child.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/child.dart similarity index 95% rename from samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/model/child.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/child.dart index 987b52ca7240..dfc2ceaef1e6 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/model/child.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/child.dart @@ -11,7 +11,7 @@ part 'child.g.dart'; /// Child /// /// Properties: -/// * [name] +/// * [name] @BuiltValue() abstract class Child implements Built { @BuiltValueField(wireName: r'name') @@ -55,7 +55,9 @@ class _$ChildSerializer implements PrimitiveSerializer { Child object, { FullType specifiedType = FullType.unspecified, }) { - return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); } void _deserializeProperties( @@ -105,4 +107,3 @@ class _$ChildSerializer implements PrimitiveSerializer { return result.build(); } } - diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/class_model.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/class_model.dart new file mode 100644 index 000000000000..74442b2e44ac --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/class_model.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'class_model.g.dart'; + +/// Model for testing model with \"_class\" property +/// +/// Properties: +/// * [classField] +@BuiltValue() +abstract class ClassModel implements Built { + @BuiltValueField(wireName: r'_class') + String? get classField; + + ClassModel._(); + + factory ClassModel([void updates(ClassModelBuilder b)]) = _$ClassModel; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ClassModelBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ClassModelSerializer(); +} + +class _$ClassModelSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ClassModel, _$ClassModel]; + + @override + final String wireName = r'ClassModel'; + + Iterable _serializeProperties( + Serializers serializers, + ClassModel object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.classField != null) { + yield r'_class'; + yield serializers.serialize( + object.classField, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ClassModel object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ClassModelBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'_class': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.classField = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ClassModel deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ClassModelBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/model/date.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/date.dart similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof/lib/src/model/date.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/date.dart diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/deprecated_object.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/deprecated_object.dart new file mode 100644 index 000000000000..d4e14dcc76b3 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/deprecated_object.dart @@ -0,0 +1,113 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'deprecated_object.g.dart'; + +/// DeprecatedObject +/// +/// Properties: +/// * [name] +@BuiltValue() +abstract class DeprecatedObject + implements Built { + @BuiltValueField(wireName: r'name') + String? get name; + + DeprecatedObject._(); + + factory DeprecatedObject([void updates(DeprecatedObjectBuilder b)]) = + _$DeprecatedObject; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(DeprecatedObjectBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$DeprecatedObjectSerializer(); +} + +class _$DeprecatedObjectSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [DeprecatedObject, _$DeprecatedObject]; + + @override + final String wireName = r'DeprecatedObject'; + + Iterable _serializeProperties( + Serializers serializers, + DeprecatedObject object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + DeprecatedObject object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required DeprecatedObjectBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + DeprecatedObject deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = DeprecatedObjectBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/dog.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/dog.dart new file mode 100644 index 000000000000..7f67a3b24ba0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/dog.dart @@ -0,0 +1,138 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/dog_all_of.dart'; +import 'package:openapi/src/model/animal.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'dog.g.dart'; + +/// Dog +/// +/// Properties: +/// * [className] +/// * [color] +/// * [breed] +@BuiltValue() +abstract class Dog implements Animal, DogAllOf, Built { + Dog._(); + + factory Dog([void updates(DogBuilder b)]) = _$Dog; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(DogBuilder b) => b + ..className = b.discriminatorValue + ..color = 'red'; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$DogSerializer(); +} + +class _$DogSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Dog, _$Dog]; + + @override + final String wireName = r'Dog'; + + Iterable _serializeProperties( + Serializers serializers, + Dog object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'className'; + yield serializers.serialize( + object.className, + specifiedType: const FullType(String), + ); + if (object.color != null) { + yield r'color'; + yield serializers.serialize( + object.color, + specifiedType: const FullType(String), + ); + } + if (object.breed != null) { + yield r'breed'; + yield serializers.serialize( + object.breed, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Dog object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required DogBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'className': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.className = valueDes; + break; + case r'color': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.color = valueDes; + break; + case r'breed': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.breed = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Dog deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = DogBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/dog_all_of.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/dog_all_of.dart new file mode 100644 index 000000000000..28c95d93dcf2 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/dog_all_of.dart @@ -0,0 +1,144 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'dog_all_of.g.dart'; + +/// DogAllOf +/// +/// Properties: +/// * [breed] +@BuiltValue(instantiable: false) +abstract class DogAllOf { + @BuiltValueField(wireName: r'breed') + String? get breed; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$DogAllOfSerializer(); +} + +class _$DogAllOfSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [DogAllOf]; + + @override + final String wireName = r'DogAllOf'; + + Iterable _serializeProperties( + Serializers serializers, + DogAllOf object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.breed != null) { + yield r'breed'; + yield serializers.serialize( + object.breed, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + DogAllOf object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + @override + DogAllOf deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.deserialize(serialized, + specifiedType: FullType($DogAllOf)) as $DogAllOf; + } +} + +/// a concrete implementation of [DogAllOf], since [DogAllOf] is not instantiable +@BuiltValue(instantiable: true) +abstract class $DogAllOf + implements DogAllOf, Built<$DogAllOf, $DogAllOfBuilder> { + $DogAllOf._(); + + factory $DogAllOf([void Function($DogAllOfBuilder)? updates]) = _$$DogAllOf; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($DogAllOfBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$DogAllOf> get serializer => _$$DogAllOfSerializer(); +} + +class _$$DogAllOfSerializer implements PrimitiveSerializer<$DogAllOf> { + @override + final Iterable types = const [$DogAllOf, _$$DogAllOf]; + + @override + final String wireName = r'$DogAllOf'; + + @override + Object serialize( + Serializers serializers, + $DogAllOf object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(DogAllOf))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required DogAllOfBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'breed': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.breed = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $DogAllOf deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $DogAllOfBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/entity.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/entity.dart similarity index 88% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/entity.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/entity.dart index 7e27fab47387..c742bf3e2685 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/entity.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/entity.dart @@ -42,50 +42,51 @@ abstract class Entity implements Addressable, Extensible { } extension EntityDiscriminatorExt on Entity { - String? get discriminatorValue { - if (this is Bar) { - return r'Bar'; - } - if (this is BarCreate) { - return r'Bar_Create'; - } - if (this is Foo) { - return r'Foo'; - } - if (this is Pasta) { - return r'Pasta'; - } - if (this is Pizza) { - return r'Pizza'; - } - if (this is PizzaSpeziale) { - return r'PizzaSpeziale'; - } - return null; + String? get discriminatorValue { + if (this is Bar) { + return r'Bar'; } + if (this is BarCreate) { + return r'Bar_Create'; + } + if (this is Foo) { + return r'Foo'; + } + if (this is Pasta) { + return r'Pasta'; + } + if (this is Pizza) { + return r'Pizza'; + } + if (this is PizzaSpeziale) { + return r'PizzaSpeziale'; + } + return null; + } } + extension EntityBuilderDiscriminatorExt on EntityBuilder { - String? get discriminatorValue { - if (this is BarBuilder) { - return r'Bar'; - } - if (this is BarCreateBuilder) { - return r'Bar_Create'; - } - if (this is FooBuilder) { - return r'Foo'; - } - if (this is PastaBuilder) { - return r'Pasta'; - } - if (this is PizzaBuilder) { - return r'Pizza'; - } - if (this is PizzaSpezialeBuilder) { - return r'PizzaSpeziale'; - } - return null; + String? get discriminatorValue { + if (this is BarBuilder) { + return r'Bar'; } + if (this is BarCreateBuilder) { + return r'Bar_Create'; + } + if (this is FooBuilder) { + return r'Foo'; + } + if (this is PastaBuilder) { + return r'Pasta'; + } + if (this is PizzaBuilder) { + return r'Pizza'; + } + if (this is PizzaSpezialeBuilder) { + return r'PizzaSpeziale'; + } + return null; + } } class _$EntitySerializer implements PrimitiveSerializer { @@ -295,4 +296,3 @@ class _$$EntitySerializer implements PrimitiveSerializer<$Entity> { return result.build(); } } - diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/entity_ref.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/entity_ref.dart similarity index 95% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/entity_ref.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/entity_ref.dart index 7502c94dd7f3..d01a18fdde43 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/entity_ref.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/entity_ref.dart @@ -44,26 +44,27 @@ abstract class EntityRef implements Addressable, Extensible { } extension EntityRefDiscriminatorExt on EntityRef { - String? get discriminatorValue { - if (this is BarRef) { - return r'BarRef'; - } - if (this is FooRef) { - return r'FooRef'; - } - return null; + String? get discriminatorValue { + if (this is BarRef) { + return r'BarRef'; } + if (this is FooRef) { + return r'FooRef'; + } + return null; + } } + extension EntityRefBuilderDiscriminatorExt on EntityRefBuilder { - String? get discriminatorValue { - if (this is BarRefBuilder) { - return r'BarRef'; - } - if (this is FooRefBuilder) { - return r'FooRef'; - } - return null; + String? get discriminatorValue { + if (this is BarRefBuilder) { + return r'BarRef'; } + if (this is FooRefBuilder) { + return r'FooRef'; + } + return null; + } } class _$EntityRefSerializer implements PrimitiveSerializer { @@ -281,4 +282,3 @@ class _$$EntityRefSerializer implements PrimitiveSerializer<$EntityRef> { return result.build(); } } - diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/enum_arrays.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/enum_arrays.dart new file mode 100644 index 000000000000..2c8e3e6e4bb8 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/enum_arrays.dart @@ -0,0 +1,174 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'enum_arrays.g.dart'; + +/// EnumArrays +/// +/// Properties: +/// * [justSymbol] +/// * [arrayEnum] +@BuiltValue() +abstract class EnumArrays implements Built { + @BuiltValueField(wireName: r'just_symbol') + EnumArraysJustSymbolEnum? get justSymbol; + // enum justSymbolEnum { >=, $, }; + + @BuiltValueField(wireName: r'array_enum') + BuiltList? get arrayEnum; + // enum arrayEnumEnum { fish, crab, }; + + EnumArrays._(); + + factory EnumArrays([void updates(EnumArraysBuilder b)]) = _$EnumArrays; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(EnumArraysBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$EnumArraysSerializer(); +} + +class _$EnumArraysSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [EnumArrays, _$EnumArrays]; + + @override + final String wireName = r'EnumArrays'; + + Iterable _serializeProperties( + Serializers serializers, + EnumArrays object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.justSymbol != null) { + yield r'just_symbol'; + yield serializers.serialize( + object.justSymbol, + specifiedType: const FullType(EnumArraysJustSymbolEnum), + ); + } + if (object.arrayEnum != null) { + yield r'array_enum'; + yield serializers.serialize( + object.arrayEnum, + specifiedType: + const FullType(BuiltList, [FullType(EnumArraysArrayEnumEnum)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + EnumArrays object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required EnumArraysBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'just_symbol': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumArraysJustSymbolEnum), + ) as EnumArraysJustSymbolEnum; + result.justSymbol = valueDes; + break; + case r'array_enum': + final valueDes = serializers.deserialize( + value, + specifiedType: + const FullType(BuiltList, [FullType(EnumArraysArrayEnumEnum)]), + ) as BuiltList; + result.arrayEnum.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + EnumArrays deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = EnumArraysBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + +class EnumArraysJustSymbolEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'>=') + static const EnumArraysJustSymbolEnum greaterThanEqual = + _$enumArraysJustSymbolEnum_greaterThanEqual; + @BuiltValueEnumConst(wireName: r'$') + static const EnumArraysJustSymbolEnum dollar = + _$enumArraysJustSymbolEnum_dollar; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumArraysJustSymbolEnum unknownDefaultOpenApi = + _$enumArraysJustSymbolEnum_unknownDefaultOpenApi; + + static Serializer get serializer => + _$enumArraysJustSymbolEnumSerializer; + + const EnumArraysJustSymbolEnum._(String name) : super(name); + + static BuiltSet get values => + _$enumArraysJustSymbolEnumValues; + static EnumArraysJustSymbolEnum valueOf(String name) => + _$enumArraysJustSymbolEnumValueOf(name); +} + +class EnumArraysArrayEnumEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'fish') + static const EnumArraysArrayEnumEnum fish = _$enumArraysArrayEnumEnum_fish; + @BuiltValueEnumConst(wireName: r'crab') + static const EnumArraysArrayEnumEnum crab = _$enumArraysArrayEnumEnum_crab; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumArraysArrayEnumEnum unknownDefaultOpenApi = + _$enumArraysArrayEnumEnum_unknownDefaultOpenApi; + + static Serializer get serializer => + _$enumArraysArrayEnumEnumSerializer; + + const EnumArraysArrayEnumEnum._(String name) : super(name); + + static BuiltSet get values => + _$enumArraysArrayEnumEnumValues; + static EnumArraysArrayEnumEnum valueOf(String name) => + _$enumArraysArrayEnumEnumValueOf(name); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/enum_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/enum_test.dart new file mode 100644 index 000000000000..effda132acdd --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/enum_test.dart @@ -0,0 +1,338 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/outer_enum.dart'; +import 'package:openapi/src/model/outer_enum_default_value.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/outer_enum_integer.dart'; +import 'package:openapi/src/model/outer_enum_integer_default_value.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'enum_test.g.dart'; + +/// EnumTest +/// +/// Properties: +/// * [enumString] +/// * [enumStringRequired] +/// * [enumInteger] +/// * [enumNumber] +/// * [outerEnum] +/// * [outerEnumInteger] +/// * [outerEnumDefaultValue] +/// * [outerEnumIntegerDefaultValue] +@BuiltValue() +abstract class EnumTest implements Built { + @BuiltValueField(wireName: r'enum_string') + EnumTestEnumStringEnum? get enumString; + // enum enumStringEnum { UPPER, lower, , }; + + @BuiltValueField(wireName: r'enum_string_required') + EnumTestEnumStringRequiredEnum get enumStringRequired; + // enum enumStringRequiredEnum { UPPER, lower, , }; + + @BuiltValueField(wireName: r'enum_integer') + EnumTestEnumIntegerEnum? get enumInteger; + // enum enumIntegerEnum { 1, -1, }; + + @BuiltValueField(wireName: r'enum_number') + EnumTestEnumNumberEnum? get enumNumber; + // enum enumNumberEnum { 1.1, -1.2, }; + + @BuiltValueField(wireName: r'outerEnum') + OuterEnum? get outerEnum; + // enum outerEnumEnum { placed, approved, delivered, }; + + @BuiltValueField(wireName: r'outerEnumInteger') + OuterEnumInteger? get outerEnumInteger; + // enum outerEnumIntegerEnum { 0, 1, 2, }; + + @BuiltValueField(wireName: r'outerEnumDefaultValue') + OuterEnumDefaultValue? get outerEnumDefaultValue; + // enum outerEnumDefaultValueEnum { placed, approved, delivered, }; + + @BuiltValueField(wireName: r'outerEnumIntegerDefaultValue') + OuterEnumIntegerDefaultValue? get outerEnumIntegerDefaultValue; + // enum outerEnumIntegerDefaultValueEnum { 0, 1, 2, }; + + EnumTest._(); + + factory EnumTest([void updates(EnumTestBuilder b)]) = _$EnumTest; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(EnumTestBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$EnumTestSerializer(); +} + +class _$EnumTestSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [EnumTest, _$EnumTest]; + + @override + final String wireName = r'EnumTest'; + + Iterable _serializeProperties( + Serializers serializers, + EnumTest object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.enumString != null) { + yield r'enum_string'; + yield serializers.serialize( + object.enumString, + specifiedType: const FullType(EnumTestEnumStringEnum), + ); + } + yield r'enum_string_required'; + yield serializers.serialize( + object.enumStringRequired, + specifiedType: const FullType(EnumTestEnumStringRequiredEnum), + ); + if (object.enumInteger != null) { + yield r'enum_integer'; + yield serializers.serialize( + object.enumInteger, + specifiedType: const FullType(EnumTestEnumIntegerEnum), + ); + } + if (object.enumNumber != null) { + yield r'enum_number'; + yield serializers.serialize( + object.enumNumber, + specifiedType: const FullType(EnumTestEnumNumberEnum), + ); + } + if (object.outerEnum != null) { + yield r'outerEnum'; + yield serializers.serialize( + object.outerEnum, + specifiedType: const FullType.nullable(OuterEnum), + ); + } + if (object.outerEnumInteger != null) { + yield r'outerEnumInteger'; + yield serializers.serialize( + object.outerEnumInteger, + specifiedType: const FullType(OuterEnumInteger), + ); + } + if (object.outerEnumDefaultValue != null) { + yield r'outerEnumDefaultValue'; + yield serializers.serialize( + object.outerEnumDefaultValue, + specifiedType: const FullType(OuterEnumDefaultValue), + ); + } + if (object.outerEnumIntegerDefaultValue != null) { + yield r'outerEnumIntegerDefaultValue'; + yield serializers.serialize( + object.outerEnumIntegerDefaultValue, + specifiedType: const FullType(OuterEnumIntegerDefaultValue), + ); + } + } + + @override + Object serialize( + Serializers serializers, + EnumTest object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required EnumTestBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'enum_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumTestEnumStringEnum), + ) as EnumTestEnumStringEnum; + result.enumString = valueDes; + break; + case r'enum_string_required': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumTestEnumStringRequiredEnum), + ) as EnumTestEnumStringRequiredEnum; + result.enumStringRequired = valueDes; + break; + case r'enum_integer': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumTestEnumIntegerEnum), + ) as EnumTestEnumIntegerEnum; + result.enumInteger = valueDes; + break; + case r'enum_number': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumTestEnumNumberEnum), + ) as EnumTestEnumNumberEnum; + result.enumNumber = valueDes; + break; + case r'outerEnum': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(OuterEnum), + ) as OuterEnum?; + if (valueDes == null) continue; + result.outerEnum = valueDes; + break; + case r'outerEnumInteger': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OuterEnumInteger), + ) as OuterEnumInteger; + result.outerEnumInteger = valueDes; + break; + case r'outerEnumDefaultValue': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OuterEnumDefaultValue), + ) as OuterEnumDefaultValue; + result.outerEnumDefaultValue = valueDes; + break; + case r'outerEnumIntegerDefaultValue': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OuterEnumIntegerDefaultValue), + ) as OuterEnumIntegerDefaultValue; + result.outerEnumIntegerDefaultValue = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + EnumTest deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = EnumTestBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + +class EnumTestEnumStringEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'UPPER') + static const EnumTestEnumStringEnum UPPER = _$enumTestEnumStringEnum_UPPER; + @BuiltValueEnumConst(wireName: r'lower') + static const EnumTestEnumStringEnum lower = _$enumTestEnumStringEnum_lower; + @BuiltValueEnumConst(wireName: r'') + static const EnumTestEnumStringEnum empty = _$enumTestEnumStringEnum_empty; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumTestEnumStringEnum unknownDefaultOpenApi = + _$enumTestEnumStringEnum_unknownDefaultOpenApi; + + static Serializer get serializer => + _$enumTestEnumStringEnumSerializer; + + const EnumTestEnumStringEnum._(String name) : super(name); + + static BuiltSet get values => + _$enumTestEnumStringEnumValues; + static EnumTestEnumStringEnum valueOf(String name) => + _$enumTestEnumStringEnumValueOf(name); +} + +class EnumTestEnumStringRequiredEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'UPPER') + static const EnumTestEnumStringRequiredEnum UPPER = + _$enumTestEnumStringRequiredEnum_UPPER; + @BuiltValueEnumConst(wireName: r'lower') + static const EnumTestEnumStringRequiredEnum lower = + _$enumTestEnumStringRequiredEnum_lower; + @BuiltValueEnumConst(wireName: r'') + static const EnumTestEnumStringRequiredEnum empty = + _$enumTestEnumStringRequiredEnum_empty; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumTestEnumStringRequiredEnum unknownDefaultOpenApi = + _$enumTestEnumStringRequiredEnum_unknownDefaultOpenApi; + + static Serializer get serializer => + _$enumTestEnumStringRequiredEnumSerializer; + + const EnumTestEnumStringRequiredEnum._(String name) : super(name); + + static BuiltSet get values => + _$enumTestEnumStringRequiredEnumValues; + static EnumTestEnumStringRequiredEnum valueOf(String name) => + _$enumTestEnumStringRequiredEnumValueOf(name); +} + +class EnumTestEnumIntegerEnum extends EnumClass { + @BuiltValueEnumConst(wireNumber: 1) + static const EnumTestEnumIntegerEnum number1 = + _$enumTestEnumIntegerEnum_number1; + @BuiltValueEnumConst(wireNumber: -1) + static const EnumTestEnumIntegerEnum numberNegative1 = + _$enumTestEnumIntegerEnum_numberNegative1; + @BuiltValueEnumConst(wireNumber: 11184809, fallback: true) + static const EnumTestEnumIntegerEnum unknownDefaultOpenApi = + _$enumTestEnumIntegerEnum_unknownDefaultOpenApi; + + static Serializer get serializer => + _$enumTestEnumIntegerEnumSerializer; + + const EnumTestEnumIntegerEnum._(String name) : super(name); + + static BuiltSet get values => + _$enumTestEnumIntegerEnumValues; + static EnumTestEnumIntegerEnum valueOf(String name) => + _$enumTestEnumIntegerEnumValueOf(name); +} + +class EnumTestEnumNumberEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'1.1') + static const EnumTestEnumNumberEnum number1Period1 = + _$enumTestEnumNumberEnum_number1Period1; + @BuiltValueEnumConst(wireName: r'-1.2') + static const EnumTestEnumNumberEnum numberNegative1Period2 = + _$enumTestEnumNumberEnum_numberNegative1Period2; + @BuiltValueEnumConst(wireName: r'11184809', fallback: true) + static const EnumTestEnumNumberEnum unknownDefaultOpenApi = + _$enumTestEnumNumberEnum_unknownDefaultOpenApi; + + static Serializer get serializer => + _$enumTestEnumNumberEnumSerializer; + + const EnumTestEnumNumberEnum._(String name) : super(name); + + static BuiltSet get values => + _$enumTestEnumNumberEnumValues; + static EnumTestEnumNumberEnum valueOf(String name) => + _$enumTestEnumNumberEnumValueOf(name); +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/model/example.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/example.dart similarity index 82% rename from samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/model/example.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/example.dart index 799b77e4e178..27d7e939103c 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/model/example.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/example.dart @@ -14,7 +14,7 @@ part 'example.g.dart'; /// Example /// /// Properties: -/// * [name] +/// * [name] @BuiltValue() abstract class Example implements Built { /// One Of [Child], [int] @@ -42,8 +42,7 @@ class _$ExampleSerializer implements PrimitiveSerializer { Serializers serializers, Example object, { FullType specifiedType = FullType.unspecified, - }) sync* { - } + }) sync* {} @override Object serialize( @@ -52,7 +51,8 @@ class _$ExampleSerializer implements PrimitiveSerializer { FullType specifiedType = FullType.unspecified, }) { final oneOf = object.oneOf; - return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + return serializers.serialize(oneOf.value, + specifiedType: FullType(oneOf.valueType))!; } @override @@ -63,10 +63,13 @@ class _$ExampleSerializer implements PrimitiveSerializer { }) { final result = ExampleBuilder(); Object? oneOfDataSrc; - final targetType = const FullType(OneOf, [FullType(Child), FullType(int), ]); + final targetType = const FullType(OneOf, [ + FullType(Child), + FullType(int), + ]); oneOfDataSrc = serialized; - result.oneOf = serializers.deserialize(oneOfDataSrc, specifiedType: targetType) as OneOf; + result.oneOf = serializers.deserialize(oneOfDataSrc, + specifiedType: targetType) as OneOf; return result.build(); } } - diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/example_non_primitive.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/example_non_primitive.dart new file mode 100644 index 000000000000..6812a9f2fc60 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/example_non_primitive.dart @@ -0,0 +1,80 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'dart:core'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'example_non_primitive.g.dart'; + +/// ExampleNonPrimitive +@BuiltValue() +abstract class ExampleNonPrimitive + implements Built { + /// One Of [DateTime], [String], [int], [num] + OneOf get oneOf; + + ExampleNonPrimitive._(); + + factory ExampleNonPrimitive([void updates(ExampleNonPrimitiveBuilder b)]) = + _$ExampleNonPrimitive; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ExampleNonPrimitiveBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$ExampleNonPrimitiveSerializer(); +} + +class _$ExampleNonPrimitiveSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [ + ExampleNonPrimitive, + _$ExampleNonPrimitive + ]; + + @override + final String wireName = r'ExampleNonPrimitive'; + + Iterable _serializeProperties( + Serializers serializers, + ExampleNonPrimitive object, { + FullType specifiedType = FullType.unspecified, + }) sync* {} + + @override + Object serialize( + Serializers serializers, + ExampleNonPrimitive object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, + specifiedType: FullType(oneOf.valueType))!; + } + + @override + ExampleNonPrimitive deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ExampleNonPrimitiveBuilder(); + Object? oneOfDataSrc; + final targetType = const FullType(OneOf, [ + FullType(String), + FullType(DateTime), + FullType(int), + FullType(num), + ]); + oneOfDataSrc = serialized; + result.oneOf = serializers.deserialize(oneOfDataSrc, + specifiedType: targetType) as OneOf; + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/extensible.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/extensible.dart similarity index 92% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/extensible.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/extensible.dart index 2423fb276412..4751e487f2cd 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/extensible.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/extensible.dart @@ -15,7 +15,7 @@ part 'extensible.g.dart'; /// * [atBaseType] - When sub-classing, this defines the super-class /// * [atType] - When sub-classing, this defines the sub-class Extensible name @BuiltValue(instantiable: false) -abstract class Extensible { +abstract class Extensible { /// A URI to a JSON-Schema file that defines additional attributes and relationships @BuiltValueField(wireName: r'@schemaLocation') String? get atSchemaLocation; @@ -71,7 +71,9 @@ class _$ExtensibleSerializer implements PrimitiveSerializer { Extensible object, { FullType specifiedType = FullType.unspecified, }) { - return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); } @override @@ -80,16 +82,19 @@ class _$ExtensibleSerializer implements PrimitiveSerializer { Object serialized, { FullType specifiedType = FullType.unspecified, }) { - return serializers.deserialize(serialized, specifiedType: FullType($Extensible)) as $Extensible; + return serializers.deserialize(serialized, + specifiedType: FullType($Extensible)) as $Extensible; } } /// a concrete implementation of [Extensible], since [Extensible] is not instantiable @BuiltValue(instantiable: true) -abstract class $Extensible implements Extensible, Built<$Extensible, $ExtensibleBuilder> { +abstract class $Extensible + implements Extensible, Built<$Extensible, $ExtensibleBuilder> { $Extensible._(); - factory $Extensible([void Function($ExtensibleBuilder)? updates]) = _$$Extensible; + factory $Extensible([void Function($ExtensibleBuilder)? updates]) = + _$$Extensible; @BuiltValueHook(initializeBuilder: true) static void _defaults($ExtensibleBuilder b) => b; @@ -175,4 +180,3 @@ class _$$ExtensibleSerializer implements PrimitiveSerializer<$Extensible> { return result.build(); } } - diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/file_schema_test_class.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/file_schema_test_class.dart new file mode 100644 index 000000000000..e28ed72311d5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/file_schema_test_class.dart @@ -0,0 +1,136 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/model_file.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'file_schema_test_class.g.dart'; + +/// FileSchemaTestClass +/// +/// Properties: +/// * [file] +/// * [files] +@BuiltValue() +abstract class FileSchemaTestClass + implements Built { + @BuiltValueField(wireName: r'file') + ModelFile? get file; + + @BuiltValueField(wireName: r'files') + BuiltList? get files; + + FileSchemaTestClass._(); + + factory FileSchemaTestClass([void updates(FileSchemaTestClassBuilder b)]) = + _$FileSchemaTestClass; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FileSchemaTestClassBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$FileSchemaTestClassSerializer(); +} + +class _$FileSchemaTestClassSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [ + FileSchemaTestClass, + _$FileSchemaTestClass + ]; + + @override + final String wireName = r'FileSchemaTestClass'; + + Iterable _serializeProperties( + Serializers serializers, + FileSchemaTestClass object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.file != null) { + yield r'file'; + yield serializers.serialize( + object.file, + specifiedType: const FullType(ModelFile), + ); + } + if (object.files != null) { + yield r'files'; + yield serializers.serialize( + object.files, + specifiedType: const FullType(BuiltList, [FullType(ModelFile)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + FileSchemaTestClass object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FileSchemaTestClassBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'file': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(ModelFile), + ) as ModelFile; + result.file.replace(valueDes); + break; + case r'files': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(ModelFile)]), + ) as BuiltList; + result.files.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FileSchemaTestClass deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FileSchemaTestClassBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/foo.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/foo.dart similarity index 98% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/foo.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/foo.dart index d2e1f5817f20..f6d6a0d3f45e 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/foo.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/foo.dart @@ -12,8 +12,8 @@ part 'foo.g.dart'; /// Foo /// /// Properties: -/// * [fooPropA] -/// * [fooPropB] +/// * [fooPropA] +/// * [fooPropB] /// * [href] - Hyperlink reference /// * [id] - unique identifier /// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships @@ -32,7 +32,7 @@ abstract class Foo implements Entity, Built { factory Foo([void updates(FooBuilder b)]) = _$Foo; @BuiltValueHook(initializeBuilder: true) - static void _defaults(FooBuilder b) => b..atType=b.discriminatorValue; + static void _defaults(FooBuilder b) => b..atType = b.discriminatorValue; @BuiltValueSerializer(custom: true) static Serializer get serializer => _$FooSerializer(); @@ -197,4 +197,3 @@ class _$FooSerializer implements PrimitiveSerializer { return result.build(); } } - diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/foo_ref.dart similarity index 98% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/foo_ref.dart index 1f77d990f0e8..574a71475c2d 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/foo_ref.dart @@ -12,7 +12,7 @@ part 'foo_ref.g.dart'; /// FooRef /// /// Properties: -/// * [foorefPropA] +/// * [foorefPropA] /// * [href] - Hyperlink reference /// * [id] - unique identifier /// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships @@ -28,7 +28,7 @@ abstract class FooRef implements EntityRef, Built { factory FooRef([void updates(FooRefBuilder b)]) = _$FooRef; @BuiltValueHook(initializeBuilder: true) - static void _defaults(FooRefBuilder b) => b..atType=b.discriminatorValue; + static void _defaults(FooRefBuilder b) => b..atType = b.discriminatorValue; @BuiltValueSerializer(custom: true) static Serializer get serializer => _$FooRefSerializer(); @@ -207,4 +207,3 @@ class _$FooRefSerializer implements PrimitiveSerializer { return result.build(); } } - diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref_or_value.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/foo_ref_or_value.dart similarity index 71% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref_or_value.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/foo_ref_or_value.dart index af3e4875d9d6..bdfd5f2d0792 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/foo_ref_or_value.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/foo_ref_or_value.dart @@ -20,7 +20,8 @@ part 'foo_ref_or_value.g.dart'; /// * [atBaseType] - When sub-classing, this defines the super-class /// * [atType] - When sub-classing, this defines the sub-class Extensible name @BuiltValue() -abstract class FooRefOrValue implements Built { +abstract class FooRefOrValue + implements Built { /// One Of [Foo], [FooRef] OneOf get oneOf; @@ -33,13 +34,39 @@ abstract class FooRefOrValue implements Built b; @BuiltValueSerializer(custom: true) - static Serializer get serializer => _$FooRefOrValueSerializer(); + static Serializer get serializer => + _$FooRefOrValueSerializer(); +} + +extension FooRefOrValueDiscriminatorExt on FooRefOrValue { + String? get discriminatorValue { + if (this is Foo) { + return r'Foo'; + } + if (this is FooRef) { + return r'FooRef'; + } + return null; + } +} + +extension FooRefOrValueBuilderDiscriminatorExt on FooRefOrValueBuilder { + String? get discriminatorValue { + if (this is FooBuilder) { + return r'Foo'; + } + if (this is FooRefBuilder) { + return r'FooRef'; + } + return null; + } } extension FooRefOrValueDiscriminatorExt on FooRefOrValue { @@ -76,8 +103,7 @@ class _$FooRefOrValueSerializer implements PrimitiveSerializer { Serializers serializers, FooRefOrValue object, { FullType specifiedType = FullType.unspecified, - }) sync* { - } + }) sync* {} @override Object serialize( @@ -86,7 +112,8 @@ class _$FooRefOrValueSerializer implements PrimitiveSerializer { FullType specifiedType = FullType.unspecified, }) { final oneOf = object.oneOf; - return serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType))!; + return serializers.serialize(oneOf.value, + specifiedType: FullType(oneOf.valueType))!; } @override @@ -98,10 +125,15 @@ class _$FooRefOrValueSerializer implements PrimitiveSerializer { final result = FooRefOrValueBuilder(); Object? oneOfDataSrc; final serializedList = (serialized as Iterable).toList(); - final discIndex = serializedList.indexOf(FooRefOrValue.discriminatorFieldName) + 1; - final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + final discIndex = + serializedList.indexOf(FooRefOrValue.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], + specifiedType: FullType(String)) as String; oneOfDataSrc = serialized; - final oneOfTypes = [Foo, FooRef, ]; + final oneOfTypes = [ + Foo, + FooRef, + ]; Object oneOfResult; Type oneOfType; switch (discValue) { @@ -120,10 +152,13 @@ class _$FooRefOrValueSerializer implements PrimitiveSerializer { oneOfType = FooRef; break; default: - throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + throw UnsupportedError( + "Couldn't deserialize oneOf for the discriminator value: ${discValue}"); } - result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + result.oneOf = OneOfDynamic( + typeIndex: oneOfTypes.indexOf(oneOfType), + types: oneOfTypes, + value: oneOfResult); return result.build(); } } - diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/format_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/format_test.dart new file mode 100644 index 000000000000..771056f35226 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/format_test.dart @@ -0,0 +1,375 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'dart:typed_data'; +import 'package:openapi/src/model/date.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'format_test.g.dart'; + +/// FormatTest +/// +/// Properties: +/// * [integer] +/// * [int32] +/// * [int64] +/// * [number] +/// * [float] +/// * [double_] +/// * [decimal] +/// * [string] +/// * [byte] +/// * [binary] +/// * [date] +/// * [dateTime] +/// * [uuid] +/// * [password] +/// * [patternWithDigits] - A string that is a 10 digit number. Can have leading zeros. +/// * [patternWithDigitsAndDelimiter] - A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. +@BuiltValue() +abstract class FormatTest implements Built { + @BuiltValueField(wireName: r'integer') + int? get integer; + + @BuiltValueField(wireName: r'int32') + int? get int32; + + @BuiltValueField(wireName: r'int64') + int? get int64; + + @BuiltValueField(wireName: r'number') + num get number; + + @BuiltValueField(wireName: r'float') + double? get float; + + @BuiltValueField(wireName: r'double') + double? get double_; + + @BuiltValueField(wireName: r'decimal') + double? get decimal; + + @BuiltValueField(wireName: r'string') + String? get string; + + @BuiltValueField(wireName: r'byte') + String get byte; + + @BuiltValueField(wireName: r'binary') + Uint8List? get binary; + + @BuiltValueField(wireName: r'date') + Date get date; + + @BuiltValueField(wireName: r'dateTime') + DateTime? get dateTime; + + @BuiltValueField(wireName: r'uuid') + String? get uuid; + + @BuiltValueField(wireName: r'password') + String get password; + + /// A string that is a 10 digit number. Can have leading zeros. + @BuiltValueField(wireName: r'pattern_with_digits') + String? get patternWithDigits; + + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + @BuiltValueField(wireName: r'pattern_with_digits_and_delimiter') + String? get patternWithDigitsAndDelimiter; + + FormatTest._(); + + factory FormatTest([void updates(FormatTestBuilder b)]) = _$FormatTest; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FormatTestBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FormatTestSerializer(); +} + +class _$FormatTestSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FormatTest, _$FormatTest]; + + @override + final String wireName = r'FormatTest'; + + Iterable _serializeProperties( + Serializers serializers, + FormatTest object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.integer != null) { + yield r'integer'; + yield serializers.serialize( + object.integer, + specifiedType: const FullType(int), + ); + } + if (object.int32 != null) { + yield r'int32'; + yield serializers.serialize( + object.int32, + specifiedType: const FullType(int), + ); + } + if (object.int64 != null) { + yield r'int64'; + yield serializers.serialize( + object.int64, + specifiedType: const FullType(int), + ); + } + yield r'number'; + yield serializers.serialize( + object.number, + specifiedType: const FullType(num), + ); + if (object.float != null) { + yield r'float'; + yield serializers.serialize( + object.float, + specifiedType: const FullType(double), + ); + } + if (object.double_ != null) { + yield r'double'; + yield serializers.serialize( + object.double_, + specifiedType: const FullType(double), + ); + } + if (object.decimal != null) { + yield r'decimal'; + yield serializers.serialize( + object.decimal, + specifiedType: const FullType(double), + ); + } + if (object.string != null) { + yield r'string'; + yield serializers.serialize( + object.string, + specifiedType: const FullType(String), + ); + } + yield r'byte'; + yield serializers.serialize( + object.byte, + specifiedType: const FullType(String), + ); + if (object.binary != null) { + yield r'binary'; + yield serializers.serialize( + object.binary, + specifiedType: const FullType(Uint8List), + ); + } + yield r'date'; + yield serializers.serialize( + object.date, + specifiedType: const FullType(Date), + ); + if (object.dateTime != null) { + yield r'dateTime'; + yield serializers.serialize( + object.dateTime, + specifiedType: const FullType(DateTime), + ); + } + if (object.uuid != null) { + yield r'uuid'; + yield serializers.serialize( + object.uuid, + specifiedType: const FullType(String), + ); + } + yield r'password'; + yield serializers.serialize( + object.password, + specifiedType: const FullType(String), + ); + if (object.patternWithDigits != null) { + yield r'pattern_with_digits'; + yield serializers.serialize( + object.patternWithDigits, + specifiedType: const FullType(String), + ); + } + if (object.patternWithDigitsAndDelimiter != null) { + yield r'pattern_with_digits_and_delimiter'; + yield serializers.serialize( + object.patternWithDigitsAndDelimiter, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + FormatTest object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FormatTestBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'integer': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.integer = valueDes; + break; + case r'int32': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.int32 = valueDes; + break; + case r'int64': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.int64 = valueDes; + break; + case r'number': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.number = valueDes; + break; + case r'float': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(double), + ) as double; + result.float = valueDes; + break; + case r'double': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(double), + ) as double; + result.double_ = valueDes; + break; + case r'decimal': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(double), + ) as double; + result.decimal = valueDes; + break; + case r'string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.string = valueDes; + break; + case r'byte': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.byte = valueDes; + break; + case r'binary': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(Uint8List), + ) as Uint8List; + result.binary = valueDes; + break; + case r'date': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(Date), + ) as Date; + result.date = valueDes; + break; + case r'dateTime': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(DateTime), + ) as DateTime; + result.dateTime = valueDes; + break; + case r'uuid': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.uuid = valueDes; + break; + case r'password': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.password = valueDes; + break; + case r'pattern_with_digits': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.patternWithDigits = valueDes; + break; + case r'pattern_with_digits_and_delimiter': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.patternWithDigitsAndDelimiter = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FormatTest deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FormatTestBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/model/fruit.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/fruit.dart similarity index 85% rename from samples/openapi3/client/petstore/dart-dio/oneof/lib/src/model/fruit.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/fruit.dart index 11f8cfa70501..5c31531d9e55 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/model/fruit.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/fruit.dart @@ -14,9 +14,9 @@ part 'fruit.g.dart'; /// Fruit /// /// Properties: -/// * [color] -/// * [kind] -/// * [count] +/// * [color] +/// * [kind] +/// * [count] @BuiltValue() abstract class Fruit implements Built { @BuiltValueField(wireName: r'color') @@ -64,8 +64,11 @@ class _$FruitSerializer implements PrimitiveSerializer { FullType specifiedType = FullType.unspecified, }) { final oneOf = object.oneOf; - final result = _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); - result.addAll(serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType)) as Iterable); + final result = + _serializeProperties(serializers, object, specifiedType: specifiedType) + .toList(); + result.addAll(serializers.serialize(oneOf.value, + specifiedType: FullType(oneOf.valueType)) as Iterable); return result; } @@ -104,7 +107,10 @@ class _$FruitSerializer implements PrimitiveSerializer { }) { final result = FruitBuilder(); Object? oneOfDataSrc; - final targetType = const FullType(OneOf, [FullType(Apple), FullType(Banana), ]); + final targetType = const FullType(OneOf, [ + FullType(Apple), + FullType(Banana), + ]); final serializedList = (serialized as Iterable).toList(); final unhandled = []; _deserializeProperties( @@ -116,8 +122,8 @@ class _$FruitSerializer implements PrimitiveSerializer { result: result, ); oneOfDataSrc = unhandled; - result.oneOf = serializers.deserialize(oneOfDataSrc, specifiedType: targetType) as OneOf; + result.oneOf = serializers.deserialize(oneOfDataSrc, + specifiedType: targetType) as OneOf; return result.build(); } } - diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/has_only_read_only.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/has_only_read_only.dart new file mode 100644 index 000000000000..9d2538bab52a --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/has_only_read_only.dart @@ -0,0 +1,131 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'has_only_read_only.g.dart'; + +/// HasOnlyReadOnly +/// +/// Properties: +/// * [bar] +/// * [foo] +@BuiltValue() +abstract class HasOnlyReadOnly + implements Built { + @BuiltValueField(wireName: r'bar') + String? get bar; + + @BuiltValueField(wireName: r'foo') + String? get foo; + + HasOnlyReadOnly._(); + + factory HasOnlyReadOnly([void updates(HasOnlyReadOnlyBuilder b)]) = + _$HasOnlyReadOnly; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(HasOnlyReadOnlyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$HasOnlyReadOnlySerializer(); +} + +class _$HasOnlyReadOnlySerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [HasOnlyReadOnly, _$HasOnlyReadOnly]; + + @override + final String wireName = r'HasOnlyReadOnly'; + + Iterable _serializeProperties( + Serializers serializers, + HasOnlyReadOnly object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.bar != null) { + yield r'bar'; + yield serializers.serialize( + object.bar, + specifiedType: const FullType(String), + ); + } + if (object.foo != null) { + yield r'foo'; + yield serializers.serialize( + object.foo, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + HasOnlyReadOnly object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required HasOnlyReadOnlyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'bar': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.bar = valueDes; + break; + case r'foo': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.foo = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + HasOnlyReadOnly deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = HasOnlyReadOnlyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/health_check_result.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/health_check_result.dart new file mode 100644 index 000000000000..4756e8600c1c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/health_check_result.dart @@ -0,0 +1,114 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'health_check_result.g.dart'; + +/// Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. +/// +/// Properties: +/// * [nullableMessage] +@BuiltValue() +abstract class HealthCheckResult + implements Built { + @BuiltValueField(wireName: r'NullableMessage') + String? get nullableMessage; + + HealthCheckResult._(); + + factory HealthCheckResult([void updates(HealthCheckResultBuilder b)]) = + _$HealthCheckResult; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(HealthCheckResultBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$HealthCheckResultSerializer(); +} + +class _$HealthCheckResultSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [HealthCheckResult, _$HealthCheckResult]; + + @override + final String wireName = r'HealthCheckResult'; + + Iterable _serializeProperties( + Serializers serializers, + HealthCheckResult object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.nullableMessage != null) { + yield r'NullableMessage'; + yield serializers.serialize( + object.nullableMessage, + specifiedType: const FullType.nullable(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + HealthCheckResult object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required HealthCheckResultBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'NullableMessage': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(String), + ) as String?; + if (valueDes == null) continue; + result.nullableMessage = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + HealthCheckResult deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = HealthCheckResultBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/map_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/map_test.dart new file mode 100644 index 000000000000..a31e79364fc5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/map_test.dart @@ -0,0 +1,199 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'map_test.g.dart'; + +/// MapTest +/// +/// Properties: +/// * [mapMapOfString] +/// * [mapOfEnumString] +/// * [directMap] +/// * [indirectMap] +@BuiltValue() +abstract class MapTest implements Built { + @BuiltValueField(wireName: r'map_map_of_string') + BuiltMap>? get mapMapOfString; + + @BuiltValueField(wireName: r'map_of_enum_string') + BuiltMap? get mapOfEnumString; + // enum mapOfEnumStringEnum { UPPER, lower, }; + + @BuiltValueField(wireName: r'direct_map') + BuiltMap? get directMap; + + @BuiltValueField(wireName: r'indirect_map') + BuiltMap? get indirectMap; + + MapTest._(); + + factory MapTest([void updates(MapTestBuilder b)]) = _$MapTest; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(MapTestBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$MapTestSerializer(); +} + +class _$MapTestSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [MapTest, _$MapTest]; + + @override + final String wireName = r'MapTest'; + + Iterable _serializeProperties( + Serializers serializers, + MapTest object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.mapMapOfString != null) { + yield r'map_map_of_string'; + yield serializers.serialize( + object.mapMapOfString, + specifiedType: const FullType(BuiltMap, [ + FullType(String), + FullType(BuiltMap, [FullType(String), FullType(String)]) + ]), + ); + } + if (object.mapOfEnumString != null) { + yield r'map_of_enum_string'; + yield serializers.serialize( + object.mapOfEnumString, + specifiedType: const FullType( + BuiltMap, [FullType(String), FullType(MapTestMapOfEnumStringEnum)]), + ); + } + if (object.directMap != null) { + yield r'direct_map'; + yield serializers.serialize( + object.directMap, + specifiedType: + const FullType(BuiltMap, [FullType(String), FullType(bool)]), + ); + } + if (object.indirectMap != null) { + yield r'indirect_map'; + yield serializers.serialize( + object.indirectMap, + specifiedType: + const FullType(BuiltMap, [FullType(String), FullType(bool)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + MapTest object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required MapTestBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'map_map_of_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [ + FullType(String), + FullType(BuiltMap, [FullType(String), FullType(String)]) + ]), + ) as BuiltMap>; + result.mapMapOfString.replace(valueDes); + break; + case r'map_of_enum_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, + [FullType(String), FullType(MapTestMapOfEnumStringEnum)]), + ) as BuiltMap; + result.mapOfEnumString.replace(valueDes); + break; + case r'direct_map': + final valueDes = serializers.deserialize( + value, + specifiedType: + const FullType(BuiltMap, [FullType(String), FullType(bool)]), + ) as BuiltMap; + result.directMap.replace(valueDes); + break; + case r'indirect_map': + final valueDes = serializers.deserialize( + value, + specifiedType: + const FullType(BuiltMap, [FullType(String), FullType(bool)]), + ) as BuiltMap; + result.indirectMap.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + MapTest deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = MapTestBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + +class MapTestMapOfEnumStringEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'UPPER') + static const MapTestMapOfEnumStringEnum UPPER = + _$mapTestMapOfEnumStringEnum_UPPER; + @BuiltValueEnumConst(wireName: r'lower') + static const MapTestMapOfEnumStringEnum lower = + _$mapTestMapOfEnumStringEnum_lower; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const MapTestMapOfEnumStringEnum unknownDefaultOpenApi = + _$mapTestMapOfEnumStringEnum_unknownDefaultOpenApi; + + static Serializer get serializer => + _$mapTestMapOfEnumStringEnumSerializer; + + const MapTestMapOfEnumStringEnum._(String name) : super(name); + + static BuiltSet get values => + _$mapTestMapOfEnumStringEnumValues; + static MapTestMapOfEnumStringEnum valueOf(String name) => + _$mapTestMapOfEnumStringEnumValueOf(name); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/mixed_properties_and_additional_properties_class.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/mixed_properties_and_additional_properties_class.dart new file mode 100644 index 000000000000..0d85f7d589aa --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/mixed_properties_and_additional_properties_class.dart @@ -0,0 +1,163 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/animal.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'mixed_properties_and_additional_properties_class.g.dart'; + +/// MixedPropertiesAndAdditionalPropertiesClass +/// +/// Properties: +/// * [uuid] +/// * [dateTime] +/// * [map] +@BuiltValue() +abstract class MixedPropertiesAndAdditionalPropertiesClass + implements + Built { + @BuiltValueField(wireName: r'uuid') + String? get uuid; + + @BuiltValueField(wireName: r'dateTime') + DateTime? get dateTime; + + @BuiltValueField(wireName: r'map') + BuiltMap? get map; + + MixedPropertiesAndAdditionalPropertiesClass._(); + + factory MixedPropertiesAndAdditionalPropertiesClass( + [void updates( + MixedPropertiesAndAdditionalPropertiesClassBuilder b)]) = + _$MixedPropertiesAndAdditionalPropertiesClass; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(MixedPropertiesAndAdditionalPropertiesClassBuilder b) => + b; + + @BuiltValueSerializer(custom: true) + static Serializer + get serializer => + _$MixedPropertiesAndAdditionalPropertiesClassSerializer(); +} + +class _$MixedPropertiesAndAdditionalPropertiesClassSerializer + implements + PrimitiveSerializer { + @override + final Iterable types = const [ + MixedPropertiesAndAdditionalPropertiesClass, + _$MixedPropertiesAndAdditionalPropertiesClass + ]; + + @override + final String wireName = r'MixedPropertiesAndAdditionalPropertiesClass'; + + Iterable _serializeProperties( + Serializers serializers, + MixedPropertiesAndAdditionalPropertiesClass object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.uuid != null) { + yield r'uuid'; + yield serializers.serialize( + object.uuid, + specifiedType: const FullType(String), + ); + } + if (object.dateTime != null) { + yield r'dateTime'; + yield serializers.serialize( + object.dateTime, + specifiedType: const FullType(DateTime), + ); + } + if (object.map != null) { + yield r'map'; + yield serializers.serialize( + object.map, + specifiedType: + const FullType(BuiltMap, [FullType(String), FullType(Animal)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + MixedPropertiesAndAdditionalPropertiesClass object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required MixedPropertiesAndAdditionalPropertiesClassBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'uuid': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.uuid = valueDes; + break; + case r'dateTime': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(DateTime), + ) as DateTime; + result.dateTime = valueDes; + break; + case r'map': + final valueDes = serializers.deserialize( + value, + specifiedType: + const FullType(BuiltMap, [FullType(String), FullType(Animal)]), + ) as BuiltMap; + result.map.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + MixedPropertiesAndAdditionalPropertiesClass deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = MixedPropertiesAndAdditionalPropertiesClassBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/model200_response.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/model200_response.dart new file mode 100644 index 000000000000..b9f7146fd0e8 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/model200_response.dart @@ -0,0 +1,131 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model200_response.g.dart'; + +/// Model for testing model name starting with number +/// +/// Properties: +/// * [name] +/// * [classField] +@BuiltValue() +abstract class Model200Response + implements Built { + @BuiltValueField(wireName: r'name') + int? get name; + + @BuiltValueField(wireName: r'class') + String? get classField; + + Model200Response._(); + + factory Model200Response([void updates(Model200ResponseBuilder b)]) = + _$Model200Response; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(Model200ResponseBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$Model200ResponseSerializer(); +} + +class _$Model200ResponseSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [Model200Response, _$Model200Response]; + + @override + final String wireName = r'Model200Response'; + + Iterable _serializeProperties( + Serializers serializers, + Model200Response object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(int), + ); + } + if (object.classField != null) { + yield r'class'; + yield serializers.serialize( + object.classField, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Model200Response object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required Model200ResponseBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.name = valueDes; + break; + case r'class': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.classField = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Model200Response deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = Model200ResponseBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/model_client.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/model_client.dart new file mode 100644 index 000000000000..63cba51c4be9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/model_client.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_client.g.dart'; + +/// ModelClient +/// +/// Properties: +/// * [client] +@BuiltValue() +abstract class ModelClient implements Built { + @BuiltValueField(wireName: r'client') + String? get client; + + ModelClient._(); + + factory ModelClient([void updates(ModelClientBuilder b)]) = _$ModelClient; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ModelClientBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelClientSerializer(); +} + +class _$ModelClientSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ModelClient, _$ModelClient]; + + @override + final String wireName = r'ModelClient'; + + Iterable _serializeProperties( + Serializers serializers, + ModelClient object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.client != null) { + yield r'client'; + yield serializers.serialize( + object.client, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ModelClient object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ModelClientBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'client': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.client = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ModelClient deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ModelClientBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/model_enum_class.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/model_enum_class.dart new file mode 100644 index 000000000000..02835bd779f5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/model_enum_class.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_enum_class.g.dart'; + +class ModelEnumClass extends EnumClass { + @BuiltValueEnumConst(wireName: r'_abc') + static const ModelEnumClass abc = _$abc; + @BuiltValueEnumConst(wireName: r'-efg') + static const ModelEnumClass efg = _$efg; + @BuiltValueEnumConst(wireName: r'(xyz)') + static const ModelEnumClass leftParenthesisXyzRightParenthesis = + _$leftParenthesisXyzRightParenthesis; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const ModelEnumClass unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + static Serializer get serializer => + _$modelEnumClassSerializer; + + const ModelEnumClass._(String name) : super(name); + + static BuiltSet get values => _$values; + static ModelEnumClass valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class ModelEnumClassMixin = Object with _$ModelEnumClassMixin; diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/model_file.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/model_file.dart new file mode 100644 index 000000000000..a74db4217b29 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/model_file.dart @@ -0,0 +1,110 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_file.g.dart'; + +/// Must be named `File` for test. +/// +/// Properties: +/// * [sourceURI] - Test capitalization +@BuiltValue() +abstract class ModelFile implements Built { + /// Test capitalization + @BuiltValueField(wireName: r'sourceURI') + String? get sourceURI; + + ModelFile._(); + + factory ModelFile([void updates(ModelFileBuilder b)]) = _$ModelFile; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ModelFileBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelFileSerializer(); +} + +class _$ModelFileSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ModelFile, _$ModelFile]; + + @override + final String wireName = r'ModelFile'; + + Iterable _serializeProperties( + Serializers serializers, + ModelFile object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.sourceURI != null) { + yield r'sourceURI'; + yield serializers.serialize( + object.sourceURI, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ModelFile object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ModelFileBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'sourceURI': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.sourceURI = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ModelFile deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ModelFileBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/model_list.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/model_list.dart new file mode 100644 index 000000000000..fbea6fe8232c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/model_list.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_list.g.dart'; + +/// ModelList +/// +/// Properties: +/// * [n123list] +@BuiltValue() +abstract class ModelList implements Built { + @BuiltValueField(wireName: r'123-list') + String? get n123list; + + ModelList._(); + + factory ModelList([void updates(ModelListBuilder b)]) = _$ModelList; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ModelListBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelListSerializer(); +} + +class _$ModelListSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ModelList, _$ModelList]; + + @override + final String wireName = r'ModelList'; + + Iterable _serializeProperties( + Serializers serializers, + ModelList object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.n123list != null) { + yield r'123-list'; + yield serializers.serialize( + object.n123list, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ModelList object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ModelListBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'123-list': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.n123list = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ModelList deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ModelListBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/model_return.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/model_return.dart new file mode 100644 index 000000000000..46770cac8e9e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/model_return.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_return.g.dart'; + +/// Model for testing reserved words +/// +/// Properties: +/// * [return_] +@BuiltValue() +abstract class ModelReturn implements Built { + @BuiltValueField(wireName: r'return') + int? get return_; + + ModelReturn._(); + + factory ModelReturn([void updates(ModelReturnBuilder b)]) = _$ModelReturn; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ModelReturnBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelReturnSerializer(); +} + +class _$ModelReturnSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ModelReturn, _$ModelReturn]; + + @override + final String wireName = r'ModelReturn'; + + Iterable _serializeProperties( + Serializers serializers, + ModelReturn object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.return_ != null) { + yield r'return'; + yield serializers.serialize( + object.return_, + specifiedType: const FullType(int), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ModelReturn object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ModelReturnBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'return': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.return_ = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ModelReturn deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ModelReturnBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/name.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/name.dart new file mode 100644 index 000000000000..12531dce5470 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/name.dart @@ -0,0 +1,161 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'name.g.dart'; + +/// Model for testing model name same as property name +/// +/// Properties: +/// * [name] +/// * [snakeCase] +/// * [property] +/// * [n123number] +@BuiltValue() +abstract class Name implements Built { + @BuiltValueField(wireName: r'name') + int get name; + + @BuiltValueField(wireName: r'snake_case') + int? get snakeCase; + + @BuiltValueField(wireName: r'property') + String? get property; + + @BuiltValueField(wireName: r'123Number') + int? get n123number; + + Name._(); + + factory Name([void updates(NameBuilder b)]) = _$Name; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(NameBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$NameSerializer(); +} + +class _$NameSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Name, _$Name]; + + @override + final String wireName = r'Name'; + + Iterable _serializeProperties( + Serializers serializers, + Name object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(int), + ); + if (object.snakeCase != null) { + yield r'snake_case'; + yield serializers.serialize( + object.snakeCase, + specifiedType: const FullType(int), + ); + } + if (object.property != null) { + yield r'property'; + yield serializers.serialize( + object.property, + specifiedType: const FullType(String), + ); + } + if (object.n123number != null) { + yield r'123Number'; + yield serializers.serialize( + object.n123number, + specifiedType: const FullType(int), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Name object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required NameBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.name = valueDes; + break; + case r'snake_case': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.snakeCase = valueDes; + break; + case r'property': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.property = valueDes; + break; + case r'123Number': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.n123number = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Name deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = NameBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/nullable_class.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/nullable_class.dart new file mode 100644 index 000000000000..ff124c21bf20 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/nullable_class.dart @@ -0,0 +1,335 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/date.dart'; +import 'package:built_value/json_object.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'nullable_class.g.dart'; + +/// NullableClass +/// +/// Properties: +/// * [integerProp] +/// * [numberProp] +/// * [booleanProp] +/// * [stringProp] +/// * [dateProp] +/// * [datetimeProp] +/// * [arrayNullableProp] +/// * [arrayAndItemsNullableProp] +/// * [arrayItemsNullable] +/// * [objectNullableProp] +/// * [objectAndItemsNullableProp] +/// * [objectItemsNullable] +@BuiltValue() +abstract class NullableClass + implements Built { + @BuiltValueField(wireName: r'integer_prop') + int? get integerProp; + + @BuiltValueField(wireName: r'number_prop') + num? get numberProp; + + @BuiltValueField(wireName: r'boolean_prop') + bool? get booleanProp; + + @BuiltValueField(wireName: r'string_prop') + String? get stringProp; + + @BuiltValueField(wireName: r'date_prop') + Date? get dateProp; + + @BuiltValueField(wireName: r'datetime_prop') + DateTime? get datetimeProp; + + @BuiltValueField(wireName: r'array_nullable_prop') + BuiltList? get arrayNullableProp; + + @BuiltValueField(wireName: r'array_and_items_nullable_prop') + BuiltList? get arrayAndItemsNullableProp; + + @BuiltValueField(wireName: r'array_items_nullable') + BuiltList? get arrayItemsNullable; + + @BuiltValueField(wireName: r'object_nullable_prop') + BuiltMap? get objectNullableProp; + + @BuiltValueField(wireName: r'object_and_items_nullable_prop') + BuiltMap? get objectAndItemsNullableProp; + + @BuiltValueField(wireName: r'object_items_nullable') + BuiltMap? get objectItemsNullable; + + NullableClass._(); + + factory NullableClass([void updates(NullableClassBuilder b)]) = + _$NullableClass; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(NullableClassBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$NullableClassSerializer(); +} + +class _$NullableClassSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [NullableClass, _$NullableClass]; + + @override + final String wireName = r'NullableClass'; + + Iterable _serializeProperties( + Serializers serializers, + NullableClass object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.integerProp != null) { + yield r'integer_prop'; + yield serializers.serialize( + object.integerProp, + specifiedType: const FullType.nullable(int), + ); + } + if (object.numberProp != null) { + yield r'number_prop'; + yield serializers.serialize( + object.numberProp, + specifiedType: const FullType.nullable(num), + ); + } + if (object.booleanProp != null) { + yield r'boolean_prop'; + yield serializers.serialize( + object.booleanProp, + specifiedType: const FullType.nullable(bool), + ); + } + if (object.stringProp != null) { + yield r'string_prop'; + yield serializers.serialize( + object.stringProp, + specifiedType: const FullType.nullable(String), + ); + } + if (object.dateProp != null) { + yield r'date_prop'; + yield serializers.serialize( + object.dateProp, + specifiedType: const FullType.nullable(Date), + ); + } + if (object.datetimeProp != null) { + yield r'datetime_prop'; + yield serializers.serialize( + object.datetimeProp, + specifiedType: const FullType.nullable(DateTime), + ); + } + if (object.arrayNullableProp != null) { + yield r'array_nullable_prop'; + yield serializers.serialize( + object.arrayNullableProp, + specifiedType: + const FullType.nullable(BuiltList, [FullType(JsonObject)]), + ); + } + if (object.arrayAndItemsNullableProp != null) { + yield r'array_and_items_nullable_prop'; + yield serializers.serialize( + object.arrayAndItemsNullableProp, + specifiedType: + const FullType.nullable(BuiltList, [FullType.nullable(JsonObject)]), + ); + } + if (object.arrayItemsNullable != null) { + yield r'array_items_nullable'; + yield serializers.serialize( + object.arrayItemsNullable, + specifiedType: + const FullType(BuiltList, [FullType.nullable(JsonObject)]), + ); + } + if (object.objectNullableProp != null) { + yield r'object_nullable_prop'; + yield serializers.serialize( + object.objectNullableProp, + specifiedType: const FullType.nullable( + BuiltMap, [FullType(String), FullType(JsonObject)]), + ); + } + if (object.objectAndItemsNullableProp != null) { + yield r'object_and_items_nullable_prop'; + yield serializers.serialize( + object.objectAndItemsNullableProp, + specifiedType: const FullType.nullable( + BuiltMap, [FullType(String), FullType.nullable(JsonObject)]), + ); + } + if (object.objectItemsNullable != null) { + yield r'object_items_nullable'; + yield serializers.serialize( + object.objectItemsNullable, + specifiedType: const FullType( + BuiltMap, [FullType(String), FullType.nullable(JsonObject)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + NullableClass object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required NullableClassBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'integer_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(int), + ) as int?; + if (valueDes == null) continue; + result.integerProp = valueDes; + break; + case r'number_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(num), + ) as num?; + if (valueDes == null) continue; + result.numberProp = valueDes; + break; + case r'boolean_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(bool), + ) as bool?; + if (valueDes == null) continue; + result.booleanProp = valueDes; + break; + case r'string_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(String), + ) as String?; + if (valueDes == null) continue; + result.stringProp = valueDes; + break; + case r'date_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(Date), + ) as Date?; + if (valueDes == null) continue; + result.dateProp = valueDes; + break; + case r'datetime_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(DateTime), + ) as DateTime?; + if (valueDes == null) continue; + result.datetimeProp = valueDes; + break; + case r'array_nullable_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: + const FullType.nullable(BuiltList, [FullType(JsonObject)]), + ) as BuiltList?; + if (valueDes == null) continue; + result.arrayNullableProp.replace(valueDes); + break; + case r'array_and_items_nullable_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable( + BuiltList, [FullType.nullable(JsonObject)]), + ) as BuiltList?; + if (valueDes == null) continue; + result.arrayAndItemsNullableProp.replace(valueDes); + break; + case r'array_items_nullable': + final valueDes = serializers.deserialize( + value, + specifiedType: + const FullType(BuiltList, [FullType.nullable(JsonObject)]), + ) as BuiltList; + result.arrayItemsNullable.replace(valueDes); + break; + case r'object_nullable_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable( + BuiltMap, [FullType(String), FullType(JsonObject)]), + ) as BuiltMap?; + if (valueDes == null) continue; + result.objectNullableProp.replace(valueDes); + break; + case r'object_and_items_nullable_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable( + BuiltMap, [FullType(String), FullType.nullable(JsonObject)]), + ) as BuiltMap?; + if (valueDes == null) continue; + result.objectAndItemsNullableProp.replace(valueDes); + break; + case r'object_items_nullable': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType( + BuiltMap, [FullType(String), FullType.nullable(JsonObject)]), + ) as BuiltMap; + result.objectItemsNullable.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + NullableClass deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = NullableClassBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/number_only.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/number_only.dart new file mode 100644 index 000000000000..bc854c85003b --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/number_only.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'number_only.g.dart'; + +/// NumberOnly +/// +/// Properties: +/// * [justNumber] +@BuiltValue() +abstract class NumberOnly implements Built { + @BuiltValueField(wireName: r'JustNumber') + num? get justNumber; + + NumberOnly._(); + + factory NumberOnly([void updates(NumberOnlyBuilder b)]) = _$NumberOnly; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(NumberOnlyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$NumberOnlySerializer(); +} + +class _$NumberOnlySerializer implements PrimitiveSerializer { + @override + final Iterable types = const [NumberOnly, _$NumberOnly]; + + @override + final String wireName = r'NumberOnly'; + + Iterable _serializeProperties( + Serializers serializers, + NumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.justNumber != null) { + yield r'JustNumber'; + yield serializers.serialize( + object.justNumber, + specifiedType: const FullType(num), + ); + } + } + + @override + Object serialize( + Serializers serializers, + NumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required NumberOnlyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'JustNumber': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.justNumber = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + NumberOnly deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = NumberOnlyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/object_with_deprecated_fields.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/object_with_deprecated_fields.dart new file mode 100644 index 000000000000..de8620fcf22a --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/object_with_deprecated_fields.dart @@ -0,0 +1,175 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/deprecated_object.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'object_with_deprecated_fields.g.dart'; + +/// ObjectWithDeprecatedFields +/// +/// Properties: +/// * [uuid] +/// * [id] +/// * [deprecatedRef] +/// * [bars] +@BuiltValue() +abstract class ObjectWithDeprecatedFields + implements + Built { + @BuiltValueField(wireName: r'uuid') + String? get uuid; + + @BuiltValueField(wireName: r'id') + num? get id; + + @BuiltValueField(wireName: r'deprecatedRef') + DeprecatedObject? get deprecatedRef; + + @BuiltValueField(wireName: r'bars') + BuiltList? get bars; + + ObjectWithDeprecatedFields._(); + + factory ObjectWithDeprecatedFields( + [void updates(ObjectWithDeprecatedFieldsBuilder b)]) = + _$ObjectWithDeprecatedFields; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ObjectWithDeprecatedFieldsBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$ObjectWithDeprecatedFieldsSerializer(); +} + +class _$ObjectWithDeprecatedFieldsSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [ + ObjectWithDeprecatedFields, + _$ObjectWithDeprecatedFields + ]; + + @override + final String wireName = r'ObjectWithDeprecatedFields'; + + Iterable _serializeProperties( + Serializers serializers, + ObjectWithDeprecatedFields object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.uuid != null) { + yield r'uuid'; + yield serializers.serialize( + object.uuid, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(num), + ); + } + if (object.deprecatedRef != null) { + yield r'deprecatedRef'; + yield serializers.serialize( + object.deprecatedRef, + specifiedType: const FullType(DeprecatedObject), + ); + } + if (object.bars != null) { + yield r'bars'; + yield serializers.serialize( + object.bars, + specifiedType: const FullType(BuiltList, [FullType(Bar)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ObjectWithDeprecatedFields object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ObjectWithDeprecatedFieldsBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'uuid': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.uuid = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.id = valueDes; + break; + case r'deprecatedRef': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(DeprecatedObject), + ) as DeprecatedObject; + result.deprecatedRef.replace(valueDes); + break; + case r'bars': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(Bar)]), + ) as BuiltList; + result.bars.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ObjectWithDeprecatedFields deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ObjectWithDeprecatedFieldsBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/order.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/order.dart new file mode 100644 index 000000000000..35b18409ec52 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/order.dart @@ -0,0 +1,229 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'order.g.dart'; + +/// Order +/// +/// Properties: +/// * [id] +/// * [petId] +/// * [quantity] +/// * [shipDate] +/// * [status] - Order Status +/// * [complete] +@BuiltValue() +abstract class Order implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'petId') + int? get petId; + + @BuiltValueField(wireName: r'quantity') + int? get quantity; + + @BuiltValueField(wireName: r'shipDate') + DateTime? get shipDate; + + /// Order Status + @BuiltValueField(wireName: r'status') + OrderStatusEnum? get status; + // enum statusEnum { placed, approved, delivered, }; + + @BuiltValueField(wireName: r'complete') + bool? get complete; + + Order._(); + + factory Order([void updates(OrderBuilder b)]) = _$Order; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(OrderBuilder b) => b..complete = false; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$OrderSerializer(); +} + +class _$OrderSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Order, _$Order]; + + @override + final String wireName = r'Order'; + + Iterable _serializeProperties( + Serializers serializers, + Order object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + if (object.petId != null) { + yield r'petId'; + yield serializers.serialize( + object.petId, + specifiedType: const FullType(int), + ); + } + if (object.quantity != null) { + yield r'quantity'; + yield serializers.serialize( + object.quantity, + specifiedType: const FullType(int), + ); + } + if (object.shipDate != null) { + yield r'shipDate'; + yield serializers.serialize( + object.shipDate, + specifiedType: const FullType(DateTime), + ); + } + if (object.status != null) { + yield r'status'; + yield serializers.serialize( + object.status, + specifiedType: const FullType(OrderStatusEnum), + ); + } + if (object.complete != null) { + yield r'complete'; + yield serializers.serialize( + object.complete, + specifiedType: const FullType(bool), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Order object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required OrderBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'petId': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.petId = valueDes; + break; + case r'quantity': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.quantity = valueDes; + break; + case r'shipDate': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(DateTime), + ) as DateTime; + result.shipDate = valueDes; + break; + case r'status': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OrderStatusEnum), + ) as OrderStatusEnum; + result.status = valueDes; + break; + case r'complete': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) as bool; + result.complete = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Order deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = OrderBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + +class OrderStatusEnum extends EnumClass { + /// Order Status + @BuiltValueEnumConst(wireName: r'placed') + static const OrderStatusEnum placed = _$orderStatusEnum_placed; + + /// Order Status + @BuiltValueEnumConst(wireName: r'approved') + static const OrderStatusEnum approved = _$orderStatusEnum_approved; + + /// Order Status + @BuiltValueEnumConst(wireName: r'delivered') + static const OrderStatusEnum delivered = _$orderStatusEnum_delivered; + + /// Order Status + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const OrderStatusEnum unknownDefaultOpenApi = + _$orderStatusEnum_unknownDefaultOpenApi; + + static Serializer get serializer => + _$orderStatusEnumSerializer; + + const OrderStatusEnum._(String name) : super(name); + + static BuiltSet get values => _$orderStatusEnumValues; + static OrderStatusEnum valueOf(String name) => _$orderStatusEnumValueOf(name); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/outer_composite.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/outer_composite.dart new file mode 100644 index 000000000000..899262513eb7 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/outer_composite.dart @@ -0,0 +1,149 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_composite.g.dart'; + +/// OuterComposite +/// +/// Properties: +/// * [myNumber] +/// * [myString] +/// * [myBoolean] +@BuiltValue() +abstract class OuterComposite + implements Built { + @BuiltValueField(wireName: r'my_number') + num? get myNumber; + + @BuiltValueField(wireName: r'my_string') + String? get myString; + + @BuiltValueField(wireName: r'my_boolean') + bool? get myBoolean; + + OuterComposite._(); + + factory OuterComposite([void updates(OuterCompositeBuilder b)]) = + _$OuterComposite; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(OuterCompositeBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$OuterCompositeSerializer(); +} + +class _$OuterCompositeSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [OuterComposite, _$OuterComposite]; + + @override + final String wireName = r'OuterComposite'; + + Iterable _serializeProperties( + Serializers serializers, + OuterComposite object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.myNumber != null) { + yield r'my_number'; + yield serializers.serialize( + object.myNumber, + specifiedType: const FullType(num), + ); + } + if (object.myString != null) { + yield r'my_string'; + yield serializers.serialize( + object.myString, + specifiedType: const FullType(String), + ); + } + if (object.myBoolean != null) { + yield r'my_boolean'; + yield serializers.serialize( + object.myBoolean, + specifiedType: const FullType(bool), + ); + } + } + + @override + Object serialize( + Serializers serializers, + OuterComposite object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required OuterCompositeBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'my_number': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.myNumber = valueDes; + break; + case r'my_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.myString = valueDes; + break; + case r'my_boolean': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) as bool; + result.myBoolean = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + OuterComposite deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = OuterCompositeBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/outer_enum.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/outer_enum.dart new file mode 100644 index 000000000000..bf08d4aa048d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/outer_enum.dart @@ -0,0 +1,36 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_enum.g.dart'; + +class OuterEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'placed') + static const OuterEnum placed = _$placed; + @BuiltValueEnumConst(wireName: r'approved') + static const OuterEnum approved = _$approved; + @BuiltValueEnumConst(wireName: r'delivered') + static const OuterEnum delivered = _$delivered; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const OuterEnum unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + static Serializer get serializer => _$outerEnumSerializer; + + const OuterEnum._(String name) : super(name); + + static BuiltSet get values => _$values; + static OuterEnum valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class OuterEnumMixin = Object with _$OuterEnumMixin; diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/outer_enum_default_value.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/outer_enum_default_value.dart new file mode 100644 index 000000000000..446e5c2fed2d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/outer_enum_default_value.dart @@ -0,0 +1,39 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_enum_default_value.g.dart'; + +class OuterEnumDefaultValue extends EnumClass { + @BuiltValueEnumConst(wireName: r'placed') + static const OuterEnumDefaultValue placed = _$placed; + @BuiltValueEnumConst(wireName: r'approved') + static const OuterEnumDefaultValue approved = _$approved; + @BuiltValueEnumConst(wireName: r'delivered') + static const OuterEnumDefaultValue delivered = _$delivered; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const OuterEnumDefaultValue unknownDefaultOpenApi = + _$unknownDefaultOpenApi; + + static Serializer get serializer => + _$outerEnumDefaultValueSerializer; + + const OuterEnumDefaultValue._(String name) : super(name); + + static BuiltSet get values => _$values; + static OuterEnumDefaultValue valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class OuterEnumDefaultValueMixin = Object + with _$OuterEnumDefaultValueMixin; diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/outer_enum_integer.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/outer_enum_integer.dart new file mode 100644 index 000000000000..d42a7baf5dbd --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/outer_enum_integer.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_enum_integer.g.dart'; + +class OuterEnumInteger extends EnumClass { + @BuiltValueEnumConst(wireNumber: 0) + static const OuterEnumInteger number0 = _$number0; + @BuiltValueEnumConst(wireNumber: 1) + static const OuterEnumInteger number1 = _$number1; + @BuiltValueEnumConst(wireNumber: 2) + static const OuterEnumInteger number2 = _$number2; + @BuiltValueEnumConst(wireNumber: 11184809, fallback: true) + static const OuterEnumInteger unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + static Serializer get serializer => + _$outerEnumIntegerSerializer; + + const OuterEnumInteger._(String name) : super(name); + + static BuiltSet get values => _$values; + static OuterEnumInteger valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class OuterEnumIntegerMixin = Object with _$OuterEnumIntegerMixin; diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/outer_enum_integer_default_value.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/outer_enum_integer_default_value.dart new file mode 100644 index 000000000000..33b46287a86b --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/outer_enum_integer_default_value.dart @@ -0,0 +1,39 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_enum_integer_default_value.g.dart'; + +class OuterEnumIntegerDefaultValue extends EnumClass { + @BuiltValueEnumConst(wireNumber: 0) + static const OuterEnumIntegerDefaultValue number0 = _$number0; + @BuiltValueEnumConst(wireNumber: 1) + static const OuterEnumIntegerDefaultValue number1 = _$number1; + @BuiltValueEnumConst(wireNumber: 2) + static const OuterEnumIntegerDefaultValue number2 = _$number2; + @BuiltValueEnumConst(wireNumber: 11184809, fallback: true) + static const OuterEnumIntegerDefaultValue unknownDefaultOpenApi = + _$unknownDefaultOpenApi; + + static Serializer get serializer => + _$outerEnumIntegerDefaultValueSerializer; + + const OuterEnumIntegerDefaultValue._(String name) : super(name); + + static BuiltSet get values => _$values; + static OuterEnumIntegerDefaultValue valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class OuterEnumIntegerDefaultValueMixin = Object + with _$OuterEnumIntegerDefaultValueMixin; diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/outer_object_with_enum_property.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/outer_object_with_enum_property.dart new file mode 100644 index 000000000000..43dddcba352f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/outer_object_with_enum_property.dart @@ -0,0 +1,118 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/outer_enum_integer.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_object_with_enum_property.g.dart'; + +/// OuterObjectWithEnumProperty +/// +/// Properties: +/// * [value] +@BuiltValue() +abstract class OuterObjectWithEnumProperty + implements + Built { + @BuiltValueField(wireName: r'value') + OuterEnumInteger get value; + // enum valueEnum { 0, 1, 2, }; + + OuterObjectWithEnumProperty._(); + + factory OuterObjectWithEnumProperty( + [void updates(OuterObjectWithEnumPropertyBuilder b)]) = + _$OuterObjectWithEnumProperty; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(OuterObjectWithEnumPropertyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$OuterObjectWithEnumPropertySerializer(); +} + +class _$OuterObjectWithEnumPropertySerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [ + OuterObjectWithEnumProperty, + _$OuterObjectWithEnumProperty + ]; + + @override + final String wireName = r'OuterObjectWithEnumProperty'; + + Iterable _serializeProperties( + Serializers serializers, + OuterObjectWithEnumProperty object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'value'; + yield serializers.serialize( + object.value, + specifiedType: const FullType(OuterEnumInteger), + ); + } + + @override + Object serialize( + Serializers serializers, + OuterObjectWithEnumProperty object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required OuterObjectWithEnumPropertyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'value': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OuterEnumInteger), + ) as OuterEnumInteger; + result.value = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + OuterObjectWithEnumProperty deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = OuterObjectWithEnumPropertyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/pasta.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/pasta.dart similarity index 98% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/pasta.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/pasta.dart index e8b1ebdf31ea..c0aab58124de 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/pasta.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/pasta.dart @@ -12,7 +12,7 @@ part 'pasta.g.dart'; /// Pasta /// /// Properties: -/// * [vendor] +/// * [vendor] /// * [href] - Hyperlink reference /// * [id] - unique identifier /// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships @@ -28,7 +28,7 @@ abstract class Pasta implements Entity, Built { factory Pasta([void updates(PastaBuilder b)]) = _$Pasta; @BuiltValueHook(initializeBuilder: true) - static void _defaults(PastaBuilder b) => b..atType=b.discriminatorValue; + static void _defaults(PastaBuilder b) => b..atType = b.discriminatorValue; @BuiltValueSerializer(custom: true) static Serializer get serializer => _$PastaSerializer(); @@ -179,4 +179,3 @@ class _$PastaSerializer implements PrimitiveSerializer { return result.build(); } } - diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/pet.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/pet.dart new file mode 100644 index 000000000000..6c377470f4a6 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/pet.dart @@ -0,0 +1,226 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/category.dart'; +import 'package:openapi/src/model/tag.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'pet.g.dart'; + +/// Pet +/// +/// Properties: +/// * [id] +/// * [name] +/// * [category] +/// * [photoUrls] +/// * [tags] +/// * [status] - pet status in the store +@BuiltValue() +abstract class Pet implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'name') + String get name; + + @BuiltValueField(wireName: r'category') + Category? get category; + + @BuiltValueField(wireName: r'photoUrls') + BuiltList get photoUrls; + + @BuiltValueField(wireName: r'tags') + BuiltList? get tags; + + /// pet status in the store + @BuiltValueField(wireName: r'status') + PetStatusEnum? get status; + // enum statusEnum { available, pending, sold, }; + + Pet._(); + + factory Pet([void updates(PetBuilder b)]) = _$Pet; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(PetBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$PetSerializer(); +} + +class _$PetSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Pet, _$Pet]; + + @override + final String wireName = r'Pet'; + + Iterable _serializeProperties( + Serializers serializers, + Pet object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + if (object.category != null) { + yield r'category'; + yield serializers.serialize( + object.category, + specifiedType: const FullType(Category), + ); + } + yield r'photoUrls'; + yield serializers.serialize( + object.photoUrls, + specifiedType: const FullType(BuiltList, [FullType(String)]), + ); + if (object.tags != null) { + yield r'tags'; + yield serializers.serialize( + object.tags, + specifiedType: const FullType(BuiltList, [FullType(Tag)]), + ); + } + if (object.status != null) { + yield r'status'; + yield serializers.serialize( + object.status, + specifiedType: const FullType(PetStatusEnum), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Pet object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required PetBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + case r'category': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(Category), + ) as Category; + result.category.replace(valueDes); + break; + case r'photoUrls': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(String)]), + ) as BuiltList; + result.photoUrls.replace(valueDes); + break; + case r'tags': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(Tag)]), + ) as BuiltList; + result.tags.replace(valueDes); + break; + case r'status': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(PetStatusEnum), + ) as PetStatusEnum; + result.status = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Pet deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = PetBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + +class PetStatusEnum extends EnumClass { + /// pet status in the store + @BuiltValueEnumConst(wireName: r'available') + static const PetStatusEnum available = _$petStatusEnum_available; + + /// pet status in the store + @BuiltValueEnumConst(wireName: r'pending') + static const PetStatusEnum pending = _$petStatusEnum_pending; + + /// pet status in the store + @BuiltValueEnumConst(wireName: r'sold') + static const PetStatusEnum sold = _$petStatusEnum_sold; + + /// pet status in the store + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const PetStatusEnum unknownDefaultOpenApi = + _$petStatusEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$petStatusEnumSerializer; + + const PetStatusEnum._(String name) : super(name); + + static BuiltSet get values => _$petStatusEnumValues; + static PetStatusEnum valueOf(String name) => _$petStatusEnumValueOf(name); +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/pizza.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/pizza.dart similarity index 95% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/pizza.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/pizza.dart index 14c06db06d7e..f23ae49eac7e 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/pizza.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/pizza.dart @@ -13,7 +13,7 @@ part 'pizza.g.dart'; /// Pizza /// /// Properties: -/// * [pizzaSize] +/// * [pizzaSize] /// * [href] - Hyperlink reference /// * [id] - unique identifier /// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships @@ -35,20 +35,21 @@ abstract class Pizza implements Entity { } extension PizzaDiscriminatorExt on Pizza { - String? get discriminatorValue { - if (this is PizzaSpeziale) { - return r'PizzaSpeziale'; - } - return null; + String? get discriminatorValue { + if (this is PizzaSpeziale) { + return r'PizzaSpeziale'; } + return null; + } } + extension PizzaBuilderDiscriminatorExt on PizzaBuilder { - String? get discriminatorValue { - if (this is PizzaSpezialeBuilder) { - return r'PizzaSpeziale'; - } - return null; + String? get discriminatorValue { + if (this is PizzaSpezialeBuilder) { + return r'PizzaSpeziale'; } + return null; + } } class _$PizzaSerializer implements PrimitiveSerializer { @@ -247,4 +248,3 @@ class _$$PizzaSerializer implements PrimitiveSerializer<$Pizza> { return result.build(); } } - diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/pizza_speziale.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/pizza_speziale.dart similarity index 98% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/pizza_speziale.dart rename to samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/pizza_speziale.dart index 673052cc8fcf..587bdba55146 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/pizza_speziale.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/pizza_speziale.dart @@ -12,7 +12,7 @@ part 'pizza_speziale.g.dart'; /// PizzaSpeziale /// /// Properties: -/// * [toppings] +/// * [toppings] /// * [href] - Hyperlink reference /// * [id] - unique identifier /// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships @@ -28,7 +28,7 @@ abstract class PizzaSpeziale implements Pizza, Built b..atType=b.discriminatorValue; + static void _defaults(PizzaSpezialeBuilder b) => b..atType = b.discriminatorValue; @BuiltValueSerializer(custom: true) static Serializer get serializer => _$PizzaSpezialeSerializer(); @@ -193,4 +193,3 @@ class _$PizzaSpezialeSerializer implements PrimitiveSerializer { return result.build(); } } - diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/read_only_first.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/read_only_first.dart new file mode 100644 index 000000000000..b2501901295f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/read_only_first.dart @@ -0,0 +1,130 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'read_only_first.g.dart'; + +/// ReadOnlyFirst +/// +/// Properties: +/// * [bar] +/// * [baz] +@BuiltValue() +abstract class ReadOnlyFirst + implements Built { + @BuiltValueField(wireName: r'bar') + String? get bar; + + @BuiltValueField(wireName: r'baz') + String? get baz; + + ReadOnlyFirst._(); + + factory ReadOnlyFirst([void updates(ReadOnlyFirstBuilder b)]) = + _$ReadOnlyFirst; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ReadOnlyFirstBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$ReadOnlyFirstSerializer(); +} + +class _$ReadOnlyFirstSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ReadOnlyFirst, _$ReadOnlyFirst]; + + @override + final String wireName = r'ReadOnlyFirst'; + + Iterable _serializeProperties( + Serializers serializers, + ReadOnlyFirst object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.bar != null) { + yield r'bar'; + yield serializers.serialize( + object.bar, + specifiedType: const FullType(String), + ); + } + if (object.baz != null) { + yield r'baz'; + yield serializers.serialize( + object.baz, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ReadOnlyFirst object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ReadOnlyFirstBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'bar': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.bar = valueDes; + break; + case r'baz': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.baz = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ReadOnlyFirst deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ReadOnlyFirstBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/single_ref_type.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/single_ref_type.dart new file mode 100644 index 000000000000..5324d92a7831 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/single_ref_type.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'single_ref_type.g.dart'; + +class SingleRefType extends EnumClass { + @BuiltValueEnumConst(wireName: r'admin') + static const SingleRefType admin = _$admin; + @BuiltValueEnumConst(wireName: r'user') + static const SingleRefType user = _$user; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const SingleRefType unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + static Serializer get serializer => _$singleRefTypeSerializer; + + const SingleRefType._(String name) : super(name); + + static BuiltSet get values => _$values; + static SingleRefType valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class SingleRefTypeMixin = Object with _$SingleRefTypeMixin; diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/special_model_name.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/special_model_name.dart new file mode 100644 index 000000000000..c5a18443b89f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/special_model_name.dart @@ -0,0 +1,117 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'special_model_name.g.dart'; + +/// SpecialModelName +/// +/// Properties: +/// * [dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket] +@BuiltValue() +abstract class SpecialModelName + implements Built { + @BuiltValueField(wireName: r'$special[property.name]') + int? get dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + + SpecialModelName._(); + + factory SpecialModelName([void updates(SpecialModelNameBuilder b)]) = + _$SpecialModelName; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(SpecialModelNameBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$SpecialModelNameSerializer(); +} + +class _$SpecialModelNameSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [SpecialModelName, _$SpecialModelName]; + + @override + final String wireName = r'SpecialModelName'; + + Iterable _serializeProperties( + Serializers serializers, + SpecialModelName object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object + .dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket != + null) { + yield r'$special[property.name]'; + yield serializers.serialize( + object + .dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket, + specifiedType: const FullType(int), + ); + } + } + + @override + Object serialize( + Serializers serializers, + SpecialModelName object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required SpecialModelNameBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'$special[property.name]': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket = + valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + SpecialModelName deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = SpecialModelNameBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/tag.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/tag.dart new file mode 100644 index 000000000000..87f6428e39c2 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/tag.dart @@ -0,0 +1,127 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'tag.g.dart'; + +/// Tag +/// +/// Properties: +/// * [id] +/// * [name] +@BuiltValue() +abstract class Tag implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'name') + String? get name; + + Tag._(); + + factory Tag([void updates(TagBuilder b)]) = _$Tag; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(TagBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$TagSerializer(); +} + +class _$TagSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Tag, _$Tag]; + + @override + final String wireName = r'Tag'; + + Iterable _serializeProperties( + Serializers serializers, + Tag object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Tag object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required TagBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Tag deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = TagBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart new file mode 100644 index 000000000000..43cf4b6c0d3f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart @@ -0,0 +1,132 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'test_query_style_form_explode_true_array_string_query_object_parameter.g.dart'; + +/// TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter +/// +/// Properties: +/// * [values] +@BuiltValue() +abstract class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + implements + Built { + @BuiltValueField(wireName: r'values') + BuiltList? get values; + + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter._(); + + factory TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter( + [void updates( + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterBuilder + b)]) = + _$TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults( + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterBuilder + b) => + b; + + @BuiltValueSerializer(custom: true) + static Serializer< + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter> + get serializer => + _$TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterSerializer(); +} + +class _$TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterSerializer + implements + PrimitiveSerializer< + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter> { + @override + final Iterable types = const [ + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, + _$TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + ]; + + @override + final String wireName = + r'TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter'; + + Iterable _serializeProperties( + Serializers serializers, + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.values != null) { + yield r'values'; + yield serializers.serialize( + object.values, + specifiedType: const FullType(BuiltList, [FullType(String)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterBuilder + result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'values': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(String)]), + ) as BuiltList; + result.values.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/user.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/user.dart new file mode 100644 index 000000000000..5d10005382ff --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/model/user.dart @@ -0,0 +1,236 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'user.g.dart'; + +/// User +/// +/// Properties: +/// * [id] +/// * [username] +/// * [firstName] +/// * [lastName] +/// * [email] +/// * [password] +/// * [phone] +/// * [userStatus] - User Status +@BuiltValue() +abstract class User implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'username') + String? get username; + + @BuiltValueField(wireName: r'firstName') + String? get firstName; + + @BuiltValueField(wireName: r'lastName') + String? get lastName; + + @BuiltValueField(wireName: r'email') + String? get email; + + @BuiltValueField(wireName: r'password') + String? get password; + + @BuiltValueField(wireName: r'phone') + String? get phone; + + /// User Status + @BuiltValueField(wireName: r'userStatus') + int? get userStatus; + + User._(); + + factory User([void updates(UserBuilder b)]) = _$User; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(UserBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$UserSerializer(); +} + +class _$UserSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [User, _$User]; + + @override + final String wireName = r'User'; + + Iterable _serializeProperties( + Serializers serializers, + User object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + if (object.username != null) { + yield r'username'; + yield serializers.serialize( + object.username, + specifiedType: const FullType(String), + ); + } + if (object.firstName != null) { + yield r'firstName'; + yield serializers.serialize( + object.firstName, + specifiedType: const FullType(String), + ); + } + if (object.lastName != null) { + yield r'lastName'; + yield serializers.serialize( + object.lastName, + specifiedType: const FullType(String), + ); + } + if (object.email != null) { + yield r'email'; + yield serializers.serialize( + object.email, + specifiedType: const FullType(String), + ); + } + if (object.password != null) { + yield r'password'; + yield serializers.serialize( + object.password, + specifiedType: const FullType(String), + ); + } + if (object.phone != null) { + yield r'phone'; + yield serializers.serialize( + object.phone, + specifiedType: const FullType(String), + ); + } + if (object.userStatus != null) { + yield r'userStatus'; + yield serializers.serialize( + object.userStatus, + specifiedType: const FullType(int), + ); + } + } + + @override + Object serialize( + Serializers serializers, + User object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required UserBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'username': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.username = valueDes; + break; + case r'firstName': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.firstName = valueDes; + break; + case r'lastName': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.lastName = valueDes; + break; + case r'email': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.email = valueDes; + break; + case r'password': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.password = valueDes; + break; + case r'phone': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.phone = valueDes; + break; + case r'userStatus': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.userStatus = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + User deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = UserBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/lib/src/serializers.dart b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/serializers.dart new file mode 100644 index 000000000000..76baea9bd50a --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/lib/src/serializers.dart @@ -0,0 +1,184 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_import + +import 'package:one_of_serializer/any_of_serializer.dart'; +import 'package:one_of_serializer/one_of_serializer.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/json_object.dart'; +import 'package:built_value/serializer.dart'; +import 'package:built_value/standard_json_plugin.dart'; +import 'package:built_value/iso_8601_date_time_serializer.dart'; +import 'package:openapi/src/date_serializer.dart'; +import 'package:openapi/src/model/date.dart'; + +import 'package:openapi/src/model/additional_properties_class.dart'; +import 'package:openapi/src/model/addressable.dart'; +import 'package:openapi/src/model/all_of_with_single_ref.dart'; +import 'package:openapi/src/model/animal.dart'; +import 'package:openapi/src/model/api_response.dart'; +import 'package:openapi/src/model/apple.dart'; +import 'package:openapi/src/model/array_of_array_of_number_only.dart'; +import 'package:openapi/src/model/array_of_number_only.dart'; +import 'package:openapi/src/model/array_test.dart'; +import 'package:openapi/src/model/banana.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:openapi/src/model/bar_create.dart'; +import 'package:openapi/src/model/bar_ref.dart'; +import 'package:openapi/src/model/bar_ref_or_value.dart'; +import 'package:openapi/src/model/capitalization.dart'; +import 'package:openapi/src/model/cat.dart'; +import 'package:openapi/src/model/cat_all_of.dart'; +import 'package:openapi/src/model/category.dart'; +import 'package:openapi/src/model/child.dart'; +import 'package:openapi/src/model/class_model.dart'; +import 'package:openapi/src/model/deprecated_object.dart'; +import 'package:openapi/src/model/dog.dart'; +import 'package:openapi/src/model/dog_all_of.dart'; +import 'package:openapi/src/model/entity.dart'; +import 'package:openapi/src/model/entity_ref.dart'; +import 'package:openapi/src/model/enum_arrays.dart'; +import 'package:openapi/src/model/enum_test.dart'; +import 'package:openapi/src/model/example.dart'; +import 'package:openapi/src/model/example_non_primitive.dart'; +import 'package:openapi/src/model/extensible.dart'; +import 'package:openapi/src/model/file_schema_test_class.dart'; +import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/foo_ref.dart'; +import 'package:openapi/src/model/foo_ref_or_value.dart'; +import 'package:openapi/src/model/format_test.dart'; +import 'package:openapi/src/model/fruit.dart'; +import 'package:openapi/src/model/has_only_read_only.dart'; +import 'package:openapi/src/model/health_check_result.dart'; +import 'package:openapi/src/model/map_test.dart'; +import 'package:openapi/src/model/mixed_properties_and_additional_properties_class.dart'; +import 'package:openapi/src/model/model200_response.dart'; +import 'package:openapi/src/model/model_client.dart'; +import 'package:openapi/src/model/model_enum_class.dart'; +import 'package:openapi/src/model/model_file.dart'; +import 'package:openapi/src/model/model_list.dart'; +import 'package:openapi/src/model/model_return.dart'; +import 'package:openapi/src/model/name.dart'; +import 'package:openapi/src/model/nullable_class.dart'; +import 'package:openapi/src/model/number_only.dart'; +import 'package:openapi/src/model/object_with_deprecated_fields.dart'; +import 'package:openapi/src/model/order.dart'; +import 'package:openapi/src/model/outer_composite.dart'; +import 'package:openapi/src/model/outer_enum.dart'; +import 'package:openapi/src/model/outer_enum_default_value.dart'; +import 'package:openapi/src/model/outer_enum_integer.dart'; +import 'package:openapi/src/model/outer_enum_integer_default_value.dart'; +import 'package:openapi/src/model/outer_object_with_enum_property.dart'; +import 'package:openapi/src/model/pasta.dart'; +import 'package:openapi/src/model/pet.dart'; +import 'package:openapi/src/model/pizza.dart'; +import 'package:openapi/src/model/pizza_speziale.dart'; +import 'package:openapi/src/model/read_only_first.dart'; +import 'package:openapi/src/model/single_ref_type.dart'; +import 'package:openapi/src/model/special_model_name.dart'; +import 'package:openapi/src/model/tag.dart'; +import 'package:openapi/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart'; +import 'package:openapi/src/model/user.dart'; + +part 'serializers.g.dart'; + +@SerializersFor([ + AdditionalPropertiesClass, + Addressable, + $Addressable, + AllOfWithSingleRef, + Animal, + $Animal, + ApiResponse, + Apple, + ArrayOfArrayOfNumberOnly, + ArrayOfNumberOnly, + ArrayTest, + Banana, + Bar, + BarCreate, + BarRef, + BarRefOrValue, + Capitalization, + Cat, + CatAllOf, + $CatAllOf, + Category, + Child, + ClassModel, + DeprecatedObject, + Dog, + DogAllOf, + $DogAllOf, + Entity, + $Entity, + EntityRef, + $EntityRef, + EnumArrays, + EnumTest, + Example, + ExampleNonPrimitive, + Extensible, + $Extensible, + FileSchemaTestClass, + Foo, + FooRef, + FooRefOrValue, + FormatTest, + Fruit, + HasOnlyReadOnly, + HealthCheckResult, + MapTest, + MixedPropertiesAndAdditionalPropertiesClass, + Model200Response, + ModelClient, + ModelEnumClass, + ModelFile, + ModelList, + ModelReturn, + Name, + NullableClass, + NumberOnly, + ObjectWithDeprecatedFields, + Order, + OuterComposite, + OuterEnum, + OuterEnumDefaultValue, + OuterEnumInteger, + OuterEnumIntegerDefaultValue, + OuterObjectWithEnumProperty, + Pasta, + Pet, + Pizza, + $Pizza, + PizzaSpeziale, + ReadOnlyFirst, + SingleRefType, + SpecialModelName, + Tag, + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, + User, +]) +Serializers serializers = (_$serializers.toBuilder() + ..addBuilderFactory( + const FullType(BuiltMap, [FullType(String), FullType(String)]), + () => MapBuilder(), + ) + ..add(Addressable.serializer) + ..add(Animal.serializer) + ..add(CatAllOf.serializer) + ..add(DogAllOf.serializer) + ..add(Entity.serializer) + ..add(EntityRef.serializer) + ..add(Extensible.serializer) + ..add(Pizza.serializer) + ..add(const OneOfSerializer()) + ..add(const AnyOfSerializer()) + ..add(const DateSerializer()) + ..add(Iso8601DateTimeSerializer())) + .build(); + +Serializers standardSerializers = + (serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build(); diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/pubspec.yaml b/samples/client/echo_api/dart/dart-dio-built_value/pubspec.yaml similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/pubspec.yaml rename to samples/client/echo_api/dart/dart-dio-built_value/pubspec.yaml index fb676f65c393..71e321cb7d8d 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/pubspec.yaml +++ b/samples/client/echo_api/dart/dart-dio-built_value/pubspec.yaml @@ -7,6 +7,7 @@ environment: sdk: '>=2.12.0 <3.0.0' dependencies: + dio: '>=4.0.1 <5.0.0' one_of: '>=1.5.0 <2.0.0' one_of_serializer: '>=1.5.0 <2.0.0' diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/additional_properties_class_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/additional_properties_class_test.dart new file mode 100644 index 000000000000..0ee0559d710c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/additional_properties_class_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AdditionalPropertiesClass +void main() { + final instance = AdditionalPropertiesClassBuilder(); + // TODO add properties to the builder and call build() + + group(AdditionalPropertiesClass, () { + // BuiltMap mapProperty + test('to test the property `mapProperty`', () async { + // TODO + }); + + // BuiltMap> mapOfMapProperty + test('to test the property `mapOfMapProperty`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/addressable_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/addressable_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/addressable_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/addressable_test.dart index 696e26e8e549..657f7ee74448 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/addressable_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/addressable_test.dart @@ -18,6 +18,5 @@ void main() { test('to test the property `id`', () async { // TODO }); - }); } diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/all_of_with_single_ref_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/all_of_with_single_ref_test.dart new file mode 100644 index 000000000000..a423afab69b0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/all_of_with_single_ref_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AllOfWithSingleRef +void main() { + final instance = AllOfWithSingleRefBuilder(); + // TODO add properties to the builder and call build() + + 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/client/echo_api/dart/dart-dio-built_value/test/animal_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/animal_test.dart new file mode 100644 index 000000000000..023e09145fe3 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/animal_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Animal +void main() { + //final instance = AnimalBuilder(); + // TODO add properties to the builder and call build() + + group(Animal, () { + // String className + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/api_response_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/api_response_test.dart new file mode 100644 index 000000000000..9587579a4ab0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/api_response_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ApiResponse +void main() { + final instance = ApiResponseBuilder(); + // TODO add properties to the builder and call build() + + group(ApiResponse, () { + // int code + test('to test the property `code`', () async { + // TODO + }); + + // String type + test('to test the property `type`', () async { + // TODO + }); + + // String message + test('to test the property `message`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/test/apple_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/apple_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof/test/apple_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/apple_test.dart index 1d542169550d..0949f55b7247 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof/test/apple_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/apple_test.dart @@ -11,6 +11,5 @@ void main() { test('to test the property `kind`', () async { // TODO }); - }); } diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/array_of_array_of_number_only_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/array_of_array_of_number_only_test.dart new file mode 100644 index 000000000000..ad6d165e3c83 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/array_of_array_of_number_only_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayOfArrayOfNumberOnly +void main() { + final instance = ArrayOfArrayOfNumberOnlyBuilder(); + // TODO add properties to the builder and call build() + + group(ArrayOfArrayOfNumberOnly, () { + // BuiltList> arrayArrayNumber + test('to test the property `arrayArrayNumber`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/array_of_number_only_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/array_of_number_only_test.dart new file mode 100644 index 000000000000..456681ced455 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/array_of_number_only_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayOfNumberOnly +void main() { + final instance = ArrayOfNumberOnlyBuilder(); + // TODO add properties to the builder and call build() + + group(ArrayOfNumberOnly, () { + // BuiltList arrayNumber + test('to test the property `arrayNumber`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/array_test_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/array_test_test.dart new file mode 100644 index 000000000000..7b89588b2157 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/array_test_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayTest +void main() { + final instance = ArrayTestBuilder(); + // TODO add properties to the builder and call build() + + group(ArrayTest, () { + // BuiltList arrayOfString + test('to test the property `arrayOfString`', () async { + // TODO + }); + + // BuiltList> arrayArrayOfInteger + test('to test the property `arrayArrayOfInteger`', () async { + // TODO + }); + + // BuiltList> arrayArrayOfModel + test('to test the property `arrayArrayOfModel`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/test/banana_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/banana_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof/test/banana_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/banana_test.dart index a883acc0a9e8..34f4c1ca36ed 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof/test/banana_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/banana_test.dart @@ -11,6 +11,5 @@ void main() { test('to test the property `count`', () async { // TODO }); - }); } diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/bar_create_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/bar_create_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/bar_create_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/bar_create_test.dart index 1bf90151be8b..050dcadfb0f9 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/bar_create_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/bar_create_test.dart @@ -51,6 +51,5 @@ void main() { test('to test the property `atType`', () async { // TODO }); - }); } diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/bar_ref_or_value_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/bar_ref_or_value_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/bar_ref_or_value_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/bar_ref_or_value_test.dart index c132ac09943b..a6ceb001ec11 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/bar_ref_or_value_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/bar_ref_or_value_test.dart @@ -36,6 +36,5 @@ void main() { test('to test the property `atType`', () async { // TODO }); - }); } diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/bar_ref_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/bar_ref_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/bar_ref_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/bar_ref_test.dart index 9c410b2b5c54..4a31ed0904b5 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/bar_ref_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/bar_ref_test.dart @@ -36,6 +36,5 @@ void main() { test('to test the property `atType`', () async { // TODO }); - }); } diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/bar_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/bar_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/bar_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/bar_test.dart index dc6daaa3400d..616f922b5d14 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/bar_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/bar_test.dart @@ -50,6 +50,5 @@ void main() { test('to test the property `atType`', () async { // TODO }); - }); } diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/body_api_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/body_api_test.dart new file mode 100644 index 000000000000..05eedc2d2540 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/body_api_test.dart @@ -0,0 +1,18 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for BodyApi +void main() { + final instance = Openapi().getBodyApi(); + + group(BodyApi, () { + // Test body parameter(s) + // + // Test body parameter(s) + // + //Future testEchoBodyPet({ Pet pet }) async + test('test testEchoBodyPet', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/capitalization_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/capitalization_test.dart new file mode 100644 index 000000000000..c1fb9cd73dc7 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/capitalization_test.dart @@ -0,0 +1,41 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Capitalization +void main() { + final instance = CapitalizationBuilder(); + // TODO add properties to the builder and call build() + + group(Capitalization, () { + // String smallCamel + test('to test the property `smallCamel`', () async { + // TODO + }); + + // String capitalCamel + test('to test the property `capitalCamel`', () async { + // TODO + }); + + // String smallSnake + test('to test the property `smallSnake`', () async { + // TODO + }); + + // String capitalSnake + test('to test the property `capitalSnake`', () async { + // TODO + }); + + // String sCAETHFlowPoints + test('to test the property `sCAETHFlowPoints`', () async { + // TODO + }); + + // Name of the pet + // String ATT_NAME + test('to test the property `ATT_NAME`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/cat_all_of_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/cat_all_of_test.dart new file mode 100644 index 000000000000..b84216c8996d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/cat_all_of_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for CatAllOf +void main() { + //final instance = CatAllOfBuilder(); + // TODO add properties to the builder and call build() + + group(CatAllOf, () { + // bool declawed + test('to test the property `declawed`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/cat_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/cat_test.dart new file mode 100644 index 000000000000..000e31d7f176 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/cat_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Cat +void main() { + final instance = CatBuilder(); + // TODO add properties to the builder and call build() + + group(Cat, () { + // String className + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + // bool declawed + test('to test the property `declawed`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/category_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/category_test.dart new file mode 100644 index 000000000000..ba39a86cfb6a --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/category_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Category +void main() { + final instance = CategoryBuilder(); + // TODO add properties to the builder and call build() + + group(Category, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/test/child_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/child_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof_primitive/test/child_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/child_test.dart index d40451a84c2c..6c5defb7b228 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/test/child_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/child_test.dart @@ -11,6 +11,5 @@ void main() { test('to test the property `name`', () async { // TODO }); - }); } diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/class_model_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/class_model_test.dart new file mode 100644 index 000000000000..1ca5ccc3a74b --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/class_model_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ClassModel +void main() { + final instance = ClassModelBuilder(); + // TODO add properties to the builder and call build() + + group(ClassModel, () { + // String classField + test('to test the property `classField`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/deprecated_object_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/deprecated_object_test.dart new file mode 100644 index 000000000000..298f2d2253b4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/deprecated_object_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DeprecatedObject +void main() { + final instance = DeprecatedObjectBuilder(); + // TODO add properties to the builder and call build() + + group(DeprecatedObject, () { + // String name + test('to test the property `name`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/dog_all_of_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/dog_all_of_test.dart new file mode 100644 index 000000000000..8d258244accb --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/dog_all_of_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DogAllOf +void main() { + //final instance = DogAllOfBuilder(); + // TODO add properties to the builder and call build() + + group(DogAllOf, () { + // String breed + test('to test the property `breed`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/dog_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/dog_test.dart new file mode 100644 index 000000000000..0d810b3b9fa9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/dog_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Dog +void main() { + final instance = DogBuilder(); + // TODO add properties to the builder and call build() + + group(Dog, () { + // String className + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + // String breed + test('to test the property `breed`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/entity_ref_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/entity_ref_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/entity_ref_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/entity_ref_test.dart index 836289893fb4..ce3ed9868212 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/entity_ref_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/entity_ref_test.dart @@ -48,6 +48,5 @@ void main() { test('to test the property `atType`', () async { // TODO }); - }); } diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/entity_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/entity_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/entity_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/entity_test.dart index 30429747562d..ca7dd754f98d 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/entity_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/entity_test.dart @@ -36,6 +36,5 @@ void main() { test('to test the property `atType`', () async { // TODO }); - }); } diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/enum_arrays_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/enum_arrays_test.dart new file mode 100644 index 000000000000..c0d5de925aec --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/enum_arrays_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EnumArrays +void main() { + final instance = EnumArraysBuilder(); + // TODO add properties to the builder and call build() + + group(EnumArrays, () { + // String justSymbol + test('to test the property `justSymbol`', () async { + // TODO + }); + + // BuiltList arrayEnum + test('to test the property `arrayEnum`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/enum_test_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/enum_test_test.dart new file mode 100644 index 000000000000..d7dc20b5eb77 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/enum_test_test.dart @@ -0,0 +1,50 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EnumTest +void main() { + final instance = EnumTestBuilder(); + // TODO add properties to the builder and call build() + + group(EnumTest, () { + // String enumString + test('to test the property `enumString`', () async { + // TODO + }); + + // String enumStringRequired + test('to test the property `enumStringRequired`', () async { + // TODO + }); + + // int enumInteger + test('to test the property `enumInteger`', () async { + // TODO + }); + + // double enumNumber + test('to test the property `enumNumber`', () async { + // TODO + }); + + // OuterEnum outerEnum + test('to test the property `outerEnum`', () async { + // TODO + }); + + // OuterEnumInteger outerEnumInteger + test('to test the property `outerEnumInteger`', () async { + // TODO + }); + + // OuterEnumDefaultValue outerEnumDefaultValue + test('to test the property `outerEnumDefaultValue`', () async { + // TODO + }); + + // OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue + test('to test the property `outerEnumIntegerDefaultValue`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/example_non_primitive_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/example_non_primitive_test.dart new file mode 100644 index 000000000000..5563d239e355 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/example_non_primitive_test.dart @@ -0,0 +1,10 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ExampleNonPrimitive +void main() { + final instance = ExampleNonPrimitiveBuilder(); + // TODO add properties to the builder and call build() + + group(ExampleNonPrimitive, () {}); +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/test/example_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/example_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof_primitive/test/example_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/example_test.dart index ccb35121143e..1150465e7d28 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/test/example_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/example_test.dart @@ -11,6 +11,5 @@ void main() { test('to test the property `name`', () async { // TODO }); - }); } diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/extensible_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/extensible_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/extensible_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/extensible_test.dart index 75e6211e074b..158df10ac74e 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/extensible_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/extensible_test.dart @@ -24,6 +24,5 @@ void main() { test('to test the property `atType`', () async { // TODO }); - }); } diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/file_schema_test_class_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/file_schema_test_class_test.dart new file mode 100644 index 000000000000..1ef8cf8861b4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/file_schema_test_class_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FileSchemaTestClass +void main() { + final instance = FileSchemaTestClassBuilder(); + // TODO add properties to the builder and call build() + + group(FileSchemaTestClass, () { + // ModelFile file + test('to test the property `file`', () async { + // TODO + }); + + // BuiltList files + test('to test the property `files`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/foo_ref_or_value_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/foo_ref_or_value_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/foo_ref_or_value_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/foo_ref_or_value_test.dart index 029d030e5e35..bcee2f7eaee1 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/foo_ref_or_value_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/foo_ref_or_value_test.dart @@ -36,6 +36,5 @@ void main() { test('to test the property `atType`', () async { // TODO }); - }); } diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/foo_ref_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/foo_ref_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/foo_ref_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/foo_ref_test.dart index a1398787bbcb..b28c262c3e22 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/foo_ref_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/foo_ref_test.dart @@ -41,6 +41,5 @@ void main() { test('to test the property `atType`', () async { // TODO }); - }); } diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/foo_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/foo_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/foo_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/foo_test.dart index 93a5286e2b45..0b491bb37b68 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/foo_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/foo_test.dart @@ -46,6 +46,5 @@ void main() { test('to test the property `atType`', () async { // TODO }); - }); } diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/format_test_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/format_test_test.dart new file mode 100644 index 000000000000..3827c02e13ae --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/format_test_test.dart @@ -0,0 +1,92 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FormatTest +void main() { + final instance = FormatTestBuilder(); + // TODO add properties to the builder and call build() + + group(FormatTest, () { + // int integer + test('to test the property `integer`', () async { + // TODO + }); + + // int int32 + test('to test the property `int32`', () async { + // TODO + }); + + // int int64 + test('to test the property `int64`', () async { + // TODO + }); + + // num number + test('to test the property `number`', () async { + // TODO + }); + + // double float + test('to test the property `float`', () async { + // TODO + }); + + // double double_ + test('to test the property `double_`', () async { + // TODO + }); + + // double decimal + test('to test the property `decimal`', () async { + // TODO + }); + + // String string + test('to test the property `string`', () async { + // TODO + }); + + // String byte + test('to test the property `byte`', () async { + // TODO + }); + + // Uint8List binary + test('to test the property `binary`', () async { + // TODO + }); + + // Date 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/oneof/test/fruit_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/fruit_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof/test/fruit_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/fruit_test.dart index c18790ae9566..26b265ccb93f 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof/test/fruit_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/fruit_test.dart @@ -21,6 +21,5 @@ void main() { test('to test the property `count`', () async { // TODO }); - }); } diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/has_only_read_only_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/has_only_read_only_test.dart new file mode 100644 index 000000000000..8b00db3d0711 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/has_only_read_only_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for HasOnlyReadOnly +void main() { + final instance = HasOnlyReadOnlyBuilder(); + // TODO add properties to the builder and call build() + + group(HasOnlyReadOnly, () { + // String bar + test('to test the property `bar`', () async { + // TODO + }); + + // String foo + test('to test the property `foo`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/health_check_result_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/health_check_result_test.dart new file mode 100644 index 000000000000..050e2c9b814f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/health_check_result_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for HealthCheckResult +void main() { + final instance = HealthCheckResultBuilder(); + // TODO add properties to the builder and call build() + + group(HealthCheckResult, () { + // String nullableMessage + test('to test the property `nullableMessage`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/map_test_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/map_test_test.dart new file mode 100644 index 000000000000..56c3d448c6c5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/map_test_test.dart @@ -0,0 +1,30 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for MapTest +void main() { + final instance = MapTestBuilder(); + // TODO add properties to the builder and call build() + + group(MapTest, () { + // BuiltMap> mapMapOfString + test('to test the property `mapMapOfString`', () async { + // TODO + }); + + // BuiltMap mapOfEnumString + test('to test the property `mapOfEnumString`', () async { + // TODO + }); + + // BuiltMap directMap + test('to test the property `directMap`', () async { + // TODO + }); + + // BuiltMap indirectMap + test('to test the property `indirectMap`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/mixed_properties_and_additional_properties_class_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/mixed_properties_and_additional_properties_class_test.dart new file mode 100644 index 000000000000..dcaa8d351ae5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/mixed_properties_and_additional_properties_class_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for MixedPropertiesAndAdditionalPropertiesClass +void main() { + final instance = MixedPropertiesAndAdditionalPropertiesClassBuilder(); + // TODO add properties to the builder and call build() + + group(MixedPropertiesAndAdditionalPropertiesClass, () { + // String uuid + test('to test the property `uuid`', () async { + // TODO + }); + + // DateTime dateTime + test('to test the property `dateTime`', () async { + // TODO + }); + + // BuiltMap map + test('to test the property `map`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/model200_response_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/model200_response_test.dart new file mode 100644 index 000000000000..8064eb959a32 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/model200_response_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Model200Response +void main() { + final instance = Model200ResponseBuilder(); + // TODO add properties to the builder and call build() + + group(Model200Response, () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // String classField + test('to test the property `classField`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/model_client_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/model_client_test.dart new file mode 100644 index 000000000000..1998f27d715a --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/model_client_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelClient +void main() { + final instance = ModelClientBuilder(); + // TODO add properties to the builder and call build() + + group(ModelClient, () { + // String client + test('to test the property `client`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/model_enum_class_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/model_enum_class_test.dart new file mode 100644 index 000000000000..fa31f816801c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/model_enum_class_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelEnumClass +void main() { + group(ModelEnumClass, () {}); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/model_file_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/model_file_test.dart new file mode 100644 index 000000000000..a07c60c5d85d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/model_file_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelFile +void main() { + final instance = ModelFileBuilder(); + // TODO add properties to the builder and call build() + + group(ModelFile, () { + // Test capitalization + // String sourceURI + test('to test the property `sourceURI`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/model_list_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/model_list_test.dart new file mode 100644 index 000000000000..0c4e3c45c7a9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/model_list_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelList +void main() { + final instance = ModelListBuilder(); + // TODO add properties to the builder and call build() + + group(ModelList, () { + // String n123list + test('to test the property `n123list`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/model_return_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/model_return_test.dart new file mode 100644 index 000000000000..b60abdfd6021 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/model_return_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelReturn +void main() { + final instance = ModelReturnBuilder(); + // TODO add properties to the builder and call build() + + group(ModelReturn, () { + // int return_ + test('to test the property `return_`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/name_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/name_test.dart new file mode 100644 index 000000000000..d04e76fef9e0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/name_test.dart @@ -0,0 +1,30 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Name +void main() { + final instance = NameBuilder(); + // TODO add properties to the builder and call build() + + group(Name, () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // int snakeCase + test('to test the property `snakeCase`', () async { + // TODO + }); + + // String property + test('to test the property `property`', () async { + // TODO + }); + + // int n123number + test('to test the property `n123number`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/nullable_class_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/nullable_class_test.dart new file mode 100644 index 000000000000..32f0eba4fb2e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/nullable_class_test.dart @@ -0,0 +1,70 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for NullableClass +void main() { + final instance = NullableClassBuilder(); + // TODO add properties to the builder and call build() + + group(NullableClass, () { + // int integerProp + test('to test the property `integerProp`', () async { + // TODO + }); + + // num numberProp + test('to test the property `numberProp`', () async { + // TODO + }); + + // bool booleanProp + test('to test the property `booleanProp`', () async { + // TODO + }); + + // String stringProp + test('to test the property `stringProp`', () async { + // TODO + }); + + // Date dateProp + test('to test the property `dateProp`', () async { + // TODO + }); + + // DateTime datetimeProp + test('to test the property `datetimeProp`', () async { + // TODO + }); + + // BuiltList arrayNullableProp + test('to test the property `arrayNullableProp`', () async { + // TODO + }); + + // BuiltList arrayAndItemsNullableProp + test('to test the property `arrayAndItemsNullableProp`', () async { + // TODO + }); + + // BuiltList arrayItemsNullable + test('to test the property `arrayItemsNullable`', () async { + // TODO + }); + + // BuiltMap objectNullableProp + test('to test the property `objectNullableProp`', () async { + // TODO + }); + + // BuiltMap objectAndItemsNullableProp + test('to test the property `objectAndItemsNullableProp`', () async { + // TODO + }); + + // BuiltMap objectItemsNullable + test('to test the property `objectItemsNullable`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/number_only_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/number_only_test.dart new file mode 100644 index 000000000000..7f34d2a5ce60 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/number_only_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for NumberOnly +void main() { + final instance = NumberOnlyBuilder(); + // TODO add properties to the builder and call build() + + group(NumberOnly, () { + // num justNumber + test('to test the property `justNumber`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/object_with_deprecated_fields_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/object_with_deprecated_fields_test.dart new file mode 100644 index 000000000000..574970b317ca --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/object_with_deprecated_fields_test.dart @@ -0,0 +1,30 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ObjectWithDeprecatedFields +void main() { + final instance = ObjectWithDeprecatedFieldsBuilder(); + // TODO add properties to the builder and call build() + + 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 + }); + + // BuiltList bars + test('to test the property `bars`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/order_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/order_test.dart new file mode 100644 index 000000000000..3ed96043d80c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/order_test.dart @@ -0,0 +1,41 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Order +void main() { + final instance = OrderBuilder(); + // TODO add properties to the builder and call build() + + group(Order, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // int petId + test('to test the property `petId`', () async { + // TODO + }); + + // int quantity + test('to test the property `quantity`', () async { + // TODO + }); + + // DateTime shipDate + test('to test the property `shipDate`', () async { + // TODO + }); + + // Order Status + // String status + test('to test the property `status`', () async { + // TODO + }); + + // bool complete (default value: false) + test('to test the property `complete`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/outer_composite_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/outer_composite_test.dart new file mode 100644 index 000000000000..99a7cb7db596 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/outer_composite_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterComposite +void main() { + final instance = OuterCompositeBuilder(); + // TODO add properties to the builder and call build() + + group(OuterComposite, () { + // num myNumber + test('to test the property `myNumber`', () async { + // TODO + }); + + // String myString + test('to test the property `myString`', () async { + // TODO + }); + + // bool myBoolean + test('to test the property `myBoolean`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/outer_enum_default_value_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/outer_enum_default_value_test.dart new file mode 100644 index 000000000000..a5c83f615194 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/outer_enum_default_value_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumDefaultValue +void main() { + group(OuterEnumDefaultValue, () {}); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/outer_enum_integer_default_value_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/outer_enum_integer_default_value_test.dart new file mode 100644 index 000000000000..49ebbfcead7f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/outer_enum_integer_default_value_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumIntegerDefaultValue +void main() { + group(OuterEnumIntegerDefaultValue, () {}); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/outer_enum_integer_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/outer_enum_integer_test.dart new file mode 100644 index 000000000000..3c6b81305c71 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/outer_enum_integer_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumInteger +void main() { + group(OuterEnumInteger, () {}); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/outer_enum_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/outer_enum_test.dart new file mode 100644 index 000000000000..4ee10f379d5e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/outer_enum_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnum +void main() { + group(OuterEnum, () {}); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/outer_object_with_enum_property_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/outer_object_with_enum_property_test.dart new file mode 100644 index 000000000000..cb621828cbc0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/outer_object_with_enum_property_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterObjectWithEnumProperty +void main() { + final instance = OuterObjectWithEnumPropertyBuilder(); + // TODO add properties to the builder and call build() + + group(OuterObjectWithEnumProperty, () { + // OuterEnumInteger value + test('to test the property `value`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/pasta_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/pasta_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/pasta_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/pasta_test.dart index 6a3ae338eec2..42de4a90e2fa 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/pasta_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/pasta_test.dart @@ -41,6 +41,5 @@ void main() { test('to test the property `atType`', () async { // TODO }); - }); } diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/path_api_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/path_api_test.dart new file mode 100644 index 000000000000..658f714ec35f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/path_api_test.dart @@ -0,0 +1,18 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for PathApi +void main() { + final instance = Openapi().getPathApi(); + + group(PathApi, () { + // Test path parameter(s) + // + // Test path parameter(s) + // + //Future testsPathStringPathStringIntegerPathInteger(String pathString, int pathInteger) async + test('test testsPathStringPathStringIntegerPathInteger', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/pet_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/pet_test.dart new file mode 100644 index 000000000000..bf61da3114ce --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/pet_test.dart @@ -0,0 +1,41 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Pet +void main() { + final instance = PetBuilder(); + // TODO add properties to the builder and call build() + + group(Pet, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // Category category + test('to test the property `category`', () async { + // TODO + }); + + // BuiltList photoUrls + test('to test the property `photoUrls`', () async { + // TODO + }); + + // BuiltList tags + test('to test the property `tags`', () async { + // TODO + }); + + // pet status in the store + // String status + test('to test the property `status`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/pizza_speziale_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/pizza_speziale_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/pizza_speziale_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/pizza_speziale_test.dart index 774320231c9e..c6a78cb12fc7 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/pizza_speziale_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/pizza_speziale_test.dart @@ -41,6 +41,5 @@ void main() { test('to test the property `atType`', () async { // TODO }); - }); } diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/pizza_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/pizza_test.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/pizza_test.dart rename to samples/client/echo_api/dart/dart-dio-built_value/test/pizza_test.dart index 5c6e1af95a59..7e0b87b9ab5a 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/pizza_test.dart +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/pizza_test.dart @@ -41,6 +41,5 @@ void main() { test('to test the property `atType`', () async { // TODO }); - }); } diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/query_api_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/query_api_test.dart new file mode 100644 index 000000000000..960e3b243e74 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/query_api_test.dart @@ -0,0 +1,36 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for QueryApi +void main() { + final instance = Openapi().getQueryApi(); + + group(QueryApi, () { + // Test query parameter(s) + // + // Test query parameter(s) + // + //Future testQueryIntegerBooleanString({ int integerQuery, bool booleanQuery, String stringQuery }) async + test('test testQueryIntegerBooleanString', () async { + // TODO + }); + + // Test query parameter(s) + // + // Test query parameter(s) + // + //Future testQueryStyleFormExplodeTrueArrayString({ TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject }) async + test('test testQueryStyleFormExplodeTrueArrayString', () async { + // TODO + }); + + // Test query parameter(s) + // + // Test query parameter(s) + // + //Future testQueryStyleFormExplodeTrueObject({ Pet queryObject }) async + test('test testQueryStyleFormExplodeTrueObject', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/read_only_first_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/read_only_first_test.dart new file mode 100644 index 000000000000..f4652322f2c7 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/read_only_first_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ReadOnlyFirst +void main() { + final instance = ReadOnlyFirstBuilder(); + // TODO add properties to the builder and call build() + + group(ReadOnlyFirst, () { + // String bar + test('to test the property `bar`', () async { + // TODO + }); + + // String baz + test('to test the property `baz`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/single_ref_type_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/single_ref_type_test.dart new file mode 100644 index 000000000000..2c265f0d24ae --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/single_ref_type_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for SingleRefType +void main() { + group(SingleRefType, () {}); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/special_model_name_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/special_model_name_test.dart new file mode 100644 index 000000000000..f81e03f7188d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/special_model_name_test.dart @@ -0,0 +1,17 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for SpecialModelName +void main() { + final instance = SpecialModelNameBuilder(); + // TODO add properties to the builder and call build() + + group(SpecialModelName, () { + // int dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket + test( + 'to test the property `dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket`', + () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/tag_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/tag_test.dart new file mode 100644 index 000000000000..253a283fc867 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/tag_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Tag +void main() { + final instance = TagBuilder(); + // TODO add properties to the builder and call build() + + group(Tag, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/test_query_style_form_explode_true_array_string_query_object_parameter_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/test_query_style_form_explode_true_array_string_query_object_parameter_test.dart new file mode 100644 index 000000000000..e15b28ac90c2 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/test_query_style_form_explode_true_array_string_query_object_parameter_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter +void main() { + final instance = + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterBuilder(); + // TODO add properties to the builder and call build() + + group(TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, () { + // BuiltList values + test('to test the property `values`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-built_value/test/user_test.dart b/samples/client/echo_api/dart/dart-dio-built_value/test/user_test.dart new file mode 100644 index 000000000000..40bef6e6d21c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-built_value/test/user_test.dart @@ -0,0 +1,51 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for User +void main() { + final instance = UserBuilder(); + // TODO add properties to the builder and call build() + + group(User, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String username + test('to test the property `username`', () async { + // TODO + }); + + // String firstName + test('to test the property `firstName`', () async { + // TODO + }); + + // String lastName + test('to test the property `lastName`', () async { + // TODO + }); + + // String email + test('to test the property `email`', () async { + // TODO + }); + + // String password + test('to test the property `password`', () async { + // TODO + }); + + // String phone + test('to test the property `phone`', () async { + // TODO + }); + + // User Status + // int userStatus + test('to test the property `userStatus`', () async { + // TODO + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/.gitignore b/samples/client/echo_api/dart/dart-dio-json_serializable/.gitignore similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/.gitignore rename to samples/client/echo_api/dart/dart-dio-json_serializable/.gitignore diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/.openapi-generator-ignore b/samples/client/echo_api/dart/dart-dio-json_serializable/.openapi-generator-ignore similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/.openapi-generator-ignore rename to samples/client/echo_api/dart/dart-dio-json_serializable/.openapi-generator-ignore diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/.openapi-generator/FILES b/samples/client/echo_api/dart/dart-dio-json_serializable/.openapi-generator/FILES new file mode 100644 index 000000000000..d866d909b67d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/.openapi-generator/FILES @@ -0,0 +1,157 @@ +.gitignore +README.md +analysis_options.yaml +build.yaml +doc/AdditionalPropertiesClass.md +doc/Addressable.md +doc/AllOfWithSingleRef.md +doc/Animal.md +doc/ApiResponse.md +doc/Apple.md +doc/ArrayOfArrayOfNumberOnly.md +doc/ArrayOfNumberOnly.md +doc/ArrayTest.md +doc/Banana.md +doc/Bar.md +doc/BarCreate.md +doc/BarRef.md +doc/BarRefOrValue.md +doc/BodyApi.md +doc/Capitalization.md +doc/Cat.md +doc/CatAllOf.md +doc/Category.md +doc/Child.md +doc/ClassModel.md +doc/DeprecatedObject.md +doc/Dog.md +doc/DogAllOf.md +doc/Entity.md +doc/EntityRef.md +doc/EnumArrays.md +doc/EnumTest.md +doc/Example.md +doc/ExampleNonPrimitive.md +doc/Extensible.md +doc/FileSchemaTestClass.md +doc/Foo.md +doc/FooRef.md +doc/FooRefOrValue.md +doc/FormatTest.md +doc/Fruit.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/Pasta.md +doc/PathApi.md +doc/Pet.md +doc/Pizza.md +doc/PizzaSpeziale.md +doc/QueryApi.md +doc/ReadOnlyFirst.md +doc/SingleRefType.md +doc/SpecialModelName.md +doc/Tag.md +doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md +doc/User.md +lib/openapi.dart +lib/src/api.dart +lib/src/api/_exports.dart +lib/src/api/body_api.dart +lib/src/api/path_api.dart +lib/src/api/query_api.dart +lib/src/api_util.dart +lib/src/auth/_exports.dart +lib/src/auth/api_key_auth.dart +lib/src/auth/auth.dart +lib/src/auth/basic_auth.dart +lib/src/auth/bearer_auth.dart +lib/src/auth/oauth.dart +lib/src/deserialize.dart +lib/src/model/_exports.dart +lib/src/model/additional_properties_class.dart +lib/src/model/addressable.dart +lib/src/model/all_of_with_single_ref.dart +lib/src/model/animal.dart +lib/src/model/api_response.dart +lib/src/model/apple.dart +lib/src/model/array_of_array_of_number_only.dart +lib/src/model/array_of_number_only.dart +lib/src/model/array_test.dart +lib/src/model/banana.dart +lib/src/model/bar.dart +lib/src/model/bar_create.dart +lib/src/model/bar_ref.dart +lib/src/model/bar_ref_or_value.dart +lib/src/model/capitalization.dart +lib/src/model/cat.dart +lib/src/model/cat_all_of.dart +lib/src/model/category.dart +lib/src/model/child.dart +lib/src/model/class_model.dart +lib/src/model/deprecated_object.dart +lib/src/model/dog.dart +lib/src/model/dog_all_of.dart +lib/src/model/entity.dart +lib/src/model/entity_ref.dart +lib/src/model/enum_arrays.dart +lib/src/model/enum_test.dart +lib/src/model/example.dart +lib/src/model/example_non_primitive.dart +lib/src/model/extensible.dart +lib/src/model/file_schema_test_class.dart +lib/src/model/foo.dart +lib/src/model/foo_ref.dart +lib/src/model/foo_ref_or_value.dart +lib/src/model/format_test.dart +lib/src/model/fruit.dart +lib/src/model/has_only_read_only.dart +lib/src/model/health_check_result.dart +lib/src/model/map_test.dart +lib/src/model/mixed_properties_and_additional_properties_class.dart +lib/src/model/model200_response.dart +lib/src/model/model_client.dart +lib/src/model/model_enum_class.dart +lib/src/model/model_file.dart +lib/src/model/model_list.dart +lib/src/model/model_return.dart +lib/src/model/name.dart +lib/src/model/nullable_class.dart +lib/src/model/number_only.dart +lib/src/model/object_with_deprecated_fields.dart +lib/src/model/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/pasta.dart +lib/src/model/pet.dart +lib/src/model/pizza.dart +lib/src/model/pizza_speziale.dart +lib/src/model/read_only_first.dart +lib/src/model/single_ref_type.dart +lib/src/model/special_model_name.dart +lib/src/model/tag.dart +lib/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart +lib/src/model/user.dart +pubspec.yaml diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/.openapi-generator/VERSION b/samples/client/echo_api/dart/dart-dio-json_serializable/.openapi-generator/VERSION similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/.openapi-generator/VERSION rename to samples/client/echo_api/dart/dart-dio-json_serializable/.openapi-generator/VERSION diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/README.md b/samples/client/echo_api/dart/dart-dio-json_serializable/README.md new file mode 100644 index 000000000000..ed9a0096600c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/README.md @@ -0,0 +1,153 @@ +# openapi +Echo Server API + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 0.1.0 +- Build package: org.openapitools.codegen.languages.DartDioClientCodegen + +## Requirements + +* Dart 2.12.0 or later OR Flutter 1.26.0 or later +* Dio 4.0.0+ + +## 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().getBodyApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store + +try { + final response = await api.testEchoBodyPet(pet); + print(response); +} catch on DioError (e) { + print("Exception when calling BodyApi->testEchoBodyPet: $e\n"); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:3000* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +[*BodyApi*](doc/BodyApi.md) | [**testEchoBodyPet**](doc/BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s) +[*PathApi*](doc/PathApi.md) | [**testsPathStringPathStringIntegerPathInteger**](doc/PathApi.md#testspathstringpathstringintegerpathinteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) +[*QueryApi*](doc/QueryApi.md) | [**testQueryIntegerBooleanString**](doc/QueryApi.md#testqueryintegerbooleanstring) | **GET** /query/integer/boolean/string | Test query parameter(s) +[*QueryApi*](doc/QueryApi.md) | [**testQueryStyleFormExplodeTrueArrayString**](doc/QueryApi.md#testquerystyleformexplodetruearraystring) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) +[*QueryApi*](doc/QueryApi.md) | [**testQueryStyleFormExplodeTrueObject**](doc/QueryApi.md#testquerystyleformexplodetrueobject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) + + +## Documentation For Models + + - [AdditionalPropertiesClass](doc/AdditionalPropertiesClass.md) + - [Addressable](doc/Addressable.md) + - [AllOfWithSingleRef](doc/AllOfWithSingleRef.md) + - [Animal](doc/Animal.md) + - [ApiResponse](doc/ApiResponse.md) + - [Apple](doc/Apple.md) + - [ArrayOfArrayOfNumberOnly](doc/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](doc/ArrayOfNumberOnly.md) + - [ArrayTest](doc/ArrayTest.md) + - [Banana](doc/Banana.md) + - [Bar](doc/Bar.md) + - [BarCreate](doc/BarCreate.md) + - [BarRef](doc/BarRef.md) + - [BarRefOrValue](doc/BarRefOrValue.md) + - [Capitalization](doc/Capitalization.md) + - [Cat](doc/Cat.md) + - [CatAllOf](doc/CatAllOf.md) + - [Category](doc/Category.md) + - [Child](doc/Child.md) + - [ClassModel](doc/ClassModel.md) + - [DeprecatedObject](doc/DeprecatedObject.md) + - [Dog](doc/Dog.md) + - [DogAllOf](doc/DogAllOf.md) + - [Entity](doc/Entity.md) + - [EntityRef](doc/EntityRef.md) + - [EnumArrays](doc/EnumArrays.md) + - [EnumTest](doc/EnumTest.md) + - [Example](doc/Example.md) + - [ExampleNonPrimitive](doc/ExampleNonPrimitive.md) + - [Extensible](doc/Extensible.md) + - [FileSchemaTestClass](doc/FileSchemaTestClass.md) + - [Foo](doc/Foo.md) + - [FooRef](doc/FooRef.md) + - [FooRefOrValue](doc/FooRefOrValue.md) + - [FormatTest](doc/FormatTest.md) + - [Fruit](doc/Fruit.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) + - [Pasta](doc/Pasta.md) + - [Pet](doc/Pet.md) + - [Pizza](doc/Pizza.md) + - [PizzaSpeziale](doc/PizzaSpeziale.md) + - [ReadOnlyFirst](doc/ReadOnlyFirst.md) + - [SingleRefType](doc/SingleRefType.md) + - [SpecialModelName](doc/SpecialModelName.md) + - [Tag](doc/Tag.md) + - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) + - [User](doc/User.md) + + +## Documentation For Authorization + + All endpoints do not require authorization. + + +## Author + +team@openapitools.org + diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/analysis_options.yaml b/samples/client/echo_api/dart/dart-dio-json_serializable/analysis_options.yaml similarity index 85% rename from samples/openapi3/client/petstore/dart-dio/oneof_primitive/analysis_options.yaml rename to samples/client/echo_api/dart/dart-dio-json_serializable/analysis_options.yaml index a611887d3acf..28be8936a4bd 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/analysis_options.yaml +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/analysis_options.yaml @@ -7,3 +7,4 @@ analyzer: implicit-casts: false exclude: - test/*.dart + - lib/src/model/*.g.dart diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/build.yaml b/samples/client/echo_api/dart/dart-dio-json_serializable/build.yaml new file mode 100644 index 000000000000..89a4dd6e1c2e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/build.yaml @@ -0,0 +1,18 @@ +targets: + $default: + builders: + json_serializable: + options: + # Options configure how source code is generated for every + # `@JsonSerializable`-annotated class in the package. + # + # The default value for each is listed. + any_map: false + checked: true + create_factory: true + create_to_json: true + disallow_unrecognized_keys: true + explicit_to_json: true + field_rename: none + ignore_unannotated: false + include_if_null: false diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/doc/AdditionalPropertiesClass.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..863b8503db83 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/Addressable.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Addressable.md new file mode 100644 index 000000000000..0fcd81b80382 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/AllOfWithSingleRef.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/AllOfWithSingleRef.md new file mode 100644 index 000000000000..4c6f3ab2fe11 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/Animal.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Animal.md new file mode 100644 index 000000000000..415b56e9bc2e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/ApiResponse.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/ApiResponse.md new file mode 100644 index 000000000000..7ad5da0f89e4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/Apple.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Apple.md new file mode 100644 index 000000000000..c7f711b87cef --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/ArrayOfArrayOfNumberOnly.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..e5b9d669a436 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/ArrayOfNumberOnly.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..fe8e071eb45c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/ArrayTest.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/ArrayTest.md new file mode 100644 index 000000000000..8ae11de10022 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/Banana.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Banana.md new file mode 100644 index 000000000000..bef8a58a4276 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/Bar.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Bar.md new file mode 100644 index 000000000000..4cccc863a489 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/BarCreate.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/BarCreate.md new file mode 100644 index 000000000000..c0b4ba6edc9a --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/oneof_polymorphism_and_inheritance/doc/FooRefOrValueWithProperties.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/BarRef.md similarity index 94% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/FooRefOrValueWithProperties.md rename to samples/client/echo_api/dart/dart-dio-json_serializable/doc/BarRef.md index 05aa2b0bbc1c..949695f4d36f 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/FooRefOrValueWithProperties.md +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/BarRef.md @@ -1,4 +1,4 @@ -# openapi.model.FooRefOrValueWithProperties +# openapi.model.BarRef ## Load the model package ```dart diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/doc/BarRefOrValue.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/BarRefOrValue.md new file mode 100644 index 000000000000..9dafa2d6b220 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/BarRefOrValue.md @@ -0,0 +1,19 @@ +# openapi.model.BarRefOrValue + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible name | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/doc/BodyApi.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/BodyApi.md new file mode 100644 index 000000000000..145854fc8d28 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/BodyApi.md @@ -0,0 +1,57 @@ +# openapi.api.BodyApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testEchoBodyPet**](BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s) + + +# **testEchoBodyPet** +> Pet testEchoBodyPet(pet) + +Test body parameter(s) + +Test body parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getBodyApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store + +try { + final response = api.testEchoBodyPet(pet); + print(response); +} catch on DioError (e) { + print('Exception when calling BodyApi->testEchoBodyPet: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Capitalization.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Capitalization.md new file mode 100644 index 000000000000..4a07b4eb820d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/Cat.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Cat.md new file mode 100644 index 000000000000..6552eea4b435 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/CatAllOf.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/CatAllOf.md new file mode 100644 index 000000000000..36b2ae0e8ab3 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/CatAllOf.md @@ -0,0 +1,15 @@ +# openapi.model.CatAllOf + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Category.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Category.md new file mode 100644 index 000000000000..98d0b14be7b1 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Child.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Child.md new file mode 100644 index 000000000000..bed0f2feec12 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/ClassModel.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/ClassModel.md new file mode 100644 index 000000000000..9b80d4f71eea --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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 +------------ | ------------- | ------------- | ------------- +**classField** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/doc/DeprecatedObject.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/DeprecatedObject.md new file mode 100644 index 000000000000..bf2ef67a26fc --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/Dog.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Dog.md new file mode 100644 index 000000000000..d36439b767bb --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/DogAllOf.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/DogAllOf.md new file mode 100644 index 000000000000..97a7c8fba492 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/DogAllOf.md @@ -0,0 +1,15 @@ +# openapi.model.DogAllOf + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Entity.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Entity.md new file mode 100644 index 000000000000..5ba2144b44fe --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/EntityRef.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/EntityRef.md new file mode 100644 index 000000000000..80eae55f4145 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/EnumArrays.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/EnumArrays.md new file mode 100644 index 000000000000..1d4fd1363b59 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/EnumTest.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/EnumTest.md new file mode 100644 index 000000000000..7c24fe2347b4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/Example.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Example.md new file mode 100644 index 000000000000..bf49bb137a60 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/ExampleNonPrimitive.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/ExampleNonPrimitive.md new file mode 100644 index 000000000000..2b63a98c6ad9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/ExampleNonPrimitive.md @@ -0,0 +1,14 @@ +# openapi.model.ExampleNonPrimitive + +## 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/client/echo_api/dart/dart-dio-json_serializable/doc/Extensible.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Extensible.md new file mode 100644 index 000000000000..7a781e578ea4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/FileSchemaTestClass.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/FileSchemaTestClass.md new file mode 100644 index 000000000000..d14ac319d294 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/Foo.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Foo.md new file mode 100644 index 000000000000..2627691fefe5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/FooRef.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/FooRef.md new file mode 100644 index 000000000000..68104b227292 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/FooRef.md @@ -0,0 +1,20 @@ +# openapi.model.FooRef + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foorefPropA** | **String** | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible name | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/doc/FooRefOrValue.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/FooRefOrValue.md new file mode 100644 index 000000000000..35e9fd114e1d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/FooRefOrValue.md @@ -0,0 +1,19 @@ +# openapi.model.FooRefOrValue + +## 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/client/echo_api/dart/dart-dio-json_serializable/doc/FormatTest.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/FormatTest.md new file mode 100644 index 000000000000..83b60545eb61 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/Fruit.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Fruit.md new file mode 100644 index 000000000000..5d48cc6e6d38 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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 +------------ | ------------- | ------------- | ------------- +**color** | **String** | | [optional] +**kind** | **String** | | [optional] +**count** | **num** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/doc/HasOnlyReadOnly.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/HasOnlyReadOnly.md new file mode 100644 index 000000000000..32cae937155d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/HealthCheckResult.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/HealthCheckResult.md new file mode 100644 index 000000000000..4d6aeb75d965 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/MapTest.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/MapTest.md new file mode 100644 index 000000000000..197fe780a25a --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..66d0d39c42be --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/Model200Response.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Model200Response.md new file mode 100644 index 000000000000..e8b088ca1afa --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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] +**classField** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/doc/ModelClient.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/ModelClient.md new file mode 100644 index 000000000000..f7b922f4a398 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/ModelEnumClass.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/ModelEnumClass.md new file mode 100644 index 000000000000..ebaafb44c7f7 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/ModelFile.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/ModelFile.md new file mode 100644 index 000000000000..4be260e93f6e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/ModelList.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/ModelList.md new file mode 100644 index 000000000000..283aa1f6b711 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/ModelReturn.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/ModelReturn.md new file mode 100644 index 000000000000..bc02df7a3692 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/Name.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Name.md new file mode 100644 index 000000000000..25f49ea946b4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/NullableClass.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/NullableClass.md new file mode 100644 index 000000000000..70ac1091d417 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/NumberOnly.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/NumberOnly.md new file mode 100644 index 000000000000..d8096a3db37a --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/ObjectWithDeprecatedFields.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..e0fa7b908d10 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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<Bar>**](Bar.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Order.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Order.md new file mode 100644 index 000000000000..bde5ffe51a2c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/OuterComposite.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/OuterComposite.md new file mode 100644 index 000000000000..04bab7eff5d1 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/OuterEnum.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/OuterEnum.md new file mode 100644 index 000000000000..af62ad87ab2e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/OuterEnumDefaultValue.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..c1bf8b0dec44 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/OuterEnumInteger.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/OuterEnumInteger.md new file mode 100644 index 000000000000..8c80a9e5c85f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/OuterEnumIntegerDefaultValue.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..eb8b55d70249 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/OuterObjectWithEnumProperty.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/OuterObjectWithEnumProperty.md new file mode 100644 index 000000000000..eab2ae8f66b4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/Pasta.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Pasta.md new file mode 100644 index 000000000000..034ff420d323 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/PathApi.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/PathApi.md new file mode 100644 index 000000000000..ae663a2f7f04 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/PathApi.md @@ -0,0 +1,59 @@ +# openapi.api.PathApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testsPathStringPathStringIntegerPathInteger**](PathApi.md#testspathstringpathstringintegerpathinteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) + + +# **testsPathStringPathStringIntegerPathInteger** +> String testsPathStringPathStringIntegerPathInteger(pathString, pathInteger) + +Test path parameter(s) + +Test path parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getPathApi(); +final String pathString = pathString_example; // String | +final int pathInteger = 56; // int | + +try { + final response = api.testsPathStringPathStringIntegerPathInteger(pathString, pathInteger); + print(response); +} catch on DioError (e) { + print('Exception when calling PathApi->testsPathStringPathStringIntegerPathInteger: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pathString** | **String**| | + **pathInteger** | **int**| | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Pet.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Pet.md new file mode 100644 index 000000000000..80414658dc87 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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] +**name** | **String** | | +**category** | [**Category**](Category.md) | | [optional] +**photoUrls** | **List<String>** | | +**tags** | [**List<Tag>**](Tag.md) | | [optional] +**status** | **String** | pet status in the store | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Pizza.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Pizza.md new file mode 100644 index 000000000000..e4b040a6a79c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/PizzaSpeziale.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/PizzaSpeziale.md new file mode 100644 index 000000000000..e1d8434c077d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/PizzaSpeziale.md @@ -0,0 +1,20 @@ +# openapi.model.PizzaSpeziale + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**toppings** | **String** | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible name | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/doc/QueryApi.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/QueryApi.md new file mode 100644 index 000000000000..f92f9532a113 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/QueryApi.md @@ -0,0 +1,149 @@ +# openapi.api.QueryApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testQueryIntegerBooleanString**](QueryApi.md#testqueryintegerbooleanstring) | **GET** /query/integer/boolean/string | Test query parameter(s) +[**testQueryStyleFormExplodeTrueArrayString**](QueryApi.md#testquerystyleformexplodetruearraystring) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) +[**testQueryStyleFormExplodeTrueObject**](QueryApi.md#testquerystyleformexplodetrueobject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) + + +# **testQueryIntegerBooleanString** +> String testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getQueryApi(); +final int integerQuery = 56; // int | +final bool booleanQuery = true; // bool | +final String stringQuery = stringQuery_example; // String | + +try { + final response = api.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery); + print(response); +} catch on DioError (e) { + print('Exception when calling QueryApi->testQueryIntegerBooleanString: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integerQuery** | **int**| | [optional] + **booleanQuery** | **bool**| | [optional] + **stringQuery** | **String**| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testQueryStyleFormExplodeTrueArrayString** +> String testQueryStyleFormExplodeTrueArrayString(queryObject) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getQueryApi(); +final TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject = ; // TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter | + +try { + final response = api.testQueryStyleFormExplodeTrueArrayString(queryObject); + print(response); +} catch on DioError (e) { + print('Exception when calling QueryApi->testQueryStyleFormExplodeTrueArrayString: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](.md)| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testQueryStyleFormExplodeTrueObject** +> String testQueryStyleFormExplodeTrueObject(queryObject) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getQueryApi(); +final Pet queryObject = ; // Pet | + +try { + final response = api.testQueryStyleFormExplodeTrueObject(queryObject); + print(response); +} catch on DioError (e) { + print('Exception when calling QueryApi->testQueryStyleFormExplodeTrueObject: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | [**Pet**](.md)| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/doc/ReadOnlyFirst.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/ReadOnlyFirst.md new file mode 100644 index 000000000000..8f612e8ba19f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/SingleRefType.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/SingleRefType.md new file mode 100644 index 000000000000..0dc93840cd7f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/SpecialModelName.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/SpecialModelName.md new file mode 100644 index 000000000000..5fcfa98e0b36 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/Tag.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/Tag.md new file mode 100644 index 000000000000..c219f987c19c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md new file mode 100644 index 000000000000..8e5541bd1f04 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md @@ -0,0 +1,15 @@ +# openapi.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**values** | **List<String>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/doc/User.md b/samples/client/echo_api/dart/dart-dio-json_serializable/doc/User.md new file mode 100644 index 000000000000..fa87e64d8595 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/lib/openapi.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/openapi.dart new file mode 100644 index 000000000000..dfc13b14b46d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/openapi.dart @@ -0,0 +1,9 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +export 'package:openapi/src/api.dart'; +export 'package:openapi/src/auth/_exports.dart'; + +export 'package:openapi/src/api/_exports.dart'; +export 'package:openapi/src/model/_exports.dart'; diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/api.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/api.dart similarity index 51% rename from samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/api.dart rename to samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/api.dart index 776737680d59..3cdbe7c3b75b 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/api.dart +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/api.dart @@ -3,27 +3,20 @@ // import 'package:dio/dio.dart'; -import 'package:built_value/serializer.dart'; -import 'package:openapi/src/serializers.dart'; -import 'package:openapi/src/auth/api_key_auth.dart'; -import 'package:openapi/src/auth/basic_auth.dart'; -import 'package:openapi/src/auth/bearer_auth.dart'; -import 'package:openapi/src/auth/oauth.dart'; -import 'package:openapi/src/api/default_api.dart'; +import 'package:openapi/src/auth/_exports.dart'; +import 'package:openapi/src/api/body_api.dart'; +import 'package:openapi/src/api/path_api.dart'; +import 'package:openapi/src/api/query_api.dart'; class Openapi { - static const String basePath = r'http://api.example.xyz/v1'; + static const String basePath = r'http://localhost:3000'; final Dio dio; - final Serializers serializers; - Openapi({ Dio? dio, - Serializers? serializers, String? basePathOverride, List? interceptors, - }) : this.serializers = serializers ?? standardSerializers, - this.dio = dio ?? + }) : this.dio = dio ?? Dio(BaseOptions( baseUrl: basePathOverride ?? basePath, connectTimeout: 5000, @@ -43,31 +36,54 @@ class Openapi { 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; + (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; + (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); + (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; + (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, + /// Get BodyApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + BodyApi getBodyApi() { + return BodyApi(dio); + } + + /// Get PathApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + PathApi getPathApi() { + return PathApi(dio); + } + + /// Get QueryApi instance, base route and serializer can be overridden by a given but be careful, /// by doing that all interceptors will not be executed - DefaultApi getDefaultApi() { - return DefaultApi(dio, serializers); + QueryApi getQueryApi() { + return QueryApi(dio); } } diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/api/_exports.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/api/_exports.dart new file mode 100644 index 000000000000..f06d548e0d23 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/api/_exports.dart @@ -0,0 +1,3 @@ +export 'body_api.dart'; +export 'path_api.dart'; +export 'query_api.dart'; diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/api/body_api.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/api/body_api.dart new file mode 100644 index 000000000000..7393d14c3a6b --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/api/body_api.dart @@ -0,0 +1,104 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +//ignore: unused_import +import 'dart:convert'; +import 'package:dio/dio.dart'; +import 'package:openapi/src/deserialize.dart'; + +import 'package:openapi/src/model/pet.dart'; + +class BodyApi { + final Dio _dio; + + const BodyApi(this._dio); + + /// Test body parameter(s) + /// Test body parameter(s) + /// + /// 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] containing a [Response] with a [Pet] as data + /// Throws [DioError] if API call or serialization fails + + Future> testEchoBodyPet({ + Pet? pet, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/echo/body/Pet'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = jsonEncode(pet); + } catch (error, stackTrace) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Pet _responseData; + + try { + _responseData = + deserialize(_response.data!, 'Pet', growable: true); + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + 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/oneof/lib/src/api/default_api.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/api/path_api.dart similarity index 70% rename from samples/openapi3/client/petstore/dart-dio/oneof/lib/src/api/default_api.dart rename to samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/api/path_api.dart index e98b7ae9cae4..214425d7f403 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/api/default_api.dart +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/api/path_api.dart @@ -2,25 +2,22 @@ // AUTO-GENERATED FILE, DO NOT MODIFY! // -import 'dart:async'; - -import 'package:built_value/serializer.dart'; +//ignore: unused_import +import 'dart:convert'; import 'package:dio/dio.dart'; +import 'package:openapi/src/deserialize.dart'; -import 'package:openapi/src/model/fruit.dart'; - -class DefaultApi { - +class PathApi { final Dio _dio; - final Serializers _serializers; - - const DefaultApi(this._dio, this._serializers); + const PathApi(this._dio); - /// rootGet - /// + /// Test path parameter(s) + /// Test path parameter(s) /// /// Parameters: + /// * [pathString] + /// * [pathInteger] /// * [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 @@ -28,9 +25,12 @@ class DefaultApi { /// * [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 + /// Returns a [Future] containing a [Response] with a [String] as data /// Throws [DioError] if API call or serialization fails - Future> rootGet({ + + Future> testsPathStringPathStringIntegerPathInteger({ + required String pathString, + required int pathInteger, CancelToken? cancelToken, Map? headers, Map? extra, @@ -38,7 +38,9 @@ class DefaultApi { ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { - final _path = r'/'; + final _path = r'/path/string/{path_string}/integer/{path_integer}' + .replaceAll('{' r'path_string' '}', pathString.toString()) + .replaceAll('{' r'path_integer' '}', pathInteger.toString()); final _options = Options( method: r'GET', headers: { @@ -59,15 +61,11 @@ class DefaultApi { onReceiveProgress: onReceiveProgress, ); - Fruit _responseData; + String _responseData; try { - const _responseType = FullType(Fruit); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, - ) as Fruit; - + _responseData = deserialize(_response.data!, 'String', + growable: true); } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, @@ -77,7 +75,7 @@ class DefaultApi { )..stackTrace = stackTrace; } - return Response( + return Response( data: _responseData, headers: _response.headers, isRedirect: _response.isRedirect, @@ -88,5 +86,4 @@ class DefaultApi { extra: _response.extra, ); } - } diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/api/query_api.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/api/query_api.dart new file mode 100644 index 000000000000..2d552eba310c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/api/query_api.dart @@ -0,0 +1,251 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +//ignore: unused_import +import 'dart:convert'; +import 'package:dio/dio.dart'; +import 'package:openapi/src/deserialize.dart'; + +import 'package:openapi/src/model/pet.dart'; +import 'package:openapi/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart'; + +class QueryApi { + final Dio _dio; + + const QueryApi(this._dio); + + /// Test query parameter(s) + /// Test query parameter(s) + /// + /// Parameters: + /// * [integerQuery] + /// * [booleanQuery] + /// * [stringQuery] + /// * [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 [DioError] if API call or serialization fails + + Future> testQueryIntegerBooleanString({ + int? integerQuery, + bool? booleanQuery, + String? stringQuery, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/query/integer/boolean/string'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (integerQuery != null) r'integer_query': integerQuery, + if (booleanQuery != null) r'boolean_query': booleanQuery, + if (stringQuery != null) r'string_query': stringQuery, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + String _responseData; + + try { + _responseData = deserialize(_response.data!, 'String', + growable: true); + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + 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 query parameter(s) + /// Test query parameter(s) + /// + /// Parameters: + /// * [queryObject] + /// * [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 [DioError] if API call or serialization fails + + Future> testQueryStyleFormExplodeTrueArrayString({ + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? queryObject, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/query/style_form/explode_true/array_string'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (queryObject != null) r'query_object': queryObject, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + String _responseData; + + try { + _responseData = deserialize(_response.data!, 'String', + growable: true); + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + 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 query parameter(s) + /// Test query parameter(s) + /// + /// Parameters: + /// * [queryObject] + /// * [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 [DioError] if API call or serialization fails + + Future> testQueryStyleFormExplodeTrueObject({ + Pet? queryObject, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/query/style_form/explode_true/object'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (queryObject != null) r'query_object': queryObject, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + String _responseData; + + try { + _responseData = deserialize(_response.data!, 'String', + growable: true); + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + 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/client/echo_api/dart/dart-dio-json_serializable/lib/src/api_util.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/api_util.dart new file mode 100644 index 000000000000..de0c8e46ea32 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/api_util.dart @@ -0,0 +1,8 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:convert'; +import 'dart:typed_data'; + +import 'package:dio/dio.dart'; diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/auth/_exports.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/auth/_exports.dart new file mode 100644 index 000000000000..01c9ad2dfa7e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/auth/_exports.dart @@ -0,0 +1,9 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +export 'api_key_auth.dart'; +export 'auth.dart'; +export 'basic_auth.dart'; +export 'bearer_auth.dart'; +export 'oauth.dart'; diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/auth/api_key_auth.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/auth/api_key_auth.dart similarity index 85% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/auth/api_key_auth.dart rename to samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/auth/api_key_auth.dart index ee16e3f0f92f..c67c514ee94e 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/auth/api_key_auth.dart +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/auth/api_key_auth.dart @@ -2,16 +2,16 @@ // AUTO-GENERATED FILE, DO NOT MODIFY! // - import 'package:dio/dio.dart'; -import 'package:openapi/src/auth/auth.dart'; +import 'auth.dart'; class ApiKeyAuthInterceptor extends AuthInterceptor { final Map apiKeys = {}; @override void onRequest(RequestOptions options, RequestInterceptorHandler handler) { - final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'apiKey'); + 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; diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/auth/auth.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/auth/auth.dart similarity index 80% rename from samples/openapi3/client/petstore/dart-dio/oneof/lib/src/auth/auth.dart rename to samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/auth/auth.dart index f7ae9bf3f11e..c6fcca595cb3 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/auth/auth.dart +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/auth/auth.dart @@ -8,7 +8,8 @@ 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) { + 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(); diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/auth/basic_auth.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/auth/basic_auth.dart similarity index 68% rename from samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/auth/basic_auth.dart rename to samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/auth/basic_auth.dart index b6e6dce04f9c..6cea35ca3665 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/auth/basic_auth.dart +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/auth/basic_auth.dart @@ -5,7 +5,7 @@ import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:openapi/src/auth/auth.dart'; +import 'auth.dart'; class BasicAuthInfo { final String username; @@ -22,12 +22,17 @@ class BasicAuthInterceptor extends AuthInterceptor { RequestOptions options, RequestInterceptorHandler handler, ) { - final metadataAuthInfo = getAuthInfo(options, (secure) => (secure['type'] == 'http' && secure['scheme'] == 'basic') || secure['type'] == 'basic'); + final metadataAuthInfo = getAuthInfo( + options, + (secure) => + (secure['type'] == 'http' && secure['scheme'] == 'basic') || + secure['type'] == 'basic'); for (final info in metadataAuthInfo) { final authName = info['name'] as String; final basicAuthInfo = authInfo[authName]; if (basicAuthInfo != null) { - final basicAuth = 'Basic ${base64Encode(utf8.encode('${basicAuthInfo.username}:${basicAuthInfo.password}'))}'; + final basicAuth = + 'Basic ${base64Encode(utf8.encode('${basicAuthInfo.username}:${basicAuthInfo.password}'))}'; options.headers['Authorization'] = basicAuth; break; } diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/auth/bearer_auth.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/auth/bearer_auth.dart similarity index 76% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/auth/bearer_auth.dart rename to samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/auth/bearer_auth.dart index 1d4402b376c0..38729451f23e 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/auth/bearer_auth.dart +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/auth/bearer_auth.dart @@ -3,7 +3,7 @@ // import 'package:dio/dio.dart'; -import 'package:openapi/src/auth/auth.dart'; +import 'auth.dart'; class BearerAuthInterceptor extends AuthInterceptor { final Map tokens = {}; @@ -13,7 +13,8 @@ class BearerAuthInterceptor extends AuthInterceptor { RequestOptions options, RequestInterceptorHandler handler, ) { - final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'http' && secure['scheme'] == 'bearer'); + final authInfo = getAuthInfo(options, + (secure) => secure['type'] == 'http' && secure['scheme'] == 'bearer'); for (final info in authInfo) { final token = tokens[info['name']]; if (token != null) { diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/auth/oauth.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/auth/oauth.dart similarity index 76% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/auth/oauth.dart rename to samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/auth/oauth.dart index 337cf762b0ce..54aa4706ef69 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/auth/oauth.dart +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/auth/oauth.dart @@ -3,7 +3,7 @@ // import 'package:dio/dio.dart'; -import 'package:openapi/src/auth/auth.dart'; +import 'auth.dart'; class OAuthInterceptor extends AuthInterceptor { final Map tokens = {}; @@ -13,7 +13,8 @@ class OAuthInterceptor extends AuthInterceptor { RequestOptions options, RequestInterceptorHandler handler, ) { - final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'oauth' || secure['type'] == 'oauth2'); + final authInfo = getAuthInfo(options, + (secure) => secure['type'] == 'oauth' || secure['type'] == 'oauth2'); for (final info in authInfo) { final token = tokens[info['name']]; if (token != null) { diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/deserialize.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/deserialize.dart new file mode 100644 index 000000000000..929f58eb4909 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/deserialize.dart @@ -0,0 +1,269 @@ +import 'package:openapi/src/model/additional_properties_class.dart'; +import 'package:openapi/src/model/addressable.dart'; +import 'package:openapi/src/model/all_of_with_single_ref.dart'; +import 'package:openapi/src/model/animal.dart'; +import 'package:openapi/src/model/api_response.dart'; +import 'package:openapi/src/model/apple.dart'; +import 'package:openapi/src/model/array_of_array_of_number_only.dart'; +import 'package:openapi/src/model/array_of_number_only.dart'; +import 'package:openapi/src/model/array_test.dart'; +import 'package:openapi/src/model/banana.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:openapi/src/model/bar_create.dart'; +import 'package:openapi/src/model/bar_ref.dart'; +import 'package:openapi/src/model/bar_ref_or_value.dart'; +import 'package:openapi/src/model/capitalization.dart'; +import 'package:openapi/src/model/cat.dart'; +import 'package:openapi/src/model/cat_all_of.dart'; +import 'package:openapi/src/model/category.dart'; +import 'package:openapi/src/model/child.dart'; +import 'package:openapi/src/model/class_model.dart'; +import 'package:openapi/src/model/deprecated_object.dart'; +import 'package:openapi/src/model/dog.dart'; +import 'package:openapi/src/model/dog_all_of.dart'; +import 'package:openapi/src/model/entity.dart'; +import 'package:openapi/src/model/entity_ref.dart'; +import 'package:openapi/src/model/enum_arrays.dart'; +import 'package:openapi/src/model/enum_test.dart'; +import 'package:openapi/src/model/example.dart'; +import 'package:openapi/src/model/example_non_primitive.dart'; +import 'package:openapi/src/model/extensible.dart'; +import 'package:openapi/src/model/file_schema_test_class.dart'; +import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/foo_ref.dart'; +import 'package:openapi/src/model/foo_ref_or_value.dart'; +import 'package:openapi/src/model/format_test.dart'; +import 'package:openapi/src/model/fruit.dart'; +import 'package:openapi/src/model/has_only_read_only.dart'; +import 'package:openapi/src/model/health_check_result.dart'; +import 'package:openapi/src/model/map_test.dart'; +import 'package:openapi/src/model/mixed_properties_and_additional_properties_class.dart'; +import 'package:openapi/src/model/model200_response.dart'; +import 'package:openapi/src/model/model_client.dart'; +import 'package:openapi/src/model/model_file.dart'; +import 'package:openapi/src/model/model_list.dart'; +import 'package:openapi/src/model/model_return.dart'; +import 'package:openapi/src/model/name.dart'; +import 'package:openapi/src/model/nullable_class.dart'; +import 'package:openapi/src/model/number_only.dart'; +import 'package:openapi/src/model/object_with_deprecated_fields.dart'; +import 'package:openapi/src/model/order.dart'; +import 'package:openapi/src/model/outer_composite.dart'; +import 'package:openapi/src/model/outer_object_with_enum_property.dart'; +import 'package:openapi/src/model/pasta.dart'; +import 'package:openapi/src/model/pet.dart'; +import 'package:openapi/src/model/pizza.dart'; +import 'package:openapi/src/model/pizza_speziale.dart'; +import 'package:openapi/src/model/read_only_first.dart'; +import 'package:openapi/src/model/special_model_name.dart'; +import 'package:openapi/src/model/tag.dart'; +import 'package:openapi/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart'; +import 'package:openapi/src/model/user.dart'; + +final _regList = RegExp(r'^List<(.*)>$'); +final _regSet = RegExp(r'^Set<(.*)>$'); +final _regMap = RegExp(r'^Map$'); + +ReturnType deserialize(dynamic value, String targetType, + {bool growable = true}) { + switch (targetType) { + case 'String': + return '$value' as ReturnType; + case 'int': + return (value is int ? value : int.parse('$value')) as ReturnType; + case 'bool': + if (value is bool) { + return value as ReturnType; + } + final valueString = '$value'.toLowerCase(); + return (valueString == 'true' || valueString == '1') as ReturnType; + case 'double': + return (value is double ? value : double.parse('$value')) as ReturnType; + case 'AdditionalPropertiesClass': + return AdditionalPropertiesClass.fromJson(value as Map) + as ReturnType; + case 'Addressable': + return Addressable.fromJson(value as Map) as ReturnType; + case 'AllOfWithSingleRef': + return AllOfWithSingleRef.fromJson(value as Map) + as ReturnType; + case 'Animal': + return Animal.fromJson(value as Map) as ReturnType; + case 'ApiResponse': + return ApiResponse.fromJson(value as Map) as ReturnType; + case 'Apple': + return Apple.fromJson(value as Map) as ReturnType; + case 'ArrayOfArrayOfNumberOnly': + return ArrayOfArrayOfNumberOnly.fromJson(value as Map) + as ReturnType; + case 'ArrayOfNumberOnly': + return ArrayOfNumberOnly.fromJson(value as Map) + as ReturnType; + case 'ArrayTest': + return ArrayTest.fromJson(value as Map) as ReturnType; + case 'Banana': + return Banana.fromJson(value as Map) as ReturnType; + case 'Bar': + return Bar.fromJson(value as Map) as ReturnType; + case 'BarCreate': + return BarCreate.fromJson(value as Map) as ReturnType; + case 'BarRef': + return BarRef.fromJson(value as Map) as ReturnType; + case 'BarRefOrValue': + return BarRefOrValue.fromJson(value as Map) + as ReturnType; + case 'Capitalization': + return Capitalization.fromJson(value as Map) + as ReturnType; + case 'Cat': + return Cat.fromJson(value as Map) as ReturnType; + case 'CatAllOf': + return CatAllOf.fromJson(value as Map) as ReturnType; + case 'Category': + return Category.fromJson(value as Map) as ReturnType; + case 'Child': + return Child.fromJson(value as Map) as ReturnType; + case 'ClassModel': + return ClassModel.fromJson(value as Map) as ReturnType; + case 'DeprecatedObject': + return DeprecatedObject.fromJson(value as Map) + as ReturnType; + case 'Dog': + return Dog.fromJson(value as Map) as ReturnType; + case 'DogAllOf': + return DogAllOf.fromJson(value as Map) as ReturnType; + case 'Entity': + return Entity.fromJson(value as Map) as ReturnType; + case 'EntityRef': + return EntityRef.fromJson(value as Map) as ReturnType; + case 'EnumArrays': + return EnumArrays.fromJson(value as Map) as ReturnType; + case 'EnumTest': + return EnumTest.fromJson(value as Map) as ReturnType; + case 'Example': + return Example.fromJson(value as Map) as ReturnType; + case 'ExampleNonPrimitive': + return ExampleNonPrimitive.fromJson(value as Map) + as ReturnType; + case 'Extensible': + return Extensible.fromJson(value as Map) as ReturnType; + case 'FileSchemaTestClass': + return FileSchemaTestClass.fromJson(value as Map) + as ReturnType; + case 'Foo': + return Foo.fromJson(value as Map) as ReturnType; + case 'FooRef': + return FooRef.fromJson(value as Map) as ReturnType; + case 'FooRefOrValue': + return FooRefOrValue.fromJson(value as Map) + as ReturnType; + case 'FormatTest': + return FormatTest.fromJson(value as Map) as ReturnType; + case 'Fruit': + return Fruit.fromJson(value as Map) as ReturnType; + case 'HasOnlyReadOnly': + return HasOnlyReadOnly.fromJson(value as Map) + as ReturnType; + case 'HealthCheckResult': + return HealthCheckResult.fromJson(value as Map) + as ReturnType; + case 'MapTest': + return MapTest.fromJson(value as Map) as ReturnType; + case 'MixedPropertiesAndAdditionalPropertiesClass': + return MixedPropertiesAndAdditionalPropertiesClass.fromJson( + value as Map) as ReturnType; + case 'Model200Response': + return Model200Response.fromJson(value as Map) + as ReturnType; + case 'ModelClient': + return ModelClient.fromJson(value as Map) as ReturnType; + case 'ModelEnumClass': + + case 'ModelFile': + return ModelFile.fromJson(value as Map) as ReturnType; + case 'ModelList': + return ModelList.fromJson(value as Map) as ReturnType; + case 'ModelReturn': + return ModelReturn.fromJson(value as Map) as ReturnType; + case 'Name': + return Name.fromJson(value as Map) as ReturnType; + case 'NullableClass': + return NullableClass.fromJson(value as Map) + as ReturnType; + case 'NumberOnly': + return NumberOnly.fromJson(value as Map) as ReturnType; + case 'ObjectWithDeprecatedFields': + return ObjectWithDeprecatedFields.fromJson(value as Map) + as ReturnType; + case 'Order': + return Order.fromJson(value as Map) as ReturnType; + case 'OuterComposite': + return OuterComposite.fromJson(value as Map) + as ReturnType; + case 'OuterEnum': + + case 'OuterEnumDefaultValue': + + case 'OuterEnumInteger': + + case 'OuterEnumIntegerDefaultValue': + + case 'OuterObjectWithEnumProperty': + return OuterObjectWithEnumProperty.fromJson(value as Map) + as ReturnType; + case 'Pasta': + return Pasta.fromJson(value as Map) as ReturnType; + case 'Pet': + return Pet.fromJson(value as Map) as ReturnType; + case 'Pizza': + return Pizza.fromJson(value as Map) as ReturnType; + case 'PizzaSpeziale': + return PizzaSpeziale.fromJson(value as Map) + as ReturnType; + case 'ReadOnlyFirst': + return ReadOnlyFirst.fromJson(value as Map) + as ReturnType; + case 'SingleRefType': + + case 'SpecialModelName': + return SpecialModelName.fromJson(value as Map) + as ReturnType; + case 'Tag': + return Tag.fromJson(value as Map) as ReturnType; + case 'TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter': + return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + .fromJson(value as Map) as ReturnType; + case 'User': + return User.fromJson(value as Map) as ReturnType; + default: + RegExpMatch? match; + + if (value is List && (match = _regList.firstMatch(targetType)) != null) { + targetType = match![1]!; // ignore: parameter_assignments + return value + .map((dynamic v) => deserialize( + v, targetType, + growable: growable)) + .toList(growable: growable) as ReturnType; + } + if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { + targetType = match![1]!; // ignore: parameter_assignments + return value + .map((dynamic v) => deserialize( + v, targetType, + growable: growable)) + .toSet() as ReturnType; + } + if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { + targetType = match![1]!; // ignore: parameter_assignments + return Map.fromIterables( + value.keys, + value.values.map((dynamic v) => deserialize( + v, targetType, + growable: growable)), + ) as ReturnType; + } + break; + } + throw Exception('Cannot deserialize'); +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/_exports.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/_exports.dart new file mode 100644 index 000000000000..43ed998d2fd8 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/_exports.dart @@ -0,0 +1,67 @@ +export 'additional_properties_class.dart'; +export 'addressable.dart'; +export 'all_of_with_single_ref.dart'; +export 'animal.dart'; +export 'api_response.dart'; +export 'apple.dart'; +export 'array_of_array_of_number_only.dart'; +export 'array_of_number_only.dart'; +export 'array_test.dart'; +export 'banana.dart'; +export 'bar.dart'; +export 'bar_create.dart'; +export 'bar_ref.dart'; +export 'bar_ref_or_value.dart'; +export 'capitalization.dart'; +export 'cat.dart'; +export 'cat_all_of.dart'; +export 'category.dart'; +export 'child.dart'; +export 'class_model.dart'; +export 'deprecated_object.dart'; +export 'dog.dart'; +export 'dog_all_of.dart'; +export 'entity.dart'; +export 'entity_ref.dart'; +export 'enum_arrays.dart'; +export 'enum_test.dart'; +export 'example.dart'; +export 'example_non_primitive.dart'; +export 'extensible.dart'; +export 'file_schema_test_class.dart'; +export 'foo.dart'; +export 'foo_ref.dart'; +export 'foo_ref_or_value.dart'; +export 'format_test.dart'; +export 'fruit.dart'; +export 'has_only_read_only.dart'; +export 'health_check_result.dart'; +export 'map_test.dart'; +export 'mixed_properties_and_additional_properties_class.dart'; +export 'model200_response.dart'; +export 'model_client.dart'; +export 'model_enum_class.dart'; +export 'model_file.dart'; +export 'model_list.dart'; +export 'model_return.dart'; +export 'name.dart'; +export 'nullable_class.dart'; +export 'number_only.dart'; +export 'object_with_deprecated_fields.dart'; +export 'order.dart'; +export 'outer_composite.dart'; +export 'outer_enum.dart'; +export 'outer_enum_default_value.dart'; +export 'outer_enum_integer.dart'; +export 'outer_enum_integer_default_value.dart'; +export 'outer_object_with_enum_property.dart'; +export 'pasta.dart'; +export 'pet.dart'; +export 'pizza.dart'; +export 'pizza_speziale.dart'; +export 'read_only_first.dart'; +export 'single_ref_type.dart'; +export 'special_model_name.dart'; +export 'tag.dart'; +export 'test_query_style_form_explode_true_array_string_query_object_parameter.dart'; +export 'user.dart'; diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/additional_properties_class.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/additional_properties_class.dart new file mode 100644 index 000000000000..52aae4f3674b --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/additional_properties_class.dart @@ -0,0 +1,48 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'additional_properties_class.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class AdditionalPropertiesClass { + /// Returns a new [AdditionalPropertiesClass] instance. + AdditionalPropertiesClass({ + this.mapProperty, + this.mapOfMapProperty, + }); + + @JsonKey(name: r'map_property', required: false, includeIfNull: false) + final Map? mapProperty; + + @JsonKey(name: r'map_of_map_property', required: false, includeIfNull: false) + final Map>? mapOfMapProperty; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AdditionalPropertiesClass && + other.mapProperty == mapProperty && + other.mapOfMapProperty == mapOfMapProperty; + + @override + int get hashCode => mapProperty.hashCode + mapOfMapProperty.hashCode; + + factory AdditionalPropertiesClass.fromJson(Map json) => + _$AdditionalPropertiesClassFromJson(json); + + Map toJson() => _$AdditionalPropertiesClassToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/addressable.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/addressable.dart new file mode 100644 index 000000000000..1558e6f5e9dc --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/addressable.dart @@ -0,0 +1,48 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'addressable.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Addressable { + /// Returns a new [Addressable] instance. + Addressable({ + this.href, + this.id, + }); + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Addressable && other.href == href && other.id == id; + + @override + int get hashCode => href.hashCode + id.hashCode; + + factory Addressable.fromJson(Map json) => + _$AddressableFromJson(json); + + Map toJson() => _$AddressableToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/all_of_with_single_ref.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/all_of_with_single_ref.dart new file mode 100644 index 000000000000..9fec7e666068 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/all_of_with_single_ref.dart @@ -0,0 +1,49 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/single_ref_type.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'all_of_with_single_ref.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class AllOfWithSingleRef { + /// Returns a new [AllOfWithSingleRef] instance. + AllOfWithSingleRef({ + this.username, + this.singleRefType, + }); + + @JsonKey(name: r'username', required: false, includeIfNull: false) + final String? username; + + @JsonKey(name: r'SingleRefType', required: false, includeIfNull: false) + final SingleRefType? singleRefType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AllOfWithSingleRef && + other.username == username && + other.singleRefType == singleRefType; + + @override + int get hashCode => username.hashCode + singleRefType.hashCode; + + factory AllOfWithSingleRef.fromJson(Map json) => + _$AllOfWithSingleRefFromJson(json); + + Map toJson() => _$AllOfWithSingleRefToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/animal.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/animal.dart new file mode 100644 index 000000000000..464ac70be575 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/animal.dart @@ -0,0 +1,49 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'animal.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Animal { + /// Returns a new [Animal] instance. + Animal({ + required this.className, + this.color = 'red', + }); + + @JsonKey(name: r'className', required: true, includeIfNull: false) + final String className; + + @JsonKey( + defaultValue: 'red', + name: r'color', + required: false, + includeIfNull: false) + final String? color; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Animal && other.className == className && other.color == color; + + @override + int get hashCode => className.hashCode + color.hashCode; + + factory Animal.fromJson(Map json) => _$AnimalFromJson(json); + + Map toJson() => _$AnimalToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/api_response.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/api_response.dart new file mode 100644 index 000000000000..df7b51101d80 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/api_response.dart @@ -0,0 +1,53 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'api_response.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ApiResponse { + /// Returns a new [ApiResponse] instance. + ApiResponse({ + this.code, + this.type, + this.message, + }); + + @JsonKey(name: r'code', required: false, includeIfNull: false) + final int? code; + + @JsonKey(name: r'type', required: false, includeIfNull: false) + final String? type; + + @JsonKey(name: r'message', required: false, includeIfNull: false) + final String? message; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ApiResponse && + other.code == code && + other.type == type && + other.message == message; + + @override + int get hashCode => code.hashCode + type.hashCode + message.hashCode; + + factory ApiResponse.fromJson(Map json) => + _$ApiResponseFromJson(json); + + Map toJson() => _$ApiResponseToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/apple.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/apple.dart new file mode 100644 index 000000000000..81be695b9bba --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/apple.dart @@ -0,0 +1,40 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'apple.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Apple { + /// Returns a new [Apple] instance. + Apple({ + this.kind, + }); + + @JsonKey(name: r'kind', required: false, includeIfNull: false) + final String? kind; + + @override + bool operator ==(Object other) => + identical(this, other) || other is Apple && other.kind == kind; + + @override + int get hashCode => kind.hashCode; + + factory Apple.fromJson(Map json) => _$AppleFromJson(json); + + Map toJson() => _$AppleToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/array_of_array_of_number_only.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/array_of_array_of_number_only.dart new file mode 100644 index 000000000000..879bd5274b61 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/array_of_array_of_number_only.dart @@ -0,0 +1,43 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'array_of_array_of_number_only.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ArrayOfArrayOfNumberOnly { + /// Returns a new [ArrayOfArrayOfNumberOnly] instance. + ArrayOfArrayOfNumberOnly({ + this.arrayArrayNumber, + }); + + @JsonKey(name: r'ArrayArrayNumber', required: false, includeIfNull: false) + final List>? arrayArrayNumber; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ArrayOfArrayOfNumberOnly && + other.arrayArrayNumber == arrayArrayNumber; + + @override + int get hashCode => arrayArrayNumber.hashCode; + + factory ArrayOfArrayOfNumberOnly.fromJson(Map json) => + _$ArrayOfArrayOfNumberOnlyFromJson(json); + + Map toJson() => _$ArrayOfArrayOfNumberOnlyToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/array_of_number_only.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/array_of_number_only.dart new file mode 100644 index 000000000000..a1dea32fe74d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/array_of_number_only.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'array_of_number_only.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ArrayOfNumberOnly { + /// Returns a new [ArrayOfNumberOnly] instance. + ArrayOfNumberOnly({ + this.arrayNumber, + }); + + @JsonKey(name: r'ArrayNumber', required: false, includeIfNull: false) + final List? arrayNumber; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ArrayOfNumberOnly && other.arrayNumber == arrayNumber; + + @override + int get hashCode => arrayNumber.hashCode; + + factory ArrayOfNumberOnly.fromJson(Map json) => + _$ArrayOfNumberOnlyFromJson(json); + + Map toJson() => _$ArrayOfNumberOnlyToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/array_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/array_test.dart new file mode 100644 index 000000000000..bc0f83a42051 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/array_test.dart @@ -0,0 +1,58 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/read_only_first.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'array_test.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ArrayTest { + /// Returns a new [ArrayTest] instance. + ArrayTest({ + this.arrayOfString, + this.arrayArrayOfInteger, + this.arrayArrayOfModel, + }); + + @JsonKey(name: r'array_of_string', required: false, includeIfNull: false) + final List? arrayOfString; + + @JsonKey( + name: r'array_array_of_integer', required: false, includeIfNull: false) + final List>? arrayArrayOfInteger; + + @JsonKey(name: r'array_array_of_model', required: false, includeIfNull: false) + final List>? arrayArrayOfModel; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ArrayTest && + other.arrayOfString == arrayOfString && + other.arrayArrayOfInteger == arrayArrayOfInteger && + other.arrayArrayOfModel == arrayArrayOfModel; + + @override + int get hashCode => + arrayOfString.hashCode + + arrayArrayOfInteger.hashCode + + arrayArrayOfModel.hashCode; + + factory ArrayTest.fromJson(Map json) => + _$ArrayTestFromJson(json); + + Map toJson() => _$ArrayTestToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/banana.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/banana.dart new file mode 100644 index 000000000000..41fbfb80acc1 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/banana.dart @@ -0,0 +1,40 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'banana.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Banana { + /// Returns a new [Banana] instance. + Banana({ + this.count, + }); + + @JsonKey(name: r'count', required: false, includeIfNull: false) + final num? count; + + @override + bool operator ==(Object other) => + identical(this, other) || other is Banana && other.count == count; + + @override + int get hashCode => count.hashCode; + + factory Banana.fromJson(Map json) => _$BananaFromJson(json); + + Map toJson() => _$BananaToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/bar.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/bar.dart new file mode 100644 index 000000000000..39a28a166b7f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/bar.dart @@ -0,0 +1,93 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/foo_ref_or_value.dart'; +import 'package:openapi/src/model/entity.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'bar.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Bar { + /// Returns a new [Bar] instance. + Bar({ + required this.id, + this.barPropA, + this.fooPropB, + this.foo, + this.href, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + @JsonKey(name: r'id', required: true, includeIfNull: false) + final String id; + + @JsonKey(name: r'barPropA', required: false, includeIfNull: false) + final String? barPropA; + + @JsonKey(name: r'fooPropB', required: false, includeIfNull: false) + final String? fooPropB; + + @JsonKey(name: r'foo', required: false, includeIfNull: false) + final FooRefOrValue? foo; + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Bar && + other.id == id && + other.barPropA == barPropA && + other.fooPropB == fooPropB && + other.foo == foo && + other.href == href && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + id.hashCode + + barPropA.hashCode + + fooPropB.hashCode + + foo.hashCode + + href.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory Bar.fromJson(Map json) => _$BarFromJson(json); + + Map toJson() => _$BarToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/bar_create.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/bar_create.dart new file mode 100644 index 000000000000..69f8c91e9158 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/bar_create.dart @@ -0,0 +1,95 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/foo_ref_or_value.dart'; +import 'package:openapi/src/model/entity.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'bar_create.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class BarCreate { + /// Returns a new [BarCreate] instance. + BarCreate({ + this.barPropA, + this.fooPropB, + this.foo, + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + @JsonKey(name: r'barPropA', required: false, includeIfNull: false) + final String? barPropA; + + @JsonKey(name: r'fooPropB', required: false, includeIfNull: false) + final String? fooPropB; + + @JsonKey(name: r'foo', required: false, includeIfNull: false) + final FooRefOrValue? foo; + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is BarCreate && + other.barPropA == barPropA && + other.fooPropB == fooPropB && + other.foo == foo && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + barPropA.hashCode + + fooPropB.hashCode + + foo.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory BarCreate.fromJson(Map json) => + _$BarCreateFromJson(json); + + Map toJson() => _$BarCreateToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/bar_ref.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/bar_ref.dart new file mode 100644 index 000000000000..441f1475ed91 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/bar_ref.dart @@ -0,0 +1,75 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity_ref.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'bar_ref.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class BarRef { + /// Returns a new [BarRef] instance. + BarRef({ + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is BarRef && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory BarRef.fromJson(Map json) => _$BarRefFromJson(json); + + Map toJson() => _$BarRefToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/bar_ref_or_value.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/bar_ref_or_value.dart new file mode 100644 index 000000000000..2a31af86fb87 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/bar_ref_or_value.dart @@ -0,0 +1,75 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/bar_ref.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'bar_ref_or_value.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class BarRefOrValue { + /// Returns a new [BarRefOrValue] instance. + BarRefOrValue({ + this.href, + required this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: true, includeIfNull: false) + final String id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is BarRefOrValue && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory BarRefOrValue.fromJson(Map json) => + _$BarRefOrValueFromJson(json); + + Map toJson() => _$BarRefOrValueToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/capitalization.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/capitalization.dart new file mode 100644 index 000000000000..dc4ed957e2a0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/capitalization.dart @@ -0,0 +1,75 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'capitalization.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Capitalization { + /// Returns a new [Capitalization] instance. + Capitalization({ + this.smallCamel, + this.capitalCamel, + this.smallSnake, + this.capitalSnake, + this.sCAETHFlowPoints, + this.ATT_NAME, + }); + + @JsonKey(name: r'smallCamel', required: false, includeIfNull: false) + final String? smallCamel; + + @JsonKey(name: r'CapitalCamel', required: false, includeIfNull: false) + final String? capitalCamel; + + @JsonKey(name: r'small_Snake', required: false, includeIfNull: false) + final String? smallSnake; + + @JsonKey(name: r'Capital_Snake', required: false, includeIfNull: false) + final String? capitalSnake; + + @JsonKey(name: r'SCA_ETH_Flow_Points', required: false, includeIfNull: false) + final String? sCAETHFlowPoints; + + /// Name of the pet + @JsonKey(name: r'ATT_NAME', required: false, includeIfNull: false) + final String? ATT_NAME; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Capitalization && + other.smallCamel == smallCamel && + other.capitalCamel == capitalCamel && + other.smallSnake == smallSnake && + other.capitalSnake == capitalSnake && + other.sCAETHFlowPoints == sCAETHFlowPoints && + other.ATT_NAME == ATT_NAME; + + @override + int get hashCode => + smallCamel.hashCode + + capitalCamel.hashCode + + smallSnake.hashCode + + capitalSnake.hashCode + + sCAETHFlowPoints.hashCode + + ATT_NAME.hashCode; + + factory Capitalization.fromJson(Map json) => + _$CapitalizationFromJson(json); + + Map toJson() => _$CapitalizationToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/cat.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/cat.dart new file mode 100644 index 000000000000..8e0612fb641a --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/cat.dart @@ -0,0 +1,59 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/animal.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'cat.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Cat { + /// Returns a new [Cat] instance. + Cat({ + required this.className, + this.color = 'red', + this.declawed, + }); + + @JsonKey(name: r'className', required: true, includeIfNull: false) + final String className; + + @JsonKey( + defaultValue: 'red', + name: r'color', + required: false, + includeIfNull: false) + final String? color; + + @JsonKey(name: r'declawed', required: false, includeIfNull: false) + final bool? declawed; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Cat && + other.className == className && + other.color == color && + other.declawed == declawed; + + @override + int get hashCode => className.hashCode + color.hashCode + declawed.hashCode; + + factory Cat.fromJson(Map json) => _$CatFromJson(json); + + Map toJson() => _$CatToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/cat_all_of.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/cat_all_of.dart new file mode 100644 index 000000000000..af380b83994a --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/cat_all_of.dart @@ -0,0 +1,41 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'cat_all_of.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class CatAllOf { + /// Returns a new [CatAllOf] instance. + CatAllOf({ + this.declawed, + }); + + @JsonKey(name: r'declawed', required: false, includeIfNull: false) + final bool? declawed; + + @override + bool operator ==(Object other) => + identical(this, other) || other is CatAllOf && other.declawed == declawed; + + @override + int get hashCode => declawed.hashCode; + + factory CatAllOf.fromJson(Map json) => + _$CatAllOfFromJson(json); + + Map toJson() => _$CatAllOfToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/category.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/category.dart new file mode 100644 index 000000000000..287b7ee8011d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/category.dart @@ -0,0 +1,46 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'category.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Category { + /// Returns a new [Category] instance. + Category({ + this.id, + this.name, + }); + + @JsonKey(name: r'id', required: false, includeIfNull: false) + final int? id; + + @JsonKey(name: r'name', required: false, includeIfNull: false) + final String? name; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Category && other.id == id && other.name == name; + + @override + int get hashCode => id.hashCode + name.hashCode; + + factory Category.fromJson(Map json) => + _$CategoryFromJson(json); + + Map toJson() => _$CategoryToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/child.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/child.dart new file mode 100644 index 000000000000..c01536e49b2c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/child.dart @@ -0,0 +1,40 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'child.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Child { + /// Returns a new [Child] instance. + Child({ + this.name, + }); + + @JsonKey(name: r'name', required: false, includeIfNull: false) + final String? name; + + @override + bool operator ==(Object other) => + identical(this, other) || other is Child && other.name == name; + + @override + int get hashCode => name.hashCode; + + factory Child.fromJson(Map json) => _$ChildFromJson(json); + + Map toJson() => _$ChildToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/class_model.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/class_model.dart new file mode 100644 index 000000000000..c12e08bda2d7 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/class_model.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'class_model.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ClassModel { + /// Returns a new [ClassModel] instance. + ClassModel({ + this.classField, + }); + + @JsonKey(name: r'_class', required: false, includeIfNull: false) + final String? classField; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ClassModel && other.classField == classField; + + @override + int get hashCode => classField.hashCode; + + factory ClassModel.fromJson(Map json) => + _$ClassModelFromJson(json); + + Map toJson() => _$ClassModelToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/deprecated_object.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/deprecated_object.dart new file mode 100644 index 000000000000..5c32ad349f23 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/deprecated_object.dart @@ -0,0 +1,41 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'deprecated_object.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class DeprecatedObject { + /// Returns a new [DeprecatedObject] instance. + DeprecatedObject({ + this.name, + }); + + @JsonKey(name: r'name', required: false, includeIfNull: false) + final String? name; + + @override + bool operator ==(Object other) => + identical(this, other) || other is DeprecatedObject && other.name == name; + + @override + int get hashCode => name.hashCode; + + factory DeprecatedObject.fromJson(Map json) => + _$DeprecatedObjectFromJson(json); + + Map toJson() => _$DeprecatedObjectToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/dog.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/dog.dart new file mode 100644 index 000000000000..394340b11eb9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/dog.dart @@ -0,0 +1,59 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/animal.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'dog.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Dog { + /// Returns a new [Dog] instance. + Dog({ + required this.className, + this.color = 'red', + this.breed, + }); + + @JsonKey(name: r'className', required: true, includeIfNull: false) + final String className; + + @JsonKey( + defaultValue: 'red', + name: r'color', + required: false, + includeIfNull: false) + final String? color; + + @JsonKey(name: r'breed', required: false, includeIfNull: false) + final String? breed; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Dog && + other.className == className && + other.color == color && + other.breed == breed; + + @override + int get hashCode => className.hashCode + color.hashCode + breed.hashCode; + + factory Dog.fromJson(Map json) => _$DogFromJson(json); + + Map toJson() => _$DogToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/dog_all_of.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/dog_all_of.dart new file mode 100644 index 000000000000..39065be80707 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/dog_all_of.dart @@ -0,0 +1,41 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'dog_all_of.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class DogAllOf { + /// Returns a new [DogAllOf] instance. + DogAllOf({ + this.breed, + }); + + @JsonKey(name: r'breed', required: false, includeIfNull: false) + final String? breed; + + @override + bool operator ==(Object other) => + identical(this, other) || other is DogAllOf && other.breed == breed; + + @override + int get hashCode => breed.hashCode; + + factory DogAllOf.fromJson(Map json) => + _$DogAllOfFromJson(json); + + Map toJson() => _$DogAllOfToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/entity.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/entity.dart new file mode 100644 index 000000000000..9bba5eff8b34 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/entity.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'entity.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Entity { + /// Returns a new [Entity] instance. + Entity({ + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Entity && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory Entity.fromJson(Map json) => _$EntityFromJson(json); + + Map toJson() => _$EntityToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/entity_ref.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/entity_ref.dart new file mode 100644 index 000000000000..32901f43eaa9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/entity_ref.dart @@ -0,0 +1,87 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'entity_ref.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class EntityRef { + /// Returns a new [EntityRef] instance. + EntityRef({ + this.name, + this.atReferredType, + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + /// Name of the related entity. + @JsonKey(name: r'name', required: false, includeIfNull: false) + final String? name; + + /// The actual type of the target instance when needed for disambiguation. + @JsonKey(name: r'@referredType', required: false, includeIfNull: false) + final String? atReferredType; + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is EntityRef && + other.name == name && + other.atReferredType == atReferredType && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + name.hashCode + + atReferredType.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory EntityRef.fromJson(Map json) => + _$EntityRefFromJson(json); + + Map toJson() => _$EntityRefToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/enum_arrays.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/enum_arrays.dart new file mode 100644 index 000000000000..4a9ce1458928 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/enum_arrays.dart @@ -0,0 +1,66 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'enum_arrays.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class EnumArrays { + /// Returns a new [EnumArrays] instance. + EnumArrays({ + this.justSymbol, + this.arrayEnum, + }); + + @JsonKey(name: r'just_symbol', required: false, includeIfNull: false) + final EnumArraysJustSymbolEnum? justSymbol; + + @JsonKey(name: r'array_enum', required: false, includeIfNull: false) + final List? arrayEnum; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is EnumArrays && + other.justSymbol == justSymbol && + other.arrayEnum == arrayEnum; + + @override + int get hashCode => justSymbol.hashCode + arrayEnum.hashCode; + + factory EnumArrays.fromJson(Map json) => + _$EnumArraysFromJson(json); + + Map toJson() => _$EnumArraysToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} + +enum EnumArraysJustSymbolEnum { + @JsonValue(r'>=') + greaterThanEqual, + @JsonValue(r'$') + dollar, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} + +enum EnumArraysArrayEnumEnum { + @JsonValue(r'fish') + fish, + @JsonValue(r'crab') + crab, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/enum_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/enum_test.dart new file mode 100644 index 000000000000..926b40e5977f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/enum_test.dart @@ -0,0 +1,134 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/outer_enum.dart'; +import 'package:openapi/src/model/outer_enum_default_value.dart'; +import 'package:openapi/src/model/outer_enum_integer.dart'; +import 'package:openapi/src/model/outer_enum_integer_default_value.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'enum_test.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class EnumTest { + /// Returns a new [EnumTest] instance. + EnumTest({ + this.enumString, + required this.enumStringRequired, + this.enumInteger, + this.enumNumber, + this.outerEnum, + this.outerEnumInteger, + this.outerEnumDefaultValue, + this.outerEnumIntegerDefaultValue, + }); + + @JsonKey(name: r'enum_string', required: false, includeIfNull: false) + final EnumTestEnumStringEnum? enumString; + + @JsonKey(name: r'enum_string_required', required: true, includeIfNull: false) + final EnumTestEnumStringRequiredEnum enumStringRequired; + + @JsonKey(name: r'enum_integer', required: false, includeIfNull: false) + final EnumTestEnumIntegerEnum? enumInteger; + + @JsonKey(name: r'enum_number', required: false, includeIfNull: false) + final EnumTestEnumNumberEnum? enumNumber; + + @JsonKey(name: r'outerEnum', required: false, includeIfNull: false) + final OuterEnum? outerEnum; + + @JsonKey(name: r'outerEnumInteger', required: false, includeIfNull: false) + final OuterEnumInteger? outerEnumInteger; + + @JsonKey( + name: r'outerEnumDefaultValue', required: false, includeIfNull: false) + final OuterEnumDefaultValue? outerEnumDefaultValue; + + @JsonKey( + name: r'outerEnumIntegerDefaultValue', + required: false, + includeIfNull: false) + final OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is EnumTest && + other.enumString == enumString && + other.enumStringRequired == enumStringRequired && + other.enumInteger == enumInteger && + other.enumNumber == enumNumber && + other.outerEnum == outerEnum && + other.outerEnumInteger == outerEnumInteger && + other.outerEnumDefaultValue == outerEnumDefaultValue && + other.outerEnumIntegerDefaultValue == outerEnumIntegerDefaultValue; + + @override + int get hashCode => + enumString.hashCode + + enumStringRequired.hashCode + + enumInteger.hashCode + + enumNumber.hashCode + + (outerEnum == null ? 0 : outerEnum.hashCode) + + outerEnumInteger.hashCode + + outerEnumDefaultValue.hashCode + + outerEnumIntegerDefaultValue.hashCode; + + factory EnumTest.fromJson(Map json) => + _$EnumTestFromJson(json); + + Map toJson() => _$EnumTestToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} + +enum EnumTestEnumStringEnum { + @JsonValue(r'UPPER') + UPPER, + @JsonValue(r'lower') + lower, + @JsonValue(r'') + empty, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} + +enum EnumTestEnumStringRequiredEnum { + @JsonValue(r'UPPER') + UPPER, + @JsonValue(r'lower') + lower, + @JsonValue(r'') + empty, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} + +enum EnumTestEnumIntegerEnum { + @JsonValue(1) + number1, + @JsonValue(-1) + numberNegative1, + @JsonValue(11184809) + unknownDefaultOpenApi, +} + +enum EnumTestEnumNumberEnum { + @JsonValue('1.1') + number1Period1, + @JsonValue('-1.2') + numberNegative1Period2, + @JsonValue('11184809') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/example.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/example.dart new file mode 100644 index 000000000000..12ed94125a83 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/example.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/child.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'example.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Example { + /// Returns a new [Example] instance. + Example({ + this.name, + }); + + @JsonKey(name: r'name', required: false, includeIfNull: false) + final String? name; + + @override + bool operator ==(Object other) => + identical(this, other) || other is Example && other.name == name; + + @override + int get hashCode => name.hashCode; + + factory Example.fromJson(Map json) => + _$ExampleFromJson(json); + + Map toJson() => _$ExampleToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/example_non_primitive.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/example_non_primitive.dart new file mode 100644 index 000000000000..b05d98f10dc2 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/example_non_primitive.dart @@ -0,0 +1,29 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'example_non_primitive.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ExampleNonPrimitive { + /// Returns a new [ExampleNonPrimitive] instance. + ExampleNonPrimitive(); + + factory ExampleNonPrimitive.fromJson(Map json) => + _$ExampleNonPrimitiveFromJson(json); + + Map toJson() => _$ExampleNonPrimitiveToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/extensible.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/extensible.dart new file mode 100644 index 000000000000..bad2e3789836 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/extensible.dart @@ -0,0 +1,57 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'extensible.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Extensible { + /// Returns a new [Extensible] instance. + Extensible({ + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Extensible && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + atSchemaLocation.hashCode + atBaseType.hashCode + atType.hashCode; + + factory Extensible.fromJson(Map json) => + _$ExtensibleFromJson(json); + + Map toJson() => _$ExtensibleToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/file_schema_test_class.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/file_schema_test_class.dart new file mode 100644 index 000000000000..3da04204b0b2 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/file_schema_test_class.dart @@ -0,0 +1,49 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/model_file.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'file_schema_test_class.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FileSchemaTestClass { + /// Returns a new [FileSchemaTestClass] instance. + FileSchemaTestClass({ + this.file, + this.files, + }); + + @JsonKey(name: r'file', required: false, includeIfNull: false) + final ModelFile? file; + + @JsonKey(name: r'files', required: false, includeIfNull: false) + final List? files; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is FileSchemaTestClass && + other.file == file && + other.files == files; + + @override + int get hashCode => file.hashCode + files.hashCode; + + factory FileSchemaTestClass.fromJson(Map json) => + _$FileSchemaTestClassFromJson(json); + + Map toJson() => _$FileSchemaTestClassToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/foo.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/foo.dart new file mode 100644 index 000000000000..5fbd0e3f800a --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/foo.dart @@ -0,0 +1,87 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'foo.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Foo { + /// Returns a new [Foo] instance. + Foo({ + this.fooPropA, + this.fooPropB, + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + @JsonKey(name: r'fooPropA', required: false, includeIfNull: false) + final String? fooPropA; + + @JsonKey(name: r'fooPropB', required: false, includeIfNull: false) + final String? fooPropB; + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Foo && + other.fooPropA == fooPropA && + other.fooPropB == fooPropB && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + fooPropA.hashCode + + fooPropB.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory Foo.fromJson(Map json) => _$FooFromJson(json); + + Map toJson() => _$FooToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/foo_ref.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/foo_ref.dart new file mode 100644 index 000000000000..1e0ec166fb66 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/foo_ref.dart @@ -0,0 +1,81 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity_ref.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'foo_ref.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FooRef { + /// Returns a new [FooRef] instance. + FooRef({ + this.foorefPropA, + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + @JsonKey(name: r'foorefPropA', required: false, includeIfNull: false) + final String? foorefPropA; + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is FooRef && + other.foorefPropA == foorefPropA && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + foorefPropA.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory FooRef.fromJson(Map json) => _$FooRefFromJson(json); + + Map toJson() => _$FooRefToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/foo_ref_or_value.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/foo_ref_or_value.dart new file mode 100644 index 000000000000..f71d4b51f73e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/foo_ref_or_value.dart @@ -0,0 +1,75 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/foo_ref.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'foo_ref_or_value.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FooRefOrValue { + /// Returns a new [FooRefOrValue] instance. + FooRefOrValue({ + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is FooRefOrValue && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory FooRefOrValue.fromJson(Map json) => + _$FooRefOrValueFromJson(json); + + Map toJson() => _$FooRefOrValueToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/format_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/format_test.dart new file mode 100644 index 000000000000..f036a62c2df5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/format_test.dart @@ -0,0 +1,150 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:dio/dio.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'format_test.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FormatTest { + /// Returns a new [FormatTest] instance. + FormatTest({ + this.integer, + this.int32, + this.int64, + required this.number, + this.float, + this.double_, + this.decimal, + this.string, + required this.byte, + this.binary, + required this.date, + this.dateTime, + this.uuid, + required this.password, + this.patternWithDigits, + this.patternWithDigitsAndDelimiter, + }); + + // minimum: 10 + // maximum: 100 + @JsonKey(name: r'integer', required: false, includeIfNull: false) + final int? integer; + + // minimum: 20 + // maximum: 200 + @JsonKey(name: r'int32', required: false, includeIfNull: false) + final int? int32; + + @JsonKey(name: r'int64', required: false, includeIfNull: false) + final int? int64; + + // minimum: 32.1 + // maximum: 543.2 + @JsonKey(name: r'number', required: true, includeIfNull: false) + final num number; + + // minimum: 54.3 + // maximum: 987.6 + @JsonKey(name: r'float', required: false, includeIfNull: false) + final double? float; + + // minimum: 67.8 + // maximum: 123.4 + @JsonKey(name: r'double', required: false, includeIfNull: false) + final double? double_; + + @JsonKey(name: r'decimal', required: false, includeIfNull: false) + final double? decimal; + + @JsonKey(name: r'string', required: false, includeIfNull: false) + final String? string; + + @JsonKey(name: r'byte', required: true, includeIfNull: false) + final String byte; + + @JsonKey(ignore: true) + final MultipartFile? binary; + + @JsonKey(name: r'date', required: true, includeIfNull: false) + final DateTime date; + + @JsonKey(name: r'dateTime', required: false, includeIfNull: false) + final DateTime? dateTime; + + @JsonKey(name: r'uuid', required: false, includeIfNull: false) + final String? uuid; + + @JsonKey(name: r'password', required: true, includeIfNull: false) + final String password; + + /// A string that is a 10 digit number. Can have leading zeros. + @JsonKey(name: r'pattern_with_digits', required: false, includeIfNull: false) + final String? patternWithDigits; + + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + @JsonKey( + name: r'pattern_with_digits_and_delimiter', + required: false, + includeIfNull: false) + final String? patternWithDigitsAndDelimiter; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is FormatTest && + other.integer == integer && + other.int32 == int32 && + other.int64 == int64 && + other.number == number && + other.float == float && + other.double_ == double_ && + other.decimal == decimal && + other.string == string && + other.byte == byte && + other.binary == binary && + other.date == date && + other.dateTime == dateTime && + other.uuid == uuid && + other.password == password && + other.patternWithDigits == patternWithDigits && + other.patternWithDigitsAndDelimiter == patternWithDigitsAndDelimiter; + + @override + int get hashCode => + integer.hashCode + + int32.hashCode + + int64.hashCode + + number.hashCode + + float.hashCode + + double_.hashCode + + decimal.hashCode + + string.hashCode + + byte.hashCode + + binary.hashCode + + date.hashCode + + dateTime.hashCode + + uuid.hashCode + + password.hashCode + + patternWithDigits.hashCode + + patternWithDigitsAndDelimiter.hashCode; + + factory FormatTest.fromJson(Map json) => + _$FormatTestFromJson(json); + + Map toJson() => _$FormatTestToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/fruit.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/fruit.dart new file mode 100644 index 000000000000..ecbad5014c05 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/fruit.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/apple.dart'; +import 'package:openapi/src/model/banana.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'fruit.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Fruit { + /// Returns a new [Fruit] instance. + Fruit({ + this.color, + this.kind, + this.count, + }); + + @JsonKey(name: r'color', required: false, includeIfNull: false) + final String? color; + + @JsonKey(name: r'kind', required: false, includeIfNull: false) + final String? kind; + + @JsonKey(name: r'count', required: false, includeIfNull: false) + final num? count; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Fruit && + other.color == color && + other.kind == kind && + other.count == count; + + @override + int get hashCode => color.hashCode + kind.hashCode + count.hashCode; + + factory Fruit.fromJson(Map json) => _$FruitFromJson(json); + + Map toJson() => _$FruitToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/has_only_read_only.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/has_only_read_only.dart new file mode 100644 index 000000000000..ed6a55c59d03 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/has_only_read_only.dart @@ -0,0 +1,46 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'has_only_read_only.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class HasOnlyReadOnly { + /// Returns a new [HasOnlyReadOnly] instance. + HasOnlyReadOnly({ + this.bar, + this.foo, + }); + + @JsonKey(name: r'bar', required: false, includeIfNull: false) + final String? bar; + + @JsonKey(name: r'foo', required: false, includeIfNull: false) + final String? foo; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is HasOnlyReadOnly && other.bar == bar && other.foo == foo; + + @override + int get hashCode => bar.hashCode + foo.hashCode; + + factory HasOnlyReadOnly.fromJson(Map json) => + _$HasOnlyReadOnlyFromJson(json); + + Map toJson() => _$HasOnlyReadOnlyToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/health_check_result.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/health_check_result.dart new file mode 100644 index 000000000000..e14245b733fe --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/health_check_result.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'health_check_result.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class HealthCheckResult { + /// Returns a new [HealthCheckResult] instance. + HealthCheckResult({ + this.nullableMessage, + }); + + @JsonKey(name: r'NullableMessage', required: false, includeIfNull: false) + final String? nullableMessage; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is HealthCheckResult && other.nullableMessage == nullableMessage; + + @override + int get hashCode => (nullableMessage == null ? 0 : nullableMessage.hashCode); + + factory HealthCheckResult.fromJson(Map json) => + _$HealthCheckResultFromJson(json); + + Map toJson() => _$HealthCheckResultToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/map_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/map_test.dart new file mode 100644 index 000000000000..68f69e6ab300 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/map_test.dart @@ -0,0 +1,71 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'map_test.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class MapTest { + /// Returns a new [MapTest] instance. + MapTest({ + this.mapMapOfString, + this.mapOfEnumString, + this.directMap, + this.indirectMap, + }); + + @JsonKey(name: r'map_map_of_string', required: false, includeIfNull: false) + final Map>? mapMapOfString; + + @JsonKey(name: r'map_of_enum_string', required: false, includeIfNull: false) + final Map? mapOfEnumString; + + @JsonKey(name: r'direct_map', required: false, includeIfNull: false) + final Map? directMap; + + @JsonKey(name: r'indirect_map', required: false, includeIfNull: false) + final Map? indirectMap; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is MapTest && + other.mapMapOfString == mapMapOfString && + other.mapOfEnumString == mapOfEnumString && + other.directMap == directMap && + other.indirectMap == indirectMap; + + @override + int get hashCode => + mapMapOfString.hashCode + + mapOfEnumString.hashCode + + directMap.hashCode + + indirectMap.hashCode; + + factory MapTest.fromJson(Map json) => + _$MapTestFromJson(json); + + Map toJson() => _$MapTestToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} + +enum MapTestMapOfEnumStringEnum { + @JsonValue(r'UPPER') + UPPER, + @JsonValue(r'lower') + lower, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/mixed_properties_and_additional_properties_class.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/mixed_properties_and_additional_properties_class.dart new file mode 100644 index 000000000000..7045930e1616 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/mixed_properties_and_additional_properties_class.dart @@ -0,0 +1,56 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/animal.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'mixed_properties_and_additional_properties_class.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class MixedPropertiesAndAdditionalPropertiesClass { + /// Returns a new [MixedPropertiesAndAdditionalPropertiesClass] instance. + MixedPropertiesAndAdditionalPropertiesClass({ + this.uuid, + this.dateTime, + this.map, + }); + + @JsonKey(name: r'uuid', required: false, includeIfNull: false) + final String? uuid; + + @JsonKey(name: r'dateTime', required: false, includeIfNull: false) + final DateTime? dateTime; + + @JsonKey(name: r'map', required: false, includeIfNull: false) + final Map? map; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is MixedPropertiesAndAdditionalPropertiesClass && + other.uuid == uuid && + other.dateTime == dateTime && + other.map == map; + + @override + int get hashCode => uuid.hashCode + dateTime.hashCode + map.hashCode; + + factory MixedPropertiesAndAdditionalPropertiesClass.fromJson( + Map json) => + _$MixedPropertiesAndAdditionalPropertiesClassFromJson(json); + + Map toJson() => + _$MixedPropertiesAndAdditionalPropertiesClassToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/model200_response.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/model200_response.dart new file mode 100644 index 000000000000..a95d30009c5d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/model200_response.dart @@ -0,0 +1,48 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'model200_response.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Model200Response { + /// Returns a new [Model200Response] instance. + Model200Response({ + this.name, + this.classField, + }); + + @JsonKey(name: r'name', required: false, includeIfNull: false) + final int? name; + + @JsonKey(name: r'class', required: false, includeIfNull: false) + final String? classField; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Model200Response && + other.name == name && + other.classField == classField; + + @override + int get hashCode => name.hashCode + classField.hashCode; + + factory Model200Response.fromJson(Map json) => + _$Model200ResponseFromJson(json); + + Map toJson() => _$Model200ResponseToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/model_client.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/model_client.dart new file mode 100644 index 000000000000..420ab5a1f4dd --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/model_client.dart @@ -0,0 +1,41 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'model_client.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ModelClient { + /// Returns a new [ModelClient] instance. + ModelClient({ + this.client, + }); + + @JsonKey(name: r'client', required: false, includeIfNull: false) + final String? client; + + @override + bool operator ==(Object other) => + identical(this, other) || other is ModelClient && other.client == client; + + @override + int get hashCode => client.hashCode; + + factory ModelClient.fromJson(Map json) => + _$ModelClientFromJson(json); + + Map toJson() => _$ModelClientToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/model_enum_class.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/model_enum_class.dart new file mode 100644 index 000000000000..67b79a2a5c9a --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/model_enum_class.dart @@ -0,0 +1,17 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum ModelEnumClass { + @JsonValue(r'_abc') + abc, + @JsonValue(r'-efg') + efg, + @JsonValue(r'(xyz)') + leftParenthesisXyzRightParenthesis, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/model_file.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/model_file.dart new file mode 100644 index 000000000000..24ab5b777009 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/model_file.dart @@ -0,0 +1,43 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'model_file.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ModelFile { + /// Returns a new [ModelFile] instance. + ModelFile({ + this.sourceURI, + }); + + /// Test capitalization + @JsonKey(name: r'sourceURI', required: false, includeIfNull: false) + final String? sourceURI; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ModelFile && other.sourceURI == sourceURI; + + @override + int get hashCode => sourceURI.hashCode; + + factory ModelFile.fromJson(Map json) => + _$ModelFileFromJson(json); + + Map toJson() => _$ModelFileToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/model_list.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/model_list.dart new file mode 100644 index 000000000000..b2d3f190af9e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/model_list.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'model_list.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ModelList { + /// Returns a new [ModelList] instance. + ModelList({ + this.n123list, + }); + + @JsonKey(name: r'123-list', required: false, includeIfNull: false) + final String? n123list; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ModelList && other.n123list == n123list; + + @override + int get hashCode => n123list.hashCode; + + factory ModelList.fromJson(Map json) => + _$ModelListFromJson(json); + + Map toJson() => _$ModelListToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/model_return.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/model_return.dart new file mode 100644 index 000000000000..1d2547c95628 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/model_return.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'model_return.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ModelReturn { + /// Returns a new [ModelReturn] instance. + ModelReturn({ + this.return_, + }); + + @JsonKey(name: r'return', required: false, includeIfNull: false) + final int? return_; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ModelReturn && other.return_ == return_; + + @override + int get hashCode => return_.hashCode; + + factory ModelReturn.fromJson(Map json) => + _$ModelReturnFromJson(json); + + Map toJson() => _$ModelReturnToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/name.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/name.dart new file mode 100644 index 000000000000..0aad5dcc0480 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/name.dart @@ -0,0 +1,61 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'name.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Name { + /// Returns a new [Name] instance. + Name({ + required this.name, + this.snakeCase, + this.property, + this.n123number, + }); + + @JsonKey(name: r'name', required: true, includeIfNull: false) + final int name; + + @JsonKey(name: r'snake_case', required: false, includeIfNull: false) + final int? snakeCase; + + @JsonKey(name: r'property', required: false, includeIfNull: false) + final String? property; + + @JsonKey(name: r'123Number', required: false, includeIfNull: false) + final int? n123number; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Name && + other.name == name && + other.snakeCase == snakeCase && + other.property == property && + other.n123number == n123number; + + @override + int get hashCode => + name.hashCode + + snakeCase.hashCode + + property.hashCode + + n123number.hashCode; + + factory Name.fromJson(Map json) => _$NameFromJson(json); + + Map toJson() => _$NameToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/nullable_class.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/nullable_class.dart new file mode 100644 index 000000000000..66e3f84395b6 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/nullable_class.dart @@ -0,0 +1,121 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'nullable_class.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class NullableClass { + /// Returns a new [NullableClass] instance. + NullableClass({ + this.integerProp, + this.numberProp, + this.booleanProp, + this.stringProp, + this.dateProp, + this.datetimeProp, + this.arrayNullableProp, + this.arrayAndItemsNullableProp, + this.arrayItemsNullable, + this.objectNullableProp, + this.objectAndItemsNullableProp, + this.objectItemsNullable, + }); + + @JsonKey(name: r'integer_prop', required: false, includeIfNull: false) + final int? integerProp; + + @JsonKey(name: r'number_prop', required: false, includeIfNull: false) + final num? numberProp; + + @JsonKey(name: r'boolean_prop', required: false, includeIfNull: false) + final bool? booleanProp; + + @JsonKey(name: r'string_prop', required: false, includeIfNull: false) + final String? stringProp; + + @JsonKey(name: r'date_prop', required: false, includeIfNull: false) + final DateTime? dateProp; + + @JsonKey(name: r'datetime_prop', required: false, includeIfNull: false) + final DateTime? datetimeProp; + + @JsonKey(name: r'array_nullable_prop', required: false, includeIfNull: false) + final List? arrayNullableProp; + + @JsonKey( + name: r'array_and_items_nullable_prop', + required: false, + includeIfNull: false) + final List? arrayAndItemsNullableProp; + + @JsonKey(name: r'array_items_nullable', required: false, includeIfNull: false) + final List? arrayItemsNullable; + + @JsonKey(name: r'object_nullable_prop', required: false, includeIfNull: false) + final Map? objectNullableProp; + + @JsonKey( + name: r'object_and_items_nullable_prop', + required: false, + includeIfNull: false) + final Map? objectAndItemsNullableProp; + + @JsonKey( + name: r'object_items_nullable', required: false, includeIfNull: false) + final Map? objectItemsNullable; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is NullableClass && + other.integerProp == integerProp && + other.numberProp == numberProp && + other.booleanProp == booleanProp && + other.stringProp == stringProp && + other.dateProp == dateProp && + other.datetimeProp == datetimeProp && + other.arrayNullableProp == arrayNullableProp && + other.arrayAndItemsNullableProp == arrayAndItemsNullableProp && + other.arrayItemsNullable == arrayItemsNullable && + other.objectNullableProp == objectNullableProp && + other.objectAndItemsNullableProp == objectAndItemsNullableProp && + other.objectItemsNullable == objectItemsNullable; + + @override + int get hashCode => + (integerProp == null ? 0 : integerProp.hashCode) + + (numberProp == null ? 0 : numberProp.hashCode) + + (booleanProp == null ? 0 : booleanProp.hashCode) + + (stringProp == null ? 0 : stringProp.hashCode) + + (dateProp == null ? 0 : dateProp.hashCode) + + (datetimeProp == null ? 0 : datetimeProp.hashCode) + + (arrayNullableProp == null ? 0 : arrayNullableProp.hashCode) + + (arrayAndItemsNullableProp == null + ? 0 + : arrayAndItemsNullableProp.hashCode) + + arrayItemsNullable.hashCode + + (objectNullableProp == null ? 0 : objectNullableProp.hashCode) + + (objectAndItemsNullableProp == null + ? 0 + : objectAndItemsNullableProp.hashCode) + + objectItemsNullable.hashCode; + + factory NullableClass.fromJson(Map json) => + _$NullableClassFromJson(json); + + Map toJson() => _$NullableClassToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/number_only.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/number_only.dart new file mode 100644 index 000000000000..75022ee68437 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/number_only.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'number_only.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class NumberOnly { + /// Returns a new [NumberOnly] instance. + NumberOnly({ + this.justNumber, + }); + + @JsonKey(name: r'JustNumber', required: false, includeIfNull: false) + final num? justNumber; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is NumberOnly && other.justNumber == justNumber; + + @override + int get hashCode => justNumber.hashCode; + + factory NumberOnly.fromJson(Map json) => + _$NumberOnlyFromJson(json); + + Map toJson() => _$NumberOnlyToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/object_with_deprecated_fields.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/object_with_deprecated_fields.dart new file mode 100644 index 000000000000..77865e64e421 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/object_with_deprecated_fields.dart @@ -0,0 +1,61 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/deprecated_object.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'object_with_deprecated_fields.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ObjectWithDeprecatedFields { + /// Returns a new [ObjectWithDeprecatedFields] instance. + ObjectWithDeprecatedFields({ + this.uuid, + this.id, + this.deprecatedRef, + this.bars, + }); + + @JsonKey(name: r'uuid', required: false, includeIfNull: false) + final String? uuid; + + @JsonKey(name: r'id', required: false, includeIfNull: false) + final num? id; + + @JsonKey(name: r'deprecatedRef', required: false, includeIfNull: false) + final DeprecatedObject? deprecatedRef; + + @JsonKey(name: r'bars', required: false, includeIfNull: false) + final List? bars; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ObjectWithDeprecatedFields && + other.uuid == uuid && + other.id == id && + other.deprecatedRef == deprecatedRef && + other.bars == bars; + + @override + int get hashCode => + uuid.hashCode + id.hashCode + deprecatedRef.hashCode + bars.hashCode; + + factory ObjectWithDeprecatedFields.fromJson(Map json) => + _$ObjectWithDeprecatedFieldsFromJson(json); + + Map toJson() => _$ObjectWithDeprecatedFieldsToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/order.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/order.dart new file mode 100644 index 000000000000..e5bcbae3225e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/order.dart @@ -0,0 +1,90 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'order.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Order { + /// Returns a new [Order] instance. + Order({ + this.id, + this.petId, + this.quantity, + this.shipDate, + this.status, + this.complete = false, + }); + + @JsonKey(name: r'id', required: false, includeIfNull: false) + final int? id; + + @JsonKey(name: r'petId', required: false, includeIfNull: false) + final int? petId; + + @JsonKey(name: r'quantity', required: false, includeIfNull: false) + final int? quantity; + + @JsonKey(name: r'shipDate', required: false, includeIfNull: false) + final DateTime? shipDate; + + /// Order Status + @JsonKey(name: r'status', required: false, includeIfNull: false) + final OrderStatusEnum? status; + + @JsonKey( + defaultValue: false, + name: r'complete', + required: false, + includeIfNull: false) + final bool? complete; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Order && + other.id == id && + other.petId == petId && + other.quantity == quantity && + other.shipDate == shipDate && + other.status == status && + other.complete == complete; + + @override + int get hashCode => + id.hashCode + + petId.hashCode + + quantity.hashCode + + shipDate.hashCode + + status.hashCode + + complete.hashCode; + + factory Order.fromJson(Map json) => _$OrderFromJson(json); + + Map toJson() => _$OrderToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} + +/// Order Status +enum OrderStatusEnum { + @JsonValue(r'placed') + placed, + @JsonValue(r'approved') + approved, + @JsonValue(r'delivered') + delivered, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/outer_composite.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/outer_composite.dart new file mode 100644 index 000000000000..df6d371f533f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/outer_composite.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'outer_composite.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class OuterComposite { + /// Returns a new [OuterComposite] instance. + OuterComposite({ + this.myNumber, + this.myString, + this.myBoolean, + }); + + @JsonKey(name: r'my_number', required: false, includeIfNull: false) + final num? myNumber; + + @JsonKey(name: r'my_string', required: false, includeIfNull: false) + final String? myString; + + @JsonKey(name: r'my_boolean', required: false, includeIfNull: false) + final bool? myBoolean; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is OuterComposite && + other.myNumber == myNumber && + other.myString == myString && + other.myBoolean == myBoolean; + + @override + int get hashCode => + myNumber.hashCode + myString.hashCode + myBoolean.hashCode; + + factory OuterComposite.fromJson(Map json) => + _$OuterCompositeFromJson(json); + + Map toJson() => _$OuterCompositeToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/outer_enum.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/outer_enum.dart new file mode 100644 index 000000000000..2d1326c259bf --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/outer_enum.dart @@ -0,0 +1,17 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum OuterEnum { + @JsonValue(r'placed') + placed, + @JsonValue(r'approved') + approved, + @JsonValue(r'delivered') + delivered, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/outer_enum_default_value.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/outer_enum_default_value.dart new file mode 100644 index 000000000000..45919f099158 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/outer_enum_default_value.dart @@ -0,0 +1,17 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum OuterEnumDefaultValue { + @JsonValue(r'placed') + placed, + @JsonValue(r'approved') + approved, + @JsonValue(r'delivered') + delivered, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/outer_enum_integer.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/outer_enum_integer.dart new file mode 100644 index 000000000000..b91ca3455678 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/outer_enum_integer.dart @@ -0,0 +1,17 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum OuterEnumInteger { + @JsonValue(0) + number0, + @JsonValue(1) + number1, + @JsonValue(2) + number2, + @JsonValue(11184809) + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/outer_enum_integer_default_value.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/outer_enum_integer_default_value.dart new file mode 100644 index 000000000000..799321b37c85 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/outer_enum_integer_default_value.dart @@ -0,0 +1,17 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum OuterEnumIntegerDefaultValue { + @JsonValue(0) + number0, + @JsonValue(1) + number1, + @JsonValue(2) + number2, + @JsonValue(11184809) + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/outer_object_with_enum_property.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/outer_object_with_enum_property.dart new file mode 100644 index 000000000000..7620543d1f4a --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/outer_object_with_enum_property.dart @@ -0,0 +1,43 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/outer_enum_integer.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'outer_object_with_enum_property.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class OuterObjectWithEnumProperty { + /// Returns a new [OuterObjectWithEnumProperty] instance. + OuterObjectWithEnumProperty({ + required this.value, + }); + + @JsonKey(name: r'value', required: true, includeIfNull: false) + final OuterEnumInteger value; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is OuterObjectWithEnumProperty && other.value == value; + + @override + int get hashCode => value.hashCode; + + factory OuterObjectWithEnumProperty.fromJson(Map json) => + _$OuterObjectWithEnumPropertyFromJson(json); + + Map toJson() => _$OuterObjectWithEnumPropertyToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/pasta.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/pasta.dart new file mode 100644 index 000000000000..816d59814caf --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/pasta.dart @@ -0,0 +1,81 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'pasta.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Pasta { + /// Returns a new [Pasta] instance. + Pasta({ + this.vendor, + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + @JsonKey(name: r'vendor', required: false, includeIfNull: false) + final String? vendor; + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Pasta && + other.vendor == vendor && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + vendor.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory Pasta.fromJson(Map json) => _$PastaFromJson(json); + + Map toJson() => _$PastaToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/pet.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/pet.dart new file mode 100644 index 000000000000..58cdc030d017 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/pet.dart @@ -0,0 +1,88 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/category.dart'; +import 'package:openapi/src/model/tag.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'pet.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Pet { + /// Returns a new [Pet] instance. + Pet({ + this.id, + required this.name, + this.category, + required this.photoUrls, + this.tags, + this.status, + }); + + @JsonKey(name: r'id', required: false, includeIfNull: false) + final int? id; + + @JsonKey(name: r'name', required: true, includeIfNull: false) + final String name; + + @JsonKey(name: r'category', required: false, includeIfNull: false) + final Category? category; + + @JsonKey(name: r'photoUrls', required: true, includeIfNull: false) + final List photoUrls; + + @JsonKey(name: r'tags', required: false, includeIfNull: false) + final List? tags; + + /// pet status in the store + @JsonKey(name: r'status', required: false, includeIfNull: false) + final PetStatusEnum? status; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Pet && + other.id == id && + other.name == name && + other.category == category && + other.photoUrls == photoUrls && + other.tags == tags && + other.status == status; + + @override + int get hashCode => + id.hashCode + + name.hashCode + + category.hashCode + + photoUrls.hashCode + + tags.hashCode + + status.hashCode; + + factory Pet.fromJson(Map json) => _$PetFromJson(json); + + Map toJson() => _$PetToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} + +/// pet status in the store +enum PetStatusEnum { + @JsonValue(r'available') + available, + @JsonValue(r'pending') + pending, + @JsonValue(r'sold') + sold, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/pizza.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/pizza.dart new file mode 100644 index 000000000000..32d80d992a50 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/pizza.dart @@ -0,0 +1,81 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'pizza.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Pizza { + /// Returns a new [Pizza] instance. + Pizza({ + this.pizzaSize, + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + @JsonKey(name: r'pizzaSize', required: false, includeIfNull: false) + final num? pizzaSize; + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Pizza && + other.pizzaSize == pizzaSize && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + pizzaSize.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory Pizza.fromJson(Map json) => _$PizzaFromJson(json); + + Map toJson() => _$PizzaToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/pizza_speziale.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/pizza_speziale.dart new file mode 100644 index 000000000000..07d031e8c289 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/pizza_speziale.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/pizza.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'pizza_speziale.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class PizzaSpeziale { + /// Returns a new [PizzaSpeziale] instance. + PizzaSpeziale({ + this.toppings, + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + @JsonKey(name: r'toppings', required: false, includeIfNull: false) + final String? toppings; + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is PizzaSpeziale && + other.toppings == toppings && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + toppings.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory PizzaSpeziale.fromJson(Map json) => + _$PizzaSpezialeFromJson(json); + + Map toJson() => _$PizzaSpezialeToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/read_only_first.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/read_only_first.dart new file mode 100644 index 000000000000..38c57afbafd8 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/read_only_first.dart @@ -0,0 +1,46 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'read_only_first.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ReadOnlyFirst { + /// Returns a new [ReadOnlyFirst] instance. + ReadOnlyFirst({ + this.bar, + this.baz, + }); + + @JsonKey(name: r'bar', required: false, includeIfNull: false) + final String? bar; + + @JsonKey(name: r'baz', required: false, includeIfNull: false) + final String? baz; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ReadOnlyFirst && other.bar == bar && other.baz == baz; + + @override + int get hashCode => bar.hashCode + baz.hashCode; + + factory ReadOnlyFirst.fromJson(Map json) => + _$ReadOnlyFirstFromJson(json); + + Map toJson() => _$ReadOnlyFirstToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/single_ref_type.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/single_ref_type.dart new file mode 100644 index 000000000000..783d766acc82 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/single_ref_type.dart @@ -0,0 +1,15 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum SingleRefType { + @JsonValue(r'admin') + admin, + @JsonValue(r'user') + user, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/special_model_name.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/special_model_name.dart new file mode 100644 index 000000000000..fe1029818a7f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/special_model_name.dart @@ -0,0 +1,47 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'special_model_name.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class SpecialModelName { + /// Returns a new [SpecialModelName] instance. + SpecialModelName({ + this.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket, + }); + + @JsonKey( + name: r'$special[property.name]', required: false, includeIfNull: false) + final int? dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is SpecialModelName && + other.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket == + dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + + @override + int get hashCode => + dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket + .hashCode; + + factory SpecialModelName.fromJson(Map json) => + _$SpecialModelNameFromJson(json); + + Map toJson() => _$SpecialModelNameToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/tag.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/tag.dart new file mode 100644 index 000000000000..e1c5a2c8cc1c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/tag.dart @@ -0,0 +1,45 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'tag.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Tag { + /// Returns a new [Tag] instance. + Tag({ + this.id, + this.name, + }); + + @JsonKey(name: r'id', required: false, includeIfNull: false) + final int? id; + + @JsonKey(name: r'name', required: false, includeIfNull: false) + final String? name; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Tag && other.id == id && other.name == name; + + @override + int get hashCode => id.hashCode + name.hashCode; + + factory Tag.fromJson(Map json) => _$TagFromJson(json); + + Map toJson() => _$TagToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart new file mode 100644 index 000000000000..cbea21d55960 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart @@ -0,0 +1,47 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'test_query_style_form_explode_true_array_string_query_object_parameter.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter { + /// Returns a new [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter] instance. + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter({ + this.values, + }); + + @JsonKey(name: r'values', required: false, includeIfNull: false) + final List? values; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter && + other.values == values; + + @override + int get hashCode => values.hashCode; + + factory TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.fromJson( + Map json) => + _$TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterFromJson( + json); + + Map toJson() => + _$TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterToJson( + this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/user.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/user.dart new file mode 100644 index 000000000000..f1da4cd38cab --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/lib/src/model/user.dart @@ -0,0 +1,86 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'user.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class User { + /// Returns a new [User] instance. + User({ + this.id, + this.username, + this.firstName, + this.lastName, + this.email, + this.password, + this.phone, + this.userStatus, + }); + + @JsonKey(name: r'id', required: false, includeIfNull: false) + final int? id; + + @JsonKey(name: r'username', required: false, includeIfNull: false) + final String? username; + + @JsonKey(name: r'firstName', required: false, includeIfNull: false) + final String? firstName; + + @JsonKey(name: r'lastName', required: false, includeIfNull: false) + final String? lastName; + + @JsonKey(name: r'email', required: false, includeIfNull: false) + final String? email; + + @JsonKey(name: r'password', required: false, includeIfNull: false) + final String? password; + + @JsonKey(name: r'phone', required: false, includeIfNull: false) + final String? phone; + + /// User Status + @JsonKey(name: r'userStatus', required: false, includeIfNull: false) + final int? userStatus; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is User && + other.id == id && + other.username == username && + other.firstName == firstName && + other.lastName == lastName && + other.email == email && + other.password == password && + other.phone == phone && + other.userStatus == userStatus; + + @override + int get hashCode => + id.hashCode + + username.hashCode + + firstName.hashCode + + lastName.hashCode + + email.hashCode + + password.hashCode + + phone.hashCode + + userStatus.hashCode; + + factory User.fromJson(Map json) => _$UserFromJson(json); + + Map toJson() => _$UserToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/pubspec.yaml b/samples/client/echo_api/dart/dart-dio-json_serializable/pubspec.yaml new file mode 100644 index 000000000000..7d77ea38b02e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/pubspec.yaml @@ -0,0 +1,17 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client +homepage: homepage + +environment: + sdk: '>=2.14.0 <3.0.0' + +dependencies: + + dio: '>=4.0.1 <5.0.0' + json_annotation: '^4.4.0' + +dev_dependencies: + build_runner: any + json_serializable: '^6.1.5' + test: ^1.16.0 diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/test/additional_properties_class_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/additional_properties_class_test.dart new file mode 100644 index 000000000000..28348e7fc36e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/test/addressable_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/addressable_test.dart new file mode 100644 index 000000000000..00e1b6eba940 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/addressable_test.dart @@ -0,0 +1,22 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/all_of_with_single_ref_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/all_of_with_single_ref_test.dart new file mode 100644 index 000000000000..92cbebda26cf --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/all_of_with_single_ref_test.dart @@ -0,0 +1,20 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/animal_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/animal_test.dart new file mode 100644 index 000000000000..d5464a4278b1 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/animal_test.dart @@ -0,0 +1,20 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/api_response_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/api_response_test.dart new file mode 100644 index 000000000000..3132ef4e8a51 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/api_response_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ApiResponse +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/apple_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/apple_test.dart new file mode 100644 index 000000000000..1c2c2037cd06 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/apple_test.dart @@ -0,0 +1,15 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/array_of_array_of_number_only_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/array_of_array_of_number_only_test.dart new file mode 100644 index 000000000000..f844a1cd920d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/test/array_of_number_only_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/array_of_number_only_test.dart new file mode 100644 index 000000000000..b547bb1728d8 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/array_of_number_only_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayOfNumberOnly +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/array_test_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/array_test_test.dart new file mode 100644 index 000000000000..83b1fee56fb0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/array_test_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayTest +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/banana_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/banana_test.dart new file mode 100644 index 000000000000..d5b0a6def843 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/banana_test.dart @@ -0,0 +1,15 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/bar_create_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/bar_create_test.dart new file mode 100644 index 000000000000..0833036690d6 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/bar_create_test.dart @@ -0,0 +1,55 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/bar_ref_or_value_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/bar_ref_or_value_test.dart new file mode 100644 index 000000000000..3088b2f6cd4e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/bar_ref_or_value_test.dart @@ -0,0 +1,40 @@ +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, () { + // 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/client/echo_api/dart/dart-dio-json_serializable/test/bar_ref_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/bar_ref_test.dart new file mode 100644 index 000000000000..080a462d0be6 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/bar_ref_test.dart @@ -0,0 +1,40 @@ +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, () { + // 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/client/echo_api/dart/dart-dio-json_serializable/test/bar_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/bar_test.dart new file mode 100644 index 000000000000..80bcd0c8227c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/bar_test.dart @@ -0,0 +1,54 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/body_api_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/body_api_test.dart new file mode 100644 index 000000000000..05eedc2d2540 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/body_api_test.dart @@ -0,0 +1,18 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for BodyApi +void main() { + final instance = Openapi().getBodyApi(); + + group(BodyApi, () { + // Test body parameter(s) + // + // Test body parameter(s) + // + //Future testEchoBodyPet({ Pet pet }) async + test('test testEchoBodyPet', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/test/capitalization_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/capitalization_test.dart new file mode 100644 index 000000000000..6d1094e22d0d --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/capitalization_test.dart @@ -0,0 +1,41 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/cat_all_of_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/cat_all_of_test.dart new file mode 100644 index 000000000000..c9df8b953a81 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/cat_all_of_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for CatAllOf +void main() { + final CatAllOf? instance = /* CatAllOf(...) */ null; + // TODO add properties to the entity + + group(CatAllOf, () { + // bool declawed + test('to test the property `declawed`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/test/cat_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/cat_test.dart new file mode 100644 index 000000000000..28e5faaeb1cd --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/cat_test.dart @@ -0,0 +1,25 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/category_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/category_test.dart new file mode 100644 index 000000000000..d4e1abb4179c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/category_test.dart @@ -0,0 +1,20 @@ +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 + test('to test the property `name`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/test/child_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/child_test.dart new file mode 100644 index 000000000000..48eac97bfd9c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/child_test.dart @@ -0,0 +1,15 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/class_model_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/class_model_test.dart new file mode 100644 index 000000000000..66305bae33e5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/class_model_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ClassModel +void main() { + final ClassModel? instance = /* ClassModel(...) */ null; + // TODO add properties to the entity + + group(ClassModel, () { + // String classField + test('to test the property `classField`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/test/deprecated_object_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/deprecated_object_test.dart new file mode 100644 index 000000000000..8668a44a0158 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/deprecated_object_test.dart @@ -0,0 +1,15 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/dog_all_of_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/dog_all_of_test.dart new file mode 100644 index 000000000000..ca5f74f20fbe --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/dog_all_of_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DogAllOf +void main() { + final DogAllOf? instance = /* DogAllOf(...) */ null; + // TODO add properties to the entity + + group(DogAllOf, () { + // String breed + test('to test the property `breed`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/test/dog_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/dog_test.dart new file mode 100644 index 000000000000..611f2a3fdc6f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/dog_test.dart @@ -0,0 +1,25 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/entity_ref_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/entity_ref_test.dart new file mode 100644 index 000000000000..6f3bf3393abc --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/entity_ref_test.dart @@ -0,0 +1,52 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/entity_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/entity_test.dart new file mode 100644 index 000000000000..72563a81a3e5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/entity_test.dart @@ -0,0 +1,40 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/enum_arrays_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/enum_arrays_test.dart new file mode 100644 index 000000000000..5c12838ce848 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/enum_arrays_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EnumArrays +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/enum_test_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/enum_test_test.dart new file mode 100644 index 000000000000..40083505d1c0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/enum_test_test.dart @@ -0,0 +1,50 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EnumTest +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/example_non_primitive_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/example_non_primitive_test.dart new file mode 100644 index 000000000000..dbc2c1fcae41 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/example_non_primitive_test.dart @@ -0,0 +1,10 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ExampleNonPrimitive +void main() { + final ExampleNonPrimitive? instance = /* ExampleNonPrimitive(...) */ null; + // TODO add properties to the entity + + group(ExampleNonPrimitive, () {}); +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/test/example_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/example_test.dart new file mode 100644 index 000000000000..8c5b7ba11746 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/example_test.dart @@ -0,0 +1,15 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/extensible_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/extensible_test.dart new file mode 100644 index 000000000000..821bd1b142fa --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/extensible_test.dart @@ -0,0 +1,28 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/file_schema_test_class_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/file_schema_test_class_test.dart new file mode 100644 index 000000000000..14d7c2120cd9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/file_schema_test_class_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FileSchemaTestClass +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/foo_ref_or_value_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/foo_ref_or_value_test.dart new file mode 100644 index 000000000000..e5c101940aa0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/foo_ref_or_value_test.dart @@ -0,0 +1,40 @@ +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, () { + // 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/client/echo_api/dart/dart-dio-json_serializable/test/foo_ref_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/foo_ref_test.dart new file mode 100644 index 000000000000..fe14a0965722 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/foo_ref_test.dart @@ -0,0 +1,45 @@ +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 + }); + + // 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/client/echo_api/dart/dart-dio-json_serializable/test/foo_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/foo_test.dart new file mode 100644 index 000000000000..42b4149f85b6 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/foo_test.dart @@ -0,0 +1,50 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/format_test_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/format_test_test.dart new file mode 100644 index 000000000000..93bb4ba3ca97 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/format_test_test.dart @@ -0,0 +1,92 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FormatTest +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/fruit_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/fruit_test.dart new file mode 100644 index 000000000000..e376b1d49990 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/fruit_test.dart @@ -0,0 +1,25 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/has_only_read_only_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/has_only_read_only_test.dart new file mode 100644 index 000000000000..5b33d9ca7457 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/has_only_read_only_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for HasOnlyReadOnly +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/health_check_result_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/health_check_result_test.dart new file mode 100644 index 000000000000..adc423fde5d8 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/health_check_result_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for HealthCheckResult +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/map_test_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/map_test_test.dart new file mode 100644 index 000000000000..e6efc4c58af7 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/map_test_test.dart @@ -0,0 +1,30 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for MapTest +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/mixed_properties_and_additional_properties_class_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/mixed_properties_and_additional_properties_class_test.dart new file mode 100644 index 000000000000..4f4ed38bff17 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/test/model200_response_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/model200_response_test.dart new file mode 100644 index 000000000000..217772fc7626 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/model200_response_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Model200Response +void main() { + final Model200Response? instance = /* Model200Response(...) */ null; + // TODO add properties to the entity + + group(Model200Response, () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // String classField + test('to test the property `classField`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/test/model_client_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/model_client_test.dart new file mode 100644 index 000000000000..5ea0a93ab265 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/model_client_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelClient +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/model_enum_class_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/model_enum_class_test.dart new file mode 100644 index 000000000000..fa31f816801c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/model_enum_class_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelEnumClass +void main() { + group(ModelEnumClass, () {}); +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/test/model_file_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/model_file_test.dart new file mode 100644 index 000000000000..cfc5be5ba117 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/model_file_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelFile +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/model_list_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/model_list_test.dart new file mode 100644 index 000000000000..a4ff05980ee6 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/model_list_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelList +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/model_return_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/model_return_test.dart new file mode 100644 index 000000000000..2f97f6cf6ed7 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/model_return_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelReturn +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/name_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/name_test.dart new file mode 100644 index 000000000000..036c3d07845c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/name_test.dart @@ -0,0 +1,30 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/nullable_class_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/nullable_class_test.dart new file mode 100644 index 000000000000..b5b320cae68b --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/nullable_class_test.dart @@ -0,0 +1,70 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for NullableClass +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/number_only_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/number_only_test.dart new file mode 100644 index 000000000000..6764fbc7a8c5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/number_only_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for NumberOnly +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/object_with_deprecated_fields_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/object_with_deprecated_fields_test.dart new file mode 100644 index 000000000000..dd0c27df02a3 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/test/order_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/order_test.dart new file mode 100644 index 000000000000..8d5cbc6a9df5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/order_test.dart @@ -0,0 +1,41 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/outer_composite_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/outer_composite_test.dart new file mode 100644 index 000000000000..5d675fe37618 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/outer_composite_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterComposite +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/outer_enum_default_value_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/outer_enum_default_value_test.dart new file mode 100644 index 000000000000..a5c83f615194 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/outer_enum_default_value_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumDefaultValue +void main() { + group(OuterEnumDefaultValue, () {}); +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/test/outer_enum_integer_default_value_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/outer_enum_integer_default_value_test.dart new file mode 100644 index 000000000000..49ebbfcead7f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/outer_enum_integer_default_value_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumIntegerDefaultValue +void main() { + group(OuterEnumIntegerDefaultValue, () {}); +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/test/outer_enum_integer_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/outer_enum_integer_test.dart new file mode 100644 index 000000000000..3c6b81305c71 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/outer_enum_integer_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumInteger +void main() { + group(OuterEnumInteger, () {}); +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/test/outer_enum_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/outer_enum_test.dart new file mode 100644 index 000000000000..4ee10f379d5e --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/outer_enum_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnum +void main() { + group(OuterEnum, () {}); +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/test/outer_object_with_enum_property_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/outer_object_with_enum_property_test.dart new file mode 100644 index 000000000000..c658fed371ec --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/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/client/echo_api/dart/dart-dio-json_serializable/test/pasta_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/pasta_test.dart new file mode 100644 index 000000000000..98ba6325ac09 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/pasta_test.dart @@ -0,0 +1,45 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/path_api_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/path_api_test.dart new file mode 100644 index 000000000000..658f714ec35f --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/path_api_test.dart @@ -0,0 +1,18 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for PathApi +void main() { + final instance = Openapi().getPathApi(); + + group(PathApi, () { + // Test path parameter(s) + // + // Test path parameter(s) + // + //Future testsPathStringPathStringIntegerPathInteger(String pathString, int pathInteger) async + test('test testsPathStringPathStringIntegerPathInteger', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/test/pet_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/pet_test.dart new file mode 100644 index 000000000000..fdfc9dbd062c --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/pet_test.dart @@ -0,0 +1,41 @@ +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 + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // Category category + test('to test the property `category`', () async { + // TODO + }); + + // List 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/client/echo_api/dart/dart-dio-json_serializable/test/pizza_speziale_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/pizza_speziale_test.dart new file mode 100644 index 000000000000..002deb101bfc --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/pizza_speziale_test.dart @@ -0,0 +1,45 @@ +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 + }); + + // 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/client/echo_api/dart/dart-dio-json_serializable/test/pizza_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/pizza_test.dart new file mode 100644 index 000000000000..ea886dcc3a49 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/pizza_test.dart @@ -0,0 +1,45 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/query_api_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/query_api_test.dart new file mode 100644 index 000000000000..960e3b243e74 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/query_api_test.dart @@ -0,0 +1,36 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for QueryApi +void main() { + final instance = Openapi().getQueryApi(); + + group(QueryApi, () { + // Test query parameter(s) + // + // Test query parameter(s) + // + //Future testQueryIntegerBooleanString({ int integerQuery, bool booleanQuery, String stringQuery }) async + test('test testQueryIntegerBooleanString', () async { + // TODO + }); + + // Test query parameter(s) + // + // Test query parameter(s) + // + //Future testQueryStyleFormExplodeTrueArrayString({ TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject }) async + test('test testQueryStyleFormExplodeTrueArrayString', () async { + // TODO + }); + + // Test query parameter(s) + // + // Test query parameter(s) + // + //Future testQueryStyleFormExplodeTrueObject({ Pet queryObject }) async + test('test testQueryStyleFormExplodeTrueObject', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/test/read_only_first_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/read_only_first_test.dart new file mode 100644 index 000000000000..4f4d9d207593 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/read_only_first_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ReadOnlyFirst +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/single_ref_type_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/single_ref_type_test.dart new file mode 100644 index 000000000000..2c265f0d24ae --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/single_ref_type_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for SingleRefType +void main() { + group(SingleRefType, () {}); +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/test/special_model_name_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/special_model_name_test.dart new file mode 100644 index 000000000000..3a6043c9054b --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/special_model_name_test.dart @@ -0,0 +1,17 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for SpecialModelName +void main() { + final 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/client/echo_api/dart/dart-dio-json_serializable/test/tag_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/tag_test.dart new file mode 100644 index 000000000000..df95f3461fd9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/tag_test.dart @@ -0,0 +1,20 @@ +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/client/echo_api/dart/dart-dio-json_serializable/test/test_query_style_form_explode_true_array_string_query_object_parameter_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/test_query_style_form_explode_true_array_string_query_object_parameter_test.dart new file mode 100644 index 000000000000..882e416d1958 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/test_query_style_form_explode_true_array_string_query_object_parameter_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter +void main() { + final TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? + instance = /* TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(...) */ null; + // TODO add properties to the entity + + group(TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, () { + // List values + test('to test the property `values`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-dio-json_serializable/test/user_test.dart b/samples/client/echo_api/dart/dart-dio-json_serializable/test/user_test.dart new file mode 100644 index 000000000000..fc1bb1cea555 --- /dev/null +++ b/samples/client/echo_api/dart/dart-dio-json_serializable/test/user_test.dart @@ -0,0 +1,51 @@ +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 + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/.gitignore b/samples/client/echo_api/dart/dart-http-built_value/.gitignore similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_primitive/.gitignore rename to samples/client/echo_api/dart/dart-http-built_value/.gitignore diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/.openapi-generator-ignore b/samples/client/echo_api/dart/dart-http-built_value/.openapi-generator-ignore similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_primitive/.openapi-generator-ignore rename to samples/client/echo_api/dart/dart-http-built_value/.openapi-generator-ignore diff --git a/samples/client/echo_api/dart/dart-http-built_value/.openapi-generator/FILES b/samples/client/echo_api/dart/dart-http-built_value/.openapi-generator/FILES new file mode 100644 index 000000000000..eb91ad816446 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/.openapi-generator/FILES @@ -0,0 +1,158 @@ +.gitignore +README.md +analysis_options.yaml +doc/AdditionalPropertiesClass.md +doc/Addressable.md +doc/AllOfWithSingleRef.md +doc/Animal.md +doc/ApiResponse.md +doc/Apple.md +doc/ArrayOfArrayOfNumberOnly.md +doc/ArrayOfNumberOnly.md +doc/ArrayTest.md +doc/Banana.md +doc/Bar.md +doc/BarCreate.md +doc/BarRef.md +doc/BarRefOrValue.md +doc/BodyApi.md +doc/Capitalization.md +doc/Cat.md +doc/CatAllOf.md +doc/Category.md +doc/Child.md +doc/ClassModel.md +doc/DeprecatedObject.md +doc/Dog.md +doc/DogAllOf.md +doc/Entity.md +doc/EntityRef.md +doc/EnumArrays.md +doc/EnumTest.md +doc/Example.md +doc/ExampleNonPrimitive.md +doc/Extensible.md +doc/FileSchemaTestClass.md +doc/Foo.md +doc/FooRef.md +doc/FooRefOrValue.md +doc/FormatTest.md +doc/Fruit.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/Pasta.md +doc/PathApi.md +doc/Pet.md +doc/Pizza.md +doc/PizzaSpeziale.md +doc/QueryApi.md +doc/ReadOnlyFirst.md +doc/SingleRefType.md +doc/SpecialModelName.md +doc/Tag.md +doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md +doc/User.md +lib/openapi.dart +lib/src/api.dart +lib/src/api/_exports.dart +lib/src/api/body_api.dart +lib/src/api/path_api.dart +lib/src/api/query_api.dart +lib/src/api_util.dart +lib/src/auth/_exports.dart +lib/src/auth/api_key_auth.dart +lib/src/auth/auth.dart +lib/src/auth/basic_auth.dart +lib/src/auth/bearer_auth.dart +lib/src/auth/oauth.dart +lib/src/date_serializer.dart +lib/src/model/_exports.dart +lib/src/model/additional_properties_class.dart +lib/src/model/addressable.dart +lib/src/model/all_of_with_single_ref.dart +lib/src/model/animal.dart +lib/src/model/api_response.dart +lib/src/model/apple.dart +lib/src/model/array_of_array_of_number_only.dart +lib/src/model/array_of_number_only.dart +lib/src/model/array_test.dart +lib/src/model/banana.dart +lib/src/model/bar.dart +lib/src/model/bar_create.dart +lib/src/model/bar_ref.dart +lib/src/model/bar_ref_or_value.dart +lib/src/model/capitalization.dart +lib/src/model/cat.dart +lib/src/model/cat_all_of.dart +lib/src/model/category.dart +lib/src/model/child.dart +lib/src/model/class_model.dart +lib/src/model/date.dart +lib/src/model/deprecated_object.dart +lib/src/model/dog.dart +lib/src/model/dog_all_of.dart +lib/src/model/entity.dart +lib/src/model/entity_ref.dart +lib/src/model/enum_arrays.dart +lib/src/model/enum_test.dart +lib/src/model/example.dart +lib/src/model/example_non_primitive.dart +lib/src/model/extensible.dart +lib/src/model/file_schema_test_class.dart +lib/src/model/foo.dart +lib/src/model/foo_ref.dart +lib/src/model/foo_ref_or_value.dart +lib/src/model/format_test.dart +lib/src/model/fruit.dart +lib/src/model/has_only_read_only.dart +lib/src/model/health_check_result.dart +lib/src/model/map_test.dart +lib/src/model/mixed_properties_and_additional_properties_class.dart +lib/src/model/model200_response.dart +lib/src/model/model_client.dart +lib/src/model/model_enum_class.dart +lib/src/model/model_file.dart +lib/src/model/model_list.dart +lib/src/model/model_return.dart +lib/src/model/name.dart +lib/src/model/nullable_class.dart +lib/src/model/number_only.dart +lib/src/model/object_with_deprecated_fields.dart +lib/src/model/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/pasta.dart +lib/src/model/pet.dart +lib/src/model/pizza.dart +lib/src/model/pizza_speziale.dart +lib/src/model/read_only_first.dart +lib/src/model/single_ref_type.dart +lib/src/model/special_model_name.dart +lib/src/model/tag.dart +lib/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart +lib/src/model/user.dart +lib/src/serializers.dart +pubspec.yaml diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/.openapi-generator/VERSION b/samples/client/echo_api/dart/dart-http-built_value/.openapi-generator/VERSION similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_primitive/.openapi-generator/VERSION rename to samples/client/echo_api/dart/dart-http-built_value/.openapi-generator/VERSION diff --git a/samples/client/echo_api/dart/dart-http-built_value/README.md b/samples/client/echo_api/dart/dart-http-built_value/README.md new file mode 100644 index 000000000000..83dce6ed3339 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/README.md @@ -0,0 +1,153 @@ +# openapi +Echo Server API + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 0.1.0 +- Build package: org.openapitools.codegen.languages.DartDioClientCodegen + +## Requirements + +* Dart 2.12.0 or later OR Flutter 1.26.0 or later +* http 0.13.5+ + +## 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().getBodyApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store + +try { + final response = await api.testEchoBodyPet(pet); + print(response); +} catch on DioError (e) { + print("Exception when calling BodyApi->testEchoBodyPet: $e\n"); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:3000* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +[*BodyApi*](doc/BodyApi.md) | [**testEchoBodyPet**](doc/BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s) +[*PathApi*](doc/PathApi.md) | [**testsPathStringPathStringIntegerPathInteger**](doc/PathApi.md#testspathstringpathstringintegerpathinteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) +[*QueryApi*](doc/QueryApi.md) | [**testQueryIntegerBooleanString**](doc/QueryApi.md#testqueryintegerbooleanstring) | **GET** /query/integer/boolean/string | Test query parameter(s) +[*QueryApi*](doc/QueryApi.md) | [**testQueryStyleFormExplodeTrueArrayString**](doc/QueryApi.md#testquerystyleformexplodetruearraystring) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) +[*QueryApi*](doc/QueryApi.md) | [**testQueryStyleFormExplodeTrueObject**](doc/QueryApi.md#testquerystyleformexplodetrueobject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) + + +## Documentation For Models + + - [AdditionalPropertiesClass](doc/AdditionalPropertiesClass.md) + - [Addressable](doc/Addressable.md) + - [AllOfWithSingleRef](doc/AllOfWithSingleRef.md) + - [Animal](doc/Animal.md) + - [ApiResponse](doc/ApiResponse.md) + - [Apple](doc/Apple.md) + - [ArrayOfArrayOfNumberOnly](doc/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](doc/ArrayOfNumberOnly.md) + - [ArrayTest](doc/ArrayTest.md) + - [Banana](doc/Banana.md) + - [Bar](doc/Bar.md) + - [BarCreate](doc/BarCreate.md) + - [BarRef](doc/BarRef.md) + - [BarRefOrValue](doc/BarRefOrValue.md) + - [Capitalization](doc/Capitalization.md) + - [Cat](doc/Cat.md) + - [CatAllOf](doc/CatAllOf.md) + - [Category](doc/Category.md) + - [Child](doc/Child.md) + - [ClassModel](doc/ClassModel.md) + - [DeprecatedObject](doc/DeprecatedObject.md) + - [Dog](doc/Dog.md) + - [DogAllOf](doc/DogAllOf.md) + - [Entity](doc/Entity.md) + - [EntityRef](doc/EntityRef.md) + - [EnumArrays](doc/EnumArrays.md) + - [EnumTest](doc/EnumTest.md) + - [Example](doc/Example.md) + - [ExampleNonPrimitive](doc/ExampleNonPrimitive.md) + - [Extensible](doc/Extensible.md) + - [FileSchemaTestClass](doc/FileSchemaTestClass.md) + - [Foo](doc/Foo.md) + - [FooRef](doc/FooRef.md) + - [FooRefOrValue](doc/FooRefOrValue.md) + - [FormatTest](doc/FormatTest.md) + - [Fruit](doc/Fruit.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) + - [Pasta](doc/Pasta.md) + - [Pet](doc/Pet.md) + - [Pizza](doc/Pizza.md) + - [PizzaSpeziale](doc/PizzaSpeziale.md) + - [ReadOnlyFirst](doc/ReadOnlyFirst.md) + - [SingleRefType](doc/SingleRefType.md) + - [SpecialModelName](doc/SpecialModelName.md) + - [Tag](doc/Tag.md) + - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) + - [User](doc/User.md) + + +## Documentation For Authorization + + All endpoints do not require authorization. + + +## Author + +team@openapitools.org + diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/analysis_options.yaml b/samples/client/echo_api/dart/dart-http-built_value/analysis_options.yaml similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/analysis_options.yaml rename to samples/client/echo_api/dart/dart-http-built_value/analysis_options.yaml diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/AdditionalPropertiesClass.md b/samples/client/echo_api/dart/dart-http-built_value/doc/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..f9f7857894d0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/AdditionalPropertiesClass.md @@ -0,0 +1,16 @@ +# openapi.model.AdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapProperty** | **BuiltMap<String, String>** | | [optional] +**mapOfMapProperty** | [**BuiltMap<String, BuiltMap<String, String>>**](BuiltMap.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/Addressable.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Addressable.md new file mode 100644 index 000000000000..0fcd81b80382 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/AllOfWithSingleRef.md b/samples/client/echo_api/dart/dart-http-built_value/doc/AllOfWithSingleRef.md new file mode 100644 index 000000000000..4c6f3ab2fe11 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/Animal.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Animal.md new file mode 100644 index 000000000000..415b56e9bc2e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/ApiResponse.md b/samples/client/echo_api/dart/dart-http-built_value/doc/ApiResponse.md new file mode 100644 index 000000000000..7ad5da0f89e4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/Apple.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Apple.md new file mode 100644 index 000000000000..c7f711b87cef --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/ArrayOfArrayOfNumberOnly.md b/samples/client/echo_api/dart/dart-http-built_value/doc/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..d1a272ab6023 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayArrayNumber** | [**BuiltList<BuiltList<num>>**](BuiltList.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/ArrayOfNumberOnly.md b/samples/client/echo_api/dart/dart-http-built_value/doc/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..94b60f272fd4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/ArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayNumber** | **BuiltList<num>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/ArrayTest.md b/samples/client/echo_api/dart/dart-http-built_value/doc/ArrayTest.md new file mode 100644 index 000000000000..0813d4fa93c6 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/ArrayTest.md @@ -0,0 +1,17 @@ +# openapi.model.ArrayTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayOfString** | **BuiltList<String>** | | [optional] +**arrayArrayOfInteger** | [**BuiltList<BuiltList<int>>**](BuiltList.md) | | [optional] +**arrayArrayOfModel** | [**BuiltList<BuiltList<ReadOnlyFirst>>**](BuiltList.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/Banana.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Banana.md new file mode 100644 index 000000000000..bef8a58a4276 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/Bar.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Bar.md new file mode 100644 index 000000000000..4cccc863a489 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/BarCreate.md b/samples/client/echo_api/dart/dart-http-built_value/doc/BarCreate.md new file mode 100644 index 000000000000..c0b4ba6edc9a --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/BarRef.md b/samples/client/echo_api/dart/dart-http-built_value/doc/BarRef.md new file mode 100644 index 000000000000..949695f4d36f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/BarRef.md @@ -0,0 +1,19 @@ +# openapi.model.BarRef + +## 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/client/echo_api/dart/dart-http-built_value/doc/BarRefOrValue.md b/samples/client/echo_api/dart/dart-http-built_value/doc/BarRefOrValue.md new file mode 100644 index 000000000000..9dafa2d6b220 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/BarRefOrValue.md @@ -0,0 +1,19 @@ +# openapi.model.BarRefOrValue + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible name | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/BodyApi.md b/samples/client/echo_api/dart/dart-http-built_value/doc/BodyApi.md new file mode 100644 index 000000000000..145854fc8d28 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/BodyApi.md @@ -0,0 +1,57 @@ +# openapi.api.BodyApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testEchoBodyPet**](BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s) + + +# **testEchoBodyPet** +> Pet testEchoBodyPet(pet) + +Test body parameter(s) + +Test body parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getBodyApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store + +try { + final response = api.testEchoBodyPet(pet); + print(response); +} catch on DioError (e) { + print('Exception when calling BodyApi->testEchoBodyPet: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/Capitalization.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Capitalization.md new file mode 100644 index 000000000000..4a07b4eb820d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/Cat.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Cat.md new file mode 100644 index 000000000000..6552eea4b435 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/CatAllOf.md b/samples/client/echo_api/dart/dart-http-built_value/doc/CatAllOf.md new file mode 100644 index 000000000000..36b2ae0e8ab3 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/CatAllOf.md @@ -0,0 +1,15 @@ +# openapi.model.CatAllOf + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/Category.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Category.md new file mode 100644 index 000000000000..98d0b14be7b1 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/Child.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Child.md new file mode 100644 index 000000000000..bed0f2feec12 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/ClassModel.md b/samples/client/echo_api/dart/dart-http-built_value/doc/ClassModel.md new file mode 100644 index 000000000000..9b80d4f71eea --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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 +------------ | ------------- | ------------- | ------------- +**classField** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/DeprecatedObject.md b/samples/client/echo_api/dart/dart-http-built_value/doc/DeprecatedObject.md new file mode 100644 index 000000000000..bf2ef67a26fc --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/Dog.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Dog.md new file mode 100644 index 000000000000..d36439b767bb --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/DogAllOf.md b/samples/client/echo_api/dart/dart-http-built_value/doc/DogAllOf.md new file mode 100644 index 000000000000..97a7c8fba492 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/DogAllOf.md @@ -0,0 +1,15 @@ +# openapi.model.DogAllOf + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/Entity.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Entity.md new file mode 100644 index 000000000000..5ba2144b44fe --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/EntityRef.md b/samples/client/echo_api/dart/dart-http-built_value/doc/EntityRef.md new file mode 100644 index 000000000000..80eae55f4145 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/EnumArrays.md b/samples/client/echo_api/dart/dart-http-built_value/doc/EnumArrays.md new file mode 100644 index 000000000000..06170bb8f51d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/EnumArrays.md @@ -0,0 +1,16 @@ +# openapi.model.EnumArrays + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justSymbol** | **String** | | [optional] +**arrayEnum** | **BuiltList<String>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/EnumTest.md b/samples/client/echo_api/dart/dart-http-built_value/doc/EnumTest.md new file mode 100644 index 000000000000..7c24fe2347b4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/Example.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Example.md new file mode 100644 index 000000000000..bf49bb137a60 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/ExampleNonPrimitive.md b/samples/client/echo_api/dart/dart-http-built_value/doc/ExampleNonPrimitive.md new file mode 100644 index 000000000000..2b63a98c6ad9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/ExampleNonPrimitive.md @@ -0,0 +1,14 @@ +# openapi.model.ExampleNonPrimitive + +## 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/client/echo_api/dart/dart-http-built_value/doc/Extensible.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Extensible.md new file mode 100644 index 000000000000..7a781e578ea4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/FileSchemaTestClass.md b/samples/client/echo_api/dart/dart-http-built_value/doc/FileSchemaTestClass.md new file mode 100644 index 000000000000..105fece87f1d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/FileSchemaTestClass.md @@ -0,0 +1,16 @@ +# openapi.model.FileSchemaTestClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**ModelFile**](ModelFile.md) | | [optional] +**files** | [**BuiltList<ModelFile>**](ModelFile.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/Foo.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Foo.md new file mode 100644 index 000000000000..2627691fefe5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/FooRef.md b/samples/client/echo_api/dart/dart-http-built_value/doc/FooRef.md new file mode 100644 index 000000000000..68104b227292 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/FooRef.md @@ -0,0 +1,20 @@ +# openapi.model.FooRef + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foorefPropA** | **String** | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible name | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/FooRefOrValue.md b/samples/client/echo_api/dart/dart-http-built_value/doc/FooRefOrValue.md new file mode 100644 index 000000000000..35e9fd114e1d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/FooRefOrValue.md @@ -0,0 +1,19 @@ +# openapi.model.FooRefOrValue + +## 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/client/echo_api/dart/dart-http-built_value/doc/FormatTest.md b/samples/client/echo_api/dart/dart-http-built_value/doc/FormatTest.md new file mode 100644 index 000000000000..f811264ca2ba --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/FormatTest.md @@ -0,0 +1,30 @@ +# openapi.model.FormatTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | | [optional] +**int32** | **int** | | [optional] +**int64** | **int** | | [optional] +**number** | **num** | | +**float** | **double** | | [optional] +**double_** | **double** | | [optional] +**decimal** | **double** | | [optional] +**string** | **String** | | [optional] +**byte** | **String** | | +**binary** | [**Uint8List**](Uint8List.md) | | [optional] +**date** | [**Date**](Date.md) | | +**dateTime** | [**DateTime**](DateTime.md) | | [optional] +**uuid** | **String** | | [optional] +**password** | **String** | | +**patternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] +**patternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/Fruit.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Fruit.md new file mode 100644 index 000000000000..5d48cc6e6d38 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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 +------------ | ------------- | ------------- | ------------- +**color** | **String** | | [optional] +**kind** | **String** | | [optional] +**count** | **num** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/HasOnlyReadOnly.md b/samples/client/echo_api/dart/dart-http-built_value/doc/HasOnlyReadOnly.md new file mode 100644 index 000000000000..32cae937155d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/HealthCheckResult.md b/samples/client/echo_api/dart/dart-http-built_value/doc/HealthCheckResult.md new file mode 100644 index 000000000000..4d6aeb75d965 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/MapTest.md b/samples/client/echo_api/dart/dart-http-built_value/doc/MapTest.md new file mode 100644 index 000000000000..4ad87df64232 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/MapTest.md @@ -0,0 +1,18 @@ +# openapi.model.MapTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapMapOfString** | [**BuiltMap<String, BuiltMap<String, String>>**](BuiltMap.md) | | [optional] +**mapOfEnumString** | **BuiltMap<String, String>** | | [optional] +**directMap** | **BuiltMap<String, bool>** | | [optional] +**indirectMap** | **BuiltMap<String, bool>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/echo_api/dart/dart-http-built_value/doc/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..b1a4c4ccc401 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,17 @@ +# openapi.model.MixedPropertiesAndAdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **String** | | [optional] +**dateTime** | [**DateTime**](DateTime.md) | | [optional] +**map** | [**BuiltMap<String, Animal>**](Animal.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/Model200Response.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Model200Response.md new file mode 100644 index 000000000000..e8b088ca1afa --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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] +**classField** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/ModelClient.md b/samples/client/echo_api/dart/dart-http-built_value/doc/ModelClient.md new file mode 100644 index 000000000000..f7b922f4a398 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/ModelEnumClass.md b/samples/client/echo_api/dart/dart-http-built_value/doc/ModelEnumClass.md new file mode 100644 index 000000000000..ebaafb44c7f7 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/ModelFile.md b/samples/client/echo_api/dart/dart-http-built_value/doc/ModelFile.md new file mode 100644 index 000000000000..4be260e93f6e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/ModelList.md b/samples/client/echo_api/dart/dart-http-built_value/doc/ModelList.md new file mode 100644 index 000000000000..283aa1f6b711 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/ModelReturn.md b/samples/client/echo_api/dart/dart-http-built_value/doc/ModelReturn.md new file mode 100644 index 000000000000..bc02df7a3692 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/Name.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Name.md new file mode 100644 index 000000000000..25f49ea946b4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/NullableClass.md b/samples/client/echo_api/dart/dart-http-built_value/doc/NullableClass.md new file mode 100644 index 000000000000..4ce8d5e17576 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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** | [**Date**](Date.md) | | [optional] +**datetimeProp** | [**DateTime**](DateTime.md) | | [optional] +**arrayNullableProp** | [**BuiltList<JsonObject>**](JsonObject.md) | | [optional] +**arrayAndItemsNullableProp** | [**BuiltList<JsonObject>**](JsonObject.md) | | [optional] +**arrayItemsNullable** | [**BuiltList<JsonObject>**](JsonObject.md) | | [optional] +**objectNullableProp** | [**BuiltMap<String, JsonObject>**](JsonObject.md) | | [optional] +**objectAndItemsNullableProp** | [**BuiltMap<String, JsonObject>**](JsonObject.md) | | [optional] +**objectItemsNullable** | [**BuiltMap<String, JsonObject>**](JsonObject.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/NumberOnly.md b/samples/client/echo_api/dart/dart-http-built_value/doc/NumberOnly.md new file mode 100644 index 000000000000..d8096a3db37a --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/ObjectWithDeprecatedFields.md b/samples/client/echo_api/dart/dart-http-built_value/doc/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..00d3cc694525 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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** | [**BuiltList<Bar>**](Bar.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/Order.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Order.md new file mode 100644 index 000000000000..bde5ffe51a2c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/OuterComposite.md b/samples/client/echo_api/dart/dart-http-built_value/doc/OuterComposite.md new file mode 100644 index 000000000000..04bab7eff5d1 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/OuterEnum.md b/samples/client/echo_api/dart/dart-http-built_value/doc/OuterEnum.md new file mode 100644 index 000000000000..af62ad87ab2e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/OuterEnumDefaultValue.md b/samples/client/echo_api/dart/dart-http-built_value/doc/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..c1bf8b0dec44 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/OuterEnumInteger.md b/samples/client/echo_api/dart/dart-http-built_value/doc/OuterEnumInteger.md new file mode 100644 index 000000000000..8c80a9e5c85f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/OuterEnumIntegerDefaultValue.md b/samples/client/echo_api/dart/dart-http-built_value/doc/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..eb8b55d70249 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/OuterObjectWithEnumProperty.md b/samples/client/echo_api/dart/dart-http-built_value/doc/OuterObjectWithEnumProperty.md new file mode 100644 index 000000000000..eab2ae8f66b4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/Pasta.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Pasta.md new file mode 100644 index 000000000000..034ff420d323 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/PathApi.md b/samples/client/echo_api/dart/dart-http-built_value/doc/PathApi.md new file mode 100644 index 000000000000..ae663a2f7f04 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/PathApi.md @@ -0,0 +1,59 @@ +# openapi.api.PathApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testsPathStringPathStringIntegerPathInteger**](PathApi.md#testspathstringpathstringintegerpathinteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) + + +# **testsPathStringPathStringIntegerPathInteger** +> String testsPathStringPathStringIntegerPathInteger(pathString, pathInteger) + +Test path parameter(s) + +Test path parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getPathApi(); +final String pathString = pathString_example; // String | +final int pathInteger = 56; // int | + +try { + final response = api.testsPathStringPathStringIntegerPathInteger(pathString, pathInteger); + print(response); +} catch on DioError (e) { + print('Exception when calling PathApi->testsPathStringPathStringIntegerPathInteger: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pathString** | **String**| | + **pathInteger** | **int**| | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/Pet.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Pet.md new file mode 100644 index 000000000000..455b9330ff8e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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] +**name** | **String** | | +**category** | [**Category**](Category.md) | | [optional] +**photoUrls** | **BuiltList<String>** | | +**tags** | [**BuiltList<Tag>**](Tag.md) | | [optional] +**status** | **String** | pet status in the store | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/Pizza.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Pizza.md new file mode 100644 index 000000000000..e4b040a6a79c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/PizzaSpeziale.md b/samples/client/echo_api/dart/dart-http-built_value/doc/PizzaSpeziale.md new file mode 100644 index 000000000000..e1d8434c077d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/PizzaSpeziale.md @@ -0,0 +1,20 @@ +# openapi.model.PizzaSpeziale + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**toppings** | **String** | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible name | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/QueryApi.md b/samples/client/echo_api/dart/dart-http-built_value/doc/QueryApi.md new file mode 100644 index 000000000000..f92f9532a113 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/QueryApi.md @@ -0,0 +1,149 @@ +# openapi.api.QueryApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testQueryIntegerBooleanString**](QueryApi.md#testqueryintegerbooleanstring) | **GET** /query/integer/boolean/string | Test query parameter(s) +[**testQueryStyleFormExplodeTrueArrayString**](QueryApi.md#testquerystyleformexplodetruearraystring) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) +[**testQueryStyleFormExplodeTrueObject**](QueryApi.md#testquerystyleformexplodetrueobject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) + + +# **testQueryIntegerBooleanString** +> String testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getQueryApi(); +final int integerQuery = 56; // int | +final bool booleanQuery = true; // bool | +final String stringQuery = stringQuery_example; // String | + +try { + final response = api.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery); + print(response); +} catch on DioError (e) { + print('Exception when calling QueryApi->testQueryIntegerBooleanString: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integerQuery** | **int**| | [optional] + **booleanQuery** | **bool**| | [optional] + **stringQuery** | **String**| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testQueryStyleFormExplodeTrueArrayString** +> String testQueryStyleFormExplodeTrueArrayString(queryObject) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getQueryApi(); +final TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject = ; // TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter | + +try { + final response = api.testQueryStyleFormExplodeTrueArrayString(queryObject); + print(response); +} catch on DioError (e) { + print('Exception when calling QueryApi->testQueryStyleFormExplodeTrueArrayString: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](.md)| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testQueryStyleFormExplodeTrueObject** +> String testQueryStyleFormExplodeTrueObject(queryObject) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getQueryApi(); +final Pet queryObject = ; // Pet | + +try { + final response = api.testQueryStyleFormExplodeTrueObject(queryObject); + print(response); +} catch on DioError (e) { + print('Exception when calling QueryApi->testQueryStyleFormExplodeTrueObject: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | [**Pet**](.md)| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/ReadOnlyFirst.md b/samples/client/echo_api/dart/dart-http-built_value/doc/ReadOnlyFirst.md new file mode 100644 index 000000000000..8f612e8ba19f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/SingleRefType.md b/samples/client/echo_api/dart/dart-http-built_value/doc/SingleRefType.md new file mode 100644 index 000000000000..0dc93840cd7f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/SpecialModelName.md b/samples/client/echo_api/dart/dart-http-built_value/doc/SpecialModelName.md new file mode 100644 index 000000000000..5fcfa98e0b36 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/Tag.md b/samples/client/echo_api/dart/dart-http-built_value/doc/Tag.md new file mode 100644 index 000000000000..c219f987c19c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md b/samples/client/echo_api/dart/dart-http-built_value/doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md new file mode 100644 index 000000000000..9ee07596a0df --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md @@ -0,0 +1,15 @@ +# openapi.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**values** | **BuiltList<String>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-built_value/doc/User.md b/samples/client/echo_api/dart/dart-http-built_value/doc/User.md new file mode 100644 index 000000000000..fa87e64d8595 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/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/client/echo_api/dart/dart-http-built_value/lib/openapi.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/openapi.dart new file mode 100644 index 000000000000..0b94909a8fee --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/openapi.dart @@ -0,0 +1,10 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +export 'package:openapi/src/api.dart'; +export 'package:openapi/src/auth/_exports.dart'; +export 'package:openapi/src/serializers.dart'; + +export 'package:openapi/src/api/_exports.dart'; +export 'package:openapi/src/model/_exports.dart'; diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/api.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/api.dart new file mode 100644 index 000000000000..739cec85ba7f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/api.dart @@ -0,0 +1,45 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:http/http.dart' as http; +import 'package:built_value/serializer.dart'; +import 'package:openapi/src/serializers.dart'; +import 'package:openapi/src/auth/_exports.dart'; +import 'package:openapi/src/api/body_api.dart'; +import 'package:openapi/src/api/path_api.dart'; +import 'package:openapi/src/api/query_api.dart'; + +class Openapi { + static const String basePath = r'http://localhost:3000'; + + final http.Client client; + final String actualBasePath; + final Serializers serializers; + + Openapi({ + http.Client? client, + Serializers? serializers, + String? basePathOverride, + }) : this.serializers = serializers ?? standardSerializers, + this.client = client ?? http.Client(), + this.actualBasePath = basePathOverride ?? basePath; + + /// Get BodyApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + BodyApi getBodyApi() { + return BodyApi(client, actualBasePath, serializers); + } + + /// Get PathApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + PathApi getPathApi() { + return PathApi(client, actualBasePath, serializers); + } + + /// Get QueryApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + QueryApi getQueryApi() { + return QueryApi(client, actualBasePath, serializers); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/api/_exports.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/api/_exports.dart new file mode 100644 index 000000000000..f06d548e0d23 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/api/_exports.dart @@ -0,0 +1,3 @@ +export 'body_api.dart'; +export 'path_api.dart'; +export 'query_api.dart'; diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/api/body_api.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/api/body_api.dart new file mode 100644 index 000000000000..0dee499ea283 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/api/body_api.dart @@ -0,0 +1,104 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +//ignore: unused_import +import 'package:built_value/serializer.dart'; +import 'package:http/http.dart'; + +import 'package:openapi/src/model/pet.dart'; + +class BodyApi { + final Client _client; + final Serializers _serializers; + final String _basePath; + + const BodyApi(this._client, this._basePath, this._serializers); + + /// Test body parameter(s) + /// Test body parameter(s) + /// + /// 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 + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// + /// Throws [DioError] if API call or serialization fails + + Future testEchoBodyPet({ + Pet? pet, + Map? headers, + }) async { + final _path = r'/echo/body/Pet'; + final _uri = Uri.parse(_basePath + _path); + + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + const _type = FullType(Pet); + _bodyData = pet == null + ? null + : _serializers.serialize(pet, specifiedType: _type); + } catch (error, stackTrace) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Pet _responseData; + + try { + const _responseType = FullType(Pet); + _responseData = _serializers.deserialize( + _response.data!, + specifiedType: _responseType, + ) as Pet; + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + 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/client/echo_api/dart/dart-http-built_value/lib/src/api/path_api.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/api/path_api.dart new file mode 100644 index 000000000000..fb77bd6681e2 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/api/path_api.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +//ignore: unused_import +import 'package:built_value/serializer.dart'; +import 'package:http/http.dart'; + +class PathApi { + final Client _client; + final Serializers _serializers; + final String _basePath; + + const PathApi(this._client, this._basePath, this._serializers); + + /// Test path parameter(s) + /// Test path parameter(s) + /// + /// Parameters: + /// * [pathString] + /// * [pathInteger] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// + /// Throws [DioError] if API call or serialization fails + + Future testsPathStringPathStringIntegerPathInteger({ + required String pathString, + required int pathInteger, + Map? headers, + }) async { + final _path = r'/path/string/{path_string}/integer/{path_integer}' + .replaceAll('{' r'path_string' '}', pathString.toString()) + .replaceAll('{' r'path_integer' '}', pathInteger.toString()); + final _uri = Uri.parse(_basePath + _path); + + 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, + ); + + String _responseData; + + try { + _responseData = _response.data as String; + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + 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/client/echo_api/dart/dart-http-built_value/lib/src/api/query_api.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/api/query_api.dart new file mode 100644 index 000000000000..ce0ebce9b469 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/api/query_api.dart @@ -0,0 +1,242 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +//ignore: unused_import +import 'package:built_value/serializer.dart'; +import 'package:http/http.dart'; + +import 'package:openapi/src/api_util.dart'; +import 'package:openapi/src/model/pet.dart'; +import 'package:openapi/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart'; + +class QueryApi { + final Client _client; + final Serializers _serializers; + final String _basePath; + + const QueryApi(this._client, this._basePath, this._serializers); + + /// Test query parameter(s) + /// Test query parameter(s) + /// + /// Parameters: + /// * [integerQuery] + /// * [booleanQuery] + /// * [stringQuery] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// + /// Throws [DioError] if API call or serialization fails + + Future testQueryIntegerBooleanString({ + int? integerQuery, + bool? booleanQuery, + String? stringQuery, + Map? headers, + }) async { + final _path = r'/query/integer/boolean/string'; + final _uri = Uri.parse(_basePath + _path); + + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (integerQuery != null) + r'integer_query': encodeQueryParameter( + _serializers, integerQuery, const FullType(int)), + if (booleanQuery != null) + r'boolean_query': encodeQueryParameter( + _serializers, booleanQuery, const FullType(bool)), + if (stringQuery != null) + r'string_query': encodeQueryParameter( + _serializers, stringQuery, const FullType(String)), + }; + + 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 DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + 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 query parameter(s) + /// Test query parameter(s) + /// + /// Parameters: + /// * [queryObject] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// + /// Throws [DioError] if API call or serialization fails + + Future testQueryStyleFormExplodeTrueArrayString({ + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? queryObject, + Map? headers, + }) async { + final _path = r'/query/style_form/explode_true/array_string'; + final _uri = Uri.parse(_basePath + _path); + + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (queryObject != null) + r'query_object': encodeQueryParameter( + _serializers, + queryObject, + const FullType( + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter)), + }; + + 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 DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + 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 query parameter(s) + /// Test query parameter(s) + /// + /// Parameters: + /// * [queryObject] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// + /// Throws [DioError] if API call or serialization fails + + Future testQueryStyleFormExplodeTrueObject({ + Pet? queryObject, + Map? headers, + }) async { + final _path = r'/query/style_form/explode_true/object'; + final _uri = Uri.parse(_basePath + _path); + + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (queryObject != null) + r'query_object': encodeQueryParameter( + _serializers, queryObject, const FullType(Pet)), + }; + + 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 DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + 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/client/echo_api/dart/dart-http-built_value/lib/src/api_util.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/api_util.dart new file mode 100644 index 000000000000..2ff0d4b96f15 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/api_util.dart @@ -0,0 +1,66 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:convert'; +import 'package:http/http.dart'; +import 'package:intl/intl.dart'; + +const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; +const _dateEpochMarker = 'epoch'; +final _dateFormatter = DateFormat('yyyy-MM-dd'); +final _regList = RegExp(r'^List<(.*)>$'); +final _regSet = RegExp(r'^Set<(.*)>$'); +final _regMap = RegExp(r'^Map$'); + +class QueryParam { + const QueryParam(this.name, this.value); + + final String name; + final String value; + + @override + String toString() => + '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value)}'; +} + +/* +// Ported from the Java version. +Iterable _queryParams(String collectionFormat, String name, dynamic value,) { + // Assertions to run in debug mode only. + assert(name.isNotEmpty, 'Parameter cannot be an empty string.'); + + final params = []; + + if (value is List) { + if (collectionFormat == 'multi') { + return value.map((dynamic v) => QueryParam(name, parameterToString(v)),); + } + + // Default collection format is 'csv'. + if (collectionFormat.isEmpty) { + collectionFormat = 'csv'; // ignore: parameter_assignments + } + + final delimiter = _delimiters[collectionFormat] ?? ','; + + params.add(QueryParam(name, value.map(parameterToString).join(delimiter),)); + } else if (value != null) { + params.add(QueryParam(name, parameterToString(value))); + } + + return params; +} +*/ + +/// Returns the decoded body as UTF-8 if the given headers indicate an 'application/json' +/// content type. Otherwise, returns the decoded body as decoded by dart:http package. +Future decodeBodyBytes(Response response) async { + final contentType = response.headers['content-type']; + return contentType != null && + contentType.toLowerCase().startsWith('application/json') + ? response.bodyBytes.isEmpty + ? '' + : utf8.decode(response.bodyBytes) + : response.body; +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/auth/_exports.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/auth/_exports.dart new file mode 100644 index 000000000000..01c9ad2dfa7e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/auth/_exports.dart @@ -0,0 +1,9 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +export 'api_key_auth.dart'; +export 'auth.dart'; +export 'basic_auth.dart'; +export 'bearer_auth.dart'; +export 'oauth.dart'; diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/auth/api_key_auth.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/auth/api_key_auth.dart new file mode 100644 index 000000000000..396c364ce26b --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/auth/api_key_auth.dart @@ -0,0 +1,40 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:openapi/src/api_util.dart'; +import 'dart:convert'; + +import 'auth.dart'; + +class ApiKeyAuth implements Authentication { + ApiKeyAuth(this.location, this.paramName); + + final String location; + final String paramName; + + String apiKeyPrefix = ''; + String apiKey = ''; + + @override + Future applyToParams( + List queryParams, + Map headerParams, + ) async { + final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; + + if (paramValue.isNotEmpty) { + if (location == 'query') { + queryParams.add(QueryParam(paramName, paramValue)); + } else if (location == 'header') { + headerParams[paramName] = paramValue; + } else if (location == 'cookie') { + headerParams.update( + 'Cookie', + (existingCookie) => '$existingCookie; $paramName=$paramValue', + ifAbsent: () => '$paramName=$paramValue', + ); + } + } + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/auth/auth.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/auth/auth.dart new file mode 100644 index 000000000000..88550b41a798 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/auth/auth.dart @@ -0,0 +1,13 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:openapi/src/api_util.dart'; +import 'dart:convert'; + +// ignore: one_member_abstracts +abstract class Authentication { + /// Apply authentication settings to header and query params. + Future applyToParams( + List queryParams, Map headerParams); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/auth/basic_auth.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/auth/basic_auth.dart new file mode 100644 index 000000000000..d80e4cd88cc6 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/auth/basic_auth.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:openapi/src/api_util.dart'; +import 'dart:convert'; + +import 'auth.dart'; + +class HttpBasicAuth implements Authentication { + HttpBasicAuth({this.username = '', this.password = ''}); + + String username; + String password; + + @override + Future applyToParams( + List queryParams, + Map headerParams, + ) async { + if (username.isNotEmpty && password.isNotEmpty) { + final credentials = '$username:$password'; + headerParams['Authorization'] = + 'Basic ${base64.encode(utf8.encode(credentials))}'; + } + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/auth/bearer_auth.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/auth/bearer_auth.dart new file mode 100644 index 000000000000..238136cd86bc --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/auth/bearer_auth.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:openapi/src/api_util.dart'; +import 'dart:convert'; + +import 'auth.dart'; + +typedef HttpBearerAuthProvider = String? Function(); + +class HttpBearerAuth implements Authentication { + HttpBearerAuth(); + + HttpBearerAuthProvider? accessTokenProvider; + + @override + Future applyToParams( + List queryParams, + Map headerParams, + ) async { + final provider = accessTokenProvider; + if (provider == null) { + return; + } + + final accessToken = provider(); + if (accessToken != null && accessToken.isNotEmpty) { + headerParams['Authorization'] = 'Bearer $accessToken'; + } + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/auth/oauth.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/auth/oauth.dart new file mode 100644 index 000000000000..02d848a3c53f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/auth/oauth.dart @@ -0,0 +1,24 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:openapi/src/api_util.dart'; +import 'dart:convert'; + +import 'auth.dart'; + +class OAuth implements Authentication { + OAuth({this.accessToken = ''}); + + String accessToken; + + @override + Future applyToParams( + List queryParams, + Map headerParams, + ) async { + if (accessToken.isNotEmpty) { + headerParams['Authorization'] = 'Bearer $accessToken'; + } + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/date_serializer.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/date_serializer.dart similarity index 99% rename from samples/openapi3/client/petstore/dart-dio/oneof/lib/src/date_serializer.dart rename to samples/client/echo_api/dart/dart-http-built_value/lib/src/date_serializer.dart index db3c5c437db1..deacc6525d19 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/date_serializer.dart +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/date_serializer.dart @@ -7,7 +7,6 @@ import 'package:built_value/serializer.dart'; import 'package:openapi/src/model/date.dart'; class DateSerializer implements PrimitiveSerializer { - const DateSerializer(); @override diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/_exports.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/_exports.dart new file mode 100644 index 000000000000..d1f1f4450e41 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/_exports.dart @@ -0,0 +1,69 @@ +export 'additional_properties_class.dart'; +export 'addressable.dart'; +export 'all_of_with_single_ref.dart'; +export 'animal.dart'; +export 'api_response.dart'; +export 'apple.dart'; +export 'array_of_array_of_number_only.dart'; +export 'array_of_number_only.dart'; +export 'array_test.dart'; +export 'banana.dart'; +export 'bar.dart'; +export 'bar_create.dart'; +export 'bar_ref.dart'; +export 'bar_ref_or_value.dart'; +export 'capitalization.dart'; +export 'cat.dart'; +export 'cat_all_of.dart'; +export 'category.dart'; +export 'child.dart'; +export 'class_model.dart'; +export 'deprecated_object.dart'; +export 'dog.dart'; +export 'dog_all_of.dart'; +export 'entity.dart'; +export 'entity_ref.dart'; +export 'enum_arrays.dart'; +export 'enum_test.dart'; +export 'example.dart'; +export 'example_non_primitive.dart'; +export 'extensible.dart'; +export 'file_schema_test_class.dart'; +export 'foo.dart'; +export 'foo_ref.dart'; +export 'foo_ref_or_value.dart'; +export 'format_test.dart'; +export 'fruit.dart'; +export 'has_only_read_only.dart'; +export 'health_check_result.dart'; +export 'map_test.dart'; +export 'mixed_properties_and_additional_properties_class.dart'; +export 'model200_response.dart'; +export 'model_client.dart'; +export 'model_enum_class.dart'; +export 'model_file.dart'; +export 'model_list.dart'; +export 'model_return.dart'; +export 'name.dart'; +export 'nullable_class.dart'; +export 'number_only.dart'; +export 'object_with_deprecated_fields.dart'; +export 'order.dart'; +export 'outer_composite.dart'; +export 'outer_enum.dart'; +export 'outer_enum_default_value.dart'; +export 'outer_enum_integer.dart'; +export 'outer_enum_integer_default_value.dart'; +export 'outer_object_with_enum_property.dart'; +export 'pasta.dart'; +export 'pet.dart'; +export 'pizza.dart'; +export 'pizza_speziale.dart'; +export 'read_only_first.dart'; +export 'single_ref_type.dart'; +export 'special_model_name.dart'; +export 'tag.dart'; +export 'test_query_style_form_explode_true_array_string_query_object_parameter.dart'; +export 'user.dart'; + +export 'date.dart'; diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/additional_properties_class.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/additional_properties_class.dart new file mode 100644 index 000000000000..34022add8e5e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/additional_properties_class.dart @@ -0,0 +1,145 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'additional_properties_class.g.dart'; + +/// AdditionalPropertiesClass +/// +/// Properties: +/// * [mapProperty] +/// * [mapOfMapProperty] +@BuiltValue() +abstract class AdditionalPropertiesClass + implements + Built { + @BuiltValueField(wireName: r'map_property') + BuiltMap? get mapProperty; + + @BuiltValueField(wireName: r'map_of_map_property') + BuiltMap>? get mapOfMapProperty; + + AdditionalPropertiesClass._(); + + factory AdditionalPropertiesClass( + [void updates(AdditionalPropertiesClassBuilder b)]) = + _$AdditionalPropertiesClass; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(AdditionalPropertiesClassBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$AdditionalPropertiesClassSerializer(); +} + +class _$AdditionalPropertiesClassSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [ + AdditionalPropertiesClass, + _$AdditionalPropertiesClass + ]; + + @override + final String wireName = r'AdditionalPropertiesClass'; + + Iterable _serializeProperties( + Serializers serializers, + AdditionalPropertiesClass object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.mapProperty != null) { + yield r'map_property'; + yield serializers.serialize( + object.mapProperty, + specifiedType: + const FullType(BuiltMap, [FullType(String), FullType(String)]), + ); + } + if (object.mapOfMapProperty != null) { + yield r'map_of_map_property'; + yield serializers.serialize( + object.mapOfMapProperty, + specifiedType: const FullType(BuiltMap, [ + FullType(String), + FullType(BuiltMap, [FullType(String), FullType(String)]) + ]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + AdditionalPropertiesClass object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AdditionalPropertiesClassBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'map_property': + final valueDes = serializers.deserialize( + value, + specifiedType: + const FullType(BuiltMap, [FullType(String), FullType(String)]), + ) as BuiltMap; + result.mapProperty.replace(valueDes); + break; + case r'map_of_map_property': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [ + FullType(String), + FullType(BuiltMap, [FullType(String), FullType(String)]) + ]), + ) as BuiltMap>; + result.mapOfMapProperty.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + AdditionalPropertiesClass deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = AdditionalPropertiesClassBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/addressable.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/addressable.dart new file mode 100644 index 000000000000..22e9ab761489 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/addressable.dart @@ -0,0 +1,165 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'addressable.g.dart'; + +/// Base schema for addressable entities +/// +/// Properties: +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +@BuiltValue(instantiable: false) +abstract class Addressable { + /// Hyperlink reference + @BuiltValueField(wireName: r'href') + String? get href; + + /// unique identifier + @BuiltValueField(wireName: r'id') + String? get id; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$AddressableSerializer(); +} + +class _$AddressableSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Addressable]; + + @override + final String wireName = r'Addressable'; + + Iterable _serializeProperties( + Serializers serializers, + Addressable object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Addressable object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + @override + Addressable deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.deserialize(serialized, + specifiedType: FullType($Addressable)) as $Addressable; + } +} + +/// a concrete implementation of [Addressable], since [Addressable] is not instantiable +@BuiltValue(instantiable: true) +abstract class $Addressable + implements Addressable, Built<$Addressable, $AddressableBuilder> { + $Addressable._(); + + factory $Addressable([void Function($AddressableBuilder)? updates]) = + _$$Addressable; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($AddressableBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$Addressable> get serializer => _$$AddressableSerializer(); +} + +class _$$AddressableSerializer implements PrimitiveSerializer<$Addressable> { + @override + final Iterable types = const [$Addressable, _$$Addressable]; + + @override + final String wireName = r'$Addressable'; + + @override + Object serialize( + Serializers serializers, + $Addressable object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(Addressable))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AddressableBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $Addressable deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $AddressableBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/all_of_with_single_ref.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/all_of_with_single_ref.dart new file mode 100644 index 000000000000..cd9f8aaebec8 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/all_of_with_single_ref.dart @@ -0,0 +1,132 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/single_ref_type.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'all_of_with_single_ref.g.dart'; + +/// AllOfWithSingleRef +/// +/// Properties: +/// * [username] +/// * [singleRefType] +@BuiltValue() +abstract class AllOfWithSingleRef + implements Built { + @BuiltValueField(wireName: r'username') + String? get username; + + @BuiltValueField(wireName: r'SingleRefType') + SingleRefType? get singleRefType; + + AllOfWithSingleRef._(); + + factory AllOfWithSingleRef([void updates(AllOfWithSingleRefBuilder b)]) = + _$AllOfWithSingleRef; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(AllOfWithSingleRefBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$AllOfWithSingleRefSerializer(); +} + +class _$AllOfWithSingleRefSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [AllOfWithSingleRef, _$AllOfWithSingleRef]; + + @override + final String wireName = r'AllOfWithSingleRef'; + + Iterable _serializeProperties( + Serializers serializers, + AllOfWithSingleRef object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.username != null) { + yield r'username'; + yield serializers.serialize( + object.username, + specifiedType: const FullType(String), + ); + } + if (object.singleRefType != null) { + yield r'SingleRefType'; + yield serializers.serialize( + object.singleRefType, + specifiedType: const FullType(SingleRefType), + ); + } + } + + @override + Object serialize( + Serializers serializers, + AllOfWithSingleRef object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AllOfWithSingleRefBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'username': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.username = valueDes; + break; + case r'SingleRefType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(SingleRefType), + ) as SingleRefType; + result.singleRefType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + AllOfWithSingleRef deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = AllOfWithSingleRefBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/animal.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/animal.dart new file mode 100644 index 000000000000..94952e4b6e0b --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/animal.dart @@ -0,0 +1,211 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/dog.dart'; +import 'package:openapi/src/model/cat.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'animal.g.dart'; + +/// Animal +/// +/// Properties: +/// * [className] +/// * [color] +@BuiltValue(instantiable: false) +abstract class Animal { + @BuiltValueField(wireName: r'className') + String get className; + + @BuiltValueField(wireName: r'color') + String? get color; + + static const String discriminatorFieldName = r'className'; + + static const Map discriminatorMapping = { + r'Cat': Cat, + r'Dog': Dog, + }; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$AnimalSerializer(); +} + +extension AnimalDiscriminatorExt on Animal { + String? get discriminatorValue { + if (this is Cat) { + return r'Cat'; + } + if (this is Dog) { + return r'Dog'; + } + return null; + } +} + +extension AnimalBuilderDiscriminatorExt on AnimalBuilder { + String? get discriminatorValue { + if (this is CatBuilder) { + return r'Cat'; + } + if (this is DogBuilder) { + return r'Dog'; + } + return null; + } +} + +class _$AnimalSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Animal]; + + @override + final String wireName = r'Animal'; + + Iterable _serializeProperties( + Serializers serializers, + Animal object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'className'; + yield serializers.serialize( + object.className, + specifiedType: const FullType(String), + ); + if (object.color != null) { + yield r'color'; + yield serializers.serialize( + object.color, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Animal object, { + FullType specifiedType = FullType.unspecified, + }) { + if (object is Cat) { + return serializers.serialize(object, specifiedType: FullType(Cat))!; + } + if (object is Dog) { + return serializers.serialize(object, specifiedType: FullType(Dog))!; + } + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + @override + Animal deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(Animal.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], + specifiedType: FullType(String)) as String; + switch (discValue) { + case r'Cat': + return serializers.deserialize(serialized, specifiedType: FullType(Cat)) + as Cat; + case r'Dog': + return serializers.deserialize(serialized, specifiedType: FullType(Dog)) + as Dog; + default: + return serializers.deserialize(serialized, + specifiedType: FullType($Animal)) as $Animal; + } + } +} + +/// a concrete implementation of [Animal], since [Animal] is not instantiable +@BuiltValue(instantiable: true) +abstract class $Animal implements Animal, Built<$Animal, $AnimalBuilder> { + $Animal._(); + + factory $Animal([void Function($AnimalBuilder)? updates]) = _$$Animal; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($AnimalBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$Animal> get serializer => _$$AnimalSerializer(); +} + +class _$$AnimalSerializer implements PrimitiveSerializer<$Animal> { + @override + final Iterable types = const [$Animal, _$$Animal]; + + @override + final String wireName = r'$Animal'; + + @override + Object serialize( + Serializers serializers, + $Animal object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(Animal))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AnimalBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'className': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.className = valueDes; + break; + case r'color': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.color = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $Animal deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $AnimalBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/api_response.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/api_response.dart new file mode 100644 index 000000000000..14e9ccff7852 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/api_response.dart @@ -0,0 +1,145 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'api_response.g.dart'; + +/// ApiResponse +/// +/// Properties: +/// * [code] +/// * [type] +/// * [message] +@BuiltValue() +abstract class ApiResponse implements Built { + @BuiltValueField(wireName: r'code') + int? get code; + + @BuiltValueField(wireName: r'type') + String? get type; + + @BuiltValueField(wireName: r'message') + String? get message; + + ApiResponse._(); + + factory ApiResponse([void updates(ApiResponseBuilder b)]) = _$ApiResponse; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ApiResponseBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ApiResponseSerializer(); +} + +class _$ApiResponseSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ApiResponse, _$ApiResponse]; + + @override + final String wireName = r'ApiResponse'; + + Iterable _serializeProperties( + Serializers serializers, + ApiResponse object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.code != null) { + yield r'code'; + yield serializers.serialize( + object.code, + specifiedType: const FullType(int), + ); + } + if (object.type != null) { + yield r'type'; + yield serializers.serialize( + object.type, + specifiedType: const FullType(String), + ); + } + if (object.message != null) { + yield r'message'; + yield serializers.serialize( + object.message, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ApiResponse object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ApiResponseBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'code': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.code = valueDes; + break; + case r'type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.type = valueDes; + break; + case r'message': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.message = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ApiResponse deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ApiResponseBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/apple.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/apple.dart new file mode 100644 index 000000000000..fa77c28e614c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/apple.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'apple.g.dart'; + +/// Apple +/// +/// Properties: +/// * [kind] +@BuiltValue() +abstract class Apple implements Built { + @BuiltValueField(wireName: r'kind') + String? get kind; + + Apple._(); + + factory Apple([void updates(AppleBuilder b)]) = _$Apple; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(AppleBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$AppleSerializer(); +} + +class _$AppleSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Apple, _$Apple]; + + @override + final String wireName = r'Apple'; + + Iterable _serializeProperties( + Serializers serializers, + Apple object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.kind != null) { + yield r'kind'; + yield serializers.serialize( + object.kind, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Apple object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required AppleBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'kind': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.kind = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Apple deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = AppleBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/array_of_array_of_number_only.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/array_of_array_of_number_only.dart new file mode 100644 index 000000000000..0f51b17b901d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/array_of_array_of_number_only.dart @@ -0,0 +1,123 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'array_of_array_of_number_only.g.dart'; + +/// ArrayOfArrayOfNumberOnly +/// +/// Properties: +/// * [arrayArrayNumber] +@BuiltValue() +abstract class ArrayOfArrayOfNumberOnly + implements + Built { + @BuiltValueField(wireName: r'ArrayArrayNumber') + BuiltList>? get arrayArrayNumber; + + ArrayOfArrayOfNumberOnly._(); + + factory ArrayOfArrayOfNumberOnly( + [void updates(ArrayOfArrayOfNumberOnlyBuilder b)]) = + _$ArrayOfArrayOfNumberOnly; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ArrayOfArrayOfNumberOnlyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$ArrayOfArrayOfNumberOnlySerializer(); +} + +class _$ArrayOfArrayOfNumberOnlySerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [ + ArrayOfArrayOfNumberOnly, + _$ArrayOfArrayOfNumberOnly + ]; + + @override + final String wireName = r'ArrayOfArrayOfNumberOnly'; + + Iterable _serializeProperties( + Serializers serializers, + ArrayOfArrayOfNumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.arrayArrayNumber != null) { + yield r'ArrayArrayNumber'; + yield serializers.serialize( + object.arrayArrayNumber, + specifiedType: const FullType(BuiltList, [ + FullType(BuiltList, [FullType(num)]) + ]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ArrayOfArrayOfNumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ArrayOfArrayOfNumberOnlyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'ArrayArrayNumber': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [ + FullType(BuiltList, [FullType(num)]) + ]), + ) as BuiltList>; + result.arrayArrayNumber.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ArrayOfArrayOfNumberOnly deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ArrayOfArrayOfNumberOnlyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/array_of_number_only.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/array_of_number_only.dart new file mode 100644 index 000000000000..5aeb707cbb32 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/array_of_number_only.dart @@ -0,0 +1,114 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'array_of_number_only.g.dart'; + +/// ArrayOfNumberOnly +/// +/// Properties: +/// * [arrayNumber] +@BuiltValue() +abstract class ArrayOfNumberOnly + implements Built { + @BuiltValueField(wireName: r'ArrayNumber') + BuiltList? get arrayNumber; + + ArrayOfNumberOnly._(); + + factory ArrayOfNumberOnly([void updates(ArrayOfNumberOnlyBuilder b)]) = + _$ArrayOfNumberOnly; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ArrayOfNumberOnlyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$ArrayOfNumberOnlySerializer(); +} + +class _$ArrayOfNumberOnlySerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [ArrayOfNumberOnly, _$ArrayOfNumberOnly]; + + @override + final String wireName = r'ArrayOfNumberOnly'; + + Iterable _serializeProperties( + Serializers serializers, + ArrayOfNumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.arrayNumber != null) { + yield r'ArrayNumber'; + yield serializers.serialize( + object.arrayNumber, + specifiedType: const FullType(BuiltList, [FullType(num)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ArrayOfNumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ArrayOfNumberOnlyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'ArrayNumber': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(num)]), + ) as BuiltList; + result.arrayNumber.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ArrayOfNumberOnly deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ArrayOfNumberOnlyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/array_test.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/array_test.dart new file mode 100644 index 000000000000..e0fe071b45ef --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/array_test.dart @@ -0,0 +1,155 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/read_only_first.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'array_test.g.dart'; + +/// ArrayTest +/// +/// Properties: +/// * [arrayOfString] +/// * [arrayArrayOfInteger] +/// * [arrayArrayOfModel] +@BuiltValue() +abstract class ArrayTest implements Built { + @BuiltValueField(wireName: r'array_of_string') + BuiltList? get arrayOfString; + + @BuiltValueField(wireName: r'array_array_of_integer') + BuiltList>? get arrayArrayOfInteger; + + @BuiltValueField(wireName: r'array_array_of_model') + BuiltList>? get arrayArrayOfModel; + + ArrayTest._(); + + factory ArrayTest([void updates(ArrayTestBuilder b)]) = _$ArrayTest; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ArrayTestBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ArrayTestSerializer(); +} + +class _$ArrayTestSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ArrayTest, _$ArrayTest]; + + @override + final String wireName = r'ArrayTest'; + + Iterable _serializeProperties( + Serializers serializers, + ArrayTest object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.arrayOfString != null) { + yield r'array_of_string'; + yield serializers.serialize( + object.arrayOfString, + specifiedType: const FullType(BuiltList, [FullType(String)]), + ); + } + if (object.arrayArrayOfInteger != null) { + yield r'array_array_of_integer'; + yield serializers.serialize( + object.arrayArrayOfInteger, + specifiedType: const FullType(BuiltList, [ + FullType(BuiltList, [FullType(int)]) + ]), + ); + } + if (object.arrayArrayOfModel != null) { + yield r'array_array_of_model'; + yield serializers.serialize( + object.arrayArrayOfModel, + specifiedType: const FullType(BuiltList, [ + FullType(BuiltList, [FullType(ReadOnlyFirst)]) + ]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ArrayTest object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ArrayTestBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'array_of_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(String)]), + ) as BuiltList; + result.arrayOfString.replace(valueDes); + break; + case r'array_array_of_integer': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [ + FullType(BuiltList, [FullType(int)]) + ]), + ) as BuiltList>; + result.arrayArrayOfInteger.replace(valueDes); + break; + case r'array_array_of_model': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [ + FullType(BuiltList, [FullType(ReadOnlyFirst)]) + ]), + ) as BuiltList>; + result.arrayArrayOfModel.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ArrayTest deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ArrayTestBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/banana.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/banana.dart new file mode 100644 index 000000000000..00c090ee8727 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/banana.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'banana.g.dart'; + +/// Banana +/// +/// Properties: +/// * [count] +@BuiltValue() +abstract class Banana implements Built { + @BuiltValueField(wireName: r'count') + num? get count; + + Banana._(); + + factory Banana([void updates(BananaBuilder b)]) = _$Banana; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(BananaBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$BananaSerializer(); +} + +class _$BananaSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Banana, _$Banana]; + + @override + final String wireName = r'Banana'; + + Iterable _serializeProperties( + Serializers serializers, + Banana object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.count != null) { + yield r'count'; + yield serializers.serialize( + object.count, + specifiedType: const FullType(num), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Banana object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required BananaBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'count': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.count = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Banana deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = BananaBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/bar.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/bar.dart new file mode 100644 index 000000000000..ba6b35ebf7df --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/bar.dart @@ -0,0 +1,220 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/foo_ref_or_value.dart'; +import 'package:openapi/src/model/entity.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'bar.g.dart'; + +/// Bar +/// +/// Properties: +/// * [id] +/// * [barPropA] +/// * [fooPropB] +/// * [foo] +/// * [href] - Hyperlink reference +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue() +abstract class Bar implements Entity, Built { + @BuiltValueField(wireName: r'foo') + FooRefOrValue? get foo; + + @BuiltValueField(wireName: r'fooPropB') + String? get fooPropB; + + @BuiltValueField(wireName: r'barPropA') + String? get barPropA; + + Bar._(); + + factory Bar([void updates(BarBuilder b)]) = _$Bar; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(BarBuilder b) => b..atType = b.discriminatorValue; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$BarSerializer(); +} + +class _$BarSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Bar, _$Bar]; + + @override + final String wireName = r'Bar'; + + Iterable _serializeProperties( + Serializers serializers, + Bar object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.foo != null) { + yield r'foo'; + yield serializers.serialize( + object.foo, + specifiedType: const FullType(FooRefOrValue), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.fooPropB != null) { + yield r'fooPropB'; + yield serializers.serialize( + object.fooPropB, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + if (object.barPropA != null) { + yield r'barPropA'; + yield serializers.serialize( + object.barPropA, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Bar object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required BarBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'foo': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(FooRefOrValue), + ) as FooRefOrValue; + result.foo.replace(valueDes); + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'fooPropB': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.fooPropB = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + case r'barPropA': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.barPropA = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Bar deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = BarBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/bar_create.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/bar_create.dart new file mode 100644 index 000000000000..5d726a9957e4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/bar_create.dart @@ -0,0 +1,220 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/foo_ref_or_value.dart'; +import 'package:openapi/src/model/entity.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'bar_create.g.dart'; + +/// BarCreate +/// +/// Properties: +/// * [barPropA] +/// * [fooPropB] +/// * [foo] +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue() +abstract class BarCreate implements Entity, Built { + @BuiltValueField(wireName: r'foo') + FooRefOrValue? get foo; + + @BuiltValueField(wireName: r'fooPropB') + String? get fooPropB; + + @BuiltValueField(wireName: r'barPropA') + String? get barPropA; + + BarCreate._(); + + factory BarCreate([void updates(BarCreateBuilder b)]) = _$BarCreate; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(BarCreateBuilder b) => b..atType = b.discriminatorValue; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$BarCreateSerializer(); +} + +class _$BarCreateSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [BarCreate, _$BarCreate]; + + @override + final String wireName = r'BarCreate'; + + Iterable _serializeProperties( + Serializers serializers, + BarCreate object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.foo != null) { + yield r'foo'; + yield serializers.serialize( + object.foo, + specifiedType: const FullType(FooRefOrValue), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.fooPropB != null) { + yield r'fooPropB'; + yield serializers.serialize( + object.fooPropB, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + if (object.barPropA != null) { + yield r'barPropA'; + yield serializers.serialize( + object.barPropA, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + BarCreate object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required BarCreateBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'foo': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(FooRefOrValue), + ) as FooRefOrValue; + result.foo.replace(valueDes); + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'fooPropB': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.fooPropB = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + case r'barPropA': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.barPropA = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + BarCreate deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = BarCreateBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/bar_ref.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/bar_ref.dart new file mode 100644 index 000000000000..f77429fa929b --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/bar_ref.dart @@ -0,0 +1,193 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity_ref.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'bar_ref.g.dart'; + +/// BarRef +/// +/// Properties: +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue() +abstract class BarRef implements EntityRef, Built { + BarRef._(); + + factory BarRef([void updates(BarRefBuilder b)]) = _$BarRef; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(BarRefBuilder b) => b..atType = b.discriminatorValue; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$BarRefSerializer(); +} + +class _$BarRefSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [BarRef, _$BarRef]; + + @override + final String wireName = r'BarRef'; + + Iterable _serializeProperties( + Serializers serializers, + BarRef object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.atReferredType != null) { + yield r'@referredType'; + yield serializers.serialize( + object.atReferredType, + specifiedType: const FullType(String), + ); + } + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + BarRef object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required BarRefBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'@referredType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atReferredType = valueDes; + break; + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + BarRef deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = BarRefBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/bar_ref_or_value.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/bar_ref_or_value.dart new file mode 100644 index 000000000000..eeb993907a02 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/bar_ref_or_value.dart @@ -0,0 +1,141 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/bar_ref.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'bar_ref_or_value.g.dart'; + +/// BarRefOrValue +/// +/// Properties: +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue() +abstract class BarRefOrValue + implements Built { + /// One Of [Bar], [BarRef] + OneOf get oneOf; + + static const String discriminatorFieldName = r'@type'; + + static const Map discriminatorMapping = { + r'Bar': Bar, + r'BarRef': BarRef, + }; + + BarRefOrValue._(); + + factory BarRefOrValue([void updates(BarRefOrValueBuilder b)]) = + _$BarRefOrValue; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(BarRefOrValueBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$BarRefOrValueSerializer(); +} + +extension BarRefOrValueDiscriminatorExt on BarRefOrValue { + String? get discriminatorValue { + if (this is Bar) { + return r'Bar'; + } + if (this is BarRef) { + return r'BarRef'; + } + return null; + } +} + +extension BarRefOrValueBuilderDiscriminatorExt on BarRefOrValueBuilder { + String? get discriminatorValue { + if (this is BarBuilder) { + return r'Bar'; + } + if (this is BarRefBuilder) { + return r'BarRef'; + } + return null; + } +} + +class _$BarRefOrValueSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [BarRefOrValue, _$BarRefOrValue]; + + @override + final String wireName = r'BarRefOrValue'; + + Iterable _serializeProperties( + Serializers serializers, + BarRefOrValue object, { + FullType specifiedType = FullType.unspecified, + }) sync* {} + + @override + Object serialize( + Serializers serializers, + BarRefOrValue object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, + specifiedType: FullType(oneOf.valueType))!; + } + + @override + BarRefOrValue deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = BarRefOrValueBuilder(); + Object? oneOfDataSrc; + final serializedList = (serialized as Iterable).toList(); + final discIndex = + serializedList.indexOf(BarRefOrValue.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], + specifiedType: FullType(String)) as String; + oneOfDataSrc = serialized; + final oneOfTypes = [ + Bar, + BarRef, + ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'Bar': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(Bar), + ) as Bar; + oneOfType = Bar; + break; + case r'BarRef': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(BarRef), + ) as BarRef; + oneOfType = BarRef; + break; + default: + throw UnsupportedError( + "Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic( + typeIndex: oneOfTypes.indexOf(oneOfType), + types: oneOfTypes, + value: oneOfResult); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/capitalization.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/capitalization.dart new file mode 100644 index 000000000000..cbd4bf8cf926 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/capitalization.dart @@ -0,0 +1,204 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'capitalization.g.dart'; + +/// Capitalization +/// +/// Properties: +/// * [smallCamel] +/// * [capitalCamel] +/// * [smallSnake] +/// * [capitalSnake] +/// * [sCAETHFlowPoints] +/// * [ATT_NAME] - Name of the pet +@BuiltValue() +abstract class Capitalization + implements Built { + @BuiltValueField(wireName: r'smallCamel') + String? get smallCamel; + + @BuiltValueField(wireName: r'CapitalCamel') + String? get capitalCamel; + + @BuiltValueField(wireName: r'small_Snake') + String? get smallSnake; + + @BuiltValueField(wireName: r'Capital_Snake') + String? get capitalSnake; + + @BuiltValueField(wireName: r'SCA_ETH_Flow_Points') + String? get sCAETHFlowPoints; + + /// Name of the pet + @BuiltValueField(wireName: r'ATT_NAME') + String? get ATT_NAME; + + Capitalization._(); + + factory Capitalization([void updates(CapitalizationBuilder b)]) = + _$Capitalization; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(CapitalizationBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$CapitalizationSerializer(); +} + +class _$CapitalizationSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [Capitalization, _$Capitalization]; + + @override + final String wireName = r'Capitalization'; + + Iterable _serializeProperties( + Serializers serializers, + Capitalization object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.smallCamel != null) { + yield r'smallCamel'; + yield serializers.serialize( + object.smallCamel, + specifiedType: const FullType(String), + ); + } + if (object.capitalCamel != null) { + yield r'CapitalCamel'; + yield serializers.serialize( + object.capitalCamel, + specifiedType: const FullType(String), + ); + } + if (object.smallSnake != null) { + yield r'small_Snake'; + yield serializers.serialize( + object.smallSnake, + specifiedType: const FullType(String), + ); + } + if (object.capitalSnake != null) { + yield r'Capital_Snake'; + yield serializers.serialize( + object.capitalSnake, + specifiedType: const FullType(String), + ); + } + if (object.sCAETHFlowPoints != null) { + yield r'SCA_ETH_Flow_Points'; + yield serializers.serialize( + object.sCAETHFlowPoints, + specifiedType: const FullType(String), + ); + } + if (object.ATT_NAME != null) { + yield r'ATT_NAME'; + yield serializers.serialize( + object.ATT_NAME, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Capitalization object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required CapitalizationBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'smallCamel': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.smallCamel = valueDes; + break; + case r'CapitalCamel': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.capitalCamel = valueDes; + break; + case r'small_Snake': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.smallSnake = valueDes; + break; + case r'Capital_Snake': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.capitalSnake = valueDes; + break; + case r'SCA_ETH_Flow_Points': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.sCAETHFlowPoints = valueDes; + break; + case r'ATT_NAME': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.ATT_NAME = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Capitalization deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = CapitalizationBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/cat.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/cat.dart new file mode 100644 index 000000000000..ecc7facb059f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/cat.dart @@ -0,0 +1,138 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/animal.dart'; +import 'package:openapi/src/model/cat_all_of.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'cat.g.dart'; + +/// Cat +/// +/// Properties: +/// * [className] +/// * [color] +/// * [declawed] +@BuiltValue() +abstract class Cat implements Animal, CatAllOf, Built { + Cat._(); + + factory Cat([void updates(CatBuilder b)]) = _$Cat; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(CatBuilder b) => b + ..className = b.discriminatorValue + ..color = 'red'; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$CatSerializer(); +} + +class _$CatSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Cat, _$Cat]; + + @override + final String wireName = r'Cat'; + + Iterable _serializeProperties( + Serializers serializers, + Cat object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'className'; + yield serializers.serialize( + object.className, + specifiedType: const FullType(String), + ); + if (object.color != null) { + yield r'color'; + yield serializers.serialize( + object.color, + specifiedType: const FullType(String), + ); + } + if (object.declawed != null) { + yield r'declawed'; + yield serializers.serialize( + object.declawed, + specifiedType: const FullType(bool), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Cat object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required CatBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'className': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.className = valueDes; + break; + case r'color': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.color = valueDes; + break; + case r'declawed': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) as bool; + result.declawed = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Cat deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = CatBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/cat_all_of.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/cat_all_of.dart new file mode 100644 index 000000000000..18fd5b5ec591 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/cat_all_of.dart @@ -0,0 +1,144 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'cat_all_of.g.dart'; + +/// CatAllOf +/// +/// Properties: +/// * [declawed] +@BuiltValue(instantiable: false) +abstract class CatAllOf { + @BuiltValueField(wireName: r'declawed') + bool? get declawed; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$CatAllOfSerializer(); +} + +class _$CatAllOfSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [CatAllOf]; + + @override + final String wireName = r'CatAllOf'; + + Iterable _serializeProperties( + Serializers serializers, + CatAllOf object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.declawed != null) { + yield r'declawed'; + yield serializers.serialize( + object.declawed, + specifiedType: const FullType(bool), + ); + } + } + + @override + Object serialize( + Serializers serializers, + CatAllOf object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + @override + CatAllOf deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.deserialize(serialized, + specifiedType: FullType($CatAllOf)) as $CatAllOf; + } +} + +/// a concrete implementation of [CatAllOf], since [CatAllOf] is not instantiable +@BuiltValue(instantiable: true) +abstract class $CatAllOf + implements CatAllOf, Built<$CatAllOf, $CatAllOfBuilder> { + $CatAllOf._(); + + factory $CatAllOf([void Function($CatAllOfBuilder)? updates]) = _$$CatAllOf; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($CatAllOfBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$CatAllOf> get serializer => _$$CatAllOfSerializer(); +} + +class _$$CatAllOfSerializer implements PrimitiveSerializer<$CatAllOf> { + @override + final Iterable types = const [$CatAllOf, _$$CatAllOf]; + + @override + final String wireName = r'$CatAllOf'; + + @override + Object serialize( + Serializers serializers, + $CatAllOf object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(CatAllOf))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required CatAllOfBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'declawed': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) as bool; + result.declawed = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $CatAllOf deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $CatAllOfBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/category.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/category.dart new file mode 100644 index 000000000000..b580e36fc4dc --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/category.dart @@ -0,0 +1,127 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'category.g.dart'; + +/// Category +/// +/// Properties: +/// * [id] +/// * [name] +@BuiltValue() +abstract class Category implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'name') + String? get name; + + Category._(); + + factory Category([void updates(CategoryBuilder b)]) = _$Category; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(CategoryBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$CategorySerializer(); +} + +class _$CategorySerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Category, _$Category]; + + @override + final String wireName = r'Category'; + + Iterable _serializeProperties( + Serializers serializers, + Category object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Category object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required CategoryBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Category deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = CategoryBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/child.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/child.dart new file mode 100644 index 000000000000..dfc2ceaef1e6 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/child.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'child.g.dart'; + +/// Child +/// +/// Properties: +/// * [name] +@BuiltValue() +abstract class Child implements Built { + @BuiltValueField(wireName: r'name') + String? get name; + + Child._(); + + factory Child([void updates(ChildBuilder b)]) = _$Child; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ChildBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ChildSerializer(); +} + +class _$ChildSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Child, _$Child]; + + @override + final String wireName = r'Child'; + + Iterable _serializeProperties( + Serializers serializers, + Child object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Child object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ChildBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Child deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ChildBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/class_model.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/class_model.dart new file mode 100644 index 000000000000..74442b2e44ac --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/class_model.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'class_model.g.dart'; + +/// Model for testing model with \"_class\" property +/// +/// Properties: +/// * [classField] +@BuiltValue() +abstract class ClassModel implements Built { + @BuiltValueField(wireName: r'_class') + String? get classField; + + ClassModel._(); + + factory ClassModel([void updates(ClassModelBuilder b)]) = _$ClassModel; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ClassModelBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ClassModelSerializer(); +} + +class _$ClassModelSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ClassModel, _$ClassModel]; + + @override + final String wireName = r'ClassModel'; + + Iterable _serializeProperties( + Serializers serializers, + ClassModel object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.classField != null) { + yield r'_class'; + yield serializers.serialize( + object.classField, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ClassModel object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ClassModelBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'_class': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.classField = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ClassModel deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ClassModelBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/date.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/date.dart similarity index 100% rename from samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/model/date.dart rename to samples/client/echo_api/dart/dart-http-built_value/lib/src/model/date.dart diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/deprecated_object.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/deprecated_object.dart new file mode 100644 index 000000000000..d4e14dcc76b3 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/deprecated_object.dart @@ -0,0 +1,113 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'deprecated_object.g.dart'; + +/// DeprecatedObject +/// +/// Properties: +/// * [name] +@BuiltValue() +abstract class DeprecatedObject + implements Built { + @BuiltValueField(wireName: r'name') + String? get name; + + DeprecatedObject._(); + + factory DeprecatedObject([void updates(DeprecatedObjectBuilder b)]) = + _$DeprecatedObject; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(DeprecatedObjectBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$DeprecatedObjectSerializer(); +} + +class _$DeprecatedObjectSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [DeprecatedObject, _$DeprecatedObject]; + + @override + final String wireName = r'DeprecatedObject'; + + Iterable _serializeProperties( + Serializers serializers, + DeprecatedObject object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + DeprecatedObject object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required DeprecatedObjectBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + DeprecatedObject deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = DeprecatedObjectBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/dog.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/dog.dart new file mode 100644 index 000000000000..7f67a3b24ba0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/dog.dart @@ -0,0 +1,138 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/dog_all_of.dart'; +import 'package:openapi/src/model/animal.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'dog.g.dart'; + +/// Dog +/// +/// Properties: +/// * [className] +/// * [color] +/// * [breed] +@BuiltValue() +abstract class Dog implements Animal, DogAllOf, Built { + Dog._(); + + factory Dog([void updates(DogBuilder b)]) = _$Dog; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(DogBuilder b) => b + ..className = b.discriminatorValue + ..color = 'red'; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$DogSerializer(); +} + +class _$DogSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Dog, _$Dog]; + + @override + final String wireName = r'Dog'; + + Iterable _serializeProperties( + Serializers serializers, + Dog object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'className'; + yield serializers.serialize( + object.className, + specifiedType: const FullType(String), + ); + if (object.color != null) { + yield r'color'; + yield serializers.serialize( + object.color, + specifiedType: const FullType(String), + ); + } + if (object.breed != null) { + yield r'breed'; + yield serializers.serialize( + object.breed, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Dog object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required DogBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'className': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.className = valueDes; + break; + case r'color': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.color = valueDes; + break; + case r'breed': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.breed = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Dog deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = DogBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/dog_all_of.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/dog_all_of.dart new file mode 100644 index 000000000000..28c95d93dcf2 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/dog_all_of.dart @@ -0,0 +1,144 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'dog_all_of.g.dart'; + +/// DogAllOf +/// +/// Properties: +/// * [breed] +@BuiltValue(instantiable: false) +abstract class DogAllOf { + @BuiltValueField(wireName: r'breed') + String? get breed; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$DogAllOfSerializer(); +} + +class _$DogAllOfSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [DogAllOf]; + + @override + final String wireName = r'DogAllOf'; + + Iterable _serializeProperties( + Serializers serializers, + DogAllOf object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.breed != null) { + yield r'breed'; + yield serializers.serialize( + object.breed, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + DogAllOf object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + @override + DogAllOf deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.deserialize(serialized, + specifiedType: FullType($DogAllOf)) as $DogAllOf; + } +} + +/// a concrete implementation of [DogAllOf], since [DogAllOf] is not instantiable +@BuiltValue(instantiable: true) +abstract class $DogAllOf + implements DogAllOf, Built<$DogAllOf, $DogAllOfBuilder> { + $DogAllOf._(); + + factory $DogAllOf([void Function($DogAllOfBuilder)? updates]) = _$$DogAllOf; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($DogAllOfBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$DogAllOf> get serializer => _$$DogAllOfSerializer(); +} + +class _$$DogAllOfSerializer implements PrimitiveSerializer<$DogAllOf> { + @override + final Iterable types = const [$DogAllOf, _$$DogAllOf]; + + @override + final String wireName = r'$DogAllOf'; + + @override + Object serialize( + Serializers serializers, + $DogAllOf object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(DogAllOf))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required DogAllOfBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'breed': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.breed = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $DogAllOf deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $DogAllOfBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/entity.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/entity.dart new file mode 100644 index 000000000000..56cc04c50eb0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/entity.dart @@ -0,0 +1,309 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/extensible.dart'; +import 'package:openapi/src/model/pizza_speziale.dart'; +import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/pizza.dart'; +import 'package:openapi/src/model/addressable.dart'; +import 'package:openapi/src/model/pasta.dart'; +import 'package:openapi/src/model/bar_create.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'entity.g.dart'; + +/// Entity +/// +/// Properties: +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue(instantiable: false) +abstract class Entity implements Addressable, Extensible { + static const String discriminatorFieldName = r'@type'; + + static const Map discriminatorMapping = { + r'Bar': Bar, + r'Bar_Create': BarCreate, + r'Foo': Foo, + r'Pasta': Pasta, + r'Pizza': Pizza, + r'PizzaSpeziale': PizzaSpeziale, + }; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$EntitySerializer(); +} + +extension EntityDiscriminatorExt on Entity { + String? get discriminatorValue { + if (this is Bar) { + return r'Bar'; + } + if (this is BarCreate) { + return r'Bar_Create'; + } + if (this is Foo) { + return r'Foo'; + } + if (this is Pasta) { + return r'Pasta'; + } + if (this is Pizza) { + return r'Pizza'; + } + if (this is PizzaSpeziale) { + return r'PizzaSpeziale'; + } + return null; + } +} + +extension EntityBuilderDiscriminatorExt on EntityBuilder { + String? get discriminatorValue { + if (this is BarBuilder) { + return r'Bar'; + } + if (this is BarCreateBuilder) { + return r'Bar_Create'; + } + if (this is FooBuilder) { + return r'Foo'; + } + if (this is PastaBuilder) { + return r'Pasta'; + } + if (this is PizzaBuilder) { + return r'Pizza'; + } + if (this is PizzaSpezialeBuilder) { + return r'PizzaSpeziale'; + } + return null; + } +} + +class _$EntitySerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Entity]; + + @override + final String wireName = r'Entity'; + + Iterable _serializeProperties( + Serializers serializers, + Entity object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + Entity object, { + FullType specifiedType = FullType.unspecified, + }) { + if (object is Bar) { + return serializers.serialize(object, specifiedType: FullType(Bar))!; + } + if (object is BarCreate) { + return serializers.serialize(object, specifiedType: FullType(BarCreate))!; + } + if (object is Foo) { + return serializers.serialize(object, specifiedType: FullType(Foo))!; + } + if (object is Pasta) { + return serializers.serialize(object, specifiedType: FullType(Pasta))!; + } + if (object is Pizza) { + return serializers.serialize(object, specifiedType: FullType(Pizza))!; + } + if (object is PizzaSpeziale) { + return serializers.serialize(object, + specifiedType: FullType(PizzaSpeziale))!; + } + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + @override + Entity deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(Entity.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], + specifiedType: FullType(String)) as String; + switch (discValue) { + case r'Bar': + return serializers.deserialize(serialized, specifiedType: FullType(Bar)) + as Bar; + case r'Bar_Create': + return serializers.deserialize(serialized, + specifiedType: FullType(BarCreate)) as BarCreate; + case r'Foo': + return serializers.deserialize(serialized, specifiedType: FullType(Foo)) + as Foo; + case r'Pasta': + return serializers.deserialize(serialized, + specifiedType: FullType(Pasta)) as Pasta; + case r'Pizza': + return serializers.deserialize(serialized, + specifiedType: FullType(Pizza)) as Pizza; + case r'PizzaSpeziale': + return serializers.deserialize(serialized, + specifiedType: FullType(PizzaSpeziale)) as PizzaSpeziale; + default: + return serializers.deserialize(serialized, + specifiedType: FullType($Entity)) as $Entity; + } + } +} + +/// a concrete implementation of [Entity], since [Entity] is not instantiable +@BuiltValue(instantiable: true) +abstract class $Entity implements Entity, Built<$Entity, $EntityBuilder> { + $Entity._(); + + factory $Entity([void Function($EntityBuilder)? updates]) = _$$Entity; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($EntityBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$Entity> get serializer => _$$EntitySerializer(); +} + +class _$$EntitySerializer implements PrimitiveSerializer<$Entity> { + @override + final Iterable types = const [$Entity, _$$Entity]; + + @override + final String wireName = r'$Entity'; + + @override + Object serialize( + Serializers serializers, + $Entity object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(Entity))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required EntityBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $Entity deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $EntityBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/entity_ref.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/entity_ref.dart new file mode 100644 index 000000000000..669bbc6293bf --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/entity_ref.dart @@ -0,0 +1,293 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/extensible.dart'; +import 'package:openapi/src/model/bar_ref.dart'; +import 'package:openapi/src/model/addressable.dart'; +import 'package:openapi/src/model/foo_ref.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'entity_ref.g.dart'; + +/// Entity reference schema to be use for all entityRef class. +/// +/// Properties: +/// * [name] - Name of the related entity. +/// * [atReferredType] - The actual type of the target instance when needed for disambiguation. +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue(instantiable: false) +abstract class EntityRef implements Addressable, Extensible { + /// The actual type of the target instance when needed for disambiguation. + @BuiltValueField(wireName: r'@referredType') + String? get atReferredType; + + /// Name of the related entity. + @BuiltValueField(wireName: r'name') + String? get name; + + static const String discriminatorFieldName = r'@type'; + + static const Map discriminatorMapping = { + r'BarRef': BarRef, + r'FooRef': FooRef, + }; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$EntityRefSerializer(); +} + +extension EntityRefDiscriminatorExt on EntityRef { + String? get discriminatorValue { + if (this is BarRef) { + return r'BarRef'; + } + if (this is FooRef) { + return r'FooRef'; + } + return null; + } +} + +extension EntityRefBuilderDiscriminatorExt on EntityRefBuilder { + String? get discriminatorValue { + if (this is BarRefBuilder) { + return r'BarRef'; + } + if (this is FooRefBuilder) { + return r'FooRef'; + } + return null; + } +} + +class _$EntityRefSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [EntityRef]; + + @override + final String wireName = r'EntityRef'; + + Iterable _serializeProperties( + Serializers serializers, + EntityRef object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.atReferredType != null) { + yield r'@referredType'; + yield serializers.serialize( + object.atReferredType, + specifiedType: const FullType(String), + ); + } + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + EntityRef object, { + FullType specifiedType = FullType.unspecified, + }) { + if (object is BarRef) { + return serializers.serialize(object, specifiedType: FullType(BarRef))!; + } + if (object is FooRef) { + return serializers.serialize(object, specifiedType: FullType(FooRef))!; + } + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + @override + EntityRef deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final serializedList = (serialized as Iterable).toList(); + final discIndex = + serializedList.indexOf(EntityRef.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], + specifiedType: FullType(String)) as String; + switch (discValue) { + case r'BarRef': + return serializers.deserialize(serialized, + specifiedType: FullType(BarRef)) as BarRef; + case r'FooRef': + return serializers.deserialize(serialized, + specifiedType: FullType(FooRef)) as FooRef; + default: + return serializers.deserialize(serialized, + specifiedType: FullType($EntityRef)) as $EntityRef; + } + } +} + +/// a concrete implementation of [EntityRef], since [EntityRef] is not instantiable +@BuiltValue(instantiable: true) +abstract class $EntityRef + implements EntityRef, Built<$EntityRef, $EntityRefBuilder> { + $EntityRef._(); + + factory $EntityRef([void Function($EntityRefBuilder)? updates]) = + _$$EntityRef; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($EntityRefBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$EntityRef> get serializer => _$$EntityRefSerializer(); +} + +class _$$EntityRefSerializer implements PrimitiveSerializer<$EntityRef> { + @override + final Iterable types = const [$EntityRef, _$$EntityRef]; + + @override + final String wireName = r'$EntityRef'; + + @override + Object serialize( + Serializers serializers, + $EntityRef object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(EntityRef))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required EntityRefBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'@referredType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atReferredType = valueDes; + break; + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $EntityRef deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $EntityRefBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/enum_arrays.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/enum_arrays.dart new file mode 100644 index 000000000000..2c8e3e6e4bb8 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/enum_arrays.dart @@ -0,0 +1,174 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'enum_arrays.g.dart'; + +/// EnumArrays +/// +/// Properties: +/// * [justSymbol] +/// * [arrayEnum] +@BuiltValue() +abstract class EnumArrays implements Built { + @BuiltValueField(wireName: r'just_symbol') + EnumArraysJustSymbolEnum? get justSymbol; + // enum justSymbolEnum { >=, $, }; + + @BuiltValueField(wireName: r'array_enum') + BuiltList? get arrayEnum; + // enum arrayEnumEnum { fish, crab, }; + + EnumArrays._(); + + factory EnumArrays([void updates(EnumArraysBuilder b)]) = _$EnumArrays; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(EnumArraysBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$EnumArraysSerializer(); +} + +class _$EnumArraysSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [EnumArrays, _$EnumArrays]; + + @override + final String wireName = r'EnumArrays'; + + Iterable _serializeProperties( + Serializers serializers, + EnumArrays object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.justSymbol != null) { + yield r'just_symbol'; + yield serializers.serialize( + object.justSymbol, + specifiedType: const FullType(EnumArraysJustSymbolEnum), + ); + } + if (object.arrayEnum != null) { + yield r'array_enum'; + yield serializers.serialize( + object.arrayEnum, + specifiedType: + const FullType(BuiltList, [FullType(EnumArraysArrayEnumEnum)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + EnumArrays object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required EnumArraysBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'just_symbol': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumArraysJustSymbolEnum), + ) as EnumArraysJustSymbolEnum; + result.justSymbol = valueDes; + break; + case r'array_enum': + final valueDes = serializers.deserialize( + value, + specifiedType: + const FullType(BuiltList, [FullType(EnumArraysArrayEnumEnum)]), + ) as BuiltList; + result.arrayEnum.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + EnumArrays deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = EnumArraysBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + +class EnumArraysJustSymbolEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'>=') + static const EnumArraysJustSymbolEnum greaterThanEqual = + _$enumArraysJustSymbolEnum_greaterThanEqual; + @BuiltValueEnumConst(wireName: r'$') + static const EnumArraysJustSymbolEnum dollar = + _$enumArraysJustSymbolEnum_dollar; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumArraysJustSymbolEnum unknownDefaultOpenApi = + _$enumArraysJustSymbolEnum_unknownDefaultOpenApi; + + static Serializer get serializer => + _$enumArraysJustSymbolEnumSerializer; + + const EnumArraysJustSymbolEnum._(String name) : super(name); + + static BuiltSet get values => + _$enumArraysJustSymbolEnumValues; + static EnumArraysJustSymbolEnum valueOf(String name) => + _$enumArraysJustSymbolEnumValueOf(name); +} + +class EnumArraysArrayEnumEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'fish') + static const EnumArraysArrayEnumEnum fish = _$enumArraysArrayEnumEnum_fish; + @BuiltValueEnumConst(wireName: r'crab') + static const EnumArraysArrayEnumEnum crab = _$enumArraysArrayEnumEnum_crab; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumArraysArrayEnumEnum unknownDefaultOpenApi = + _$enumArraysArrayEnumEnum_unknownDefaultOpenApi; + + static Serializer get serializer => + _$enumArraysArrayEnumEnumSerializer; + + const EnumArraysArrayEnumEnum._(String name) : super(name); + + static BuiltSet get values => + _$enumArraysArrayEnumEnumValues; + static EnumArraysArrayEnumEnum valueOf(String name) => + _$enumArraysArrayEnumEnumValueOf(name); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/enum_test.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/enum_test.dart new file mode 100644 index 000000000000..effda132acdd --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/enum_test.dart @@ -0,0 +1,338 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/outer_enum.dart'; +import 'package:openapi/src/model/outer_enum_default_value.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/outer_enum_integer.dart'; +import 'package:openapi/src/model/outer_enum_integer_default_value.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'enum_test.g.dart'; + +/// EnumTest +/// +/// Properties: +/// * [enumString] +/// * [enumStringRequired] +/// * [enumInteger] +/// * [enumNumber] +/// * [outerEnum] +/// * [outerEnumInteger] +/// * [outerEnumDefaultValue] +/// * [outerEnumIntegerDefaultValue] +@BuiltValue() +abstract class EnumTest implements Built { + @BuiltValueField(wireName: r'enum_string') + EnumTestEnumStringEnum? get enumString; + // enum enumStringEnum { UPPER, lower, , }; + + @BuiltValueField(wireName: r'enum_string_required') + EnumTestEnumStringRequiredEnum get enumStringRequired; + // enum enumStringRequiredEnum { UPPER, lower, , }; + + @BuiltValueField(wireName: r'enum_integer') + EnumTestEnumIntegerEnum? get enumInteger; + // enum enumIntegerEnum { 1, -1, }; + + @BuiltValueField(wireName: r'enum_number') + EnumTestEnumNumberEnum? get enumNumber; + // enum enumNumberEnum { 1.1, -1.2, }; + + @BuiltValueField(wireName: r'outerEnum') + OuterEnum? get outerEnum; + // enum outerEnumEnum { placed, approved, delivered, }; + + @BuiltValueField(wireName: r'outerEnumInteger') + OuterEnumInteger? get outerEnumInteger; + // enum outerEnumIntegerEnum { 0, 1, 2, }; + + @BuiltValueField(wireName: r'outerEnumDefaultValue') + OuterEnumDefaultValue? get outerEnumDefaultValue; + // enum outerEnumDefaultValueEnum { placed, approved, delivered, }; + + @BuiltValueField(wireName: r'outerEnumIntegerDefaultValue') + OuterEnumIntegerDefaultValue? get outerEnumIntegerDefaultValue; + // enum outerEnumIntegerDefaultValueEnum { 0, 1, 2, }; + + EnumTest._(); + + factory EnumTest([void updates(EnumTestBuilder b)]) = _$EnumTest; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(EnumTestBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$EnumTestSerializer(); +} + +class _$EnumTestSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [EnumTest, _$EnumTest]; + + @override + final String wireName = r'EnumTest'; + + Iterable _serializeProperties( + Serializers serializers, + EnumTest object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.enumString != null) { + yield r'enum_string'; + yield serializers.serialize( + object.enumString, + specifiedType: const FullType(EnumTestEnumStringEnum), + ); + } + yield r'enum_string_required'; + yield serializers.serialize( + object.enumStringRequired, + specifiedType: const FullType(EnumTestEnumStringRequiredEnum), + ); + if (object.enumInteger != null) { + yield r'enum_integer'; + yield serializers.serialize( + object.enumInteger, + specifiedType: const FullType(EnumTestEnumIntegerEnum), + ); + } + if (object.enumNumber != null) { + yield r'enum_number'; + yield serializers.serialize( + object.enumNumber, + specifiedType: const FullType(EnumTestEnumNumberEnum), + ); + } + if (object.outerEnum != null) { + yield r'outerEnum'; + yield serializers.serialize( + object.outerEnum, + specifiedType: const FullType.nullable(OuterEnum), + ); + } + if (object.outerEnumInteger != null) { + yield r'outerEnumInteger'; + yield serializers.serialize( + object.outerEnumInteger, + specifiedType: const FullType(OuterEnumInteger), + ); + } + if (object.outerEnumDefaultValue != null) { + yield r'outerEnumDefaultValue'; + yield serializers.serialize( + object.outerEnumDefaultValue, + specifiedType: const FullType(OuterEnumDefaultValue), + ); + } + if (object.outerEnumIntegerDefaultValue != null) { + yield r'outerEnumIntegerDefaultValue'; + yield serializers.serialize( + object.outerEnumIntegerDefaultValue, + specifiedType: const FullType(OuterEnumIntegerDefaultValue), + ); + } + } + + @override + Object serialize( + Serializers serializers, + EnumTest object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required EnumTestBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'enum_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumTestEnumStringEnum), + ) as EnumTestEnumStringEnum; + result.enumString = valueDes; + break; + case r'enum_string_required': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumTestEnumStringRequiredEnum), + ) as EnumTestEnumStringRequiredEnum; + result.enumStringRequired = valueDes; + break; + case r'enum_integer': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumTestEnumIntegerEnum), + ) as EnumTestEnumIntegerEnum; + result.enumInteger = valueDes; + break; + case r'enum_number': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(EnumTestEnumNumberEnum), + ) as EnumTestEnumNumberEnum; + result.enumNumber = valueDes; + break; + case r'outerEnum': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(OuterEnum), + ) as OuterEnum?; + if (valueDes == null) continue; + result.outerEnum = valueDes; + break; + case r'outerEnumInteger': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OuterEnumInteger), + ) as OuterEnumInteger; + result.outerEnumInteger = valueDes; + break; + case r'outerEnumDefaultValue': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OuterEnumDefaultValue), + ) as OuterEnumDefaultValue; + result.outerEnumDefaultValue = valueDes; + break; + case r'outerEnumIntegerDefaultValue': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OuterEnumIntegerDefaultValue), + ) as OuterEnumIntegerDefaultValue; + result.outerEnumIntegerDefaultValue = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + EnumTest deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = EnumTestBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + +class EnumTestEnumStringEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'UPPER') + static const EnumTestEnumStringEnum UPPER = _$enumTestEnumStringEnum_UPPER; + @BuiltValueEnumConst(wireName: r'lower') + static const EnumTestEnumStringEnum lower = _$enumTestEnumStringEnum_lower; + @BuiltValueEnumConst(wireName: r'') + static const EnumTestEnumStringEnum empty = _$enumTestEnumStringEnum_empty; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumTestEnumStringEnum unknownDefaultOpenApi = + _$enumTestEnumStringEnum_unknownDefaultOpenApi; + + static Serializer get serializer => + _$enumTestEnumStringEnumSerializer; + + const EnumTestEnumStringEnum._(String name) : super(name); + + static BuiltSet get values => + _$enumTestEnumStringEnumValues; + static EnumTestEnumStringEnum valueOf(String name) => + _$enumTestEnumStringEnumValueOf(name); +} + +class EnumTestEnumStringRequiredEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'UPPER') + static const EnumTestEnumStringRequiredEnum UPPER = + _$enumTestEnumStringRequiredEnum_UPPER; + @BuiltValueEnumConst(wireName: r'lower') + static const EnumTestEnumStringRequiredEnum lower = + _$enumTestEnumStringRequiredEnum_lower; + @BuiltValueEnumConst(wireName: r'') + static const EnumTestEnumStringRequiredEnum empty = + _$enumTestEnumStringRequiredEnum_empty; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const EnumTestEnumStringRequiredEnum unknownDefaultOpenApi = + _$enumTestEnumStringRequiredEnum_unknownDefaultOpenApi; + + static Serializer get serializer => + _$enumTestEnumStringRequiredEnumSerializer; + + const EnumTestEnumStringRequiredEnum._(String name) : super(name); + + static BuiltSet get values => + _$enumTestEnumStringRequiredEnumValues; + static EnumTestEnumStringRequiredEnum valueOf(String name) => + _$enumTestEnumStringRequiredEnumValueOf(name); +} + +class EnumTestEnumIntegerEnum extends EnumClass { + @BuiltValueEnumConst(wireNumber: 1) + static const EnumTestEnumIntegerEnum number1 = + _$enumTestEnumIntegerEnum_number1; + @BuiltValueEnumConst(wireNumber: -1) + static const EnumTestEnumIntegerEnum numberNegative1 = + _$enumTestEnumIntegerEnum_numberNegative1; + @BuiltValueEnumConst(wireNumber: 11184809, fallback: true) + static const EnumTestEnumIntegerEnum unknownDefaultOpenApi = + _$enumTestEnumIntegerEnum_unknownDefaultOpenApi; + + static Serializer get serializer => + _$enumTestEnumIntegerEnumSerializer; + + const EnumTestEnumIntegerEnum._(String name) : super(name); + + static BuiltSet get values => + _$enumTestEnumIntegerEnumValues; + static EnumTestEnumIntegerEnum valueOf(String name) => + _$enumTestEnumIntegerEnumValueOf(name); +} + +class EnumTestEnumNumberEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'1.1') + static const EnumTestEnumNumberEnum number1Period1 = + _$enumTestEnumNumberEnum_number1Period1; + @BuiltValueEnumConst(wireName: r'-1.2') + static const EnumTestEnumNumberEnum numberNegative1Period2 = + _$enumTestEnumNumberEnum_numberNegative1Period2; + @BuiltValueEnumConst(wireName: r'11184809', fallback: true) + static const EnumTestEnumNumberEnum unknownDefaultOpenApi = + _$enumTestEnumNumberEnum_unknownDefaultOpenApi; + + static Serializer get serializer => + _$enumTestEnumNumberEnumSerializer; + + const EnumTestEnumNumberEnum._(String name) : super(name); + + static BuiltSet get values => + _$enumTestEnumNumberEnumValues; + static EnumTestEnumNumberEnum valueOf(String name) => + _$enumTestEnumNumberEnumValueOf(name); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/example.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/example.dart new file mode 100644 index 000000000000..27d7e939103c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/example.dart @@ -0,0 +1,75 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/child.dart'; +import 'dart:core'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'example.g.dart'; + +/// Example +/// +/// Properties: +/// * [name] +@BuiltValue() +abstract class Example implements Built { + /// One Of [Child], [int] + OneOf get oneOf; + + Example._(); + + factory Example([void updates(ExampleBuilder b)]) = _$Example; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ExampleBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ExampleSerializer(); +} + +class _$ExampleSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Example, _$Example]; + + @override + final String wireName = r'Example'; + + Iterable _serializeProperties( + Serializers serializers, + Example object, { + FullType specifiedType = FullType.unspecified, + }) sync* {} + + @override + Object serialize( + Serializers serializers, + Example object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, + specifiedType: FullType(oneOf.valueType))!; + } + + @override + Example deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ExampleBuilder(); + Object? oneOfDataSrc; + final targetType = const FullType(OneOf, [ + FullType(Child), + FullType(int), + ]); + oneOfDataSrc = serialized; + result.oneOf = serializers.deserialize(oneOfDataSrc, + specifiedType: targetType) as OneOf; + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/example_non_primitive.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/example_non_primitive.dart new file mode 100644 index 000000000000..6812a9f2fc60 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/example_non_primitive.dart @@ -0,0 +1,80 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'dart:core'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'example_non_primitive.g.dart'; + +/// ExampleNonPrimitive +@BuiltValue() +abstract class ExampleNonPrimitive + implements Built { + /// One Of [DateTime], [String], [int], [num] + OneOf get oneOf; + + ExampleNonPrimitive._(); + + factory ExampleNonPrimitive([void updates(ExampleNonPrimitiveBuilder b)]) = + _$ExampleNonPrimitive; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ExampleNonPrimitiveBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$ExampleNonPrimitiveSerializer(); +} + +class _$ExampleNonPrimitiveSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [ + ExampleNonPrimitive, + _$ExampleNonPrimitive + ]; + + @override + final String wireName = r'ExampleNonPrimitive'; + + Iterable _serializeProperties( + Serializers serializers, + ExampleNonPrimitive object, { + FullType specifiedType = FullType.unspecified, + }) sync* {} + + @override + Object serialize( + Serializers serializers, + ExampleNonPrimitive object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, + specifiedType: FullType(oneOf.valueType))!; + } + + @override + ExampleNonPrimitive deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ExampleNonPrimitiveBuilder(); + Object? oneOfDataSrc; + final targetType = const FullType(OneOf, [ + FullType(String), + FullType(DateTime), + FullType(int), + FullType(num), + ]); + oneOfDataSrc = serialized; + result.oneOf = serializers.deserialize(oneOfDataSrc, + specifiedType: targetType) as OneOf; + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/extensible.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/extensible.dart new file mode 100644 index 000000000000..4751e487f2cd --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/extensible.dart @@ -0,0 +1,182 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'extensible.g.dart'; + +/// Extensible +/// +/// Properties: +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue(instantiable: false) +abstract class Extensible { + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @BuiltValueField(wireName: r'@schemaLocation') + String? get atSchemaLocation; + + /// When sub-classing, this defines the super-class + @BuiltValueField(wireName: r'@baseType') + String? get atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @BuiltValueField(wireName: r'@type') + String get atType; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ExtensibleSerializer(); +} + +class _$ExtensibleSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Extensible]; + + @override + final String wireName = r'Extensible'; + + Iterable _serializeProperties( + Serializers serializers, + Extensible object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + Extensible object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + @override + Extensible deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.deserialize(serialized, + specifiedType: FullType($Extensible)) as $Extensible; + } +} + +/// a concrete implementation of [Extensible], since [Extensible] is not instantiable +@BuiltValue(instantiable: true) +abstract class $Extensible + implements Extensible, Built<$Extensible, $ExtensibleBuilder> { + $Extensible._(); + + factory $Extensible([void Function($ExtensibleBuilder)? updates]) = + _$$Extensible; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($ExtensibleBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$Extensible> get serializer => _$$ExtensibleSerializer(); +} + +class _$$ExtensibleSerializer implements PrimitiveSerializer<$Extensible> { + @override + final Iterable types = const [$Extensible, _$$Extensible]; + + @override + final String wireName = r'$Extensible'; + + @override + Object serialize( + Serializers serializers, + $Extensible object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(Extensible))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ExtensibleBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $Extensible deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $ExtensibleBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/file_schema_test_class.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/file_schema_test_class.dart new file mode 100644 index 000000000000..e28ed72311d5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/file_schema_test_class.dart @@ -0,0 +1,136 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/model_file.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'file_schema_test_class.g.dart'; + +/// FileSchemaTestClass +/// +/// Properties: +/// * [file] +/// * [files] +@BuiltValue() +abstract class FileSchemaTestClass + implements Built { + @BuiltValueField(wireName: r'file') + ModelFile? get file; + + @BuiltValueField(wireName: r'files') + BuiltList? get files; + + FileSchemaTestClass._(); + + factory FileSchemaTestClass([void updates(FileSchemaTestClassBuilder b)]) = + _$FileSchemaTestClass; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FileSchemaTestClassBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$FileSchemaTestClassSerializer(); +} + +class _$FileSchemaTestClassSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [ + FileSchemaTestClass, + _$FileSchemaTestClass + ]; + + @override + final String wireName = r'FileSchemaTestClass'; + + Iterable _serializeProperties( + Serializers serializers, + FileSchemaTestClass object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.file != null) { + yield r'file'; + yield serializers.serialize( + object.file, + specifiedType: const FullType(ModelFile), + ); + } + if (object.files != null) { + yield r'files'; + yield serializers.serialize( + object.files, + specifiedType: const FullType(BuiltList, [FullType(ModelFile)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + FileSchemaTestClass object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FileSchemaTestClassBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'file': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(ModelFile), + ) as ModelFile; + result.file.replace(valueDes); + break; + case r'files': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(ModelFile)]), + ) as BuiltList; + result.files.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FileSchemaTestClass deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FileSchemaTestClassBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/foo.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/foo.dart new file mode 100644 index 000000000000..79b1c7a7cda9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/foo.dart @@ -0,0 +1,201 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'foo.g.dart'; + +/// Foo +/// +/// Properties: +/// * [fooPropA] +/// * [fooPropB] +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue() +abstract class Foo implements Entity, Built { + @BuiltValueField(wireName: r'fooPropA') + String? get fooPropA; + + @BuiltValueField(wireName: r'fooPropB') + String? get fooPropB; + + Foo._(); + + factory Foo([void updates(FooBuilder b)]) = _$Foo; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FooBuilder b) => b..atType = b.discriminatorValue; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FooSerializer(); +} + +class _$FooSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Foo, _$Foo]; + + @override + final String wireName = r'Foo'; + + Iterable _serializeProperties( + Serializers serializers, + Foo object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.fooPropA != null) { + yield r'fooPropA'; + yield serializers.serialize( + object.fooPropA, + specifiedType: const FullType(String), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.fooPropB != null) { + yield r'fooPropB'; + yield serializers.serialize( + object.fooPropB, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + Foo object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FooBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'fooPropA': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.fooPropA = valueDes; + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'fooPropB': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.fooPropB = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Foo deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FooBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/foo_ref.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/foo_ref.dart new file mode 100644 index 000000000000..e62d40ce6b2e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/foo_ref.dart @@ -0,0 +1,211 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity_ref.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'foo_ref.g.dart'; + +/// FooRef +/// +/// Properties: +/// * [foorefPropA] +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue() +abstract class FooRef implements EntityRef, Built { + @BuiltValueField(wireName: r'foorefPropA') + String? get foorefPropA; + + FooRef._(); + + factory FooRef([void updates(FooRefBuilder b)]) = _$FooRef; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FooRefBuilder b) => b..atType = b.discriminatorValue; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FooRefSerializer(); +} + +class _$FooRefSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FooRef, _$FooRef]; + + @override + final String wireName = r'FooRef'; + + Iterable _serializeProperties( + Serializers serializers, + FooRef object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.atReferredType != null) { + yield r'@referredType'; + yield serializers.serialize( + object.atReferredType, + specifiedType: const FullType(String), + ); + } + if (object.foorefPropA != null) { + yield r'foorefPropA'; + yield serializers.serialize( + object.foorefPropA, + specifiedType: const FullType(String), + ); + } + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + FooRef object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FooRefBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'@referredType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atReferredType = valueDes; + break; + case r'foorefPropA': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.foorefPropA = valueDes; + break; + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FooRef deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FooRefBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/foo_ref_or_value.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/foo_ref_or_value.dart new file mode 100644 index 000000000000..896800fb01f8 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/foo_ref_or_value.dart @@ -0,0 +1,141 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/foo_ref.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'foo_ref_or_value.g.dart'; + +/// FooRefOrValue +/// +/// Properties: +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue() +abstract class FooRefOrValue + implements Built { + /// One Of [Foo], [FooRef] + OneOf get oneOf; + + static const String discriminatorFieldName = r'@type'; + + static const Map discriminatorMapping = { + r'Foo': Foo, + r'FooRef': FooRef, + }; + + FooRefOrValue._(); + + factory FooRefOrValue([void updates(FooRefOrValueBuilder b)]) = + _$FooRefOrValue; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FooRefOrValueBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$FooRefOrValueSerializer(); +} + +extension FooRefOrValueDiscriminatorExt on FooRefOrValue { + String? get discriminatorValue { + if (this is Foo) { + return r'Foo'; + } + if (this is FooRef) { + return r'FooRef'; + } + return null; + } +} + +extension FooRefOrValueBuilderDiscriminatorExt on FooRefOrValueBuilder { + String? get discriminatorValue { + if (this is FooBuilder) { + return r'Foo'; + } + if (this is FooRefBuilder) { + return r'FooRef'; + } + return null; + } +} + +class _$FooRefOrValueSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FooRefOrValue, _$FooRefOrValue]; + + @override + final String wireName = r'FooRefOrValue'; + + Iterable _serializeProperties( + Serializers serializers, + FooRefOrValue object, { + FullType specifiedType = FullType.unspecified, + }) sync* {} + + @override + Object serialize( + Serializers serializers, + FooRefOrValue object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + return serializers.serialize(oneOf.value, + specifiedType: FullType(oneOf.valueType))!; + } + + @override + FooRefOrValue deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FooRefOrValueBuilder(); + Object? oneOfDataSrc; + final serializedList = (serialized as Iterable).toList(); + final discIndex = + serializedList.indexOf(FooRefOrValue.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], + specifiedType: FullType(String)) as String; + oneOfDataSrc = serialized; + final oneOfTypes = [ + Foo, + FooRef, + ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'Foo': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(Foo), + ) as Foo; + oneOfType = Foo; + break; + case r'FooRef': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(FooRef), + ) as FooRef; + oneOfType = FooRef; + break; + default: + throw UnsupportedError( + "Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic( + typeIndex: oneOfTypes.indexOf(oneOfType), + types: oneOfTypes, + value: oneOfResult); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/format_test.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/format_test.dart new file mode 100644 index 000000000000..771056f35226 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/format_test.dart @@ -0,0 +1,375 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'dart:typed_data'; +import 'package:openapi/src/model/date.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'format_test.g.dart'; + +/// FormatTest +/// +/// Properties: +/// * [integer] +/// * [int32] +/// * [int64] +/// * [number] +/// * [float] +/// * [double_] +/// * [decimal] +/// * [string] +/// * [byte] +/// * [binary] +/// * [date] +/// * [dateTime] +/// * [uuid] +/// * [password] +/// * [patternWithDigits] - A string that is a 10 digit number. Can have leading zeros. +/// * [patternWithDigitsAndDelimiter] - A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. +@BuiltValue() +abstract class FormatTest implements Built { + @BuiltValueField(wireName: r'integer') + int? get integer; + + @BuiltValueField(wireName: r'int32') + int? get int32; + + @BuiltValueField(wireName: r'int64') + int? get int64; + + @BuiltValueField(wireName: r'number') + num get number; + + @BuiltValueField(wireName: r'float') + double? get float; + + @BuiltValueField(wireName: r'double') + double? get double_; + + @BuiltValueField(wireName: r'decimal') + double? get decimal; + + @BuiltValueField(wireName: r'string') + String? get string; + + @BuiltValueField(wireName: r'byte') + String get byte; + + @BuiltValueField(wireName: r'binary') + Uint8List? get binary; + + @BuiltValueField(wireName: r'date') + Date get date; + + @BuiltValueField(wireName: r'dateTime') + DateTime? get dateTime; + + @BuiltValueField(wireName: r'uuid') + String? get uuid; + + @BuiltValueField(wireName: r'password') + String get password; + + /// A string that is a 10 digit number. Can have leading zeros. + @BuiltValueField(wireName: r'pattern_with_digits') + String? get patternWithDigits; + + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + @BuiltValueField(wireName: r'pattern_with_digits_and_delimiter') + String? get patternWithDigitsAndDelimiter; + + FormatTest._(); + + factory FormatTest([void updates(FormatTestBuilder b)]) = _$FormatTest; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FormatTestBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FormatTestSerializer(); +} + +class _$FormatTestSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FormatTest, _$FormatTest]; + + @override + final String wireName = r'FormatTest'; + + Iterable _serializeProperties( + Serializers serializers, + FormatTest object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.integer != null) { + yield r'integer'; + yield serializers.serialize( + object.integer, + specifiedType: const FullType(int), + ); + } + if (object.int32 != null) { + yield r'int32'; + yield serializers.serialize( + object.int32, + specifiedType: const FullType(int), + ); + } + if (object.int64 != null) { + yield r'int64'; + yield serializers.serialize( + object.int64, + specifiedType: const FullType(int), + ); + } + yield r'number'; + yield serializers.serialize( + object.number, + specifiedType: const FullType(num), + ); + if (object.float != null) { + yield r'float'; + yield serializers.serialize( + object.float, + specifiedType: const FullType(double), + ); + } + if (object.double_ != null) { + yield r'double'; + yield serializers.serialize( + object.double_, + specifiedType: const FullType(double), + ); + } + if (object.decimal != null) { + yield r'decimal'; + yield serializers.serialize( + object.decimal, + specifiedType: const FullType(double), + ); + } + if (object.string != null) { + yield r'string'; + yield serializers.serialize( + object.string, + specifiedType: const FullType(String), + ); + } + yield r'byte'; + yield serializers.serialize( + object.byte, + specifiedType: const FullType(String), + ); + if (object.binary != null) { + yield r'binary'; + yield serializers.serialize( + object.binary, + specifiedType: const FullType(Uint8List), + ); + } + yield r'date'; + yield serializers.serialize( + object.date, + specifiedType: const FullType(Date), + ); + if (object.dateTime != null) { + yield r'dateTime'; + yield serializers.serialize( + object.dateTime, + specifiedType: const FullType(DateTime), + ); + } + if (object.uuid != null) { + yield r'uuid'; + yield serializers.serialize( + object.uuid, + specifiedType: const FullType(String), + ); + } + yield r'password'; + yield serializers.serialize( + object.password, + specifiedType: const FullType(String), + ); + if (object.patternWithDigits != null) { + yield r'pattern_with_digits'; + yield serializers.serialize( + object.patternWithDigits, + specifiedType: const FullType(String), + ); + } + if (object.patternWithDigitsAndDelimiter != null) { + yield r'pattern_with_digits_and_delimiter'; + yield serializers.serialize( + object.patternWithDigitsAndDelimiter, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + FormatTest object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FormatTestBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'integer': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.integer = valueDes; + break; + case r'int32': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.int32 = valueDes; + break; + case r'int64': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.int64 = valueDes; + break; + case r'number': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.number = valueDes; + break; + case r'float': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(double), + ) as double; + result.float = valueDes; + break; + case r'double': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(double), + ) as double; + result.double_ = valueDes; + break; + case r'decimal': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(double), + ) as double; + result.decimal = valueDes; + break; + case r'string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.string = valueDes; + break; + case r'byte': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.byte = valueDes; + break; + case r'binary': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(Uint8List), + ) as Uint8List; + result.binary = valueDes; + break; + case r'date': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(Date), + ) as Date; + result.date = valueDes; + break; + case r'dateTime': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(DateTime), + ) as DateTime; + result.dateTime = valueDes; + break; + case r'uuid': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.uuid = valueDes; + break; + case r'password': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.password = valueDes; + break; + case r'pattern_with_digits': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.patternWithDigits = valueDes; + break; + case r'pattern_with_digits_and_delimiter': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.patternWithDigitsAndDelimiter = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FormatTest deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FormatTestBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/fruit.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/fruit.dart new file mode 100644 index 000000000000..5c31531d9e55 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/fruit.dart @@ -0,0 +1,129 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/apple.dart'; +import 'package:openapi/src/model/banana.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'fruit.g.dart'; + +/// Fruit +/// +/// Properties: +/// * [color] +/// * [kind] +/// * [count] +@BuiltValue() +abstract class Fruit implements Built { + @BuiltValueField(wireName: r'color') + String? get color; + + /// One Of [Apple], [Banana] + OneOf get oneOf; + + Fruit._(); + + factory Fruit([void updates(FruitBuilder b)]) = _$Fruit; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FruitBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FruitSerializer(); +} + +class _$FruitSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Fruit, _$Fruit]; + + @override + final String wireName = r'Fruit'; + + Iterable _serializeProperties( + Serializers serializers, + Fruit object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.color != null) { + yield r'color'; + yield serializers.serialize( + object.color, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Fruit object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + final result = + _serializeProperties(serializers, object, specifiedType: specifiedType) + .toList(); + result.addAll(serializers.serialize(oneOf.value, + specifiedType: FullType(oneOf.valueType)) as Iterable); + return result; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FruitBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'color': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.color = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Fruit deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FruitBuilder(); + Object? oneOfDataSrc; + final targetType = const FullType(OneOf, [ + FullType(Apple), + FullType(Banana), + ]); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + oneOfDataSrc = unhandled; + result.oneOf = serializers.deserialize(oneOfDataSrc, + specifiedType: targetType) as OneOf; + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/has_only_read_only.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/has_only_read_only.dart new file mode 100644 index 000000000000..9d2538bab52a --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/has_only_read_only.dart @@ -0,0 +1,131 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'has_only_read_only.g.dart'; + +/// HasOnlyReadOnly +/// +/// Properties: +/// * [bar] +/// * [foo] +@BuiltValue() +abstract class HasOnlyReadOnly + implements Built { + @BuiltValueField(wireName: r'bar') + String? get bar; + + @BuiltValueField(wireName: r'foo') + String? get foo; + + HasOnlyReadOnly._(); + + factory HasOnlyReadOnly([void updates(HasOnlyReadOnlyBuilder b)]) = + _$HasOnlyReadOnly; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(HasOnlyReadOnlyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$HasOnlyReadOnlySerializer(); +} + +class _$HasOnlyReadOnlySerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [HasOnlyReadOnly, _$HasOnlyReadOnly]; + + @override + final String wireName = r'HasOnlyReadOnly'; + + Iterable _serializeProperties( + Serializers serializers, + HasOnlyReadOnly object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.bar != null) { + yield r'bar'; + yield serializers.serialize( + object.bar, + specifiedType: const FullType(String), + ); + } + if (object.foo != null) { + yield r'foo'; + yield serializers.serialize( + object.foo, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + HasOnlyReadOnly object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required HasOnlyReadOnlyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'bar': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.bar = valueDes; + break; + case r'foo': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.foo = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + HasOnlyReadOnly deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = HasOnlyReadOnlyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/health_check_result.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/health_check_result.dart new file mode 100644 index 000000000000..4756e8600c1c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/health_check_result.dart @@ -0,0 +1,114 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'health_check_result.g.dart'; + +/// Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. +/// +/// Properties: +/// * [nullableMessage] +@BuiltValue() +abstract class HealthCheckResult + implements Built { + @BuiltValueField(wireName: r'NullableMessage') + String? get nullableMessage; + + HealthCheckResult._(); + + factory HealthCheckResult([void updates(HealthCheckResultBuilder b)]) = + _$HealthCheckResult; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(HealthCheckResultBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$HealthCheckResultSerializer(); +} + +class _$HealthCheckResultSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [HealthCheckResult, _$HealthCheckResult]; + + @override + final String wireName = r'HealthCheckResult'; + + Iterable _serializeProperties( + Serializers serializers, + HealthCheckResult object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.nullableMessage != null) { + yield r'NullableMessage'; + yield serializers.serialize( + object.nullableMessage, + specifiedType: const FullType.nullable(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + HealthCheckResult object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required HealthCheckResultBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'NullableMessage': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(String), + ) as String?; + if (valueDes == null) continue; + result.nullableMessage = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + HealthCheckResult deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = HealthCheckResultBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/map_test.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/map_test.dart new file mode 100644 index 000000000000..a31e79364fc5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/map_test.dart @@ -0,0 +1,199 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'map_test.g.dart'; + +/// MapTest +/// +/// Properties: +/// * [mapMapOfString] +/// * [mapOfEnumString] +/// * [directMap] +/// * [indirectMap] +@BuiltValue() +abstract class MapTest implements Built { + @BuiltValueField(wireName: r'map_map_of_string') + BuiltMap>? get mapMapOfString; + + @BuiltValueField(wireName: r'map_of_enum_string') + BuiltMap? get mapOfEnumString; + // enum mapOfEnumStringEnum { UPPER, lower, }; + + @BuiltValueField(wireName: r'direct_map') + BuiltMap? get directMap; + + @BuiltValueField(wireName: r'indirect_map') + BuiltMap? get indirectMap; + + MapTest._(); + + factory MapTest([void updates(MapTestBuilder b)]) = _$MapTest; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(MapTestBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$MapTestSerializer(); +} + +class _$MapTestSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [MapTest, _$MapTest]; + + @override + final String wireName = r'MapTest'; + + Iterable _serializeProperties( + Serializers serializers, + MapTest object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.mapMapOfString != null) { + yield r'map_map_of_string'; + yield serializers.serialize( + object.mapMapOfString, + specifiedType: const FullType(BuiltMap, [ + FullType(String), + FullType(BuiltMap, [FullType(String), FullType(String)]) + ]), + ); + } + if (object.mapOfEnumString != null) { + yield r'map_of_enum_string'; + yield serializers.serialize( + object.mapOfEnumString, + specifiedType: const FullType( + BuiltMap, [FullType(String), FullType(MapTestMapOfEnumStringEnum)]), + ); + } + if (object.directMap != null) { + yield r'direct_map'; + yield serializers.serialize( + object.directMap, + specifiedType: + const FullType(BuiltMap, [FullType(String), FullType(bool)]), + ); + } + if (object.indirectMap != null) { + yield r'indirect_map'; + yield serializers.serialize( + object.indirectMap, + specifiedType: + const FullType(BuiltMap, [FullType(String), FullType(bool)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + MapTest object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required MapTestBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'map_map_of_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [ + FullType(String), + FullType(BuiltMap, [FullType(String), FullType(String)]) + ]), + ) as BuiltMap>; + result.mapMapOfString.replace(valueDes); + break; + case r'map_of_enum_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, + [FullType(String), FullType(MapTestMapOfEnumStringEnum)]), + ) as BuiltMap; + result.mapOfEnumString.replace(valueDes); + break; + case r'direct_map': + final valueDes = serializers.deserialize( + value, + specifiedType: + const FullType(BuiltMap, [FullType(String), FullType(bool)]), + ) as BuiltMap; + result.directMap.replace(valueDes); + break; + case r'indirect_map': + final valueDes = serializers.deserialize( + value, + specifiedType: + const FullType(BuiltMap, [FullType(String), FullType(bool)]), + ) as BuiltMap; + result.indirectMap.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + MapTest deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = MapTestBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + +class MapTestMapOfEnumStringEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'UPPER') + static const MapTestMapOfEnumStringEnum UPPER = + _$mapTestMapOfEnumStringEnum_UPPER; + @BuiltValueEnumConst(wireName: r'lower') + static const MapTestMapOfEnumStringEnum lower = + _$mapTestMapOfEnumStringEnum_lower; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const MapTestMapOfEnumStringEnum unknownDefaultOpenApi = + _$mapTestMapOfEnumStringEnum_unknownDefaultOpenApi; + + static Serializer get serializer => + _$mapTestMapOfEnumStringEnumSerializer; + + const MapTestMapOfEnumStringEnum._(String name) : super(name); + + static BuiltSet get values => + _$mapTestMapOfEnumStringEnumValues; + static MapTestMapOfEnumStringEnum valueOf(String name) => + _$mapTestMapOfEnumStringEnumValueOf(name); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/mixed_properties_and_additional_properties_class.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/mixed_properties_and_additional_properties_class.dart new file mode 100644 index 000000000000..0d85f7d589aa --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/mixed_properties_and_additional_properties_class.dart @@ -0,0 +1,163 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/animal.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'mixed_properties_and_additional_properties_class.g.dart'; + +/// MixedPropertiesAndAdditionalPropertiesClass +/// +/// Properties: +/// * [uuid] +/// * [dateTime] +/// * [map] +@BuiltValue() +abstract class MixedPropertiesAndAdditionalPropertiesClass + implements + Built { + @BuiltValueField(wireName: r'uuid') + String? get uuid; + + @BuiltValueField(wireName: r'dateTime') + DateTime? get dateTime; + + @BuiltValueField(wireName: r'map') + BuiltMap? get map; + + MixedPropertiesAndAdditionalPropertiesClass._(); + + factory MixedPropertiesAndAdditionalPropertiesClass( + [void updates( + MixedPropertiesAndAdditionalPropertiesClassBuilder b)]) = + _$MixedPropertiesAndAdditionalPropertiesClass; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(MixedPropertiesAndAdditionalPropertiesClassBuilder b) => + b; + + @BuiltValueSerializer(custom: true) + static Serializer + get serializer => + _$MixedPropertiesAndAdditionalPropertiesClassSerializer(); +} + +class _$MixedPropertiesAndAdditionalPropertiesClassSerializer + implements + PrimitiveSerializer { + @override + final Iterable types = const [ + MixedPropertiesAndAdditionalPropertiesClass, + _$MixedPropertiesAndAdditionalPropertiesClass + ]; + + @override + final String wireName = r'MixedPropertiesAndAdditionalPropertiesClass'; + + Iterable _serializeProperties( + Serializers serializers, + MixedPropertiesAndAdditionalPropertiesClass object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.uuid != null) { + yield r'uuid'; + yield serializers.serialize( + object.uuid, + specifiedType: const FullType(String), + ); + } + if (object.dateTime != null) { + yield r'dateTime'; + yield serializers.serialize( + object.dateTime, + specifiedType: const FullType(DateTime), + ); + } + if (object.map != null) { + yield r'map'; + yield serializers.serialize( + object.map, + specifiedType: + const FullType(BuiltMap, [FullType(String), FullType(Animal)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + MixedPropertiesAndAdditionalPropertiesClass object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required MixedPropertiesAndAdditionalPropertiesClassBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'uuid': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.uuid = valueDes; + break; + case r'dateTime': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(DateTime), + ) as DateTime; + result.dateTime = valueDes; + break; + case r'map': + final valueDes = serializers.deserialize( + value, + specifiedType: + const FullType(BuiltMap, [FullType(String), FullType(Animal)]), + ) as BuiltMap; + result.map.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + MixedPropertiesAndAdditionalPropertiesClass deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = MixedPropertiesAndAdditionalPropertiesClassBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/model200_response.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/model200_response.dart new file mode 100644 index 000000000000..b9f7146fd0e8 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/model200_response.dart @@ -0,0 +1,131 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model200_response.g.dart'; + +/// Model for testing model name starting with number +/// +/// Properties: +/// * [name] +/// * [classField] +@BuiltValue() +abstract class Model200Response + implements Built { + @BuiltValueField(wireName: r'name') + int? get name; + + @BuiltValueField(wireName: r'class') + String? get classField; + + Model200Response._(); + + factory Model200Response([void updates(Model200ResponseBuilder b)]) = + _$Model200Response; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(Model200ResponseBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$Model200ResponseSerializer(); +} + +class _$Model200ResponseSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [Model200Response, _$Model200Response]; + + @override + final String wireName = r'Model200Response'; + + Iterable _serializeProperties( + Serializers serializers, + Model200Response object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(int), + ); + } + if (object.classField != null) { + yield r'class'; + yield serializers.serialize( + object.classField, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Model200Response object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required Model200ResponseBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.name = valueDes; + break; + case r'class': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.classField = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Model200Response deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = Model200ResponseBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/model_client.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/model_client.dart new file mode 100644 index 000000000000..63cba51c4be9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/model_client.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_client.g.dart'; + +/// ModelClient +/// +/// Properties: +/// * [client] +@BuiltValue() +abstract class ModelClient implements Built { + @BuiltValueField(wireName: r'client') + String? get client; + + ModelClient._(); + + factory ModelClient([void updates(ModelClientBuilder b)]) = _$ModelClient; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ModelClientBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelClientSerializer(); +} + +class _$ModelClientSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ModelClient, _$ModelClient]; + + @override + final String wireName = r'ModelClient'; + + Iterable _serializeProperties( + Serializers serializers, + ModelClient object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.client != null) { + yield r'client'; + yield serializers.serialize( + object.client, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ModelClient object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ModelClientBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'client': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.client = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ModelClient deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ModelClientBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/model_enum_class.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/model_enum_class.dart new file mode 100644 index 000000000000..02835bd779f5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/model_enum_class.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_enum_class.g.dart'; + +class ModelEnumClass extends EnumClass { + @BuiltValueEnumConst(wireName: r'_abc') + static const ModelEnumClass abc = _$abc; + @BuiltValueEnumConst(wireName: r'-efg') + static const ModelEnumClass efg = _$efg; + @BuiltValueEnumConst(wireName: r'(xyz)') + static const ModelEnumClass leftParenthesisXyzRightParenthesis = + _$leftParenthesisXyzRightParenthesis; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const ModelEnumClass unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + static Serializer get serializer => + _$modelEnumClassSerializer; + + const ModelEnumClass._(String name) : super(name); + + static BuiltSet get values => _$values; + static ModelEnumClass valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class ModelEnumClassMixin = Object with _$ModelEnumClassMixin; diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/model_file.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/model_file.dart new file mode 100644 index 000000000000..a74db4217b29 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/model_file.dart @@ -0,0 +1,110 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_file.g.dart'; + +/// Must be named `File` for test. +/// +/// Properties: +/// * [sourceURI] - Test capitalization +@BuiltValue() +abstract class ModelFile implements Built { + /// Test capitalization + @BuiltValueField(wireName: r'sourceURI') + String? get sourceURI; + + ModelFile._(); + + factory ModelFile([void updates(ModelFileBuilder b)]) = _$ModelFile; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ModelFileBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelFileSerializer(); +} + +class _$ModelFileSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ModelFile, _$ModelFile]; + + @override + final String wireName = r'ModelFile'; + + Iterable _serializeProperties( + Serializers serializers, + ModelFile object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.sourceURI != null) { + yield r'sourceURI'; + yield serializers.serialize( + object.sourceURI, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ModelFile object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ModelFileBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'sourceURI': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.sourceURI = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ModelFile deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ModelFileBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/model_list.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/model_list.dart new file mode 100644 index 000000000000..fbea6fe8232c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/model_list.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_list.g.dart'; + +/// ModelList +/// +/// Properties: +/// * [n123list] +@BuiltValue() +abstract class ModelList implements Built { + @BuiltValueField(wireName: r'123-list') + String? get n123list; + + ModelList._(); + + factory ModelList([void updates(ModelListBuilder b)]) = _$ModelList; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ModelListBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelListSerializer(); +} + +class _$ModelListSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ModelList, _$ModelList]; + + @override + final String wireName = r'ModelList'; + + Iterable _serializeProperties( + Serializers serializers, + ModelList object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.n123list != null) { + yield r'123-list'; + yield serializers.serialize( + object.n123list, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ModelList object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ModelListBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'123-list': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.n123list = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ModelList deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ModelListBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/model_return.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/model_return.dart new file mode 100644 index 000000000000..46770cac8e9e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/model_return.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'model_return.g.dart'; + +/// Model for testing reserved words +/// +/// Properties: +/// * [return_] +@BuiltValue() +abstract class ModelReturn implements Built { + @BuiltValueField(wireName: r'return') + int? get return_; + + ModelReturn._(); + + factory ModelReturn([void updates(ModelReturnBuilder b)]) = _$ModelReturn; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ModelReturnBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ModelReturnSerializer(); +} + +class _$ModelReturnSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ModelReturn, _$ModelReturn]; + + @override + final String wireName = r'ModelReturn'; + + Iterable _serializeProperties( + Serializers serializers, + ModelReturn object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.return_ != null) { + yield r'return'; + yield serializers.serialize( + object.return_, + specifiedType: const FullType(int), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ModelReturn object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ModelReturnBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'return': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.return_ = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ModelReturn deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ModelReturnBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/name.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/name.dart new file mode 100644 index 000000000000..12531dce5470 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/name.dart @@ -0,0 +1,161 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'name.g.dart'; + +/// Model for testing model name same as property name +/// +/// Properties: +/// * [name] +/// * [snakeCase] +/// * [property] +/// * [n123number] +@BuiltValue() +abstract class Name implements Built { + @BuiltValueField(wireName: r'name') + int get name; + + @BuiltValueField(wireName: r'snake_case') + int? get snakeCase; + + @BuiltValueField(wireName: r'property') + String? get property; + + @BuiltValueField(wireName: r'123Number') + int? get n123number; + + Name._(); + + factory Name([void updates(NameBuilder b)]) = _$Name; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(NameBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$NameSerializer(); +} + +class _$NameSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Name, _$Name]; + + @override + final String wireName = r'Name'; + + Iterable _serializeProperties( + Serializers serializers, + Name object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(int), + ); + if (object.snakeCase != null) { + yield r'snake_case'; + yield serializers.serialize( + object.snakeCase, + specifiedType: const FullType(int), + ); + } + if (object.property != null) { + yield r'property'; + yield serializers.serialize( + object.property, + specifiedType: const FullType(String), + ); + } + if (object.n123number != null) { + yield r'123Number'; + yield serializers.serialize( + object.n123number, + specifiedType: const FullType(int), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Name object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required NameBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.name = valueDes; + break; + case r'snake_case': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.snakeCase = valueDes; + break; + case r'property': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.property = valueDes; + break; + case r'123Number': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.n123number = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Name deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = NameBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/nullable_class.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/nullable_class.dart new file mode 100644 index 000000000000..ff124c21bf20 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/nullable_class.dart @@ -0,0 +1,335 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/date.dart'; +import 'package:built_value/json_object.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'nullable_class.g.dart'; + +/// NullableClass +/// +/// Properties: +/// * [integerProp] +/// * [numberProp] +/// * [booleanProp] +/// * [stringProp] +/// * [dateProp] +/// * [datetimeProp] +/// * [arrayNullableProp] +/// * [arrayAndItemsNullableProp] +/// * [arrayItemsNullable] +/// * [objectNullableProp] +/// * [objectAndItemsNullableProp] +/// * [objectItemsNullable] +@BuiltValue() +abstract class NullableClass + implements Built { + @BuiltValueField(wireName: r'integer_prop') + int? get integerProp; + + @BuiltValueField(wireName: r'number_prop') + num? get numberProp; + + @BuiltValueField(wireName: r'boolean_prop') + bool? get booleanProp; + + @BuiltValueField(wireName: r'string_prop') + String? get stringProp; + + @BuiltValueField(wireName: r'date_prop') + Date? get dateProp; + + @BuiltValueField(wireName: r'datetime_prop') + DateTime? get datetimeProp; + + @BuiltValueField(wireName: r'array_nullable_prop') + BuiltList? get arrayNullableProp; + + @BuiltValueField(wireName: r'array_and_items_nullable_prop') + BuiltList? get arrayAndItemsNullableProp; + + @BuiltValueField(wireName: r'array_items_nullable') + BuiltList? get arrayItemsNullable; + + @BuiltValueField(wireName: r'object_nullable_prop') + BuiltMap? get objectNullableProp; + + @BuiltValueField(wireName: r'object_and_items_nullable_prop') + BuiltMap? get objectAndItemsNullableProp; + + @BuiltValueField(wireName: r'object_items_nullable') + BuiltMap? get objectItemsNullable; + + NullableClass._(); + + factory NullableClass([void updates(NullableClassBuilder b)]) = + _$NullableClass; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(NullableClassBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$NullableClassSerializer(); +} + +class _$NullableClassSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [NullableClass, _$NullableClass]; + + @override + final String wireName = r'NullableClass'; + + Iterable _serializeProperties( + Serializers serializers, + NullableClass object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.integerProp != null) { + yield r'integer_prop'; + yield serializers.serialize( + object.integerProp, + specifiedType: const FullType.nullable(int), + ); + } + if (object.numberProp != null) { + yield r'number_prop'; + yield serializers.serialize( + object.numberProp, + specifiedType: const FullType.nullable(num), + ); + } + if (object.booleanProp != null) { + yield r'boolean_prop'; + yield serializers.serialize( + object.booleanProp, + specifiedType: const FullType.nullable(bool), + ); + } + if (object.stringProp != null) { + yield r'string_prop'; + yield serializers.serialize( + object.stringProp, + specifiedType: const FullType.nullable(String), + ); + } + if (object.dateProp != null) { + yield r'date_prop'; + yield serializers.serialize( + object.dateProp, + specifiedType: const FullType.nullable(Date), + ); + } + if (object.datetimeProp != null) { + yield r'datetime_prop'; + yield serializers.serialize( + object.datetimeProp, + specifiedType: const FullType.nullable(DateTime), + ); + } + if (object.arrayNullableProp != null) { + yield r'array_nullable_prop'; + yield serializers.serialize( + object.arrayNullableProp, + specifiedType: + const FullType.nullable(BuiltList, [FullType(JsonObject)]), + ); + } + if (object.arrayAndItemsNullableProp != null) { + yield r'array_and_items_nullable_prop'; + yield serializers.serialize( + object.arrayAndItemsNullableProp, + specifiedType: + const FullType.nullable(BuiltList, [FullType.nullable(JsonObject)]), + ); + } + if (object.arrayItemsNullable != null) { + yield r'array_items_nullable'; + yield serializers.serialize( + object.arrayItemsNullable, + specifiedType: + const FullType(BuiltList, [FullType.nullable(JsonObject)]), + ); + } + if (object.objectNullableProp != null) { + yield r'object_nullable_prop'; + yield serializers.serialize( + object.objectNullableProp, + specifiedType: const FullType.nullable( + BuiltMap, [FullType(String), FullType(JsonObject)]), + ); + } + if (object.objectAndItemsNullableProp != null) { + yield r'object_and_items_nullable_prop'; + yield serializers.serialize( + object.objectAndItemsNullableProp, + specifiedType: const FullType.nullable( + BuiltMap, [FullType(String), FullType.nullable(JsonObject)]), + ); + } + if (object.objectItemsNullable != null) { + yield r'object_items_nullable'; + yield serializers.serialize( + object.objectItemsNullable, + specifiedType: const FullType( + BuiltMap, [FullType(String), FullType.nullable(JsonObject)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + NullableClass object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required NullableClassBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'integer_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(int), + ) as int?; + if (valueDes == null) continue; + result.integerProp = valueDes; + break; + case r'number_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(num), + ) as num?; + if (valueDes == null) continue; + result.numberProp = valueDes; + break; + case r'boolean_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(bool), + ) as bool?; + if (valueDes == null) continue; + result.booleanProp = valueDes; + break; + case r'string_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(String), + ) as String?; + if (valueDes == null) continue; + result.stringProp = valueDes; + break; + case r'date_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(Date), + ) as Date?; + if (valueDes == null) continue; + result.dateProp = valueDes; + break; + case r'datetime_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(DateTime), + ) as DateTime?; + if (valueDes == null) continue; + result.datetimeProp = valueDes; + break; + case r'array_nullable_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: + const FullType.nullable(BuiltList, [FullType(JsonObject)]), + ) as BuiltList?; + if (valueDes == null) continue; + result.arrayNullableProp.replace(valueDes); + break; + case r'array_and_items_nullable_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable( + BuiltList, [FullType.nullable(JsonObject)]), + ) as BuiltList?; + if (valueDes == null) continue; + result.arrayAndItemsNullableProp.replace(valueDes); + break; + case r'array_items_nullable': + final valueDes = serializers.deserialize( + value, + specifiedType: + const FullType(BuiltList, [FullType.nullable(JsonObject)]), + ) as BuiltList; + result.arrayItemsNullable.replace(valueDes); + break; + case r'object_nullable_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable( + BuiltMap, [FullType(String), FullType(JsonObject)]), + ) as BuiltMap?; + if (valueDes == null) continue; + result.objectNullableProp.replace(valueDes); + break; + case r'object_and_items_nullable_prop': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable( + BuiltMap, [FullType(String), FullType.nullable(JsonObject)]), + ) as BuiltMap?; + if (valueDes == null) continue; + result.objectAndItemsNullableProp.replace(valueDes); + break; + case r'object_items_nullable': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType( + BuiltMap, [FullType(String), FullType.nullable(JsonObject)]), + ) as BuiltMap; + result.objectItemsNullable.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + NullableClass deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = NullableClassBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/number_only.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/number_only.dart new file mode 100644 index 000000000000..bc854c85003b --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/number_only.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'number_only.g.dart'; + +/// NumberOnly +/// +/// Properties: +/// * [justNumber] +@BuiltValue() +abstract class NumberOnly implements Built { + @BuiltValueField(wireName: r'JustNumber') + num? get justNumber; + + NumberOnly._(); + + factory NumberOnly([void updates(NumberOnlyBuilder b)]) = _$NumberOnly; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(NumberOnlyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$NumberOnlySerializer(); +} + +class _$NumberOnlySerializer implements PrimitiveSerializer { + @override + final Iterable types = const [NumberOnly, _$NumberOnly]; + + @override + final String wireName = r'NumberOnly'; + + Iterable _serializeProperties( + Serializers serializers, + NumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.justNumber != null) { + yield r'JustNumber'; + yield serializers.serialize( + object.justNumber, + specifiedType: const FullType(num), + ); + } + } + + @override + Object serialize( + Serializers serializers, + NumberOnly object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required NumberOnlyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'JustNumber': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.justNumber = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + NumberOnly deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = NumberOnlyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/object_with_deprecated_fields.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/object_with_deprecated_fields.dart new file mode 100644 index 000000000000..de8620fcf22a --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/object_with_deprecated_fields.dart @@ -0,0 +1,175 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/deprecated_object.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'object_with_deprecated_fields.g.dart'; + +/// ObjectWithDeprecatedFields +/// +/// Properties: +/// * [uuid] +/// * [id] +/// * [deprecatedRef] +/// * [bars] +@BuiltValue() +abstract class ObjectWithDeprecatedFields + implements + Built { + @BuiltValueField(wireName: r'uuid') + String? get uuid; + + @BuiltValueField(wireName: r'id') + num? get id; + + @BuiltValueField(wireName: r'deprecatedRef') + DeprecatedObject? get deprecatedRef; + + @BuiltValueField(wireName: r'bars') + BuiltList? get bars; + + ObjectWithDeprecatedFields._(); + + factory ObjectWithDeprecatedFields( + [void updates(ObjectWithDeprecatedFieldsBuilder b)]) = + _$ObjectWithDeprecatedFields; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ObjectWithDeprecatedFieldsBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$ObjectWithDeprecatedFieldsSerializer(); +} + +class _$ObjectWithDeprecatedFieldsSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [ + ObjectWithDeprecatedFields, + _$ObjectWithDeprecatedFields + ]; + + @override + final String wireName = r'ObjectWithDeprecatedFields'; + + Iterable _serializeProperties( + Serializers serializers, + ObjectWithDeprecatedFields object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.uuid != null) { + yield r'uuid'; + yield serializers.serialize( + object.uuid, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(num), + ); + } + if (object.deprecatedRef != null) { + yield r'deprecatedRef'; + yield serializers.serialize( + object.deprecatedRef, + specifiedType: const FullType(DeprecatedObject), + ); + } + if (object.bars != null) { + yield r'bars'; + yield serializers.serialize( + object.bars, + specifiedType: const FullType(BuiltList, [FullType(Bar)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ObjectWithDeprecatedFields object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ObjectWithDeprecatedFieldsBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'uuid': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.uuid = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.id = valueDes; + break; + case r'deprecatedRef': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(DeprecatedObject), + ) as DeprecatedObject; + result.deprecatedRef.replace(valueDes); + break; + case r'bars': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(Bar)]), + ) as BuiltList; + result.bars.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ObjectWithDeprecatedFields deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ObjectWithDeprecatedFieldsBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/order.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/order.dart new file mode 100644 index 000000000000..35b18409ec52 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/order.dart @@ -0,0 +1,229 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'order.g.dart'; + +/// Order +/// +/// Properties: +/// * [id] +/// * [petId] +/// * [quantity] +/// * [shipDate] +/// * [status] - Order Status +/// * [complete] +@BuiltValue() +abstract class Order implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'petId') + int? get petId; + + @BuiltValueField(wireName: r'quantity') + int? get quantity; + + @BuiltValueField(wireName: r'shipDate') + DateTime? get shipDate; + + /// Order Status + @BuiltValueField(wireName: r'status') + OrderStatusEnum? get status; + // enum statusEnum { placed, approved, delivered, }; + + @BuiltValueField(wireName: r'complete') + bool? get complete; + + Order._(); + + factory Order([void updates(OrderBuilder b)]) = _$Order; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(OrderBuilder b) => b..complete = false; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$OrderSerializer(); +} + +class _$OrderSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Order, _$Order]; + + @override + final String wireName = r'Order'; + + Iterable _serializeProperties( + Serializers serializers, + Order object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + if (object.petId != null) { + yield r'petId'; + yield serializers.serialize( + object.petId, + specifiedType: const FullType(int), + ); + } + if (object.quantity != null) { + yield r'quantity'; + yield serializers.serialize( + object.quantity, + specifiedType: const FullType(int), + ); + } + if (object.shipDate != null) { + yield r'shipDate'; + yield serializers.serialize( + object.shipDate, + specifiedType: const FullType(DateTime), + ); + } + if (object.status != null) { + yield r'status'; + yield serializers.serialize( + object.status, + specifiedType: const FullType(OrderStatusEnum), + ); + } + if (object.complete != null) { + yield r'complete'; + yield serializers.serialize( + object.complete, + specifiedType: const FullType(bool), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Order object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required OrderBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'petId': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.petId = valueDes; + break; + case r'quantity': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.quantity = valueDes; + break; + case r'shipDate': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(DateTime), + ) as DateTime; + result.shipDate = valueDes; + break; + case r'status': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OrderStatusEnum), + ) as OrderStatusEnum; + result.status = valueDes; + break; + case r'complete': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) as bool; + result.complete = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Order deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = OrderBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + +class OrderStatusEnum extends EnumClass { + /// Order Status + @BuiltValueEnumConst(wireName: r'placed') + static const OrderStatusEnum placed = _$orderStatusEnum_placed; + + /// Order Status + @BuiltValueEnumConst(wireName: r'approved') + static const OrderStatusEnum approved = _$orderStatusEnum_approved; + + /// Order Status + @BuiltValueEnumConst(wireName: r'delivered') + static const OrderStatusEnum delivered = _$orderStatusEnum_delivered; + + /// Order Status + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const OrderStatusEnum unknownDefaultOpenApi = + _$orderStatusEnum_unknownDefaultOpenApi; + + static Serializer get serializer => + _$orderStatusEnumSerializer; + + const OrderStatusEnum._(String name) : super(name); + + static BuiltSet get values => _$orderStatusEnumValues; + static OrderStatusEnum valueOf(String name) => _$orderStatusEnumValueOf(name); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/outer_composite.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/outer_composite.dart new file mode 100644 index 000000000000..899262513eb7 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/outer_composite.dart @@ -0,0 +1,149 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_composite.g.dart'; + +/// OuterComposite +/// +/// Properties: +/// * [myNumber] +/// * [myString] +/// * [myBoolean] +@BuiltValue() +abstract class OuterComposite + implements Built { + @BuiltValueField(wireName: r'my_number') + num? get myNumber; + + @BuiltValueField(wireName: r'my_string') + String? get myString; + + @BuiltValueField(wireName: r'my_boolean') + bool? get myBoolean; + + OuterComposite._(); + + factory OuterComposite([void updates(OuterCompositeBuilder b)]) = + _$OuterComposite; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(OuterCompositeBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$OuterCompositeSerializer(); +} + +class _$OuterCompositeSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [OuterComposite, _$OuterComposite]; + + @override + final String wireName = r'OuterComposite'; + + Iterable _serializeProperties( + Serializers serializers, + OuterComposite object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.myNumber != null) { + yield r'my_number'; + yield serializers.serialize( + object.myNumber, + specifiedType: const FullType(num), + ); + } + if (object.myString != null) { + yield r'my_string'; + yield serializers.serialize( + object.myString, + specifiedType: const FullType(String), + ); + } + if (object.myBoolean != null) { + yield r'my_boolean'; + yield serializers.serialize( + object.myBoolean, + specifiedType: const FullType(bool), + ); + } + } + + @override + Object serialize( + Serializers serializers, + OuterComposite object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required OuterCompositeBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'my_number': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.myNumber = valueDes; + break; + case r'my_string': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.myString = valueDes; + break; + case r'my_boolean': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) as bool; + result.myBoolean = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + OuterComposite deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = OuterCompositeBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/outer_enum.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/outer_enum.dart new file mode 100644 index 000000000000..bf08d4aa048d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/outer_enum.dart @@ -0,0 +1,36 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_enum.g.dart'; + +class OuterEnum extends EnumClass { + @BuiltValueEnumConst(wireName: r'placed') + static const OuterEnum placed = _$placed; + @BuiltValueEnumConst(wireName: r'approved') + static const OuterEnum approved = _$approved; + @BuiltValueEnumConst(wireName: r'delivered') + static const OuterEnum delivered = _$delivered; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const OuterEnum unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + static Serializer get serializer => _$outerEnumSerializer; + + const OuterEnum._(String name) : super(name); + + static BuiltSet get values => _$values; + static OuterEnum valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class OuterEnumMixin = Object with _$OuterEnumMixin; diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/outer_enum_default_value.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/outer_enum_default_value.dart new file mode 100644 index 000000000000..446e5c2fed2d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/outer_enum_default_value.dart @@ -0,0 +1,39 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_enum_default_value.g.dart'; + +class OuterEnumDefaultValue extends EnumClass { + @BuiltValueEnumConst(wireName: r'placed') + static const OuterEnumDefaultValue placed = _$placed; + @BuiltValueEnumConst(wireName: r'approved') + static const OuterEnumDefaultValue approved = _$approved; + @BuiltValueEnumConst(wireName: r'delivered') + static const OuterEnumDefaultValue delivered = _$delivered; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const OuterEnumDefaultValue unknownDefaultOpenApi = + _$unknownDefaultOpenApi; + + static Serializer get serializer => + _$outerEnumDefaultValueSerializer; + + const OuterEnumDefaultValue._(String name) : super(name); + + static BuiltSet get values => _$values; + static OuterEnumDefaultValue valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class OuterEnumDefaultValueMixin = Object + with _$OuterEnumDefaultValueMixin; diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/outer_enum_integer.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/outer_enum_integer.dart new file mode 100644 index 000000000000..d42a7baf5dbd --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/outer_enum_integer.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_enum_integer.g.dart'; + +class OuterEnumInteger extends EnumClass { + @BuiltValueEnumConst(wireNumber: 0) + static const OuterEnumInteger number0 = _$number0; + @BuiltValueEnumConst(wireNumber: 1) + static const OuterEnumInteger number1 = _$number1; + @BuiltValueEnumConst(wireNumber: 2) + static const OuterEnumInteger number2 = _$number2; + @BuiltValueEnumConst(wireNumber: 11184809, fallback: true) + static const OuterEnumInteger unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + static Serializer get serializer => + _$outerEnumIntegerSerializer; + + const OuterEnumInteger._(String name) : super(name); + + static BuiltSet get values => _$values; + static OuterEnumInteger valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class OuterEnumIntegerMixin = Object with _$OuterEnumIntegerMixin; diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/outer_enum_integer_default_value.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/outer_enum_integer_default_value.dart new file mode 100644 index 000000000000..33b46287a86b --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/outer_enum_integer_default_value.dart @@ -0,0 +1,39 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_enum_integer_default_value.g.dart'; + +class OuterEnumIntegerDefaultValue extends EnumClass { + @BuiltValueEnumConst(wireNumber: 0) + static const OuterEnumIntegerDefaultValue number0 = _$number0; + @BuiltValueEnumConst(wireNumber: 1) + static const OuterEnumIntegerDefaultValue number1 = _$number1; + @BuiltValueEnumConst(wireNumber: 2) + static const OuterEnumIntegerDefaultValue number2 = _$number2; + @BuiltValueEnumConst(wireNumber: 11184809, fallback: true) + static const OuterEnumIntegerDefaultValue unknownDefaultOpenApi = + _$unknownDefaultOpenApi; + + static Serializer get serializer => + _$outerEnumIntegerDefaultValueSerializer; + + const OuterEnumIntegerDefaultValue._(String name) : super(name); + + static BuiltSet get values => _$values; + static OuterEnumIntegerDefaultValue valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class OuterEnumIntegerDefaultValueMixin = Object + with _$OuterEnumIntegerDefaultValueMixin; diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/outer_object_with_enum_property.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/outer_object_with_enum_property.dart new file mode 100644 index 000000000000..43dddcba352f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/outer_object_with_enum_property.dart @@ -0,0 +1,118 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/outer_enum_integer.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'outer_object_with_enum_property.g.dart'; + +/// OuterObjectWithEnumProperty +/// +/// Properties: +/// * [value] +@BuiltValue() +abstract class OuterObjectWithEnumProperty + implements + Built { + @BuiltValueField(wireName: r'value') + OuterEnumInteger get value; + // enum valueEnum { 0, 1, 2, }; + + OuterObjectWithEnumProperty._(); + + factory OuterObjectWithEnumProperty( + [void updates(OuterObjectWithEnumPropertyBuilder b)]) = + _$OuterObjectWithEnumProperty; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(OuterObjectWithEnumPropertyBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$OuterObjectWithEnumPropertySerializer(); +} + +class _$OuterObjectWithEnumPropertySerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [ + OuterObjectWithEnumProperty, + _$OuterObjectWithEnumProperty + ]; + + @override + final String wireName = r'OuterObjectWithEnumProperty'; + + Iterable _serializeProperties( + Serializers serializers, + OuterObjectWithEnumProperty object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'value'; + yield serializers.serialize( + object.value, + specifiedType: const FullType(OuterEnumInteger), + ); + } + + @override + Object serialize( + Serializers serializers, + OuterObjectWithEnumProperty object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required OuterObjectWithEnumPropertyBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'value': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(OuterEnumInteger), + ) as OuterEnumInteger; + result.value = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + OuterObjectWithEnumProperty deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = OuterObjectWithEnumPropertyBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/pasta.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/pasta.dart new file mode 100644 index 000000000000..a7e314f1ec0b --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/pasta.dart @@ -0,0 +1,183 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'pasta.g.dart'; + +/// Pasta +/// +/// Properties: +/// * [vendor] +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue() +abstract class Pasta implements Entity, Built { + @BuiltValueField(wireName: r'vendor') + String? get vendor; + + Pasta._(); + + factory Pasta([void updates(PastaBuilder b)]) = _$Pasta; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(PastaBuilder b) => b..atType = b.discriminatorValue; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$PastaSerializer(); +} + +class _$PastaSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Pasta, _$Pasta]; + + @override + final String wireName = r'Pasta'; + + Iterable _serializeProperties( + Serializers serializers, + Pasta object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + if (object.vendor != null) { + yield r'vendor'; + yield serializers.serialize( + object.vendor, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Pasta object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required PastaBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + case r'vendor': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.vendor = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Pasta deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = PastaBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/pet.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/pet.dart new file mode 100644 index 000000000000..6c377470f4a6 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/pet.dart @@ -0,0 +1,226 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:openapi/src/model/category.dart'; +import 'package:openapi/src/model/tag.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'pet.g.dart'; + +/// Pet +/// +/// Properties: +/// * [id] +/// * [name] +/// * [category] +/// * [photoUrls] +/// * [tags] +/// * [status] - pet status in the store +@BuiltValue() +abstract class Pet implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'name') + String get name; + + @BuiltValueField(wireName: r'category') + Category? get category; + + @BuiltValueField(wireName: r'photoUrls') + BuiltList get photoUrls; + + @BuiltValueField(wireName: r'tags') + BuiltList? get tags; + + /// pet status in the store + @BuiltValueField(wireName: r'status') + PetStatusEnum? get status; + // enum statusEnum { available, pending, sold, }; + + Pet._(); + + factory Pet([void updates(PetBuilder b)]) = _$Pet; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(PetBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$PetSerializer(); +} + +class _$PetSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Pet, _$Pet]; + + @override + final String wireName = r'Pet'; + + Iterable _serializeProperties( + Serializers serializers, + Pet object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + if (object.category != null) { + yield r'category'; + yield serializers.serialize( + object.category, + specifiedType: const FullType(Category), + ); + } + yield r'photoUrls'; + yield serializers.serialize( + object.photoUrls, + specifiedType: const FullType(BuiltList, [FullType(String)]), + ); + if (object.tags != null) { + yield r'tags'; + yield serializers.serialize( + object.tags, + specifiedType: const FullType(BuiltList, [FullType(Tag)]), + ); + } + if (object.status != null) { + yield r'status'; + yield serializers.serialize( + object.status, + specifiedType: const FullType(PetStatusEnum), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Pet object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required PetBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + case r'category': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(Category), + ) as Category; + result.category.replace(valueDes); + break; + case r'photoUrls': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(String)]), + ) as BuiltList; + result.photoUrls.replace(valueDes); + break; + case r'tags': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(Tag)]), + ) as BuiltList; + result.tags.replace(valueDes); + break; + case r'status': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(PetStatusEnum), + ) as PetStatusEnum; + result.status = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Pet deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = PetBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + +class PetStatusEnum extends EnumClass { + /// pet status in the store + @BuiltValueEnumConst(wireName: r'available') + static const PetStatusEnum available = _$petStatusEnum_available; + + /// pet status in the store + @BuiltValueEnumConst(wireName: r'pending') + static const PetStatusEnum pending = _$petStatusEnum_pending; + + /// pet status in the store + @BuiltValueEnumConst(wireName: r'sold') + static const PetStatusEnum sold = _$petStatusEnum_sold; + + /// pet status in the store + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const PetStatusEnum unknownDefaultOpenApi = + _$petStatusEnum_unknownDefaultOpenApi; + + static Serializer get serializer => _$petStatusEnumSerializer; + + const PetStatusEnum._(String name) : super(name); + + static BuiltSet get values => _$petStatusEnumValues; + static PetStatusEnum valueOf(String name) => _$petStatusEnumValueOf(name); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/pizza.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/pizza.dart new file mode 100644 index 000000000000..ca079abe8549 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/pizza.dart @@ -0,0 +1,256 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/pizza_speziale.dart'; +import 'package:openapi/src/model/entity.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'pizza.g.dart'; + +/// Pizza +/// +/// Properties: +/// * [pizzaSize] +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue(instantiable: false) +abstract class Pizza implements Entity { + @BuiltValueField(wireName: r'pizzaSize') + num? get pizzaSize; + + static const String discriminatorFieldName = r'@type'; + + static const Map discriminatorMapping = { + r'PizzaSpeziale': PizzaSpeziale, + }; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$PizzaSerializer(); +} + +extension PizzaDiscriminatorExt on Pizza { + String? get discriminatorValue { + if (this is PizzaSpeziale) { + return r'PizzaSpeziale'; + } + return null; + } +} + +extension PizzaBuilderDiscriminatorExt on PizzaBuilder { + String? get discriminatorValue { + if (this is PizzaSpezialeBuilder) { + return r'PizzaSpeziale'; + } + return null; + } +} + +class _$PizzaSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Pizza]; + + @override + final String wireName = r'Pizza'; + + Iterable _serializeProperties( + Serializers serializers, + Pizza object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.pizzaSize != null) { + yield r'pizzaSize'; + yield serializers.serialize( + object.pizzaSize, + specifiedType: const FullType(num), + ); + } + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + Pizza object, { + FullType specifiedType = FullType.unspecified, + }) { + if (object is PizzaSpeziale) { + return serializers.serialize(object, + specifiedType: FullType(PizzaSpeziale))!; + } + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + @override + Pizza deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(Pizza.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], + specifiedType: FullType(String)) as String; + switch (discValue) { + case r'PizzaSpeziale': + return serializers.deserialize(serialized, + specifiedType: FullType(PizzaSpeziale)) as PizzaSpeziale; + default: + return serializers.deserialize(serialized, + specifiedType: FullType($Pizza)) as $Pizza; + } + } +} + +/// a concrete implementation of [Pizza], since [Pizza] is not instantiable +@BuiltValue(instantiable: true) +abstract class $Pizza implements Pizza, Built<$Pizza, $PizzaBuilder> { + $Pizza._(); + + factory $Pizza([void Function($PizzaBuilder)? updates]) = _$$Pizza; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults($PizzaBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer<$Pizza> get serializer => _$$PizzaSerializer(); +} + +class _$$PizzaSerializer implements PrimitiveSerializer<$Pizza> { + @override + final Iterable types = const [$Pizza, _$$Pizza]; + + @override + final String wireName = r'$Pizza'; + + @override + Object serialize( + Serializers serializers, + $Pizza object, { + FullType specifiedType = FullType.unspecified, + }) { + return serializers.serialize(object, specifiedType: FullType(Pizza))!; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required PizzaBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'pizzaSize': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.pizzaSize = valueDes; + break; + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + $Pizza deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = $PizzaBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/pizza_speziale.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/pizza_speziale.dart new file mode 100644 index 000000000000..4c6fd7f38c26 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/pizza_speziale.dart @@ -0,0 +1,201 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/pizza.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'pizza_speziale.g.dart'; + +/// PizzaSpeziale +/// +/// Properties: +/// * [toppings] +/// * [href] - Hyperlink reference +/// * [id] - unique identifier +/// * [atSchemaLocation] - A URI to a JSON-Schema file that defines additional attributes and relationships +/// * [atBaseType] - When sub-classing, this defines the super-class +/// * [atType] - When sub-classing, this defines the sub-class Extensible name +@BuiltValue() +abstract class PizzaSpeziale + implements Pizza, Built { + @BuiltValueField(wireName: r'toppings') + String? get toppings; + + PizzaSpeziale._(); + + factory PizzaSpeziale([void updates(PizzaSpezialeBuilder b)]) = + _$PizzaSpeziale; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(PizzaSpezialeBuilder b) => + b..atType = b.discriminatorValue; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$PizzaSpezialeSerializer(); +} + +class _$PizzaSpezialeSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [PizzaSpeziale, _$PizzaSpeziale]; + + @override + final String wireName = r'PizzaSpeziale'; + + Iterable _serializeProperties( + Serializers serializers, + PizzaSpeziale object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.atSchemaLocation != null) { + yield r'@schemaLocation'; + yield serializers.serialize( + object.atSchemaLocation, + specifiedType: const FullType(String), + ); + } + if (object.pizzaSize != null) { + yield r'pizzaSize'; + yield serializers.serialize( + object.pizzaSize, + specifiedType: const FullType(num), + ); + } + if (object.toppings != null) { + yield r'toppings'; + yield serializers.serialize( + object.toppings, + specifiedType: const FullType(String), + ); + } + if (object.atBaseType != null) { + yield r'@baseType'; + yield serializers.serialize( + object.atBaseType, + specifiedType: const FullType(String), + ); + } + if (object.href != null) { + yield r'href'; + yield serializers.serialize( + object.href, + specifiedType: const FullType(String), + ); + } + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(String), + ); + } + yield r'@type'; + yield serializers.serialize( + object.atType, + specifiedType: const FullType(String), + ); + } + + @override + Object serialize( + Serializers serializers, + PizzaSpeziale object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required PizzaSpezialeBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'@schemaLocation': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atSchemaLocation = valueDes; + break; + case r'pizzaSize': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.pizzaSize = valueDes; + break; + case r'toppings': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.toppings = valueDes; + break; + case r'@baseType': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atBaseType = valueDes; + break; + case r'href': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.href = valueDes; + break; + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.id = valueDes; + break; + case r'@type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.atType = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + PizzaSpeziale deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = PizzaSpezialeBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/read_only_first.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/read_only_first.dart new file mode 100644 index 000000000000..b2501901295f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/read_only_first.dart @@ -0,0 +1,130 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'read_only_first.g.dart'; + +/// ReadOnlyFirst +/// +/// Properties: +/// * [bar] +/// * [baz] +@BuiltValue() +abstract class ReadOnlyFirst + implements Built { + @BuiltValueField(wireName: r'bar') + String? get bar; + + @BuiltValueField(wireName: r'baz') + String? get baz; + + ReadOnlyFirst._(); + + factory ReadOnlyFirst([void updates(ReadOnlyFirstBuilder b)]) = + _$ReadOnlyFirst; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ReadOnlyFirstBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$ReadOnlyFirstSerializer(); +} + +class _$ReadOnlyFirstSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ReadOnlyFirst, _$ReadOnlyFirst]; + + @override + final String wireName = r'ReadOnlyFirst'; + + Iterable _serializeProperties( + Serializers serializers, + ReadOnlyFirst object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.bar != null) { + yield r'bar'; + yield serializers.serialize( + object.bar, + specifiedType: const FullType(String), + ); + } + if (object.baz != null) { + yield r'baz'; + yield serializers.serialize( + object.baz, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + ReadOnlyFirst object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ReadOnlyFirstBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'bar': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.bar = valueDes; + break; + case r'baz': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.baz = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ReadOnlyFirst deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ReadOnlyFirstBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/single_ref_type.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/single_ref_type.dart new file mode 100644 index 000000000000..5324d92a7831 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/single_ref_type.dart @@ -0,0 +1,34 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'single_ref_type.g.dart'; + +class SingleRefType extends EnumClass { + @BuiltValueEnumConst(wireName: r'admin') + static const SingleRefType admin = _$admin; + @BuiltValueEnumConst(wireName: r'user') + static const SingleRefType user = _$user; + @BuiltValueEnumConst(wireName: r'unknown_default_open_api', fallback: true) + static const SingleRefType unknownDefaultOpenApi = _$unknownDefaultOpenApi; + + static Serializer get serializer => _$singleRefTypeSerializer; + + const SingleRefType._(String name) : super(name); + + static BuiltSet get values => _$values; + static SingleRefType valueOf(String name) => _$valueOf(name); +} + +/// Optionally, enum_class can generate a mixin to go with your enum for use +/// with Angular. It exposes your enum constants as getters. So, if you mix it +/// in to your Dart component class, the values become available to the +/// corresponding Angular template. +/// +/// Trigger mixin generation by writing a line like this one next to your enum. +abstract class SingleRefTypeMixin = Object with _$SingleRefTypeMixin; diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/special_model_name.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/special_model_name.dart new file mode 100644 index 000000000000..c5a18443b89f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/special_model_name.dart @@ -0,0 +1,117 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'special_model_name.g.dart'; + +/// SpecialModelName +/// +/// Properties: +/// * [dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket] +@BuiltValue() +abstract class SpecialModelName + implements Built { + @BuiltValueField(wireName: r'$special[property.name]') + int? get dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + + SpecialModelName._(); + + factory SpecialModelName([void updates(SpecialModelNameBuilder b)]) = + _$SpecialModelName; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(SpecialModelNameBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => + _$SpecialModelNameSerializer(); +} + +class _$SpecialModelNameSerializer + implements PrimitiveSerializer { + @override + final Iterable types = const [SpecialModelName, _$SpecialModelName]; + + @override + final String wireName = r'SpecialModelName'; + + Iterable _serializeProperties( + Serializers serializers, + SpecialModelName object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object + .dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket != + null) { + yield r'$special[property.name]'; + yield serializers.serialize( + object + .dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket, + specifiedType: const FullType(int), + ); + } + } + + @override + Object serialize( + Serializers serializers, + SpecialModelName object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required SpecialModelNameBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'$special[property.name]': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket = + valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + SpecialModelName deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = SpecialModelNameBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/tag.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/tag.dart new file mode 100644 index 000000000000..87f6428e39c2 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/tag.dart @@ -0,0 +1,127 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'tag.g.dart'; + +/// Tag +/// +/// Properties: +/// * [id] +/// * [name] +@BuiltValue() +abstract class Tag implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'name') + String? get name; + + Tag._(); + + factory Tag([void updates(TagBuilder b)]) = _$Tag; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(TagBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$TagSerializer(); +} + +class _$TagSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [Tag, _$Tag]; + + @override + final String wireName = r'Tag'; + + Iterable _serializeProperties( + Serializers serializers, + Tag object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + if (object.name != null) { + yield r'name'; + yield serializers.serialize( + object.name, + specifiedType: const FullType(String), + ); + } + } + + @override + Object serialize( + Serializers serializers, + Tag object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required TagBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'name': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.name = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + Tag deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = TagBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart new file mode 100644 index 000000000000..43cf4b6c0d3f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart @@ -0,0 +1,132 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'test_query_style_form_explode_true_array_string_query_object_parameter.g.dart'; + +/// TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter +/// +/// Properties: +/// * [values] +@BuiltValue() +abstract class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + implements + Built { + @BuiltValueField(wireName: r'values') + BuiltList? get values; + + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter._(); + + factory TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter( + [void updates( + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterBuilder + b)]) = + _$TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults( + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterBuilder + b) => + b; + + @BuiltValueSerializer(custom: true) + static Serializer< + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter> + get serializer => + _$TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterSerializer(); +} + +class _$TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterSerializer + implements + PrimitiveSerializer< + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter> { + @override + final Iterable types = const [ + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, + _$TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + ]; + + @override + final String wireName = + r'TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter'; + + Iterable _serializeProperties( + Serializers serializers, + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.values != null) { + yield r'values'; + yield serializers.serialize( + object.values, + specifiedType: const FullType(BuiltList, [FullType(String)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterBuilder + result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'values': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltList, [FullType(String)]), + ) as BuiltList; + result.values.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/user.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/user.dart new file mode 100644 index 000000000000..5d10005382ff --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/model/user.dart @@ -0,0 +1,236 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'user.g.dart'; + +/// User +/// +/// Properties: +/// * [id] +/// * [username] +/// * [firstName] +/// * [lastName] +/// * [email] +/// * [password] +/// * [phone] +/// * [userStatus] - User Status +@BuiltValue() +abstract class User implements Built { + @BuiltValueField(wireName: r'id') + int? get id; + + @BuiltValueField(wireName: r'username') + String? get username; + + @BuiltValueField(wireName: r'firstName') + String? get firstName; + + @BuiltValueField(wireName: r'lastName') + String? get lastName; + + @BuiltValueField(wireName: r'email') + String? get email; + + @BuiltValueField(wireName: r'password') + String? get password; + + @BuiltValueField(wireName: r'phone') + String? get phone; + + /// User Status + @BuiltValueField(wireName: r'userStatus') + int? get userStatus; + + User._(); + + factory User([void updates(UserBuilder b)]) = _$User; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(UserBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$UserSerializer(); +} + +class _$UserSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [User, _$User]; + + @override + final String wireName = r'User'; + + Iterable _serializeProperties( + Serializers serializers, + User object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.id != null) { + yield r'id'; + yield serializers.serialize( + object.id, + specifiedType: const FullType(int), + ); + } + if (object.username != null) { + yield r'username'; + yield serializers.serialize( + object.username, + specifiedType: const FullType(String), + ); + } + if (object.firstName != null) { + yield r'firstName'; + yield serializers.serialize( + object.firstName, + specifiedType: const FullType(String), + ); + } + if (object.lastName != null) { + yield r'lastName'; + yield serializers.serialize( + object.lastName, + specifiedType: const FullType(String), + ); + } + if (object.email != null) { + yield r'email'; + yield serializers.serialize( + object.email, + specifiedType: const FullType(String), + ); + } + if (object.password != null) { + yield r'password'; + yield serializers.serialize( + object.password, + specifiedType: const FullType(String), + ); + } + if (object.phone != null) { + yield r'phone'; + yield serializers.serialize( + object.phone, + specifiedType: const FullType(String), + ); + } + if (object.userStatus != null) { + yield r'userStatus'; + yield serializers.serialize( + object.userStatus, + specifiedType: const FullType(int), + ); + } + } + + @override + Object serialize( + Serializers serializers, + User object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, + specifiedType: specifiedType) + .toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required UserBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'id': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.id = valueDes; + break; + case r'username': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.username = valueDes; + break; + case r'firstName': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.firstName = valueDes; + break; + case r'lastName': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.lastName = valueDes; + break; + case r'email': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.email = valueDes; + break; + case r'password': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.password = valueDes; + break; + case r'phone': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.phone = valueDes; + break; + case r'userStatus': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(int), + ) as int; + result.userStatus = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + User deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = UserBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/lib/src/serializers.dart b/samples/client/echo_api/dart/dart-http-built_value/lib/src/serializers.dart new file mode 100644 index 000000000000..76baea9bd50a --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/lib/src/serializers.dart @@ -0,0 +1,184 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_import + +import 'package:one_of_serializer/any_of_serializer.dart'; +import 'package:one_of_serializer/one_of_serializer.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/json_object.dart'; +import 'package:built_value/serializer.dart'; +import 'package:built_value/standard_json_plugin.dart'; +import 'package:built_value/iso_8601_date_time_serializer.dart'; +import 'package:openapi/src/date_serializer.dart'; +import 'package:openapi/src/model/date.dart'; + +import 'package:openapi/src/model/additional_properties_class.dart'; +import 'package:openapi/src/model/addressable.dart'; +import 'package:openapi/src/model/all_of_with_single_ref.dart'; +import 'package:openapi/src/model/animal.dart'; +import 'package:openapi/src/model/api_response.dart'; +import 'package:openapi/src/model/apple.dart'; +import 'package:openapi/src/model/array_of_array_of_number_only.dart'; +import 'package:openapi/src/model/array_of_number_only.dart'; +import 'package:openapi/src/model/array_test.dart'; +import 'package:openapi/src/model/banana.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:openapi/src/model/bar_create.dart'; +import 'package:openapi/src/model/bar_ref.dart'; +import 'package:openapi/src/model/bar_ref_or_value.dart'; +import 'package:openapi/src/model/capitalization.dart'; +import 'package:openapi/src/model/cat.dart'; +import 'package:openapi/src/model/cat_all_of.dart'; +import 'package:openapi/src/model/category.dart'; +import 'package:openapi/src/model/child.dart'; +import 'package:openapi/src/model/class_model.dart'; +import 'package:openapi/src/model/deprecated_object.dart'; +import 'package:openapi/src/model/dog.dart'; +import 'package:openapi/src/model/dog_all_of.dart'; +import 'package:openapi/src/model/entity.dart'; +import 'package:openapi/src/model/entity_ref.dart'; +import 'package:openapi/src/model/enum_arrays.dart'; +import 'package:openapi/src/model/enum_test.dart'; +import 'package:openapi/src/model/example.dart'; +import 'package:openapi/src/model/example_non_primitive.dart'; +import 'package:openapi/src/model/extensible.dart'; +import 'package:openapi/src/model/file_schema_test_class.dart'; +import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/foo_ref.dart'; +import 'package:openapi/src/model/foo_ref_or_value.dart'; +import 'package:openapi/src/model/format_test.dart'; +import 'package:openapi/src/model/fruit.dart'; +import 'package:openapi/src/model/has_only_read_only.dart'; +import 'package:openapi/src/model/health_check_result.dart'; +import 'package:openapi/src/model/map_test.dart'; +import 'package:openapi/src/model/mixed_properties_and_additional_properties_class.dart'; +import 'package:openapi/src/model/model200_response.dart'; +import 'package:openapi/src/model/model_client.dart'; +import 'package:openapi/src/model/model_enum_class.dart'; +import 'package:openapi/src/model/model_file.dart'; +import 'package:openapi/src/model/model_list.dart'; +import 'package:openapi/src/model/model_return.dart'; +import 'package:openapi/src/model/name.dart'; +import 'package:openapi/src/model/nullable_class.dart'; +import 'package:openapi/src/model/number_only.dart'; +import 'package:openapi/src/model/object_with_deprecated_fields.dart'; +import 'package:openapi/src/model/order.dart'; +import 'package:openapi/src/model/outer_composite.dart'; +import 'package:openapi/src/model/outer_enum.dart'; +import 'package:openapi/src/model/outer_enum_default_value.dart'; +import 'package:openapi/src/model/outer_enum_integer.dart'; +import 'package:openapi/src/model/outer_enum_integer_default_value.dart'; +import 'package:openapi/src/model/outer_object_with_enum_property.dart'; +import 'package:openapi/src/model/pasta.dart'; +import 'package:openapi/src/model/pet.dart'; +import 'package:openapi/src/model/pizza.dart'; +import 'package:openapi/src/model/pizza_speziale.dart'; +import 'package:openapi/src/model/read_only_first.dart'; +import 'package:openapi/src/model/single_ref_type.dart'; +import 'package:openapi/src/model/special_model_name.dart'; +import 'package:openapi/src/model/tag.dart'; +import 'package:openapi/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart'; +import 'package:openapi/src/model/user.dart'; + +part 'serializers.g.dart'; + +@SerializersFor([ + AdditionalPropertiesClass, + Addressable, + $Addressable, + AllOfWithSingleRef, + Animal, + $Animal, + ApiResponse, + Apple, + ArrayOfArrayOfNumberOnly, + ArrayOfNumberOnly, + ArrayTest, + Banana, + Bar, + BarCreate, + BarRef, + BarRefOrValue, + Capitalization, + Cat, + CatAllOf, + $CatAllOf, + Category, + Child, + ClassModel, + DeprecatedObject, + Dog, + DogAllOf, + $DogAllOf, + Entity, + $Entity, + EntityRef, + $EntityRef, + EnumArrays, + EnumTest, + Example, + ExampleNonPrimitive, + Extensible, + $Extensible, + FileSchemaTestClass, + Foo, + FooRef, + FooRefOrValue, + FormatTest, + Fruit, + HasOnlyReadOnly, + HealthCheckResult, + MapTest, + MixedPropertiesAndAdditionalPropertiesClass, + Model200Response, + ModelClient, + ModelEnumClass, + ModelFile, + ModelList, + ModelReturn, + Name, + NullableClass, + NumberOnly, + ObjectWithDeprecatedFields, + Order, + OuterComposite, + OuterEnum, + OuterEnumDefaultValue, + OuterEnumInteger, + OuterEnumIntegerDefaultValue, + OuterObjectWithEnumProperty, + Pasta, + Pet, + Pizza, + $Pizza, + PizzaSpeziale, + ReadOnlyFirst, + SingleRefType, + SpecialModelName, + Tag, + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, + User, +]) +Serializers serializers = (_$serializers.toBuilder() + ..addBuilderFactory( + const FullType(BuiltMap, [FullType(String), FullType(String)]), + () => MapBuilder(), + ) + ..add(Addressable.serializer) + ..add(Animal.serializer) + ..add(CatAllOf.serializer) + ..add(DogAllOf.serializer) + ..add(Entity.serializer) + ..add(EntityRef.serializer) + ..add(Extensible.serializer) + ..add(Pizza.serializer) + ..add(const OneOfSerializer()) + ..add(const AnyOfSerializer()) + ..add(const DateSerializer()) + ..add(Iso8601DateTimeSerializer())) + .build(); + +Serializers standardSerializers = + (serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build(); diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/pubspec.yaml b/samples/client/echo_api/dart/dart-http-built_value/pubspec.yaml similarity index 85% rename from samples/openapi3/client/petstore/dart-dio/oneof_primitive/pubspec.yaml rename to samples/client/echo_api/dart/dart-http-built_value/pubspec.yaml index fb676f65c393..87b8cd162271 100644 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/pubspec.yaml +++ b/samples/client/echo_api/dart/dart-http-built_value/pubspec.yaml @@ -7,7 +7,10 @@ environment: sdk: '>=2.12.0 <3.0.0' dependencies: - dio: '>=4.0.1 <5.0.0' + + http: '>=0.13.5 <2.0.0' + intl: '^0.17.0' + meta: '^1.1.8' one_of: '>=1.5.0 <2.0.0' one_of_serializer: '>=1.5.0 <2.0.0' built_value: '>=8.4.0 <9.0.0' diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/additional_properties_class_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/additional_properties_class_test.dart new file mode 100644 index 000000000000..0ee0559d710c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/additional_properties_class_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AdditionalPropertiesClass +void main() { + final instance = AdditionalPropertiesClassBuilder(); + // TODO add properties to the builder and call build() + + group(AdditionalPropertiesClass, () { + // BuiltMap mapProperty + test('to test the property `mapProperty`', () async { + // TODO + }); + + // BuiltMap> mapOfMapProperty + test('to test the property `mapOfMapProperty`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/addressable_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/addressable_test.dart new file mode 100644 index 000000000000..657f7ee74448 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/addressable_test.dart @@ -0,0 +1,22 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Addressable +void main() { + //final instance = AddressableBuilder(); + // TODO add properties to the builder and call build() + + 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/client/echo_api/dart/dart-http-built_value/test/all_of_with_single_ref_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/all_of_with_single_ref_test.dart new file mode 100644 index 000000000000..a423afab69b0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/all_of_with_single_ref_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AllOfWithSingleRef +void main() { + final instance = AllOfWithSingleRefBuilder(); + // TODO add properties to the builder and call build() + + 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/client/echo_api/dart/dart-http-built_value/test/animal_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/animal_test.dart new file mode 100644 index 000000000000..023e09145fe3 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/animal_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Animal +void main() { + //final instance = AnimalBuilder(); + // TODO add properties to the builder and call build() + + group(Animal, () { + // String className + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/api_response_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/api_response_test.dart new file mode 100644 index 000000000000..9587579a4ab0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/api_response_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ApiResponse +void main() { + final instance = ApiResponseBuilder(); + // TODO add properties to the builder and call build() + + group(ApiResponse, () { + // int code + test('to test the property `code`', () async { + // TODO + }); + + // String type + test('to test the property `type`', () async { + // TODO + }); + + // String message + test('to test the property `message`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/apple_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/apple_test.dart new file mode 100644 index 000000000000..0949f55b7247 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/apple_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Apple +void main() { + final instance = AppleBuilder(); + // TODO add properties to the builder and call build() + + group(Apple, () { + // String kind + test('to test the property `kind`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/array_of_array_of_number_only_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/array_of_array_of_number_only_test.dart new file mode 100644 index 000000000000..ad6d165e3c83 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/array_of_array_of_number_only_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayOfArrayOfNumberOnly +void main() { + final instance = ArrayOfArrayOfNumberOnlyBuilder(); + // TODO add properties to the builder and call build() + + group(ArrayOfArrayOfNumberOnly, () { + // BuiltList> arrayArrayNumber + test('to test the property `arrayArrayNumber`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/array_of_number_only_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/array_of_number_only_test.dart new file mode 100644 index 000000000000..456681ced455 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/array_of_number_only_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayOfNumberOnly +void main() { + final instance = ArrayOfNumberOnlyBuilder(); + // TODO add properties to the builder and call build() + + group(ArrayOfNumberOnly, () { + // BuiltList arrayNumber + test('to test the property `arrayNumber`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/array_test_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/array_test_test.dart new file mode 100644 index 000000000000..7b89588b2157 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/array_test_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayTest +void main() { + final instance = ArrayTestBuilder(); + // TODO add properties to the builder and call build() + + group(ArrayTest, () { + // BuiltList arrayOfString + test('to test the property `arrayOfString`', () async { + // TODO + }); + + // BuiltList> arrayArrayOfInteger + test('to test the property `arrayArrayOfInteger`', () async { + // TODO + }); + + // BuiltList> arrayArrayOfModel + test('to test the property `arrayArrayOfModel`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/banana_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/banana_test.dart new file mode 100644 index 000000000000..34f4c1ca36ed --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/banana_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Banana +void main() { + final instance = BananaBuilder(); + // TODO add properties to the builder and call build() + + group(Banana, () { + // num count + test('to test the property `count`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/bar_create_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/bar_create_test.dart new file mode 100644 index 000000000000..050dcadfb0f9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/bar_create_test.dart @@ -0,0 +1,55 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BarCreate +void main() { + final instance = BarCreateBuilder(); + // TODO add properties to the builder and call build() + + 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/client/echo_api/dart/dart-http-built_value/test/bar_ref_or_value_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/bar_ref_or_value_test.dart new file mode 100644 index 000000000000..a6ceb001ec11 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/bar_ref_or_value_test.dart @@ -0,0 +1,40 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BarRefOrValue +void main() { + final instance = BarRefOrValueBuilder(); + // TODO add properties to the builder and call build() + + group(BarRefOrValue, () { + // 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/client/echo_api/dart/dart-http-built_value/test/bar_ref_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/bar_ref_test.dart new file mode 100644 index 000000000000..4a31ed0904b5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/bar_ref_test.dart @@ -0,0 +1,40 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for BarRef +void main() { + final instance = BarRefBuilder(); + // TODO add properties to the builder and call build() + + group(BarRef, () { + // 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/client/echo_api/dart/dart-http-built_value/test/bar_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/bar_test.dart new file mode 100644 index 000000000000..616f922b5d14 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/bar_test.dart @@ -0,0 +1,54 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Bar +void main() { + final instance = BarBuilder(); + // TODO add properties to the builder and call build() + + 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/client/echo_api/dart/dart-http-built_value/test/body_api_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/body_api_test.dart new file mode 100644 index 000000000000..05eedc2d2540 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/body_api_test.dart @@ -0,0 +1,18 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for BodyApi +void main() { + final instance = Openapi().getBodyApi(); + + group(BodyApi, () { + // Test body parameter(s) + // + // Test body parameter(s) + // + //Future testEchoBodyPet({ Pet pet }) async + test('test testEchoBodyPet', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/capitalization_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/capitalization_test.dart new file mode 100644 index 000000000000..c1fb9cd73dc7 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/capitalization_test.dart @@ -0,0 +1,41 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Capitalization +void main() { + final instance = CapitalizationBuilder(); + // TODO add properties to the builder and call build() + + group(Capitalization, () { + // String smallCamel + test('to test the property `smallCamel`', () async { + // TODO + }); + + // String capitalCamel + test('to test the property `capitalCamel`', () async { + // TODO + }); + + // String smallSnake + test('to test the property `smallSnake`', () async { + // TODO + }); + + // String capitalSnake + test('to test the property `capitalSnake`', () async { + // TODO + }); + + // String sCAETHFlowPoints + test('to test the property `sCAETHFlowPoints`', () async { + // TODO + }); + + // Name of the pet + // String ATT_NAME + test('to test the property `ATT_NAME`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/cat_all_of_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/cat_all_of_test.dart new file mode 100644 index 000000000000..b84216c8996d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/cat_all_of_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for CatAllOf +void main() { + //final instance = CatAllOfBuilder(); + // TODO add properties to the builder and call build() + + group(CatAllOf, () { + // bool declawed + test('to test the property `declawed`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/cat_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/cat_test.dart new file mode 100644 index 000000000000..000e31d7f176 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/cat_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Cat +void main() { + final instance = CatBuilder(); + // TODO add properties to the builder and call build() + + group(Cat, () { + // String className + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + // bool declawed + test('to test the property `declawed`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/category_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/category_test.dart new file mode 100644 index 000000000000..ba39a86cfb6a --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/category_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Category +void main() { + final instance = CategoryBuilder(); + // TODO add properties to the builder and call build() + + group(Category, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/child_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/child_test.dart new file mode 100644 index 000000000000..6c5defb7b228 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/child_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Child +void main() { + final instance = ChildBuilder(); + // TODO add properties to the builder and call build() + + group(Child, () { + // String name + test('to test the property `name`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/class_model_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/class_model_test.dart new file mode 100644 index 000000000000..1ca5ccc3a74b --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/class_model_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ClassModel +void main() { + final instance = ClassModelBuilder(); + // TODO add properties to the builder and call build() + + group(ClassModel, () { + // String classField + test('to test the property `classField`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/deprecated_object_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/deprecated_object_test.dart new file mode 100644 index 000000000000..298f2d2253b4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/deprecated_object_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DeprecatedObject +void main() { + final instance = DeprecatedObjectBuilder(); + // TODO add properties to the builder and call build() + + group(DeprecatedObject, () { + // String name + test('to test the property `name`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/dog_all_of_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/dog_all_of_test.dart new file mode 100644 index 000000000000..8d258244accb --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/dog_all_of_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DogAllOf +void main() { + //final instance = DogAllOfBuilder(); + // TODO add properties to the builder and call build() + + group(DogAllOf, () { + // String breed + test('to test the property `breed`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/dog_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/dog_test.dart new file mode 100644 index 000000000000..0d810b3b9fa9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/dog_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Dog +void main() { + final instance = DogBuilder(); + // TODO add properties to the builder and call build() + + group(Dog, () { + // String className + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + // String breed + test('to test the property `breed`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/entity_ref_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/entity_ref_test.dart new file mode 100644 index 000000000000..ce3ed9868212 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/entity_ref_test.dart @@ -0,0 +1,52 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EntityRef +void main() { + //final instance = EntityRefBuilder(); + // TODO add properties to the builder and call build() + + 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/client/echo_api/dart/dart-http-built_value/test/entity_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/entity_test.dart new file mode 100644 index 000000000000..ca7dd754f98d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/entity_test.dart @@ -0,0 +1,40 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Entity +void main() { + //final instance = EntityBuilder(); + // TODO add properties to the builder and call build() + + 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/client/echo_api/dart/dart-http-built_value/test/enum_arrays_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/enum_arrays_test.dart new file mode 100644 index 000000000000..c0d5de925aec --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/enum_arrays_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EnumArrays +void main() { + final instance = EnumArraysBuilder(); + // TODO add properties to the builder and call build() + + group(EnumArrays, () { + // String justSymbol + test('to test the property `justSymbol`', () async { + // TODO + }); + + // BuiltList arrayEnum + test('to test the property `arrayEnum`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/enum_test_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/enum_test_test.dart new file mode 100644 index 000000000000..d7dc20b5eb77 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/enum_test_test.dart @@ -0,0 +1,50 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EnumTest +void main() { + final instance = EnumTestBuilder(); + // TODO add properties to the builder and call build() + + group(EnumTest, () { + // String enumString + test('to test the property `enumString`', () async { + // TODO + }); + + // String enumStringRequired + test('to test the property `enumStringRequired`', () async { + // TODO + }); + + // int enumInteger + test('to test the property `enumInteger`', () async { + // TODO + }); + + // double enumNumber + test('to test the property `enumNumber`', () async { + // TODO + }); + + // OuterEnum outerEnum + test('to test the property `outerEnum`', () async { + // TODO + }); + + // OuterEnumInteger outerEnumInteger + test('to test the property `outerEnumInteger`', () async { + // TODO + }); + + // OuterEnumDefaultValue outerEnumDefaultValue + test('to test the property `outerEnumDefaultValue`', () async { + // TODO + }); + + // OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue + test('to test the property `outerEnumIntegerDefaultValue`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/example_non_primitive_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/example_non_primitive_test.dart new file mode 100644 index 000000000000..5563d239e355 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/example_non_primitive_test.dart @@ -0,0 +1,10 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ExampleNonPrimitive +void main() { + final instance = ExampleNonPrimitiveBuilder(); + // TODO add properties to the builder and call build() + + group(ExampleNonPrimitive, () {}); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/example_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/example_test.dart new file mode 100644 index 000000000000..1150465e7d28 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/example_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Example +void main() { + final instance = ExampleBuilder(); + // TODO add properties to the builder and call build() + + group(Example, () { + // String name + test('to test the property `name`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/extensible_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/extensible_test.dart new file mode 100644 index 000000000000..158df10ac74e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/extensible_test.dart @@ -0,0 +1,28 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Extensible +void main() { + //final instance = ExtensibleBuilder(); + // TODO add properties to the builder and call build() + + group(Extensible, () { + // A URI to a JSON-Schema file that defines additional attributes and relationships + // String atSchemaLocation + test('to test the property `atSchemaLocation`', () async { + // 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/client/echo_api/dart/dart-http-built_value/test/file_schema_test_class_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/file_schema_test_class_test.dart new file mode 100644 index 000000000000..1ef8cf8861b4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/file_schema_test_class_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FileSchemaTestClass +void main() { + final instance = FileSchemaTestClassBuilder(); + // TODO add properties to the builder and call build() + + group(FileSchemaTestClass, () { + // ModelFile file + test('to test the property `file`', () async { + // TODO + }); + + // BuiltList files + test('to test the property `files`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/foo_ref_or_value_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/foo_ref_or_value_test.dart new file mode 100644 index 000000000000..bcee2f7eaee1 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/foo_ref_or_value_test.dart @@ -0,0 +1,40 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FooRefOrValue +void main() { + final instance = FooRefOrValueBuilder(); + // TODO add properties to the builder and call build() + + group(FooRefOrValue, () { + // 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/client/echo_api/dart/dart-http-built_value/test/foo_ref_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/foo_ref_test.dart new file mode 100644 index 000000000000..b28c262c3e22 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/foo_ref_test.dart @@ -0,0 +1,45 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FooRef +void main() { + final instance = FooRefBuilder(); + // TODO add properties to the builder and call build() + + group(FooRef, () { + // String foorefPropA + test('to test the property `foorefPropA`', () 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/client/echo_api/dart/dart-http-built_value/test/foo_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/foo_test.dart new file mode 100644 index 000000000000..0b491bb37b68 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/foo_test.dart @@ -0,0 +1,50 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Foo +void main() { + final instance = FooBuilder(); + // TODO add properties to the builder and call build() + + group(Foo, () { + // String 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/client/echo_api/dart/dart-http-built_value/test/format_test_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/format_test_test.dart new file mode 100644 index 000000000000..3827c02e13ae --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/format_test_test.dart @@ -0,0 +1,92 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FormatTest +void main() { + final instance = FormatTestBuilder(); + // TODO add properties to the builder and call build() + + group(FormatTest, () { + // int integer + test('to test the property `integer`', () async { + // TODO + }); + + // int int32 + test('to test the property `int32`', () async { + // TODO + }); + + // int int64 + test('to test the property `int64`', () async { + // TODO + }); + + // num number + test('to test the property `number`', () async { + // TODO + }); + + // double float + test('to test the property `float`', () async { + // TODO + }); + + // double double_ + test('to test the property `double_`', () async { + // TODO + }); + + // double decimal + test('to test the property `decimal`', () async { + // TODO + }); + + // String string + test('to test the property `string`', () async { + // TODO + }); + + // String byte + test('to test the property `byte`', () async { + // TODO + }); + + // Uint8List binary + test('to test the property `binary`', () async { + // TODO + }); + + // Date 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/client/echo_api/dart/dart-http-built_value/test/fruit_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/fruit_test.dart new file mode 100644 index 000000000000..26b265ccb93f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/fruit_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Fruit +void main() { + final instance = FruitBuilder(); + // TODO add properties to the builder and call build() + + 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/client/echo_api/dart/dart-http-built_value/test/has_only_read_only_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/has_only_read_only_test.dart new file mode 100644 index 000000000000..8b00db3d0711 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/has_only_read_only_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for HasOnlyReadOnly +void main() { + final instance = HasOnlyReadOnlyBuilder(); + // TODO add properties to the builder and call build() + + group(HasOnlyReadOnly, () { + // String bar + test('to test the property `bar`', () async { + // TODO + }); + + // String foo + test('to test the property `foo`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/health_check_result_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/health_check_result_test.dart new file mode 100644 index 000000000000..050e2c9b814f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/health_check_result_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for HealthCheckResult +void main() { + final instance = HealthCheckResultBuilder(); + // TODO add properties to the builder and call build() + + group(HealthCheckResult, () { + // String nullableMessage + test('to test the property `nullableMessage`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/map_test_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/map_test_test.dart new file mode 100644 index 000000000000..56c3d448c6c5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/map_test_test.dart @@ -0,0 +1,30 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for MapTest +void main() { + final instance = MapTestBuilder(); + // TODO add properties to the builder and call build() + + group(MapTest, () { + // BuiltMap> mapMapOfString + test('to test the property `mapMapOfString`', () async { + // TODO + }); + + // BuiltMap mapOfEnumString + test('to test the property `mapOfEnumString`', () async { + // TODO + }); + + // BuiltMap directMap + test('to test the property `directMap`', () async { + // TODO + }); + + // BuiltMap indirectMap + test('to test the property `indirectMap`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/mixed_properties_and_additional_properties_class_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/mixed_properties_and_additional_properties_class_test.dart new file mode 100644 index 000000000000..dcaa8d351ae5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/mixed_properties_and_additional_properties_class_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for MixedPropertiesAndAdditionalPropertiesClass +void main() { + final instance = MixedPropertiesAndAdditionalPropertiesClassBuilder(); + // TODO add properties to the builder and call build() + + group(MixedPropertiesAndAdditionalPropertiesClass, () { + // String uuid + test('to test the property `uuid`', () async { + // TODO + }); + + // DateTime dateTime + test('to test the property `dateTime`', () async { + // TODO + }); + + // BuiltMap map + test('to test the property `map`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/model200_response_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/model200_response_test.dart new file mode 100644 index 000000000000..8064eb959a32 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/model200_response_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Model200Response +void main() { + final instance = Model200ResponseBuilder(); + // TODO add properties to the builder and call build() + + group(Model200Response, () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // String classField + test('to test the property `classField`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/model_client_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/model_client_test.dart new file mode 100644 index 000000000000..1998f27d715a --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/model_client_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelClient +void main() { + final instance = ModelClientBuilder(); + // TODO add properties to the builder and call build() + + group(ModelClient, () { + // String client + test('to test the property `client`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/model_enum_class_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/model_enum_class_test.dart new file mode 100644 index 000000000000..fa31f816801c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/model_enum_class_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelEnumClass +void main() { + group(ModelEnumClass, () {}); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/model_file_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/model_file_test.dart new file mode 100644 index 000000000000..a07c60c5d85d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/model_file_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelFile +void main() { + final instance = ModelFileBuilder(); + // TODO add properties to the builder and call build() + + group(ModelFile, () { + // Test capitalization + // String sourceURI + test('to test the property `sourceURI`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/model_list_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/model_list_test.dart new file mode 100644 index 000000000000..0c4e3c45c7a9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/model_list_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelList +void main() { + final instance = ModelListBuilder(); + // TODO add properties to the builder and call build() + + group(ModelList, () { + // String n123list + test('to test the property `n123list`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/model_return_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/model_return_test.dart new file mode 100644 index 000000000000..b60abdfd6021 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/model_return_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelReturn +void main() { + final instance = ModelReturnBuilder(); + // TODO add properties to the builder and call build() + + group(ModelReturn, () { + // int return_ + test('to test the property `return_`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/name_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/name_test.dart new file mode 100644 index 000000000000..d04e76fef9e0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/name_test.dart @@ -0,0 +1,30 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Name +void main() { + final instance = NameBuilder(); + // TODO add properties to the builder and call build() + + group(Name, () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // int snakeCase + test('to test the property `snakeCase`', () async { + // TODO + }); + + // String property + test('to test the property `property`', () async { + // TODO + }); + + // int n123number + test('to test the property `n123number`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/nullable_class_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/nullable_class_test.dart new file mode 100644 index 000000000000..32f0eba4fb2e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/nullable_class_test.dart @@ -0,0 +1,70 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for NullableClass +void main() { + final instance = NullableClassBuilder(); + // TODO add properties to the builder and call build() + + group(NullableClass, () { + // int integerProp + test('to test the property `integerProp`', () async { + // TODO + }); + + // num numberProp + test('to test the property `numberProp`', () async { + // TODO + }); + + // bool booleanProp + test('to test the property `booleanProp`', () async { + // TODO + }); + + // String stringProp + test('to test the property `stringProp`', () async { + // TODO + }); + + // Date dateProp + test('to test the property `dateProp`', () async { + // TODO + }); + + // DateTime datetimeProp + test('to test the property `datetimeProp`', () async { + // TODO + }); + + // BuiltList arrayNullableProp + test('to test the property `arrayNullableProp`', () async { + // TODO + }); + + // BuiltList arrayAndItemsNullableProp + test('to test the property `arrayAndItemsNullableProp`', () async { + // TODO + }); + + // BuiltList arrayItemsNullable + test('to test the property `arrayItemsNullable`', () async { + // TODO + }); + + // BuiltMap objectNullableProp + test('to test the property `objectNullableProp`', () async { + // TODO + }); + + // BuiltMap objectAndItemsNullableProp + test('to test the property `objectAndItemsNullableProp`', () async { + // TODO + }); + + // BuiltMap objectItemsNullable + test('to test the property `objectItemsNullable`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/number_only_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/number_only_test.dart new file mode 100644 index 000000000000..7f34d2a5ce60 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/number_only_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for NumberOnly +void main() { + final instance = NumberOnlyBuilder(); + // TODO add properties to the builder and call build() + + group(NumberOnly, () { + // num justNumber + test('to test the property `justNumber`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/object_with_deprecated_fields_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/object_with_deprecated_fields_test.dart new file mode 100644 index 000000000000..574970b317ca --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/object_with_deprecated_fields_test.dart @@ -0,0 +1,30 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ObjectWithDeprecatedFields +void main() { + final instance = ObjectWithDeprecatedFieldsBuilder(); + // TODO add properties to the builder and call build() + + 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 + }); + + // BuiltList bars + test('to test the property `bars`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/order_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/order_test.dart new file mode 100644 index 000000000000..3ed96043d80c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/order_test.dart @@ -0,0 +1,41 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Order +void main() { + final instance = OrderBuilder(); + // TODO add properties to the builder and call build() + + group(Order, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // int petId + test('to test the property `petId`', () async { + // TODO + }); + + // int quantity + test('to test the property `quantity`', () async { + // TODO + }); + + // DateTime shipDate + test('to test the property `shipDate`', () async { + // TODO + }); + + // Order Status + // String status + test('to test the property `status`', () async { + // TODO + }); + + // bool complete (default value: false) + test('to test the property `complete`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/outer_composite_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/outer_composite_test.dart new file mode 100644 index 000000000000..99a7cb7db596 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/outer_composite_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterComposite +void main() { + final instance = OuterCompositeBuilder(); + // TODO add properties to the builder and call build() + + group(OuterComposite, () { + // num myNumber + test('to test the property `myNumber`', () async { + // TODO + }); + + // String myString + test('to test the property `myString`', () async { + // TODO + }); + + // bool myBoolean + test('to test the property `myBoolean`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/outer_enum_default_value_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/outer_enum_default_value_test.dart new file mode 100644 index 000000000000..a5c83f615194 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/outer_enum_default_value_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumDefaultValue +void main() { + group(OuterEnumDefaultValue, () {}); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/outer_enum_integer_default_value_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/outer_enum_integer_default_value_test.dart new file mode 100644 index 000000000000..49ebbfcead7f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/outer_enum_integer_default_value_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumIntegerDefaultValue +void main() { + group(OuterEnumIntegerDefaultValue, () {}); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/outer_enum_integer_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/outer_enum_integer_test.dart new file mode 100644 index 000000000000..3c6b81305c71 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/outer_enum_integer_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumInteger +void main() { + group(OuterEnumInteger, () {}); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/outer_enum_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/outer_enum_test.dart new file mode 100644 index 000000000000..4ee10f379d5e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/outer_enum_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnum +void main() { + group(OuterEnum, () {}); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/outer_object_with_enum_property_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/outer_object_with_enum_property_test.dart new file mode 100644 index 000000000000..cb621828cbc0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/outer_object_with_enum_property_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterObjectWithEnumProperty +void main() { + final instance = OuterObjectWithEnumPropertyBuilder(); + // TODO add properties to the builder and call build() + + group(OuterObjectWithEnumProperty, () { + // OuterEnumInteger value + test('to test the property `value`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/pasta_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/pasta_test.dart new file mode 100644 index 000000000000..42de4a90e2fa --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/pasta_test.dart @@ -0,0 +1,45 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Pasta +void main() { + final instance = PastaBuilder(); + // TODO add properties to the builder and call build() + + 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/client/echo_api/dart/dart-http-built_value/test/path_api_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/path_api_test.dart new file mode 100644 index 000000000000..658f714ec35f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/path_api_test.dart @@ -0,0 +1,18 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for PathApi +void main() { + final instance = Openapi().getPathApi(); + + group(PathApi, () { + // Test path parameter(s) + // + // Test path parameter(s) + // + //Future testsPathStringPathStringIntegerPathInteger(String pathString, int pathInteger) async + test('test testsPathStringPathStringIntegerPathInteger', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/pet_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/pet_test.dart new file mode 100644 index 000000000000..bf61da3114ce --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/pet_test.dart @@ -0,0 +1,41 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Pet +void main() { + final instance = PetBuilder(); + // TODO add properties to the builder and call build() + + group(Pet, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // Category category + test('to test the property `category`', () async { + // TODO + }); + + // BuiltList photoUrls + test('to test the property `photoUrls`', () async { + // TODO + }); + + // BuiltList tags + test('to test the property `tags`', () async { + // TODO + }); + + // pet status in the store + // String status + test('to test the property `status`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/pizza_speziale_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/pizza_speziale_test.dart new file mode 100644 index 000000000000..c6a78cb12fc7 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/pizza_speziale_test.dart @@ -0,0 +1,45 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for PizzaSpeziale +void main() { + final instance = PizzaSpezialeBuilder(); + // TODO add properties to the builder and call build() + + group(PizzaSpeziale, () { + // String toppings + test('to test the property `toppings`', () 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/client/echo_api/dart/dart-http-built_value/test/pizza_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/pizza_test.dart new file mode 100644 index 000000000000..7e0b87b9ab5a --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/pizza_test.dart @@ -0,0 +1,45 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Pizza +void main() { + //final instance = PizzaBuilder(); + // TODO add properties to the builder and call build() + + 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/client/echo_api/dart/dart-http-built_value/test/query_api_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/query_api_test.dart new file mode 100644 index 000000000000..960e3b243e74 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/query_api_test.dart @@ -0,0 +1,36 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for QueryApi +void main() { + final instance = Openapi().getQueryApi(); + + group(QueryApi, () { + // Test query parameter(s) + // + // Test query parameter(s) + // + //Future testQueryIntegerBooleanString({ int integerQuery, bool booleanQuery, String stringQuery }) async + test('test testQueryIntegerBooleanString', () async { + // TODO + }); + + // Test query parameter(s) + // + // Test query parameter(s) + // + //Future testQueryStyleFormExplodeTrueArrayString({ TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject }) async + test('test testQueryStyleFormExplodeTrueArrayString', () async { + // TODO + }); + + // Test query parameter(s) + // + // Test query parameter(s) + // + //Future testQueryStyleFormExplodeTrueObject({ Pet queryObject }) async + test('test testQueryStyleFormExplodeTrueObject', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/read_only_first_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/read_only_first_test.dart new file mode 100644 index 000000000000..f4652322f2c7 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/read_only_first_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ReadOnlyFirst +void main() { + final instance = ReadOnlyFirstBuilder(); + // TODO add properties to the builder and call build() + + group(ReadOnlyFirst, () { + // String bar + test('to test the property `bar`', () async { + // TODO + }); + + // String baz + test('to test the property `baz`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/single_ref_type_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/single_ref_type_test.dart new file mode 100644 index 000000000000..2c265f0d24ae --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/single_ref_type_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for SingleRefType +void main() { + group(SingleRefType, () {}); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/special_model_name_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/special_model_name_test.dart new file mode 100644 index 000000000000..f81e03f7188d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/special_model_name_test.dart @@ -0,0 +1,17 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for SpecialModelName +void main() { + final instance = SpecialModelNameBuilder(); + // TODO add properties to the builder and call build() + + group(SpecialModelName, () { + // int dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket + test( + 'to test the property `dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket`', + () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/tag_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/tag_test.dart new file mode 100644 index 000000000000..253a283fc867 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/tag_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Tag +void main() { + final instance = TagBuilder(); + // TODO add properties to the builder and call build() + + group(Tag, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/test_query_style_form_explode_true_array_string_query_object_parameter_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/test_query_style_form_explode_true_array_string_query_object_parameter_test.dart new file mode 100644 index 000000000000..e15b28ac90c2 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/test_query_style_form_explode_true_array_string_query_object_parameter_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter +void main() { + final instance = + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterBuilder(); + // TODO add properties to the builder and call build() + + group(TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, () { + // BuiltList values + test('to test the property `values`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-built_value/test/user_test.dart b/samples/client/echo_api/dart/dart-http-built_value/test/user_test.dart new file mode 100644 index 000000000000..40bef6e6d21c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-built_value/test/user_test.dart @@ -0,0 +1,51 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for User +void main() { + final instance = UserBuilder(); + // TODO add properties to the builder and call build() + + group(User, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String username + test('to test the property `username`', () async { + // TODO + }); + + // String firstName + test('to test the property `firstName`', () async { + // TODO + }); + + // String lastName + test('to test the property `lastName`', () async { + // TODO + }); + + // String email + test('to test the property `email`', () async { + // TODO + }); + + // String password + test('to test the property `password`', () async { + // TODO + }); + + // String phone + test('to test the property `phone`', () async { + // TODO + }); + + // User Status + // int userStatus + test('to test the property `userStatus`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/.gitignore b/samples/client/echo_api/dart/dart-http-json_serializable/.gitignore new file mode 100644 index 000000000000..4298cdcbd1a2 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/.gitignore @@ -0,0 +1,41 @@ +# See https://dart.dev/guides/libraries/private-files + +# Files and directories created by pub +.dart_tool/ +.buildlog +.packages +.project +.pub/ +build/ +**/packages/ + +# Files created by dart2js +# (Most Dart developers will use pub build to compile Dart, use/modify these +# rules if you intend to use dart2js directly +# Convention is to use extension '.dart.js' for Dart compiled to Javascript to +# differentiate from explicit Javascript files) +*.dart.js +*.part.js +*.js.deps +*.js.map +*.info.json + +# Directory created by dartdoc +doc/api/ + +# Don't commit pubspec lock file +# (Library packages only! Remove pattern if developing an application package) +pubspec.lock + +# Don’t commit files and directories created by other development environments. +# For example, if your development environment creates any of the following files, +# consider putting them in a global ignore file: + +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ + +# Mac +.DS_Store diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/.openapi-generator-ignore b/samples/client/echo_api/dart/dart-http-json_serializable/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/.openapi-generator/FILES b/samples/client/echo_api/dart/dart-http-json_serializable/.openapi-generator/FILES new file mode 100644 index 000000000000..d866d909b67d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/.openapi-generator/FILES @@ -0,0 +1,157 @@ +.gitignore +README.md +analysis_options.yaml +build.yaml +doc/AdditionalPropertiesClass.md +doc/Addressable.md +doc/AllOfWithSingleRef.md +doc/Animal.md +doc/ApiResponse.md +doc/Apple.md +doc/ArrayOfArrayOfNumberOnly.md +doc/ArrayOfNumberOnly.md +doc/ArrayTest.md +doc/Banana.md +doc/Bar.md +doc/BarCreate.md +doc/BarRef.md +doc/BarRefOrValue.md +doc/BodyApi.md +doc/Capitalization.md +doc/Cat.md +doc/CatAllOf.md +doc/Category.md +doc/Child.md +doc/ClassModel.md +doc/DeprecatedObject.md +doc/Dog.md +doc/DogAllOf.md +doc/Entity.md +doc/EntityRef.md +doc/EnumArrays.md +doc/EnumTest.md +doc/Example.md +doc/ExampleNonPrimitive.md +doc/Extensible.md +doc/FileSchemaTestClass.md +doc/Foo.md +doc/FooRef.md +doc/FooRefOrValue.md +doc/FormatTest.md +doc/Fruit.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/Pasta.md +doc/PathApi.md +doc/Pet.md +doc/Pizza.md +doc/PizzaSpeziale.md +doc/QueryApi.md +doc/ReadOnlyFirst.md +doc/SingleRefType.md +doc/SpecialModelName.md +doc/Tag.md +doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md +doc/User.md +lib/openapi.dart +lib/src/api.dart +lib/src/api/_exports.dart +lib/src/api/body_api.dart +lib/src/api/path_api.dart +lib/src/api/query_api.dart +lib/src/api_util.dart +lib/src/auth/_exports.dart +lib/src/auth/api_key_auth.dart +lib/src/auth/auth.dart +lib/src/auth/basic_auth.dart +lib/src/auth/bearer_auth.dart +lib/src/auth/oauth.dart +lib/src/deserialize.dart +lib/src/model/_exports.dart +lib/src/model/additional_properties_class.dart +lib/src/model/addressable.dart +lib/src/model/all_of_with_single_ref.dart +lib/src/model/animal.dart +lib/src/model/api_response.dart +lib/src/model/apple.dart +lib/src/model/array_of_array_of_number_only.dart +lib/src/model/array_of_number_only.dart +lib/src/model/array_test.dart +lib/src/model/banana.dart +lib/src/model/bar.dart +lib/src/model/bar_create.dart +lib/src/model/bar_ref.dart +lib/src/model/bar_ref_or_value.dart +lib/src/model/capitalization.dart +lib/src/model/cat.dart +lib/src/model/cat_all_of.dart +lib/src/model/category.dart +lib/src/model/child.dart +lib/src/model/class_model.dart +lib/src/model/deprecated_object.dart +lib/src/model/dog.dart +lib/src/model/dog_all_of.dart +lib/src/model/entity.dart +lib/src/model/entity_ref.dart +lib/src/model/enum_arrays.dart +lib/src/model/enum_test.dart +lib/src/model/example.dart +lib/src/model/example_non_primitive.dart +lib/src/model/extensible.dart +lib/src/model/file_schema_test_class.dart +lib/src/model/foo.dart +lib/src/model/foo_ref.dart +lib/src/model/foo_ref_or_value.dart +lib/src/model/format_test.dart +lib/src/model/fruit.dart +lib/src/model/has_only_read_only.dart +lib/src/model/health_check_result.dart +lib/src/model/map_test.dart +lib/src/model/mixed_properties_and_additional_properties_class.dart +lib/src/model/model200_response.dart +lib/src/model/model_client.dart +lib/src/model/model_enum_class.dart +lib/src/model/model_file.dart +lib/src/model/model_list.dart +lib/src/model/model_return.dart +lib/src/model/name.dart +lib/src/model/nullable_class.dart +lib/src/model/number_only.dart +lib/src/model/object_with_deprecated_fields.dart +lib/src/model/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/pasta.dart +lib/src/model/pet.dart +lib/src/model/pizza.dart +lib/src/model/pizza_speziale.dart +lib/src/model/read_only_first.dart +lib/src/model/single_ref_type.dart +lib/src/model/special_model_name.dart +lib/src/model/tag.dart +lib/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart +lib/src/model/user.dart +pubspec.yaml diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/.openapi-generator/VERSION b/samples/client/echo_api/dart/dart-http-json_serializable/.openapi-generator/VERSION new file mode 100644 index 000000000000..d6b4ec4aa783 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/README.md b/samples/client/echo_api/dart/dart-http-json_serializable/README.md new file mode 100644 index 000000000000..83dce6ed3339 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/README.md @@ -0,0 +1,153 @@ +# openapi +Echo Server API + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 0.1.0 +- Build package: org.openapitools.codegen.languages.DartDioClientCodegen + +## Requirements + +* Dart 2.12.0 or later OR Flutter 1.26.0 or later +* http 0.13.5+ + +## 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().getBodyApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store + +try { + final response = await api.testEchoBodyPet(pet); + print(response); +} catch on DioError (e) { + print("Exception when calling BodyApi->testEchoBodyPet: $e\n"); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:3000* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +[*BodyApi*](doc/BodyApi.md) | [**testEchoBodyPet**](doc/BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s) +[*PathApi*](doc/PathApi.md) | [**testsPathStringPathStringIntegerPathInteger**](doc/PathApi.md#testspathstringpathstringintegerpathinteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) +[*QueryApi*](doc/QueryApi.md) | [**testQueryIntegerBooleanString**](doc/QueryApi.md#testqueryintegerbooleanstring) | **GET** /query/integer/boolean/string | Test query parameter(s) +[*QueryApi*](doc/QueryApi.md) | [**testQueryStyleFormExplodeTrueArrayString**](doc/QueryApi.md#testquerystyleformexplodetruearraystring) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) +[*QueryApi*](doc/QueryApi.md) | [**testQueryStyleFormExplodeTrueObject**](doc/QueryApi.md#testquerystyleformexplodetrueobject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) + + +## Documentation For Models + + - [AdditionalPropertiesClass](doc/AdditionalPropertiesClass.md) + - [Addressable](doc/Addressable.md) + - [AllOfWithSingleRef](doc/AllOfWithSingleRef.md) + - [Animal](doc/Animal.md) + - [ApiResponse](doc/ApiResponse.md) + - [Apple](doc/Apple.md) + - [ArrayOfArrayOfNumberOnly](doc/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](doc/ArrayOfNumberOnly.md) + - [ArrayTest](doc/ArrayTest.md) + - [Banana](doc/Banana.md) + - [Bar](doc/Bar.md) + - [BarCreate](doc/BarCreate.md) + - [BarRef](doc/BarRef.md) + - [BarRefOrValue](doc/BarRefOrValue.md) + - [Capitalization](doc/Capitalization.md) + - [Cat](doc/Cat.md) + - [CatAllOf](doc/CatAllOf.md) + - [Category](doc/Category.md) + - [Child](doc/Child.md) + - [ClassModel](doc/ClassModel.md) + - [DeprecatedObject](doc/DeprecatedObject.md) + - [Dog](doc/Dog.md) + - [DogAllOf](doc/DogAllOf.md) + - [Entity](doc/Entity.md) + - [EntityRef](doc/EntityRef.md) + - [EnumArrays](doc/EnumArrays.md) + - [EnumTest](doc/EnumTest.md) + - [Example](doc/Example.md) + - [ExampleNonPrimitive](doc/ExampleNonPrimitive.md) + - [Extensible](doc/Extensible.md) + - [FileSchemaTestClass](doc/FileSchemaTestClass.md) + - [Foo](doc/Foo.md) + - [FooRef](doc/FooRef.md) + - [FooRefOrValue](doc/FooRefOrValue.md) + - [FormatTest](doc/FormatTest.md) + - [Fruit](doc/Fruit.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) + - [Pasta](doc/Pasta.md) + - [Pet](doc/Pet.md) + - [Pizza](doc/Pizza.md) + - [PizzaSpeziale](doc/PizzaSpeziale.md) + - [ReadOnlyFirst](doc/ReadOnlyFirst.md) + - [SingleRefType](doc/SingleRefType.md) + - [SpecialModelName](doc/SpecialModelName.md) + - [Tag](doc/Tag.md) + - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) + - [User](doc/User.md) + + +## Documentation For Authorization + + All endpoints do not require authorization. + + +## Author + +team@openapitools.org + diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/analysis_options.yaml b/samples/client/echo_api/dart/dart-http-json_serializable/analysis_options.yaml new file mode 100644 index 000000000000..28be8936a4bd --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/analysis_options.yaml @@ -0,0 +1,10 @@ +analyzer: + language: + strict-inference: true + strict-raw-types: true + strong-mode: + implicit-dynamic: false + implicit-casts: false + exclude: + - test/*.dart + - lib/src/model/*.g.dart diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/build.yaml b/samples/client/echo_api/dart/dart-http-json_serializable/build.yaml new file mode 100644 index 000000000000..89a4dd6e1c2e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/build.yaml @@ -0,0 +1,18 @@ +targets: + $default: + builders: + json_serializable: + options: + # Options configure how source code is generated for every + # `@JsonSerializable`-annotated class in the package. + # + # The default value for each is listed. + any_map: false + checked: true + create_factory: true + create_to_json: true + disallow_unrecognized_keys: true + explicit_to_json: true + field_rename: none + ignore_unannotated: false + include_if_null: false diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/doc/AdditionalPropertiesClass.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..863b8503db83 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/Addressable.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Addressable.md new file mode 100644 index 000000000000..0fcd81b80382 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/AllOfWithSingleRef.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/AllOfWithSingleRef.md new file mode 100644 index 000000000000..4c6f3ab2fe11 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/Animal.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Animal.md new file mode 100644 index 000000000000..415b56e9bc2e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/ApiResponse.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/ApiResponse.md new file mode 100644 index 000000000000..7ad5da0f89e4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/Apple.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Apple.md new file mode 100644 index 000000000000..c7f711b87cef --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/ArrayOfArrayOfNumberOnly.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..e5b9d669a436 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/ArrayOfNumberOnly.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..fe8e071eb45c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/ArrayTest.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/ArrayTest.md new file mode 100644 index 000000000000..8ae11de10022 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/Banana.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Banana.md new file mode 100644 index 000000000000..bef8a58a4276 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/Bar.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Bar.md new file mode 100644 index 000000000000..4cccc863a489 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/BarCreate.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/BarCreate.md new file mode 100644 index 000000000000..c0b4ba6edc9a --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/BarRef.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/BarRef.md new file mode 100644 index 000000000000..949695f4d36f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/doc/BarRef.md @@ -0,0 +1,19 @@ +# openapi.model.BarRef + +## 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/client/echo_api/dart/dart-http-json_serializable/doc/BarRefOrValue.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/BarRefOrValue.md new file mode 100644 index 000000000000..9dafa2d6b220 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/doc/BarRefOrValue.md @@ -0,0 +1,19 @@ +# openapi.model.BarRefOrValue + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible name | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/doc/BodyApi.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/BodyApi.md new file mode 100644 index 000000000000..145854fc8d28 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/doc/BodyApi.md @@ -0,0 +1,57 @@ +# openapi.api.BodyApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testEchoBodyPet**](BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s) + + +# **testEchoBodyPet** +> Pet testEchoBodyPet(pet) + +Test body parameter(s) + +Test body parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getBodyApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store + +try { + final response = api.testEchoBodyPet(pet); + print(response); +} catch on DioError (e) { + print('Exception when calling BodyApi->testEchoBodyPet: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/doc/Capitalization.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Capitalization.md new file mode 100644 index 000000000000..4a07b4eb820d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/Cat.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Cat.md new file mode 100644 index 000000000000..6552eea4b435 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/CatAllOf.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/CatAllOf.md new file mode 100644 index 000000000000..36b2ae0e8ab3 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/doc/CatAllOf.md @@ -0,0 +1,15 @@ +# openapi.model.CatAllOf + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/doc/Category.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Category.md new file mode 100644 index 000000000000..98d0b14be7b1 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/doc/Child.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Child.md new file mode 100644 index 000000000000..bed0f2feec12 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/ClassModel.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/ClassModel.md new file mode 100644 index 000000000000..9b80d4f71eea --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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 +------------ | ------------- | ------------- | ------------- +**classField** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/doc/DeprecatedObject.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/DeprecatedObject.md new file mode 100644 index 000000000000..bf2ef67a26fc --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/Dog.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Dog.md new file mode 100644 index 000000000000..d36439b767bb --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/DogAllOf.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/DogAllOf.md new file mode 100644 index 000000000000..97a7c8fba492 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/doc/DogAllOf.md @@ -0,0 +1,15 @@ +# openapi.model.DogAllOf + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/doc/Entity.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Entity.md new file mode 100644 index 000000000000..5ba2144b44fe --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/EntityRef.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/EntityRef.md new file mode 100644 index 000000000000..80eae55f4145 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/EnumArrays.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/EnumArrays.md new file mode 100644 index 000000000000..1d4fd1363b59 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/EnumTest.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/EnumTest.md new file mode 100644 index 000000000000..7c24fe2347b4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/Example.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Example.md new file mode 100644 index 000000000000..bf49bb137a60 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/ExampleNonPrimitive.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/ExampleNonPrimitive.md new file mode 100644 index 000000000000..2b63a98c6ad9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/doc/ExampleNonPrimitive.md @@ -0,0 +1,14 @@ +# openapi.model.ExampleNonPrimitive + +## 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/client/echo_api/dart/dart-http-json_serializable/doc/Extensible.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Extensible.md new file mode 100644 index 000000000000..7a781e578ea4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/FileSchemaTestClass.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/FileSchemaTestClass.md new file mode 100644 index 000000000000..d14ac319d294 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/Foo.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Foo.md new file mode 100644 index 000000000000..2627691fefe5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/FooRef.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/FooRef.md new file mode 100644 index 000000000000..68104b227292 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/doc/FooRef.md @@ -0,0 +1,20 @@ +# openapi.model.FooRef + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foorefPropA** | **String** | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible name | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/doc/FooRefOrValue.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/FooRefOrValue.md new file mode 100644 index 000000000000..35e9fd114e1d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/doc/FooRefOrValue.md @@ -0,0 +1,19 @@ +# openapi.model.FooRefOrValue + +## 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/client/echo_api/dart/dart-http-json_serializable/doc/FormatTest.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/FormatTest.md new file mode 100644 index 000000000000..83b60545eb61 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/Fruit.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Fruit.md new file mode 100644 index 000000000000..5d48cc6e6d38 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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 +------------ | ------------- | ------------- | ------------- +**color** | **String** | | [optional] +**kind** | **String** | | [optional] +**count** | **num** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/doc/HasOnlyReadOnly.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/HasOnlyReadOnly.md new file mode 100644 index 000000000000..32cae937155d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/HealthCheckResult.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/HealthCheckResult.md new file mode 100644 index 000000000000..4d6aeb75d965 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/MapTest.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/MapTest.md new file mode 100644 index 000000000000..197fe780a25a --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..66d0d39c42be --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/Model200Response.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Model200Response.md new file mode 100644 index 000000000000..e8b088ca1afa --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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] +**classField** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/doc/ModelClient.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/ModelClient.md new file mode 100644 index 000000000000..f7b922f4a398 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/ModelEnumClass.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/ModelEnumClass.md new file mode 100644 index 000000000000..ebaafb44c7f7 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/ModelFile.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/ModelFile.md new file mode 100644 index 000000000000..4be260e93f6e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/ModelList.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/ModelList.md new file mode 100644 index 000000000000..283aa1f6b711 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/ModelReturn.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/ModelReturn.md new file mode 100644 index 000000000000..bc02df7a3692 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/Name.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Name.md new file mode 100644 index 000000000000..25f49ea946b4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/NullableClass.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/NullableClass.md new file mode 100644 index 000000000000..70ac1091d417 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/NumberOnly.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/NumberOnly.md new file mode 100644 index 000000000000..d8096a3db37a --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/ObjectWithDeprecatedFields.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..e0fa7b908d10 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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<Bar>**](Bar.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/doc/Order.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Order.md new file mode 100644 index 000000000000..bde5ffe51a2c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/OuterComposite.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/OuterComposite.md new file mode 100644 index 000000000000..04bab7eff5d1 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/OuterEnum.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/OuterEnum.md new file mode 100644 index 000000000000..af62ad87ab2e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/OuterEnumDefaultValue.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..c1bf8b0dec44 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/OuterEnumInteger.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/OuterEnumInteger.md new file mode 100644 index 000000000000..8c80a9e5c85f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/OuterEnumIntegerDefaultValue.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..eb8b55d70249 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/OuterObjectWithEnumProperty.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/OuterObjectWithEnumProperty.md new file mode 100644 index 000000000000..eab2ae8f66b4 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/Pasta.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Pasta.md new file mode 100644 index 000000000000..034ff420d323 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/PathApi.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/PathApi.md new file mode 100644 index 000000000000..ae663a2f7f04 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/doc/PathApi.md @@ -0,0 +1,59 @@ +# openapi.api.PathApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testsPathStringPathStringIntegerPathInteger**](PathApi.md#testspathstringpathstringintegerpathinteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) + + +# **testsPathStringPathStringIntegerPathInteger** +> String testsPathStringPathStringIntegerPathInteger(pathString, pathInteger) + +Test path parameter(s) + +Test path parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getPathApi(); +final String pathString = pathString_example; // String | +final int pathInteger = 56; // int | + +try { + final response = api.testsPathStringPathStringIntegerPathInteger(pathString, pathInteger); + print(response); +} catch on DioError (e) { + print('Exception when calling PathApi->testsPathStringPathStringIntegerPathInteger: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pathString** | **String**| | + **pathInteger** | **int**| | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/doc/Pet.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Pet.md new file mode 100644 index 000000000000..80414658dc87 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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] +**name** | **String** | | +**category** | [**Category**](Category.md) | | [optional] +**photoUrls** | **List<String>** | | +**tags** | [**List<Tag>**](Tag.md) | | [optional] +**status** | **String** | pet status in the store | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/doc/Pizza.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Pizza.md new file mode 100644 index 000000000000..e4b040a6a79c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/PizzaSpeziale.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/PizzaSpeziale.md new file mode 100644 index 000000000000..e1d8434c077d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/doc/PizzaSpeziale.md @@ -0,0 +1,20 @@ +# openapi.model.PizzaSpeziale + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**toppings** | **String** | | [optional] +**href** | **String** | Hyperlink reference | [optional] +**id** | **String** | unique identifier | [optional] +**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] +**atType** | **String** | When sub-classing, this defines the sub-class Extensible name | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/doc/QueryApi.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/QueryApi.md new file mode 100644 index 000000000000..f92f9532a113 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/doc/QueryApi.md @@ -0,0 +1,149 @@ +# openapi.api.QueryApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testQueryIntegerBooleanString**](QueryApi.md#testqueryintegerbooleanstring) | **GET** /query/integer/boolean/string | Test query parameter(s) +[**testQueryStyleFormExplodeTrueArrayString**](QueryApi.md#testquerystyleformexplodetruearraystring) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) +[**testQueryStyleFormExplodeTrueObject**](QueryApi.md#testquerystyleformexplodetrueobject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) + + +# **testQueryIntegerBooleanString** +> String testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getQueryApi(); +final int integerQuery = 56; // int | +final bool booleanQuery = true; // bool | +final String stringQuery = stringQuery_example; // String | + +try { + final response = api.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery); + print(response); +} catch on DioError (e) { + print('Exception when calling QueryApi->testQueryIntegerBooleanString: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integerQuery** | **int**| | [optional] + **booleanQuery** | **bool**| | [optional] + **stringQuery** | **String**| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testQueryStyleFormExplodeTrueArrayString** +> String testQueryStyleFormExplodeTrueArrayString(queryObject) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getQueryApi(); +final TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject = ; // TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter | + +try { + final response = api.testQueryStyleFormExplodeTrueArrayString(queryObject); + print(response); +} catch on DioError (e) { + print('Exception when calling QueryApi->testQueryStyleFormExplodeTrueArrayString: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](.md)| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testQueryStyleFormExplodeTrueObject** +> String testQueryStyleFormExplodeTrueObject(queryObject) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getQueryApi(); +final Pet queryObject = ; // Pet | + +try { + final response = api.testQueryStyleFormExplodeTrueObject(queryObject); + print(response); +} catch on DioError (e) { + print('Exception when calling QueryApi->testQueryStyleFormExplodeTrueObject: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | [**Pet**](.md)| | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/doc/ReadOnlyFirst.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/ReadOnlyFirst.md new file mode 100644 index 000000000000..8f612e8ba19f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/SingleRefType.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/SingleRefType.md new file mode 100644 index 000000000000..0dc93840cd7f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/SpecialModelName.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/SpecialModelName.md new file mode 100644 index 000000000000..5fcfa98e0b36 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/Tag.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/Tag.md new file mode 100644 index 000000000000..c219f987c19c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md new file mode 100644 index 000000000000..8e5541bd1f04 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/doc/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md @@ -0,0 +1,15 @@ +# openapi.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**values** | **List<String>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/doc/User.md b/samples/client/echo_api/dart/dart-http-json_serializable/doc/User.md new file mode 100644 index 000000000000..fa87e64d8595 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/lib/openapi.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/openapi.dart new file mode 100644 index 000000000000..dfc13b14b46d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/openapi.dart @@ -0,0 +1,9 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +export 'package:openapi/src/api.dart'; +export 'package:openapi/src/auth/_exports.dart'; + +export 'package:openapi/src/api/_exports.dart'; +export 'package:openapi/src/model/_exports.dart'; diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/api.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/api.dart new file mode 100644 index 000000000000..084a1ba51364 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/api.dart @@ -0,0 +1,39 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:http/http.dart' as http; +import 'package:openapi/src/auth/_exports.dart'; +import 'package:openapi/src/api/body_api.dart'; +import 'package:openapi/src/api/path_api.dart'; +import 'package:openapi/src/api/query_api.dart'; + +class Openapi { + static const String basePath = r'http://localhost:3000'; + + final http.Client client; + final String actualBasePath; + Openapi({ + http.Client? client, + String? basePathOverride, + }) : this.client = client ?? http.Client(), + this.actualBasePath = basePathOverride ?? basePath; + + /// Get BodyApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + BodyApi getBodyApi() { + return BodyApi(client, actualBasePath); + } + + /// Get PathApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + PathApi getPathApi() { + return PathApi(client, actualBasePath); + } + + /// Get QueryApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + QueryApi getQueryApi() { + return QueryApi(client, actualBasePath); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/api/_exports.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/api/_exports.dart new file mode 100644 index 000000000000..f06d548e0d23 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/api/_exports.dart @@ -0,0 +1,3 @@ +export 'body_api.dart'; +export 'path_api.dart'; +export 'query_api.dart'; diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/api/body_api.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/api/body_api.dart new file mode 100644 index 000000000000..5f18910ad38f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/api/body_api.dart @@ -0,0 +1,98 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +//ignore: unused_import +import 'package:http/http.dart'; +import 'dart:convert'; +import 'package:openapi/src/deserialize.dart'; + +import 'package:openapi/src/model/pet.dart'; + +class BodyApi { + final Client _client; + final String _basePath; + + const BodyApi(this._client, this._basePath); + + /// Test body parameter(s) + /// Test body parameter(s) + /// + /// 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 + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// + /// Throws [DioError] if API call or serialization fails + + Future testEchoBodyPet({ + Pet? pet, + Map? headers, + }) async { + final _path = r'/echo/body/Pet'; + final _uri = Uri.parse(_basePath + _path); + + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + _bodyData = jsonEncode(pet); + } catch (error, stackTrace) { + throw DioError( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioErrorType.other, + error: error, + )..stackTrace = stackTrace; + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Pet _responseData; + + try { + _responseData = + deserialize(_response.data!, 'Pet', growable: true); + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + 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/client/echo_api/dart/dart-http-json_serializable/lib/src/api/path_api.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/api/path_api.dart new file mode 100644 index 000000000000..a4f06def2bd7 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/api/path_api.dart @@ -0,0 +1,83 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +//ignore: unused_import +import 'package:http/http.dart'; +import 'dart:convert'; +import 'package:openapi/src/deserialize.dart'; + +class PathApi { + final Client _client; + final String _basePath; + + const PathApi(this._client, this._basePath); + + /// Test path parameter(s) + /// Test path parameter(s) + /// + /// Parameters: + /// * [pathString] + /// * [pathInteger] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// + /// Throws [DioError] if API call or serialization fails + + Future testsPathStringPathStringIntegerPathInteger({ + required String pathString, + required int pathInteger, + Map? headers, + }) async { + final _path = r'/path/string/{path_string}/integer/{path_integer}' + .replaceAll('{' r'path_string' '}', pathString.toString()) + .replaceAll('{' r'path_integer' '}', pathInteger.toString()); + final _uri = Uri.parse(_basePath + _path); + + 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, + ); + + String _responseData; + + try { + _responseData = deserialize(_response.data!, 'String', + growable: true); + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + 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/client/echo_api/dart/dart-http-json_serializable/lib/src/api/query_api.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/api/query_api.dart new file mode 100644 index 000000000000..73e6529cc133 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/api/query_api.dart @@ -0,0 +1,231 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +//ignore: unused_import +import 'package:http/http.dart'; +import 'dart:convert'; +import 'package:openapi/src/deserialize.dart'; + +import 'package:openapi/src/model/pet.dart'; +import 'package:openapi/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart'; + +class QueryApi { + final Client _client; + final String _basePath; + + const QueryApi(this._client, this._basePath); + + /// Test query parameter(s) + /// Test query parameter(s) + /// + /// Parameters: + /// * [integerQuery] + /// * [booleanQuery] + /// * [stringQuery] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// + /// Throws [DioError] if API call or serialization fails + + Future testQueryIntegerBooleanString({ + int? integerQuery, + bool? booleanQuery, + String? stringQuery, + Map? headers, + }) async { + final _path = r'/query/integer/boolean/string'; + final _uri = Uri.parse(_basePath + _path); + + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (integerQuery != null) r'integer_query': integerQuery, + if (booleanQuery != null) r'boolean_query': booleanQuery, + if (stringQuery != null) r'string_query': stringQuery, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + String _responseData; + + try { + _responseData = deserialize(_response.data!, 'String', + growable: true); + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + 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 query parameter(s) + /// Test query parameter(s) + /// + /// Parameters: + /// * [queryObject] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// + /// Throws [DioError] if API call or serialization fails + + Future testQueryStyleFormExplodeTrueArrayString({ + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? queryObject, + Map? headers, + }) async { + final _path = r'/query/style_form/explode_true/array_string'; + final _uri = Uri.parse(_basePath + _path); + + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (queryObject != null) r'query_object': queryObject, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + String _responseData; + + try { + _responseData = deserialize(_response.data!, 'String', + growable: true); + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + 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 query parameter(s) + /// Test query parameter(s) + /// + /// Parameters: + /// * [queryObject] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// + /// Throws [DioError] if API call or serialization fails + + Future testQueryStyleFormExplodeTrueObject({ + Pet? queryObject, + Map? headers, + }) async { + final _path = r'/query/style_form/explode_true/object'; + final _uri = Uri.parse(_basePath + _path); + + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (queryObject != null) r'query_object': queryObject, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + String _responseData; + + try { + _responseData = deserialize(_response.data!, 'String', + growable: true); + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.other, + 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/client/echo_api/dart/dart-http-json_serializable/lib/src/api_util.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/api_util.dart new file mode 100644 index 000000000000..2ff0d4b96f15 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/api_util.dart @@ -0,0 +1,66 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:convert'; +import 'package:http/http.dart'; +import 'package:intl/intl.dart'; + +const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; +const _dateEpochMarker = 'epoch'; +final _dateFormatter = DateFormat('yyyy-MM-dd'); +final _regList = RegExp(r'^List<(.*)>$'); +final _regSet = RegExp(r'^Set<(.*)>$'); +final _regMap = RegExp(r'^Map$'); + +class QueryParam { + const QueryParam(this.name, this.value); + + final String name; + final String value; + + @override + String toString() => + '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value)}'; +} + +/* +// Ported from the Java version. +Iterable _queryParams(String collectionFormat, String name, dynamic value,) { + // Assertions to run in debug mode only. + assert(name.isNotEmpty, 'Parameter cannot be an empty string.'); + + final params = []; + + if (value is List) { + if (collectionFormat == 'multi') { + return value.map((dynamic v) => QueryParam(name, parameterToString(v)),); + } + + // Default collection format is 'csv'. + if (collectionFormat.isEmpty) { + collectionFormat = 'csv'; // ignore: parameter_assignments + } + + final delimiter = _delimiters[collectionFormat] ?? ','; + + params.add(QueryParam(name, value.map(parameterToString).join(delimiter),)); + } else if (value != null) { + params.add(QueryParam(name, parameterToString(value))); + } + + return params; +} +*/ + +/// Returns the decoded body as UTF-8 if the given headers indicate an 'application/json' +/// content type. Otherwise, returns the decoded body as decoded by dart:http package. +Future decodeBodyBytes(Response response) async { + final contentType = response.headers['content-type']; + return contentType != null && + contentType.toLowerCase().startsWith('application/json') + ? response.bodyBytes.isEmpty + ? '' + : utf8.decode(response.bodyBytes) + : response.body; +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/auth/_exports.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/auth/_exports.dart new file mode 100644 index 000000000000..01c9ad2dfa7e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/auth/_exports.dart @@ -0,0 +1,9 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +export 'api_key_auth.dart'; +export 'auth.dart'; +export 'basic_auth.dart'; +export 'bearer_auth.dart'; +export 'oauth.dart'; diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/auth/api_key_auth.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/auth/api_key_auth.dart new file mode 100644 index 000000000000..396c364ce26b --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/auth/api_key_auth.dart @@ -0,0 +1,40 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:openapi/src/api_util.dart'; +import 'dart:convert'; + +import 'auth.dart'; + +class ApiKeyAuth implements Authentication { + ApiKeyAuth(this.location, this.paramName); + + final String location; + final String paramName; + + String apiKeyPrefix = ''; + String apiKey = ''; + + @override + Future applyToParams( + List queryParams, + Map headerParams, + ) async { + final paramValue = apiKeyPrefix.isEmpty ? apiKey : '$apiKeyPrefix $apiKey'; + + if (paramValue.isNotEmpty) { + if (location == 'query') { + queryParams.add(QueryParam(paramName, paramValue)); + } else if (location == 'header') { + headerParams[paramName] = paramValue; + } else if (location == 'cookie') { + headerParams.update( + 'Cookie', + (existingCookie) => '$existingCookie; $paramName=$paramValue', + ifAbsent: () => '$paramName=$paramValue', + ); + } + } + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/auth/auth.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/auth/auth.dart new file mode 100644 index 000000000000..88550b41a798 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/auth/auth.dart @@ -0,0 +1,13 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:openapi/src/api_util.dart'; +import 'dart:convert'; + +// ignore: one_member_abstracts +abstract class Authentication { + /// Apply authentication settings to header and query params. + Future applyToParams( + List queryParams, Map headerParams); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/auth/basic_auth.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/auth/basic_auth.dart new file mode 100644 index 000000000000..d80e4cd88cc6 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/auth/basic_auth.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:openapi/src/api_util.dart'; +import 'dart:convert'; + +import 'auth.dart'; + +class HttpBasicAuth implements Authentication { + HttpBasicAuth({this.username = '', this.password = ''}); + + String username; + String password; + + @override + Future applyToParams( + List queryParams, + Map headerParams, + ) async { + if (username.isNotEmpty && password.isNotEmpty) { + final credentials = '$username:$password'; + headerParams['Authorization'] = + 'Basic ${base64.encode(utf8.encode(credentials))}'; + } + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/auth/bearer_auth.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/auth/bearer_auth.dart new file mode 100644 index 000000000000..238136cd86bc --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/auth/bearer_auth.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:openapi/src/api_util.dart'; +import 'dart:convert'; + +import 'auth.dart'; + +typedef HttpBearerAuthProvider = String? Function(); + +class HttpBearerAuth implements Authentication { + HttpBearerAuth(); + + HttpBearerAuthProvider? accessTokenProvider; + + @override + Future applyToParams( + List queryParams, + Map headerParams, + ) async { + final provider = accessTokenProvider; + if (provider == null) { + return; + } + + final accessToken = provider(); + if (accessToken != null && accessToken.isNotEmpty) { + headerParams['Authorization'] = 'Bearer $accessToken'; + } + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/auth/oauth.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/auth/oauth.dart new file mode 100644 index 000000000000..02d848a3c53f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/auth/oauth.dart @@ -0,0 +1,24 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:openapi/src/api_util.dart'; +import 'dart:convert'; + +import 'auth.dart'; + +class OAuth implements Authentication { + OAuth({this.accessToken = ''}); + + String accessToken; + + @override + Future applyToParams( + List queryParams, + Map headerParams, + ) async { + if (accessToken.isNotEmpty) { + headerParams['Authorization'] = 'Bearer $accessToken'; + } + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/deserialize.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/deserialize.dart new file mode 100644 index 000000000000..929f58eb4909 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/deserialize.dart @@ -0,0 +1,269 @@ +import 'package:openapi/src/model/additional_properties_class.dart'; +import 'package:openapi/src/model/addressable.dart'; +import 'package:openapi/src/model/all_of_with_single_ref.dart'; +import 'package:openapi/src/model/animal.dart'; +import 'package:openapi/src/model/api_response.dart'; +import 'package:openapi/src/model/apple.dart'; +import 'package:openapi/src/model/array_of_array_of_number_only.dart'; +import 'package:openapi/src/model/array_of_number_only.dart'; +import 'package:openapi/src/model/array_test.dart'; +import 'package:openapi/src/model/banana.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:openapi/src/model/bar_create.dart'; +import 'package:openapi/src/model/bar_ref.dart'; +import 'package:openapi/src/model/bar_ref_or_value.dart'; +import 'package:openapi/src/model/capitalization.dart'; +import 'package:openapi/src/model/cat.dart'; +import 'package:openapi/src/model/cat_all_of.dart'; +import 'package:openapi/src/model/category.dart'; +import 'package:openapi/src/model/child.dart'; +import 'package:openapi/src/model/class_model.dart'; +import 'package:openapi/src/model/deprecated_object.dart'; +import 'package:openapi/src/model/dog.dart'; +import 'package:openapi/src/model/dog_all_of.dart'; +import 'package:openapi/src/model/entity.dart'; +import 'package:openapi/src/model/entity_ref.dart'; +import 'package:openapi/src/model/enum_arrays.dart'; +import 'package:openapi/src/model/enum_test.dart'; +import 'package:openapi/src/model/example.dart'; +import 'package:openapi/src/model/example_non_primitive.dart'; +import 'package:openapi/src/model/extensible.dart'; +import 'package:openapi/src/model/file_schema_test_class.dart'; +import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/foo_ref.dart'; +import 'package:openapi/src/model/foo_ref_or_value.dart'; +import 'package:openapi/src/model/format_test.dart'; +import 'package:openapi/src/model/fruit.dart'; +import 'package:openapi/src/model/has_only_read_only.dart'; +import 'package:openapi/src/model/health_check_result.dart'; +import 'package:openapi/src/model/map_test.dart'; +import 'package:openapi/src/model/mixed_properties_and_additional_properties_class.dart'; +import 'package:openapi/src/model/model200_response.dart'; +import 'package:openapi/src/model/model_client.dart'; +import 'package:openapi/src/model/model_file.dart'; +import 'package:openapi/src/model/model_list.dart'; +import 'package:openapi/src/model/model_return.dart'; +import 'package:openapi/src/model/name.dart'; +import 'package:openapi/src/model/nullable_class.dart'; +import 'package:openapi/src/model/number_only.dart'; +import 'package:openapi/src/model/object_with_deprecated_fields.dart'; +import 'package:openapi/src/model/order.dart'; +import 'package:openapi/src/model/outer_composite.dart'; +import 'package:openapi/src/model/outer_object_with_enum_property.dart'; +import 'package:openapi/src/model/pasta.dart'; +import 'package:openapi/src/model/pet.dart'; +import 'package:openapi/src/model/pizza.dart'; +import 'package:openapi/src/model/pizza_speziale.dart'; +import 'package:openapi/src/model/read_only_first.dart'; +import 'package:openapi/src/model/special_model_name.dart'; +import 'package:openapi/src/model/tag.dart'; +import 'package:openapi/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart'; +import 'package:openapi/src/model/user.dart'; + +final _regList = RegExp(r'^List<(.*)>$'); +final _regSet = RegExp(r'^Set<(.*)>$'); +final _regMap = RegExp(r'^Map$'); + +ReturnType deserialize(dynamic value, String targetType, + {bool growable = true}) { + switch (targetType) { + case 'String': + return '$value' as ReturnType; + case 'int': + return (value is int ? value : int.parse('$value')) as ReturnType; + case 'bool': + if (value is bool) { + return value as ReturnType; + } + final valueString = '$value'.toLowerCase(); + return (valueString == 'true' || valueString == '1') as ReturnType; + case 'double': + return (value is double ? value : double.parse('$value')) as ReturnType; + case 'AdditionalPropertiesClass': + return AdditionalPropertiesClass.fromJson(value as Map) + as ReturnType; + case 'Addressable': + return Addressable.fromJson(value as Map) as ReturnType; + case 'AllOfWithSingleRef': + return AllOfWithSingleRef.fromJson(value as Map) + as ReturnType; + case 'Animal': + return Animal.fromJson(value as Map) as ReturnType; + case 'ApiResponse': + return ApiResponse.fromJson(value as Map) as ReturnType; + case 'Apple': + return Apple.fromJson(value as Map) as ReturnType; + case 'ArrayOfArrayOfNumberOnly': + return ArrayOfArrayOfNumberOnly.fromJson(value as Map) + as ReturnType; + case 'ArrayOfNumberOnly': + return ArrayOfNumberOnly.fromJson(value as Map) + as ReturnType; + case 'ArrayTest': + return ArrayTest.fromJson(value as Map) as ReturnType; + case 'Banana': + return Banana.fromJson(value as Map) as ReturnType; + case 'Bar': + return Bar.fromJson(value as Map) as ReturnType; + case 'BarCreate': + return BarCreate.fromJson(value as Map) as ReturnType; + case 'BarRef': + return BarRef.fromJson(value as Map) as ReturnType; + case 'BarRefOrValue': + return BarRefOrValue.fromJson(value as Map) + as ReturnType; + case 'Capitalization': + return Capitalization.fromJson(value as Map) + as ReturnType; + case 'Cat': + return Cat.fromJson(value as Map) as ReturnType; + case 'CatAllOf': + return CatAllOf.fromJson(value as Map) as ReturnType; + case 'Category': + return Category.fromJson(value as Map) as ReturnType; + case 'Child': + return Child.fromJson(value as Map) as ReturnType; + case 'ClassModel': + return ClassModel.fromJson(value as Map) as ReturnType; + case 'DeprecatedObject': + return DeprecatedObject.fromJson(value as Map) + as ReturnType; + case 'Dog': + return Dog.fromJson(value as Map) as ReturnType; + case 'DogAllOf': + return DogAllOf.fromJson(value as Map) as ReturnType; + case 'Entity': + return Entity.fromJson(value as Map) as ReturnType; + case 'EntityRef': + return EntityRef.fromJson(value as Map) as ReturnType; + case 'EnumArrays': + return EnumArrays.fromJson(value as Map) as ReturnType; + case 'EnumTest': + return EnumTest.fromJson(value as Map) as ReturnType; + case 'Example': + return Example.fromJson(value as Map) as ReturnType; + case 'ExampleNonPrimitive': + return ExampleNonPrimitive.fromJson(value as Map) + as ReturnType; + case 'Extensible': + return Extensible.fromJson(value as Map) as ReturnType; + case 'FileSchemaTestClass': + return FileSchemaTestClass.fromJson(value as Map) + as ReturnType; + case 'Foo': + return Foo.fromJson(value as Map) as ReturnType; + case 'FooRef': + return FooRef.fromJson(value as Map) as ReturnType; + case 'FooRefOrValue': + return FooRefOrValue.fromJson(value as Map) + as ReturnType; + case 'FormatTest': + return FormatTest.fromJson(value as Map) as ReturnType; + case 'Fruit': + return Fruit.fromJson(value as Map) as ReturnType; + case 'HasOnlyReadOnly': + return HasOnlyReadOnly.fromJson(value as Map) + as ReturnType; + case 'HealthCheckResult': + return HealthCheckResult.fromJson(value as Map) + as ReturnType; + case 'MapTest': + return MapTest.fromJson(value as Map) as ReturnType; + case 'MixedPropertiesAndAdditionalPropertiesClass': + return MixedPropertiesAndAdditionalPropertiesClass.fromJson( + value as Map) as ReturnType; + case 'Model200Response': + return Model200Response.fromJson(value as Map) + as ReturnType; + case 'ModelClient': + return ModelClient.fromJson(value as Map) as ReturnType; + case 'ModelEnumClass': + + case 'ModelFile': + return ModelFile.fromJson(value as Map) as ReturnType; + case 'ModelList': + return ModelList.fromJson(value as Map) as ReturnType; + case 'ModelReturn': + return ModelReturn.fromJson(value as Map) as ReturnType; + case 'Name': + return Name.fromJson(value as Map) as ReturnType; + case 'NullableClass': + return NullableClass.fromJson(value as Map) + as ReturnType; + case 'NumberOnly': + return NumberOnly.fromJson(value as Map) as ReturnType; + case 'ObjectWithDeprecatedFields': + return ObjectWithDeprecatedFields.fromJson(value as Map) + as ReturnType; + case 'Order': + return Order.fromJson(value as Map) as ReturnType; + case 'OuterComposite': + return OuterComposite.fromJson(value as Map) + as ReturnType; + case 'OuterEnum': + + case 'OuterEnumDefaultValue': + + case 'OuterEnumInteger': + + case 'OuterEnumIntegerDefaultValue': + + case 'OuterObjectWithEnumProperty': + return OuterObjectWithEnumProperty.fromJson(value as Map) + as ReturnType; + case 'Pasta': + return Pasta.fromJson(value as Map) as ReturnType; + case 'Pet': + return Pet.fromJson(value as Map) as ReturnType; + case 'Pizza': + return Pizza.fromJson(value as Map) as ReturnType; + case 'PizzaSpeziale': + return PizzaSpeziale.fromJson(value as Map) + as ReturnType; + case 'ReadOnlyFirst': + return ReadOnlyFirst.fromJson(value as Map) + as ReturnType; + case 'SingleRefType': + + case 'SpecialModelName': + return SpecialModelName.fromJson(value as Map) + as ReturnType; + case 'Tag': + return Tag.fromJson(value as Map) as ReturnType; + case 'TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter': + return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + .fromJson(value as Map) as ReturnType; + case 'User': + return User.fromJson(value as Map) as ReturnType; + default: + RegExpMatch? match; + + if (value is List && (match = _regList.firstMatch(targetType)) != null) { + targetType = match![1]!; // ignore: parameter_assignments + return value + .map((dynamic v) => deserialize( + v, targetType, + growable: growable)) + .toList(growable: growable) as ReturnType; + } + if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { + targetType = match![1]!; // ignore: parameter_assignments + return value + .map((dynamic v) => deserialize( + v, targetType, + growable: growable)) + .toSet() as ReturnType; + } + if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { + targetType = match![1]!; // ignore: parameter_assignments + return Map.fromIterables( + value.keys, + value.values.map((dynamic v) => deserialize( + v, targetType, + growable: growable)), + ) as ReturnType; + } + break; + } + throw Exception('Cannot deserialize'); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/_exports.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/_exports.dart new file mode 100644 index 000000000000..43ed998d2fd8 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/_exports.dart @@ -0,0 +1,67 @@ +export 'additional_properties_class.dart'; +export 'addressable.dart'; +export 'all_of_with_single_ref.dart'; +export 'animal.dart'; +export 'api_response.dart'; +export 'apple.dart'; +export 'array_of_array_of_number_only.dart'; +export 'array_of_number_only.dart'; +export 'array_test.dart'; +export 'banana.dart'; +export 'bar.dart'; +export 'bar_create.dart'; +export 'bar_ref.dart'; +export 'bar_ref_or_value.dart'; +export 'capitalization.dart'; +export 'cat.dart'; +export 'cat_all_of.dart'; +export 'category.dart'; +export 'child.dart'; +export 'class_model.dart'; +export 'deprecated_object.dart'; +export 'dog.dart'; +export 'dog_all_of.dart'; +export 'entity.dart'; +export 'entity_ref.dart'; +export 'enum_arrays.dart'; +export 'enum_test.dart'; +export 'example.dart'; +export 'example_non_primitive.dart'; +export 'extensible.dart'; +export 'file_schema_test_class.dart'; +export 'foo.dart'; +export 'foo_ref.dart'; +export 'foo_ref_or_value.dart'; +export 'format_test.dart'; +export 'fruit.dart'; +export 'has_only_read_only.dart'; +export 'health_check_result.dart'; +export 'map_test.dart'; +export 'mixed_properties_and_additional_properties_class.dart'; +export 'model200_response.dart'; +export 'model_client.dart'; +export 'model_enum_class.dart'; +export 'model_file.dart'; +export 'model_list.dart'; +export 'model_return.dart'; +export 'name.dart'; +export 'nullable_class.dart'; +export 'number_only.dart'; +export 'object_with_deprecated_fields.dart'; +export 'order.dart'; +export 'outer_composite.dart'; +export 'outer_enum.dart'; +export 'outer_enum_default_value.dart'; +export 'outer_enum_integer.dart'; +export 'outer_enum_integer_default_value.dart'; +export 'outer_object_with_enum_property.dart'; +export 'pasta.dart'; +export 'pet.dart'; +export 'pizza.dart'; +export 'pizza_speziale.dart'; +export 'read_only_first.dart'; +export 'single_ref_type.dart'; +export 'special_model_name.dart'; +export 'tag.dart'; +export 'test_query_style_form_explode_true_array_string_query_object_parameter.dart'; +export 'user.dart'; diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/additional_properties_class.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/additional_properties_class.dart new file mode 100644 index 000000000000..52aae4f3674b --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/additional_properties_class.dart @@ -0,0 +1,48 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'additional_properties_class.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class AdditionalPropertiesClass { + /// Returns a new [AdditionalPropertiesClass] instance. + AdditionalPropertiesClass({ + this.mapProperty, + this.mapOfMapProperty, + }); + + @JsonKey(name: r'map_property', required: false, includeIfNull: false) + final Map? mapProperty; + + @JsonKey(name: r'map_of_map_property', required: false, includeIfNull: false) + final Map>? mapOfMapProperty; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AdditionalPropertiesClass && + other.mapProperty == mapProperty && + other.mapOfMapProperty == mapOfMapProperty; + + @override + int get hashCode => mapProperty.hashCode + mapOfMapProperty.hashCode; + + factory AdditionalPropertiesClass.fromJson(Map json) => + _$AdditionalPropertiesClassFromJson(json); + + Map toJson() => _$AdditionalPropertiesClassToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/addressable.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/addressable.dart new file mode 100644 index 000000000000..1558e6f5e9dc --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/addressable.dart @@ -0,0 +1,48 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'addressable.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Addressable { + /// Returns a new [Addressable] instance. + Addressable({ + this.href, + this.id, + }); + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Addressable && other.href == href && other.id == id; + + @override + int get hashCode => href.hashCode + id.hashCode; + + factory Addressable.fromJson(Map json) => + _$AddressableFromJson(json); + + Map toJson() => _$AddressableToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/all_of_with_single_ref.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/all_of_with_single_ref.dart new file mode 100644 index 000000000000..9fec7e666068 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/all_of_with_single_ref.dart @@ -0,0 +1,49 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/single_ref_type.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'all_of_with_single_ref.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class AllOfWithSingleRef { + /// Returns a new [AllOfWithSingleRef] instance. + AllOfWithSingleRef({ + this.username, + this.singleRefType, + }); + + @JsonKey(name: r'username', required: false, includeIfNull: false) + final String? username; + + @JsonKey(name: r'SingleRefType', required: false, includeIfNull: false) + final SingleRefType? singleRefType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is AllOfWithSingleRef && + other.username == username && + other.singleRefType == singleRefType; + + @override + int get hashCode => username.hashCode + singleRefType.hashCode; + + factory AllOfWithSingleRef.fromJson(Map json) => + _$AllOfWithSingleRefFromJson(json); + + Map toJson() => _$AllOfWithSingleRefToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/animal.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/animal.dart new file mode 100644 index 000000000000..464ac70be575 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/animal.dart @@ -0,0 +1,49 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'animal.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Animal { + /// Returns a new [Animal] instance. + Animal({ + required this.className, + this.color = 'red', + }); + + @JsonKey(name: r'className', required: true, includeIfNull: false) + final String className; + + @JsonKey( + defaultValue: 'red', + name: r'color', + required: false, + includeIfNull: false) + final String? color; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Animal && other.className == className && other.color == color; + + @override + int get hashCode => className.hashCode + color.hashCode; + + factory Animal.fromJson(Map json) => _$AnimalFromJson(json); + + Map toJson() => _$AnimalToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/api_response.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/api_response.dart new file mode 100644 index 000000000000..df7b51101d80 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/api_response.dart @@ -0,0 +1,53 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'api_response.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ApiResponse { + /// Returns a new [ApiResponse] instance. + ApiResponse({ + this.code, + this.type, + this.message, + }); + + @JsonKey(name: r'code', required: false, includeIfNull: false) + final int? code; + + @JsonKey(name: r'type', required: false, includeIfNull: false) + final String? type; + + @JsonKey(name: r'message', required: false, includeIfNull: false) + final String? message; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ApiResponse && + other.code == code && + other.type == type && + other.message == message; + + @override + int get hashCode => code.hashCode + type.hashCode + message.hashCode; + + factory ApiResponse.fromJson(Map json) => + _$ApiResponseFromJson(json); + + Map toJson() => _$ApiResponseToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/apple.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/apple.dart new file mode 100644 index 000000000000..81be695b9bba --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/apple.dart @@ -0,0 +1,40 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'apple.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Apple { + /// Returns a new [Apple] instance. + Apple({ + this.kind, + }); + + @JsonKey(name: r'kind', required: false, includeIfNull: false) + final String? kind; + + @override + bool operator ==(Object other) => + identical(this, other) || other is Apple && other.kind == kind; + + @override + int get hashCode => kind.hashCode; + + factory Apple.fromJson(Map json) => _$AppleFromJson(json); + + Map toJson() => _$AppleToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/array_of_array_of_number_only.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/array_of_array_of_number_only.dart new file mode 100644 index 000000000000..879bd5274b61 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/array_of_array_of_number_only.dart @@ -0,0 +1,43 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'array_of_array_of_number_only.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ArrayOfArrayOfNumberOnly { + /// Returns a new [ArrayOfArrayOfNumberOnly] instance. + ArrayOfArrayOfNumberOnly({ + this.arrayArrayNumber, + }); + + @JsonKey(name: r'ArrayArrayNumber', required: false, includeIfNull: false) + final List>? arrayArrayNumber; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ArrayOfArrayOfNumberOnly && + other.arrayArrayNumber == arrayArrayNumber; + + @override + int get hashCode => arrayArrayNumber.hashCode; + + factory ArrayOfArrayOfNumberOnly.fromJson(Map json) => + _$ArrayOfArrayOfNumberOnlyFromJson(json); + + Map toJson() => _$ArrayOfArrayOfNumberOnlyToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/array_of_number_only.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/array_of_number_only.dart new file mode 100644 index 000000000000..a1dea32fe74d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/array_of_number_only.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'array_of_number_only.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ArrayOfNumberOnly { + /// Returns a new [ArrayOfNumberOnly] instance. + ArrayOfNumberOnly({ + this.arrayNumber, + }); + + @JsonKey(name: r'ArrayNumber', required: false, includeIfNull: false) + final List? arrayNumber; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ArrayOfNumberOnly && other.arrayNumber == arrayNumber; + + @override + int get hashCode => arrayNumber.hashCode; + + factory ArrayOfNumberOnly.fromJson(Map json) => + _$ArrayOfNumberOnlyFromJson(json); + + Map toJson() => _$ArrayOfNumberOnlyToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/array_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/array_test.dart new file mode 100644 index 000000000000..bc0f83a42051 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/array_test.dart @@ -0,0 +1,58 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/read_only_first.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'array_test.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ArrayTest { + /// Returns a new [ArrayTest] instance. + ArrayTest({ + this.arrayOfString, + this.arrayArrayOfInteger, + this.arrayArrayOfModel, + }); + + @JsonKey(name: r'array_of_string', required: false, includeIfNull: false) + final List? arrayOfString; + + @JsonKey( + name: r'array_array_of_integer', required: false, includeIfNull: false) + final List>? arrayArrayOfInteger; + + @JsonKey(name: r'array_array_of_model', required: false, includeIfNull: false) + final List>? arrayArrayOfModel; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ArrayTest && + other.arrayOfString == arrayOfString && + other.arrayArrayOfInteger == arrayArrayOfInteger && + other.arrayArrayOfModel == arrayArrayOfModel; + + @override + int get hashCode => + arrayOfString.hashCode + + arrayArrayOfInteger.hashCode + + arrayArrayOfModel.hashCode; + + factory ArrayTest.fromJson(Map json) => + _$ArrayTestFromJson(json); + + Map toJson() => _$ArrayTestToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/banana.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/banana.dart new file mode 100644 index 000000000000..41fbfb80acc1 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/banana.dart @@ -0,0 +1,40 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'banana.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Banana { + /// Returns a new [Banana] instance. + Banana({ + this.count, + }); + + @JsonKey(name: r'count', required: false, includeIfNull: false) + final num? count; + + @override + bool operator ==(Object other) => + identical(this, other) || other is Banana && other.count == count; + + @override + int get hashCode => count.hashCode; + + factory Banana.fromJson(Map json) => _$BananaFromJson(json); + + Map toJson() => _$BananaToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/bar.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/bar.dart new file mode 100644 index 000000000000..39a28a166b7f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/bar.dart @@ -0,0 +1,93 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/foo_ref_or_value.dart'; +import 'package:openapi/src/model/entity.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'bar.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Bar { + /// Returns a new [Bar] instance. + Bar({ + required this.id, + this.barPropA, + this.fooPropB, + this.foo, + this.href, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + @JsonKey(name: r'id', required: true, includeIfNull: false) + final String id; + + @JsonKey(name: r'barPropA', required: false, includeIfNull: false) + final String? barPropA; + + @JsonKey(name: r'fooPropB', required: false, includeIfNull: false) + final String? fooPropB; + + @JsonKey(name: r'foo', required: false, includeIfNull: false) + final FooRefOrValue? foo; + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Bar && + other.id == id && + other.barPropA == barPropA && + other.fooPropB == fooPropB && + other.foo == foo && + other.href == href && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + id.hashCode + + barPropA.hashCode + + fooPropB.hashCode + + foo.hashCode + + href.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory Bar.fromJson(Map json) => _$BarFromJson(json); + + Map toJson() => _$BarToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/bar_create.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/bar_create.dart new file mode 100644 index 000000000000..69f8c91e9158 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/bar_create.dart @@ -0,0 +1,95 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/foo_ref_or_value.dart'; +import 'package:openapi/src/model/entity.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'bar_create.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class BarCreate { + /// Returns a new [BarCreate] instance. + BarCreate({ + this.barPropA, + this.fooPropB, + this.foo, + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + @JsonKey(name: r'barPropA', required: false, includeIfNull: false) + final String? barPropA; + + @JsonKey(name: r'fooPropB', required: false, includeIfNull: false) + final String? fooPropB; + + @JsonKey(name: r'foo', required: false, includeIfNull: false) + final FooRefOrValue? foo; + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is BarCreate && + other.barPropA == barPropA && + other.fooPropB == fooPropB && + other.foo == foo && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + barPropA.hashCode + + fooPropB.hashCode + + foo.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory BarCreate.fromJson(Map json) => + _$BarCreateFromJson(json); + + Map toJson() => _$BarCreateToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/bar_ref.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/bar_ref.dart new file mode 100644 index 000000000000..441f1475ed91 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/bar_ref.dart @@ -0,0 +1,75 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity_ref.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'bar_ref.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class BarRef { + /// Returns a new [BarRef] instance. + BarRef({ + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is BarRef && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory BarRef.fromJson(Map json) => _$BarRefFromJson(json); + + Map toJson() => _$BarRefToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/bar_ref_or_value.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/bar_ref_or_value.dart new file mode 100644 index 000000000000..2a31af86fb87 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/bar_ref_or_value.dart @@ -0,0 +1,75 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/bar_ref.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'bar_ref_or_value.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class BarRefOrValue { + /// Returns a new [BarRefOrValue] instance. + BarRefOrValue({ + this.href, + required this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: true, includeIfNull: false) + final String id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is BarRefOrValue && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory BarRefOrValue.fromJson(Map json) => + _$BarRefOrValueFromJson(json); + + Map toJson() => _$BarRefOrValueToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/capitalization.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/capitalization.dart new file mode 100644 index 000000000000..dc4ed957e2a0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/capitalization.dart @@ -0,0 +1,75 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'capitalization.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Capitalization { + /// Returns a new [Capitalization] instance. + Capitalization({ + this.smallCamel, + this.capitalCamel, + this.smallSnake, + this.capitalSnake, + this.sCAETHFlowPoints, + this.ATT_NAME, + }); + + @JsonKey(name: r'smallCamel', required: false, includeIfNull: false) + final String? smallCamel; + + @JsonKey(name: r'CapitalCamel', required: false, includeIfNull: false) + final String? capitalCamel; + + @JsonKey(name: r'small_Snake', required: false, includeIfNull: false) + final String? smallSnake; + + @JsonKey(name: r'Capital_Snake', required: false, includeIfNull: false) + final String? capitalSnake; + + @JsonKey(name: r'SCA_ETH_Flow_Points', required: false, includeIfNull: false) + final String? sCAETHFlowPoints; + + /// Name of the pet + @JsonKey(name: r'ATT_NAME', required: false, includeIfNull: false) + final String? ATT_NAME; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Capitalization && + other.smallCamel == smallCamel && + other.capitalCamel == capitalCamel && + other.smallSnake == smallSnake && + other.capitalSnake == capitalSnake && + other.sCAETHFlowPoints == sCAETHFlowPoints && + other.ATT_NAME == ATT_NAME; + + @override + int get hashCode => + smallCamel.hashCode + + capitalCamel.hashCode + + smallSnake.hashCode + + capitalSnake.hashCode + + sCAETHFlowPoints.hashCode + + ATT_NAME.hashCode; + + factory Capitalization.fromJson(Map json) => + _$CapitalizationFromJson(json); + + Map toJson() => _$CapitalizationToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/cat.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/cat.dart new file mode 100644 index 000000000000..8e0612fb641a --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/cat.dart @@ -0,0 +1,59 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/animal.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'cat.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Cat { + /// Returns a new [Cat] instance. + Cat({ + required this.className, + this.color = 'red', + this.declawed, + }); + + @JsonKey(name: r'className', required: true, includeIfNull: false) + final String className; + + @JsonKey( + defaultValue: 'red', + name: r'color', + required: false, + includeIfNull: false) + final String? color; + + @JsonKey(name: r'declawed', required: false, includeIfNull: false) + final bool? declawed; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Cat && + other.className == className && + other.color == color && + other.declawed == declawed; + + @override + int get hashCode => className.hashCode + color.hashCode + declawed.hashCode; + + factory Cat.fromJson(Map json) => _$CatFromJson(json); + + Map toJson() => _$CatToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/cat_all_of.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/cat_all_of.dart new file mode 100644 index 000000000000..af380b83994a --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/cat_all_of.dart @@ -0,0 +1,41 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'cat_all_of.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class CatAllOf { + /// Returns a new [CatAllOf] instance. + CatAllOf({ + this.declawed, + }); + + @JsonKey(name: r'declawed', required: false, includeIfNull: false) + final bool? declawed; + + @override + bool operator ==(Object other) => + identical(this, other) || other is CatAllOf && other.declawed == declawed; + + @override + int get hashCode => declawed.hashCode; + + factory CatAllOf.fromJson(Map json) => + _$CatAllOfFromJson(json); + + Map toJson() => _$CatAllOfToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/category.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/category.dart new file mode 100644 index 000000000000..287b7ee8011d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/category.dart @@ -0,0 +1,46 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'category.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Category { + /// Returns a new [Category] instance. + Category({ + this.id, + this.name, + }); + + @JsonKey(name: r'id', required: false, includeIfNull: false) + final int? id; + + @JsonKey(name: r'name', required: false, includeIfNull: false) + final String? name; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Category && other.id == id && other.name == name; + + @override + int get hashCode => id.hashCode + name.hashCode; + + factory Category.fromJson(Map json) => + _$CategoryFromJson(json); + + Map toJson() => _$CategoryToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/child.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/child.dart new file mode 100644 index 000000000000..c01536e49b2c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/child.dart @@ -0,0 +1,40 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'child.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Child { + /// Returns a new [Child] instance. + Child({ + this.name, + }); + + @JsonKey(name: r'name', required: false, includeIfNull: false) + final String? name; + + @override + bool operator ==(Object other) => + identical(this, other) || other is Child && other.name == name; + + @override + int get hashCode => name.hashCode; + + factory Child.fromJson(Map json) => _$ChildFromJson(json); + + Map toJson() => _$ChildToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/class_model.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/class_model.dart new file mode 100644 index 000000000000..c12e08bda2d7 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/class_model.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'class_model.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ClassModel { + /// Returns a new [ClassModel] instance. + ClassModel({ + this.classField, + }); + + @JsonKey(name: r'_class', required: false, includeIfNull: false) + final String? classField; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ClassModel && other.classField == classField; + + @override + int get hashCode => classField.hashCode; + + factory ClassModel.fromJson(Map json) => + _$ClassModelFromJson(json); + + Map toJson() => _$ClassModelToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/deprecated_object.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/deprecated_object.dart new file mode 100644 index 000000000000..5c32ad349f23 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/deprecated_object.dart @@ -0,0 +1,41 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'deprecated_object.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class DeprecatedObject { + /// Returns a new [DeprecatedObject] instance. + DeprecatedObject({ + this.name, + }); + + @JsonKey(name: r'name', required: false, includeIfNull: false) + final String? name; + + @override + bool operator ==(Object other) => + identical(this, other) || other is DeprecatedObject && other.name == name; + + @override + int get hashCode => name.hashCode; + + factory DeprecatedObject.fromJson(Map json) => + _$DeprecatedObjectFromJson(json); + + Map toJson() => _$DeprecatedObjectToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/dog.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/dog.dart new file mode 100644 index 000000000000..394340b11eb9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/dog.dart @@ -0,0 +1,59 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/animal.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'dog.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Dog { + /// Returns a new [Dog] instance. + Dog({ + required this.className, + this.color = 'red', + this.breed, + }); + + @JsonKey(name: r'className', required: true, includeIfNull: false) + final String className; + + @JsonKey( + defaultValue: 'red', + name: r'color', + required: false, + includeIfNull: false) + final String? color; + + @JsonKey(name: r'breed', required: false, includeIfNull: false) + final String? breed; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Dog && + other.className == className && + other.color == color && + other.breed == breed; + + @override + int get hashCode => className.hashCode + color.hashCode + breed.hashCode; + + factory Dog.fromJson(Map json) => _$DogFromJson(json); + + Map toJson() => _$DogToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/dog_all_of.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/dog_all_of.dart new file mode 100644 index 000000000000..39065be80707 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/dog_all_of.dart @@ -0,0 +1,41 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'dog_all_of.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class DogAllOf { + /// Returns a new [DogAllOf] instance. + DogAllOf({ + this.breed, + }); + + @JsonKey(name: r'breed', required: false, includeIfNull: false) + final String? breed; + + @override + bool operator ==(Object other) => + identical(this, other) || other is DogAllOf && other.breed == breed; + + @override + int get hashCode => breed.hashCode; + + factory DogAllOf.fromJson(Map json) => + _$DogAllOfFromJson(json); + + Map toJson() => _$DogAllOfToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/entity.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/entity.dart new file mode 100644 index 000000000000..9bba5eff8b34 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/entity.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'entity.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Entity { + /// Returns a new [Entity] instance. + Entity({ + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Entity && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory Entity.fromJson(Map json) => _$EntityFromJson(json); + + Map toJson() => _$EntityToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/entity_ref.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/entity_ref.dart new file mode 100644 index 000000000000..32901f43eaa9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/entity_ref.dart @@ -0,0 +1,87 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'entity_ref.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class EntityRef { + /// Returns a new [EntityRef] instance. + EntityRef({ + this.name, + this.atReferredType, + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + /// Name of the related entity. + @JsonKey(name: r'name', required: false, includeIfNull: false) + final String? name; + + /// The actual type of the target instance when needed for disambiguation. + @JsonKey(name: r'@referredType', required: false, includeIfNull: false) + final String? atReferredType; + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is EntityRef && + other.name == name && + other.atReferredType == atReferredType && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + name.hashCode + + atReferredType.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory EntityRef.fromJson(Map json) => + _$EntityRefFromJson(json); + + Map toJson() => _$EntityRefToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/enum_arrays.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/enum_arrays.dart new file mode 100644 index 000000000000..4a9ce1458928 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/enum_arrays.dart @@ -0,0 +1,66 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'enum_arrays.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class EnumArrays { + /// Returns a new [EnumArrays] instance. + EnumArrays({ + this.justSymbol, + this.arrayEnum, + }); + + @JsonKey(name: r'just_symbol', required: false, includeIfNull: false) + final EnumArraysJustSymbolEnum? justSymbol; + + @JsonKey(name: r'array_enum', required: false, includeIfNull: false) + final List? arrayEnum; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is EnumArrays && + other.justSymbol == justSymbol && + other.arrayEnum == arrayEnum; + + @override + int get hashCode => justSymbol.hashCode + arrayEnum.hashCode; + + factory EnumArrays.fromJson(Map json) => + _$EnumArraysFromJson(json); + + Map toJson() => _$EnumArraysToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} + +enum EnumArraysJustSymbolEnum { + @JsonValue(r'>=') + greaterThanEqual, + @JsonValue(r'$') + dollar, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} + +enum EnumArraysArrayEnumEnum { + @JsonValue(r'fish') + fish, + @JsonValue(r'crab') + crab, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/enum_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/enum_test.dart new file mode 100644 index 000000000000..926b40e5977f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/enum_test.dart @@ -0,0 +1,134 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/outer_enum.dart'; +import 'package:openapi/src/model/outer_enum_default_value.dart'; +import 'package:openapi/src/model/outer_enum_integer.dart'; +import 'package:openapi/src/model/outer_enum_integer_default_value.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'enum_test.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class EnumTest { + /// Returns a new [EnumTest] instance. + EnumTest({ + this.enumString, + required this.enumStringRequired, + this.enumInteger, + this.enumNumber, + this.outerEnum, + this.outerEnumInteger, + this.outerEnumDefaultValue, + this.outerEnumIntegerDefaultValue, + }); + + @JsonKey(name: r'enum_string', required: false, includeIfNull: false) + final EnumTestEnumStringEnum? enumString; + + @JsonKey(name: r'enum_string_required', required: true, includeIfNull: false) + final EnumTestEnumStringRequiredEnum enumStringRequired; + + @JsonKey(name: r'enum_integer', required: false, includeIfNull: false) + final EnumTestEnumIntegerEnum? enumInteger; + + @JsonKey(name: r'enum_number', required: false, includeIfNull: false) + final EnumTestEnumNumberEnum? enumNumber; + + @JsonKey(name: r'outerEnum', required: false, includeIfNull: false) + final OuterEnum? outerEnum; + + @JsonKey(name: r'outerEnumInteger', required: false, includeIfNull: false) + final OuterEnumInteger? outerEnumInteger; + + @JsonKey( + name: r'outerEnumDefaultValue', required: false, includeIfNull: false) + final OuterEnumDefaultValue? outerEnumDefaultValue; + + @JsonKey( + name: r'outerEnumIntegerDefaultValue', + required: false, + includeIfNull: false) + final OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is EnumTest && + other.enumString == enumString && + other.enumStringRequired == enumStringRequired && + other.enumInteger == enumInteger && + other.enumNumber == enumNumber && + other.outerEnum == outerEnum && + other.outerEnumInteger == outerEnumInteger && + other.outerEnumDefaultValue == outerEnumDefaultValue && + other.outerEnumIntegerDefaultValue == outerEnumIntegerDefaultValue; + + @override + int get hashCode => + enumString.hashCode + + enumStringRequired.hashCode + + enumInteger.hashCode + + enumNumber.hashCode + + (outerEnum == null ? 0 : outerEnum.hashCode) + + outerEnumInteger.hashCode + + outerEnumDefaultValue.hashCode + + outerEnumIntegerDefaultValue.hashCode; + + factory EnumTest.fromJson(Map json) => + _$EnumTestFromJson(json); + + Map toJson() => _$EnumTestToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} + +enum EnumTestEnumStringEnum { + @JsonValue(r'UPPER') + UPPER, + @JsonValue(r'lower') + lower, + @JsonValue(r'') + empty, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} + +enum EnumTestEnumStringRequiredEnum { + @JsonValue(r'UPPER') + UPPER, + @JsonValue(r'lower') + lower, + @JsonValue(r'') + empty, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} + +enum EnumTestEnumIntegerEnum { + @JsonValue(1) + number1, + @JsonValue(-1) + numberNegative1, + @JsonValue(11184809) + unknownDefaultOpenApi, +} + +enum EnumTestEnumNumberEnum { + @JsonValue('1.1') + number1Period1, + @JsonValue('-1.2') + numberNegative1Period2, + @JsonValue('11184809') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/example.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/example.dart new file mode 100644 index 000000000000..12ed94125a83 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/example.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/child.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'example.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Example { + /// Returns a new [Example] instance. + Example({ + this.name, + }); + + @JsonKey(name: r'name', required: false, includeIfNull: false) + final String? name; + + @override + bool operator ==(Object other) => + identical(this, other) || other is Example && other.name == name; + + @override + int get hashCode => name.hashCode; + + factory Example.fromJson(Map json) => + _$ExampleFromJson(json); + + Map toJson() => _$ExampleToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/example_non_primitive.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/example_non_primitive.dart new file mode 100644 index 000000000000..b05d98f10dc2 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/example_non_primitive.dart @@ -0,0 +1,29 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'example_non_primitive.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ExampleNonPrimitive { + /// Returns a new [ExampleNonPrimitive] instance. + ExampleNonPrimitive(); + + factory ExampleNonPrimitive.fromJson(Map json) => + _$ExampleNonPrimitiveFromJson(json); + + Map toJson() => _$ExampleNonPrimitiveToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/extensible.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/extensible.dart new file mode 100644 index 000000000000..bad2e3789836 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/extensible.dart @@ -0,0 +1,57 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'extensible.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Extensible { + /// Returns a new [Extensible] instance. + Extensible({ + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Extensible && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + atSchemaLocation.hashCode + atBaseType.hashCode + atType.hashCode; + + factory Extensible.fromJson(Map json) => + _$ExtensibleFromJson(json); + + Map toJson() => _$ExtensibleToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/file_schema_test_class.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/file_schema_test_class.dart new file mode 100644 index 000000000000..3da04204b0b2 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/file_schema_test_class.dart @@ -0,0 +1,49 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/model_file.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'file_schema_test_class.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FileSchemaTestClass { + /// Returns a new [FileSchemaTestClass] instance. + FileSchemaTestClass({ + this.file, + this.files, + }); + + @JsonKey(name: r'file', required: false, includeIfNull: false) + final ModelFile? file; + + @JsonKey(name: r'files', required: false, includeIfNull: false) + final List? files; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is FileSchemaTestClass && + other.file == file && + other.files == files; + + @override + int get hashCode => file.hashCode + files.hashCode; + + factory FileSchemaTestClass.fromJson(Map json) => + _$FileSchemaTestClassFromJson(json); + + Map toJson() => _$FileSchemaTestClassToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/foo.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/foo.dart new file mode 100644 index 000000000000..5fbd0e3f800a --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/foo.dart @@ -0,0 +1,87 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'foo.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Foo { + /// Returns a new [Foo] instance. + Foo({ + this.fooPropA, + this.fooPropB, + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + @JsonKey(name: r'fooPropA', required: false, includeIfNull: false) + final String? fooPropA; + + @JsonKey(name: r'fooPropB', required: false, includeIfNull: false) + final String? fooPropB; + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Foo && + other.fooPropA == fooPropA && + other.fooPropB == fooPropB && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + fooPropA.hashCode + + fooPropB.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory Foo.fromJson(Map json) => _$FooFromJson(json); + + Map toJson() => _$FooToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/foo_ref.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/foo_ref.dart new file mode 100644 index 000000000000..1e0ec166fb66 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/foo_ref.dart @@ -0,0 +1,81 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity_ref.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'foo_ref.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FooRef { + /// Returns a new [FooRef] instance. + FooRef({ + this.foorefPropA, + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + @JsonKey(name: r'foorefPropA', required: false, includeIfNull: false) + final String? foorefPropA; + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is FooRef && + other.foorefPropA == foorefPropA && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + foorefPropA.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory FooRef.fromJson(Map json) => _$FooRefFromJson(json); + + Map toJson() => _$FooRefToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/foo_ref_or_value.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/foo_ref_or_value.dart new file mode 100644 index 000000000000..f71d4b51f73e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/foo_ref_or_value.dart @@ -0,0 +1,75 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/foo_ref.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'foo_ref_or_value.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FooRefOrValue { + /// Returns a new [FooRefOrValue] instance. + FooRefOrValue({ + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is FooRefOrValue && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory FooRefOrValue.fromJson(Map json) => + _$FooRefOrValueFromJson(json); + + Map toJson() => _$FooRefOrValueToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/format_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/format_test.dart new file mode 100644 index 000000000000..ef85b6dc3ff2 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/format_test.dart @@ -0,0 +1,150 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:http/http.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'format_test.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FormatTest { + /// Returns a new [FormatTest] instance. + FormatTest({ + this.integer, + this.int32, + this.int64, + required this.number, + this.float, + this.double_, + this.decimal, + this.string, + required this.byte, + this.binary, + required this.date, + this.dateTime, + this.uuid, + required this.password, + this.patternWithDigits, + this.patternWithDigitsAndDelimiter, + }); + + // minimum: 10 + // maximum: 100 + @JsonKey(name: r'integer', required: false, includeIfNull: false) + final int? integer; + + // minimum: 20 + // maximum: 200 + @JsonKey(name: r'int32', required: false, includeIfNull: false) + final int? int32; + + @JsonKey(name: r'int64', required: false, includeIfNull: false) + final int? int64; + + // minimum: 32.1 + // maximum: 543.2 + @JsonKey(name: r'number', required: true, includeIfNull: false) + final num number; + + // minimum: 54.3 + // maximum: 987.6 + @JsonKey(name: r'float', required: false, includeIfNull: false) + final double? float; + + // minimum: 67.8 + // maximum: 123.4 + @JsonKey(name: r'double', required: false, includeIfNull: false) + final double? double_; + + @JsonKey(name: r'decimal', required: false, includeIfNull: false) + final double? decimal; + + @JsonKey(name: r'string', required: false, includeIfNull: false) + final String? string; + + @JsonKey(name: r'byte', required: true, includeIfNull: false) + final String byte; + + @JsonKey(ignore: true) + final MultipartFile? binary; + + @JsonKey(name: r'date', required: true, includeIfNull: false) + final DateTime date; + + @JsonKey(name: r'dateTime', required: false, includeIfNull: false) + final DateTime? dateTime; + + @JsonKey(name: r'uuid', required: false, includeIfNull: false) + final String? uuid; + + @JsonKey(name: r'password', required: true, includeIfNull: false) + final String password; + + /// A string that is a 10 digit number. Can have leading zeros. + @JsonKey(name: r'pattern_with_digits', required: false, includeIfNull: false) + final String? patternWithDigits; + + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + @JsonKey( + name: r'pattern_with_digits_and_delimiter', + required: false, + includeIfNull: false) + final String? patternWithDigitsAndDelimiter; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is FormatTest && + other.integer == integer && + other.int32 == int32 && + other.int64 == int64 && + other.number == number && + other.float == float && + other.double_ == double_ && + other.decimal == decimal && + other.string == string && + other.byte == byte && + other.binary == binary && + other.date == date && + other.dateTime == dateTime && + other.uuid == uuid && + other.password == password && + other.patternWithDigits == patternWithDigits && + other.patternWithDigitsAndDelimiter == patternWithDigitsAndDelimiter; + + @override + int get hashCode => + integer.hashCode + + int32.hashCode + + int64.hashCode + + number.hashCode + + float.hashCode + + double_.hashCode + + decimal.hashCode + + string.hashCode + + byte.hashCode + + binary.hashCode + + date.hashCode + + dateTime.hashCode + + uuid.hashCode + + password.hashCode + + patternWithDigits.hashCode + + patternWithDigitsAndDelimiter.hashCode; + + factory FormatTest.fromJson(Map json) => + _$FormatTestFromJson(json); + + Map toJson() => _$FormatTestToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/fruit.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/fruit.dart new file mode 100644 index 000000000000..ecbad5014c05 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/fruit.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/apple.dart'; +import 'package:openapi/src/model/banana.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'fruit.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Fruit { + /// Returns a new [Fruit] instance. + Fruit({ + this.color, + this.kind, + this.count, + }); + + @JsonKey(name: r'color', required: false, includeIfNull: false) + final String? color; + + @JsonKey(name: r'kind', required: false, includeIfNull: false) + final String? kind; + + @JsonKey(name: r'count', required: false, includeIfNull: false) + final num? count; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Fruit && + other.color == color && + other.kind == kind && + other.count == count; + + @override + int get hashCode => color.hashCode + kind.hashCode + count.hashCode; + + factory Fruit.fromJson(Map json) => _$FruitFromJson(json); + + Map toJson() => _$FruitToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/has_only_read_only.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/has_only_read_only.dart new file mode 100644 index 000000000000..ed6a55c59d03 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/has_only_read_only.dart @@ -0,0 +1,46 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'has_only_read_only.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class HasOnlyReadOnly { + /// Returns a new [HasOnlyReadOnly] instance. + HasOnlyReadOnly({ + this.bar, + this.foo, + }); + + @JsonKey(name: r'bar', required: false, includeIfNull: false) + final String? bar; + + @JsonKey(name: r'foo', required: false, includeIfNull: false) + final String? foo; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is HasOnlyReadOnly && other.bar == bar && other.foo == foo; + + @override + int get hashCode => bar.hashCode + foo.hashCode; + + factory HasOnlyReadOnly.fromJson(Map json) => + _$HasOnlyReadOnlyFromJson(json); + + Map toJson() => _$HasOnlyReadOnlyToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/health_check_result.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/health_check_result.dart new file mode 100644 index 000000000000..e14245b733fe --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/health_check_result.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'health_check_result.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class HealthCheckResult { + /// Returns a new [HealthCheckResult] instance. + HealthCheckResult({ + this.nullableMessage, + }); + + @JsonKey(name: r'NullableMessage', required: false, includeIfNull: false) + final String? nullableMessage; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is HealthCheckResult && other.nullableMessage == nullableMessage; + + @override + int get hashCode => (nullableMessage == null ? 0 : nullableMessage.hashCode); + + factory HealthCheckResult.fromJson(Map json) => + _$HealthCheckResultFromJson(json); + + Map toJson() => _$HealthCheckResultToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/map_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/map_test.dart new file mode 100644 index 000000000000..68f69e6ab300 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/map_test.dart @@ -0,0 +1,71 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'map_test.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class MapTest { + /// Returns a new [MapTest] instance. + MapTest({ + this.mapMapOfString, + this.mapOfEnumString, + this.directMap, + this.indirectMap, + }); + + @JsonKey(name: r'map_map_of_string', required: false, includeIfNull: false) + final Map>? mapMapOfString; + + @JsonKey(name: r'map_of_enum_string', required: false, includeIfNull: false) + final Map? mapOfEnumString; + + @JsonKey(name: r'direct_map', required: false, includeIfNull: false) + final Map? directMap; + + @JsonKey(name: r'indirect_map', required: false, includeIfNull: false) + final Map? indirectMap; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is MapTest && + other.mapMapOfString == mapMapOfString && + other.mapOfEnumString == mapOfEnumString && + other.directMap == directMap && + other.indirectMap == indirectMap; + + @override + int get hashCode => + mapMapOfString.hashCode + + mapOfEnumString.hashCode + + directMap.hashCode + + indirectMap.hashCode; + + factory MapTest.fromJson(Map json) => + _$MapTestFromJson(json); + + Map toJson() => _$MapTestToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} + +enum MapTestMapOfEnumStringEnum { + @JsonValue(r'UPPER') + UPPER, + @JsonValue(r'lower') + lower, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/mixed_properties_and_additional_properties_class.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/mixed_properties_and_additional_properties_class.dart new file mode 100644 index 000000000000..7045930e1616 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/mixed_properties_and_additional_properties_class.dart @@ -0,0 +1,56 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/animal.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'mixed_properties_and_additional_properties_class.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class MixedPropertiesAndAdditionalPropertiesClass { + /// Returns a new [MixedPropertiesAndAdditionalPropertiesClass] instance. + MixedPropertiesAndAdditionalPropertiesClass({ + this.uuid, + this.dateTime, + this.map, + }); + + @JsonKey(name: r'uuid', required: false, includeIfNull: false) + final String? uuid; + + @JsonKey(name: r'dateTime', required: false, includeIfNull: false) + final DateTime? dateTime; + + @JsonKey(name: r'map', required: false, includeIfNull: false) + final Map? map; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is MixedPropertiesAndAdditionalPropertiesClass && + other.uuid == uuid && + other.dateTime == dateTime && + other.map == map; + + @override + int get hashCode => uuid.hashCode + dateTime.hashCode + map.hashCode; + + factory MixedPropertiesAndAdditionalPropertiesClass.fromJson( + Map json) => + _$MixedPropertiesAndAdditionalPropertiesClassFromJson(json); + + Map toJson() => + _$MixedPropertiesAndAdditionalPropertiesClassToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/model200_response.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/model200_response.dart new file mode 100644 index 000000000000..a95d30009c5d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/model200_response.dart @@ -0,0 +1,48 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'model200_response.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Model200Response { + /// Returns a new [Model200Response] instance. + Model200Response({ + this.name, + this.classField, + }); + + @JsonKey(name: r'name', required: false, includeIfNull: false) + final int? name; + + @JsonKey(name: r'class', required: false, includeIfNull: false) + final String? classField; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Model200Response && + other.name == name && + other.classField == classField; + + @override + int get hashCode => name.hashCode + classField.hashCode; + + factory Model200Response.fromJson(Map json) => + _$Model200ResponseFromJson(json); + + Map toJson() => _$Model200ResponseToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/model_client.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/model_client.dart new file mode 100644 index 000000000000..420ab5a1f4dd --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/model_client.dart @@ -0,0 +1,41 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'model_client.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ModelClient { + /// Returns a new [ModelClient] instance. + ModelClient({ + this.client, + }); + + @JsonKey(name: r'client', required: false, includeIfNull: false) + final String? client; + + @override + bool operator ==(Object other) => + identical(this, other) || other is ModelClient && other.client == client; + + @override + int get hashCode => client.hashCode; + + factory ModelClient.fromJson(Map json) => + _$ModelClientFromJson(json); + + Map toJson() => _$ModelClientToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/model_enum_class.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/model_enum_class.dart new file mode 100644 index 000000000000..67b79a2a5c9a --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/model_enum_class.dart @@ -0,0 +1,17 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum ModelEnumClass { + @JsonValue(r'_abc') + abc, + @JsonValue(r'-efg') + efg, + @JsonValue(r'(xyz)') + leftParenthesisXyzRightParenthesis, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/model_file.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/model_file.dart new file mode 100644 index 000000000000..24ab5b777009 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/model_file.dart @@ -0,0 +1,43 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'model_file.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ModelFile { + /// Returns a new [ModelFile] instance. + ModelFile({ + this.sourceURI, + }); + + /// Test capitalization + @JsonKey(name: r'sourceURI', required: false, includeIfNull: false) + final String? sourceURI; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ModelFile && other.sourceURI == sourceURI; + + @override + int get hashCode => sourceURI.hashCode; + + factory ModelFile.fromJson(Map json) => + _$ModelFileFromJson(json); + + Map toJson() => _$ModelFileToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/model_list.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/model_list.dart new file mode 100644 index 000000000000..b2d3f190af9e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/model_list.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'model_list.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ModelList { + /// Returns a new [ModelList] instance. + ModelList({ + this.n123list, + }); + + @JsonKey(name: r'123-list', required: false, includeIfNull: false) + final String? n123list; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ModelList && other.n123list == n123list; + + @override + int get hashCode => n123list.hashCode; + + factory ModelList.fromJson(Map json) => + _$ModelListFromJson(json); + + Map toJson() => _$ModelListToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/model_return.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/model_return.dart new file mode 100644 index 000000000000..1d2547c95628 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/model_return.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'model_return.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ModelReturn { + /// Returns a new [ModelReturn] instance. + ModelReturn({ + this.return_, + }); + + @JsonKey(name: r'return', required: false, includeIfNull: false) + final int? return_; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ModelReturn && other.return_ == return_; + + @override + int get hashCode => return_.hashCode; + + factory ModelReturn.fromJson(Map json) => + _$ModelReturnFromJson(json); + + Map toJson() => _$ModelReturnToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/name.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/name.dart new file mode 100644 index 000000000000..0aad5dcc0480 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/name.dart @@ -0,0 +1,61 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'name.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Name { + /// Returns a new [Name] instance. + Name({ + required this.name, + this.snakeCase, + this.property, + this.n123number, + }); + + @JsonKey(name: r'name', required: true, includeIfNull: false) + final int name; + + @JsonKey(name: r'snake_case', required: false, includeIfNull: false) + final int? snakeCase; + + @JsonKey(name: r'property', required: false, includeIfNull: false) + final String? property; + + @JsonKey(name: r'123Number', required: false, includeIfNull: false) + final int? n123number; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Name && + other.name == name && + other.snakeCase == snakeCase && + other.property == property && + other.n123number == n123number; + + @override + int get hashCode => + name.hashCode + + snakeCase.hashCode + + property.hashCode + + n123number.hashCode; + + factory Name.fromJson(Map json) => _$NameFromJson(json); + + Map toJson() => _$NameToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/nullable_class.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/nullable_class.dart new file mode 100644 index 000000000000..66e3f84395b6 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/nullable_class.dart @@ -0,0 +1,121 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'nullable_class.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class NullableClass { + /// Returns a new [NullableClass] instance. + NullableClass({ + this.integerProp, + this.numberProp, + this.booleanProp, + this.stringProp, + this.dateProp, + this.datetimeProp, + this.arrayNullableProp, + this.arrayAndItemsNullableProp, + this.arrayItemsNullable, + this.objectNullableProp, + this.objectAndItemsNullableProp, + this.objectItemsNullable, + }); + + @JsonKey(name: r'integer_prop', required: false, includeIfNull: false) + final int? integerProp; + + @JsonKey(name: r'number_prop', required: false, includeIfNull: false) + final num? numberProp; + + @JsonKey(name: r'boolean_prop', required: false, includeIfNull: false) + final bool? booleanProp; + + @JsonKey(name: r'string_prop', required: false, includeIfNull: false) + final String? stringProp; + + @JsonKey(name: r'date_prop', required: false, includeIfNull: false) + final DateTime? dateProp; + + @JsonKey(name: r'datetime_prop', required: false, includeIfNull: false) + final DateTime? datetimeProp; + + @JsonKey(name: r'array_nullable_prop', required: false, includeIfNull: false) + final List? arrayNullableProp; + + @JsonKey( + name: r'array_and_items_nullable_prop', + required: false, + includeIfNull: false) + final List? arrayAndItemsNullableProp; + + @JsonKey(name: r'array_items_nullable', required: false, includeIfNull: false) + final List? arrayItemsNullable; + + @JsonKey(name: r'object_nullable_prop', required: false, includeIfNull: false) + final Map? objectNullableProp; + + @JsonKey( + name: r'object_and_items_nullable_prop', + required: false, + includeIfNull: false) + final Map? objectAndItemsNullableProp; + + @JsonKey( + name: r'object_items_nullable', required: false, includeIfNull: false) + final Map? objectItemsNullable; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is NullableClass && + other.integerProp == integerProp && + other.numberProp == numberProp && + other.booleanProp == booleanProp && + other.stringProp == stringProp && + other.dateProp == dateProp && + other.datetimeProp == datetimeProp && + other.arrayNullableProp == arrayNullableProp && + other.arrayAndItemsNullableProp == arrayAndItemsNullableProp && + other.arrayItemsNullable == arrayItemsNullable && + other.objectNullableProp == objectNullableProp && + other.objectAndItemsNullableProp == objectAndItemsNullableProp && + other.objectItemsNullable == objectItemsNullable; + + @override + int get hashCode => + (integerProp == null ? 0 : integerProp.hashCode) + + (numberProp == null ? 0 : numberProp.hashCode) + + (booleanProp == null ? 0 : booleanProp.hashCode) + + (stringProp == null ? 0 : stringProp.hashCode) + + (dateProp == null ? 0 : dateProp.hashCode) + + (datetimeProp == null ? 0 : datetimeProp.hashCode) + + (arrayNullableProp == null ? 0 : arrayNullableProp.hashCode) + + (arrayAndItemsNullableProp == null + ? 0 + : arrayAndItemsNullableProp.hashCode) + + arrayItemsNullable.hashCode + + (objectNullableProp == null ? 0 : objectNullableProp.hashCode) + + (objectAndItemsNullableProp == null + ? 0 + : objectAndItemsNullableProp.hashCode) + + objectItemsNullable.hashCode; + + factory NullableClass.fromJson(Map json) => + _$NullableClassFromJson(json); + + Map toJson() => _$NullableClassToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/number_only.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/number_only.dart new file mode 100644 index 000000000000..75022ee68437 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/number_only.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'number_only.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class NumberOnly { + /// Returns a new [NumberOnly] instance. + NumberOnly({ + this.justNumber, + }); + + @JsonKey(name: r'JustNumber', required: false, includeIfNull: false) + final num? justNumber; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is NumberOnly && other.justNumber == justNumber; + + @override + int get hashCode => justNumber.hashCode; + + factory NumberOnly.fromJson(Map json) => + _$NumberOnlyFromJson(json); + + Map toJson() => _$NumberOnlyToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/object_with_deprecated_fields.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/object_with_deprecated_fields.dart new file mode 100644 index 000000000000..77865e64e421 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/object_with_deprecated_fields.dart @@ -0,0 +1,61 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/deprecated_object.dart'; +import 'package:openapi/src/model/bar.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'object_with_deprecated_fields.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ObjectWithDeprecatedFields { + /// Returns a new [ObjectWithDeprecatedFields] instance. + ObjectWithDeprecatedFields({ + this.uuid, + this.id, + this.deprecatedRef, + this.bars, + }); + + @JsonKey(name: r'uuid', required: false, includeIfNull: false) + final String? uuid; + + @JsonKey(name: r'id', required: false, includeIfNull: false) + final num? id; + + @JsonKey(name: r'deprecatedRef', required: false, includeIfNull: false) + final DeprecatedObject? deprecatedRef; + + @JsonKey(name: r'bars', required: false, includeIfNull: false) + final List? bars; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ObjectWithDeprecatedFields && + other.uuid == uuid && + other.id == id && + other.deprecatedRef == deprecatedRef && + other.bars == bars; + + @override + int get hashCode => + uuid.hashCode + id.hashCode + deprecatedRef.hashCode + bars.hashCode; + + factory ObjectWithDeprecatedFields.fromJson(Map json) => + _$ObjectWithDeprecatedFieldsFromJson(json); + + Map toJson() => _$ObjectWithDeprecatedFieldsToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/order.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/order.dart new file mode 100644 index 000000000000..e5bcbae3225e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/order.dart @@ -0,0 +1,90 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'order.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Order { + /// Returns a new [Order] instance. + Order({ + this.id, + this.petId, + this.quantity, + this.shipDate, + this.status, + this.complete = false, + }); + + @JsonKey(name: r'id', required: false, includeIfNull: false) + final int? id; + + @JsonKey(name: r'petId', required: false, includeIfNull: false) + final int? petId; + + @JsonKey(name: r'quantity', required: false, includeIfNull: false) + final int? quantity; + + @JsonKey(name: r'shipDate', required: false, includeIfNull: false) + final DateTime? shipDate; + + /// Order Status + @JsonKey(name: r'status', required: false, includeIfNull: false) + final OrderStatusEnum? status; + + @JsonKey( + defaultValue: false, + name: r'complete', + required: false, + includeIfNull: false) + final bool? complete; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Order && + other.id == id && + other.petId == petId && + other.quantity == quantity && + other.shipDate == shipDate && + other.status == status && + other.complete == complete; + + @override + int get hashCode => + id.hashCode + + petId.hashCode + + quantity.hashCode + + shipDate.hashCode + + status.hashCode + + complete.hashCode; + + factory Order.fromJson(Map json) => _$OrderFromJson(json); + + Map toJson() => _$OrderToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} + +/// Order Status +enum OrderStatusEnum { + @JsonValue(r'placed') + placed, + @JsonValue(r'approved') + approved, + @JsonValue(r'delivered') + delivered, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/outer_composite.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/outer_composite.dart new file mode 100644 index 000000000000..df6d371f533f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/outer_composite.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'outer_composite.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class OuterComposite { + /// Returns a new [OuterComposite] instance. + OuterComposite({ + this.myNumber, + this.myString, + this.myBoolean, + }); + + @JsonKey(name: r'my_number', required: false, includeIfNull: false) + final num? myNumber; + + @JsonKey(name: r'my_string', required: false, includeIfNull: false) + final String? myString; + + @JsonKey(name: r'my_boolean', required: false, includeIfNull: false) + final bool? myBoolean; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is OuterComposite && + other.myNumber == myNumber && + other.myString == myString && + other.myBoolean == myBoolean; + + @override + int get hashCode => + myNumber.hashCode + myString.hashCode + myBoolean.hashCode; + + factory OuterComposite.fromJson(Map json) => + _$OuterCompositeFromJson(json); + + Map toJson() => _$OuterCompositeToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/outer_enum.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/outer_enum.dart new file mode 100644 index 000000000000..2d1326c259bf --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/outer_enum.dart @@ -0,0 +1,17 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum OuterEnum { + @JsonValue(r'placed') + placed, + @JsonValue(r'approved') + approved, + @JsonValue(r'delivered') + delivered, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/outer_enum_default_value.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/outer_enum_default_value.dart new file mode 100644 index 000000000000..45919f099158 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/outer_enum_default_value.dart @@ -0,0 +1,17 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum OuterEnumDefaultValue { + @JsonValue(r'placed') + placed, + @JsonValue(r'approved') + approved, + @JsonValue(r'delivered') + delivered, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/outer_enum_integer.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/outer_enum_integer.dart new file mode 100644 index 000000000000..b91ca3455678 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/outer_enum_integer.dart @@ -0,0 +1,17 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum OuterEnumInteger { + @JsonValue(0) + number0, + @JsonValue(1) + number1, + @JsonValue(2) + number2, + @JsonValue(11184809) + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/outer_enum_integer_default_value.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/outer_enum_integer_default_value.dart new file mode 100644 index 000000000000..799321b37c85 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/outer_enum_integer_default_value.dart @@ -0,0 +1,17 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum OuterEnumIntegerDefaultValue { + @JsonValue(0) + number0, + @JsonValue(1) + number1, + @JsonValue(2) + number2, + @JsonValue(11184809) + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/outer_object_with_enum_property.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/outer_object_with_enum_property.dart new file mode 100644 index 000000000000..7620543d1f4a --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/outer_object_with_enum_property.dart @@ -0,0 +1,43 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/outer_enum_integer.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'outer_object_with_enum_property.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class OuterObjectWithEnumProperty { + /// Returns a new [OuterObjectWithEnumProperty] instance. + OuterObjectWithEnumProperty({ + required this.value, + }); + + @JsonKey(name: r'value', required: true, includeIfNull: false) + final OuterEnumInteger value; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is OuterObjectWithEnumProperty && other.value == value; + + @override + int get hashCode => value.hashCode; + + factory OuterObjectWithEnumProperty.fromJson(Map json) => + _$OuterObjectWithEnumPropertyFromJson(json); + + Map toJson() => _$OuterObjectWithEnumPropertyToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/pasta.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/pasta.dart new file mode 100644 index 000000000000..816d59814caf --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/pasta.dart @@ -0,0 +1,81 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'pasta.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Pasta { + /// Returns a new [Pasta] instance. + Pasta({ + this.vendor, + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + @JsonKey(name: r'vendor', required: false, includeIfNull: false) + final String? vendor; + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Pasta && + other.vendor == vendor && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + vendor.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory Pasta.fromJson(Map json) => _$PastaFromJson(json); + + Map toJson() => _$PastaToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/pet.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/pet.dart new file mode 100644 index 000000000000..58cdc030d017 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/pet.dart @@ -0,0 +1,88 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/category.dart'; +import 'package:openapi/src/model/tag.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'pet.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Pet { + /// Returns a new [Pet] instance. + Pet({ + this.id, + required this.name, + this.category, + required this.photoUrls, + this.tags, + this.status, + }); + + @JsonKey(name: r'id', required: false, includeIfNull: false) + final int? id; + + @JsonKey(name: r'name', required: true, includeIfNull: false) + final String name; + + @JsonKey(name: r'category', required: false, includeIfNull: false) + final Category? category; + + @JsonKey(name: r'photoUrls', required: true, includeIfNull: false) + final List photoUrls; + + @JsonKey(name: r'tags', required: false, includeIfNull: false) + final List? tags; + + /// pet status in the store + @JsonKey(name: r'status', required: false, includeIfNull: false) + final PetStatusEnum? status; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Pet && + other.id == id && + other.name == name && + other.category == category && + other.photoUrls == photoUrls && + other.tags == tags && + other.status == status; + + @override + int get hashCode => + id.hashCode + + name.hashCode + + category.hashCode + + photoUrls.hashCode + + tags.hashCode + + status.hashCode; + + factory Pet.fromJson(Map json) => _$PetFromJson(json); + + Map toJson() => _$PetToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} + +/// pet status in the store +enum PetStatusEnum { + @JsonValue(r'available') + available, + @JsonValue(r'pending') + pending, + @JsonValue(r'sold') + sold, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/pizza.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/pizza.dart new file mode 100644 index 000000000000..32d80d992a50 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/pizza.dart @@ -0,0 +1,81 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/entity.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'pizza.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Pizza { + /// Returns a new [Pizza] instance. + Pizza({ + this.pizzaSize, + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + @JsonKey(name: r'pizzaSize', required: false, includeIfNull: false) + final num? pizzaSize; + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Pizza && + other.pizzaSize == pizzaSize && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + pizzaSize.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory Pizza.fromJson(Map json) => _$PizzaFromJson(json); + + Map toJson() => _$PizzaToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/pizza_speziale.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/pizza_speziale.dart new file mode 100644 index 000000000000..07d031e8c289 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/pizza_speziale.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/pizza.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'pizza_speziale.g.dart'; + +// ignore_for_file: unused_import + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class PizzaSpeziale { + /// Returns a new [PizzaSpeziale] instance. + PizzaSpeziale({ + this.toppings, + this.href, + this.id, + this.atSchemaLocation, + this.atBaseType, + required this.atType, + }); + + @JsonKey(name: r'toppings', required: false, includeIfNull: false) + final String? toppings; + + /// Hyperlink reference + @JsonKey(name: r'href', required: false, includeIfNull: false) + final String? href; + + /// unique identifier + @JsonKey(name: r'id', required: false, includeIfNull: false) + final String? id; + + /// A URI to a JSON-Schema file that defines additional attributes and relationships + @JsonKey(name: r'@schemaLocation', required: false, includeIfNull: false) + final String? atSchemaLocation; + + /// When sub-classing, this defines the super-class + @JsonKey(name: r'@baseType', required: false, includeIfNull: false) + final String? atBaseType; + + /// When sub-classing, this defines the sub-class Extensible name + @JsonKey(name: r'@type', required: true, includeIfNull: false) + final String atType; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is PizzaSpeziale && + other.toppings == toppings && + other.href == href && + other.id == id && + other.atSchemaLocation == atSchemaLocation && + other.atBaseType == atBaseType && + other.atType == atType; + + @override + int get hashCode => + toppings.hashCode + + href.hashCode + + id.hashCode + + atSchemaLocation.hashCode + + atBaseType.hashCode + + atType.hashCode; + + factory PizzaSpeziale.fromJson(Map json) => + _$PizzaSpezialeFromJson(json); + + Map toJson() => _$PizzaSpezialeToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/read_only_first.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/read_only_first.dart new file mode 100644 index 000000000000..38c57afbafd8 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/read_only_first.dart @@ -0,0 +1,46 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'read_only_first.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ReadOnlyFirst { + /// Returns a new [ReadOnlyFirst] instance. + ReadOnlyFirst({ + this.bar, + this.baz, + }); + + @JsonKey(name: r'bar', required: false, includeIfNull: false) + final String? bar; + + @JsonKey(name: r'baz', required: false, includeIfNull: false) + final String? baz; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is ReadOnlyFirst && other.bar == bar && other.baz == baz; + + @override + int get hashCode => bar.hashCode + baz.hashCode; + + factory ReadOnlyFirst.fromJson(Map json) => + _$ReadOnlyFirstFromJson(json); + + Map toJson() => _$ReadOnlyFirstToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/single_ref_type.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/single_ref_type.dart new file mode 100644 index 000000000000..783d766acc82 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/single_ref_type.dart @@ -0,0 +1,15 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +enum SingleRefType { + @JsonValue(r'admin') + admin, + @JsonValue(r'user') + user, + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi, +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/special_model_name.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/special_model_name.dart new file mode 100644 index 000000000000..fe1029818a7f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/special_model_name.dart @@ -0,0 +1,47 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'special_model_name.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class SpecialModelName { + /// Returns a new [SpecialModelName] instance. + SpecialModelName({ + this.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket, + }); + + @JsonKey( + name: r'$special[property.name]', required: false, includeIfNull: false) + final int? dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is SpecialModelName && + other.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket == + dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + + @override + int get hashCode => + dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket + .hashCode; + + factory SpecialModelName.fromJson(Map json) => + _$SpecialModelNameFromJson(json); + + Map toJson() => _$SpecialModelNameToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/tag.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/tag.dart new file mode 100644 index 000000000000..e1c5a2c8cc1c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/tag.dart @@ -0,0 +1,45 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'tag.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Tag { + /// Returns a new [Tag] instance. + Tag({ + this.id, + this.name, + }); + + @JsonKey(name: r'id', required: false, includeIfNull: false) + final int? id; + + @JsonKey(name: r'name', required: false, includeIfNull: false) + final String? name; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Tag && other.id == id && other.name == name; + + @override + int get hashCode => id.hashCode + name.hashCode; + + factory Tag.fromJson(Map json) => _$TagFromJson(json); + + Map toJson() => _$TagToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart new file mode 100644 index 000000000000..cbea21d55960 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/test_query_style_form_explode_true_array_string_query_object_parameter.dart @@ -0,0 +1,47 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'test_query_style_form_explode_true_array_string_query_object_parameter.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter { + /// Returns a new [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter] instance. + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter({ + this.values, + }); + + @JsonKey(name: r'values', required: false, includeIfNull: false) + final List? values; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter && + other.values == values; + + @override + int get hashCode => values.hashCode; + + factory TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.fromJson( + Map json) => + _$TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterFromJson( + json); + + Map toJson() => + _$TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterToJson( + this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/user.dart b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/user.dart new file mode 100644 index 000000000000..f1da4cd38cab --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/lib/src/model/user.dart @@ -0,0 +1,86 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'user.g.dart'; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class User { + /// Returns a new [User] instance. + User({ + this.id, + this.username, + this.firstName, + this.lastName, + this.email, + this.password, + this.phone, + this.userStatus, + }); + + @JsonKey(name: r'id', required: false, includeIfNull: false) + final int? id; + + @JsonKey(name: r'username', required: false, includeIfNull: false) + final String? username; + + @JsonKey(name: r'firstName', required: false, includeIfNull: false) + final String? firstName; + + @JsonKey(name: r'lastName', required: false, includeIfNull: false) + final String? lastName; + + @JsonKey(name: r'email', required: false, includeIfNull: false) + final String? email; + + @JsonKey(name: r'password', required: false, includeIfNull: false) + final String? password; + + @JsonKey(name: r'phone', required: false, includeIfNull: false) + final String? phone; + + /// User Status + @JsonKey(name: r'userStatus', required: false, includeIfNull: false) + final int? userStatus; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is User && + other.id == id && + other.username == username && + other.firstName == firstName && + other.lastName == lastName && + other.email == email && + other.password == password && + other.phone == phone && + other.userStatus == userStatus; + + @override + int get hashCode => + id.hashCode + + username.hashCode + + firstName.hashCode + + lastName.hashCode + + email.hashCode + + password.hashCode + + phone.hashCode + + userStatus.hashCode; + + factory User.fromJson(Map json) => _$UserFromJson(json); + + Map toJson() => _$UserToJson(this); + + @override + String toString() { + return toJson().toString(); + } +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/pubspec.yaml b/samples/client/echo_api/dart/dart-http-json_serializable/pubspec.yaml new file mode 100644 index 000000000000..26f8b0be6050 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/pubspec.yaml @@ -0,0 +1,19 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client +homepage: homepage + +environment: + sdk: '>=2.14.0 <3.0.0' + +dependencies: + + http: '>=0.13.5 <2.0.0' + intl: '^0.17.0' + meta: '^1.1.8' + json_annotation: '^4.4.0' + +dev_dependencies: + build_runner: any + json_serializable: '^6.1.5' + test: ^1.16.0 diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/test/additional_properties_class_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/additional_properties_class_test.dart new file mode 100644 index 000000000000..28348e7fc36e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/test/addressable_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/addressable_test.dart new file mode 100644 index 000000000000..00e1b6eba940 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/addressable_test.dart @@ -0,0 +1,22 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/all_of_with_single_ref_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/all_of_with_single_ref_test.dart new file mode 100644 index 000000000000..92cbebda26cf --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/all_of_with_single_ref_test.dart @@ -0,0 +1,20 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/animal_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/animal_test.dart new file mode 100644 index 000000000000..d5464a4278b1 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/animal_test.dart @@ -0,0 +1,20 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/api_response_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/api_response_test.dart new file mode 100644 index 000000000000..3132ef4e8a51 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/api_response_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ApiResponse +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/apple_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/apple_test.dart new file mode 100644 index 000000000000..1c2c2037cd06 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/apple_test.dart @@ -0,0 +1,15 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/array_of_array_of_number_only_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/array_of_array_of_number_only_test.dart new file mode 100644 index 000000000000..f844a1cd920d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/test/array_of_number_only_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/array_of_number_only_test.dart new file mode 100644 index 000000000000..b547bb1728d8 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/array_of_number_only_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayOfNumberOnly +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/array_test_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/array_test_test.dart new file mode 100644 index 000000000000..83b1fee56fb0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/array_test_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayTest +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/banana_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/banana_test.dart new file mode 100644 index 000000000000..d5b0a6def843 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/banana_test.dart @@ -0,0 +1,15 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/bar_create_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/bar_create_test.dart new file mode 100644 index 000000000000..0833036690d6 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/bar_create_test.dart @@ -0,0 +1,55 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/bar_ref_or_value_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/bar_ref_or_value_test.dart new file mode 100644 index 000000000000..3088b2f6cd4e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/bar_ref_or_value_test.dart @@ -0,0 +1,40 @@ +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, () { + // 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/client/echo_api/dart/dart-http-json_serializable/test/bar_ref_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/bar_ref_test.dart new file mode 100644 index 000000000000..080a462d0be6 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/bar_ref_test.dart @@ -0,0 +1,40 @@ +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, () { + // 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/client/echo_api/dart/dart-http-json_serializable/test/bar_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/bar_test.dart new file mode 100644 index 000000000000..80bcd0c8227c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/bar_test.dart @@ -0,0 +1,54 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/body_api_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/body_api_test.dart new file mode 100644 index 000000000000..05eedc2d2540 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/body_api_test.dart @@ -0,0 +1,18 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for BodyApi +void main() { + final instance = Openapi().getBodyApi(); + + group(BodyApi, () { + // Test body parameter(s) + // + // Test body parameter(s) + // + //Future testEchoBodyPet({ Pet pet }) async + test('test testEchoBodyPet', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/test/capitalization_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/capitalization_test.dart new file mode 100644 index 000000000000..6d1094e22d0d --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/capitalization_test.dart @@ -0,0 +1,41 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/cat_all_of_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/cat_all_of_test.dart new file mode 100644 index 000000000000..c9df8b953a81 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/cat_all_of_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for CatAllOf +void main() { + final CatAllOf? instance = /* CatAllOf(...) */ null; + // TODO add properties to the entity + + group(CatAllOf, () { + // bool declawed + test('to test the property `declawed`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/test/cat_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/cat_test.dart new file mode 100644 index 000000000000..28e5faaeb1cd --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/cat_test.dart @@ -0,0 +1,25 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/category_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/category_test.dart new file mode 100644 index 000000000000..d4e1abb4179c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/category_test.dart @@ -0,0 +1,20 @@ +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 + test('to test the property `name`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/test/child_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/child_test.dart new file mode 100644 index 000000000000..48eac97bfd9c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/child_test.dart @@ -0,0 +1,15 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/class_model_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/class_model_test.dart new file mode 100644 index 000000000000..66305bae33e5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/class_model_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ClassModel +void main() { + final ClassModel? instance = /* ClassModel(...) */ null; + // TODO add properties to the entity + + group(ClassModel, () { + // String classField + test('to test the property `classField`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/test/deprecated_object_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/deprecated_object_test.dart new file mode 100644 index 000000000000..8668a44a0158 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/deprecated_object_test.dart @@ -0,0 +1,15 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/dog_all_of_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/dog_all_of_test.dart new file mode 100644 index 000000000000..ca5f74f20fbe --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/dog_all_of_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DogAllOf +void main() { + final DogAllOf? instance = /* DogAllOf(...) */ null; + // TODO add properties to the entity + + group(DogAllOf, () { + // String breed + test('to test the property `breed`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/test/dog_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/dog_test.dart new file mode 100644 index 000000000000..611f2a3fdc6f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/dog_test.dart @@ -0,0 +1,25 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/entity_ref_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/entity_ref_test.dart new file mode 100644 index 000000000000..6f3bf3393abc --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/entity_ref_test.dart @@ -0,0 +1,52 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/entity_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/entity_test.dart new file mode 100644 index 000000000000..72563a81a3e5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/entity_test.dart @@ -0,0 +1,40 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/enum_arrays_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/enum_arrays_test.dart new file mode 100644 index 000000000000..5c12838ce848 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/enum_arrays_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EnumArrays +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/enum_test_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/enum_test_test.dart new file mode 100644 index 000000000000..40083505d1c0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/enum_test_test.dart @@ -0,0 +1,50 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EnumTest +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/example_non_primitive_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/example_non_primitive_test.dart new file mode 100644 index 000000000000..dbc2c1fcae41 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/example_non_primitive_test.dart @@ -0,0 +1,10 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ExampleNonPrimitive +void main() { + final ExampleNonPrimitive? instance = /* ExampleNonPrimitive(...) */ null; + // TODO add properties to the entity + + group(ExampleNonPrimitive, () {}); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/test/example_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/example_test.dart new file mode 100644 index 000000000000..8c5b7ba11746 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/example_test.dart @@ -0,0 +1,15 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/extensible_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/extensible_test.dart new file mode 100644 index 000000000000..821bd1b142fa --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/extensible_test.dart @@ -0,0 +1,28 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/file_schema_test_class_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/file_schema_test_class_test.dart new file mode 100644 index 000000000000..14d7c2120cd9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/file_schema_test_class_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FileSchemaTestClass +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/foo_ref_or_value_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/foo_ref_or_value_test.dart new file mode 100644 index 000000000000..e5c101940aa0 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/foo_ref_or_value_test.dart @@ -0,0 +1,40 @@ +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, () { + // 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/client/echo_api/dart/dart-http-json_serializable/test/foo_ref_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/foo_ref_test.dart new file mode 100644 index 000000000000..fe14a0965722 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/foo_ref_test.dart @@ -0,0 +1,45 @@ +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 + }); + + // 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/client/echo_api/dart/dart-http-json_serializable/test/foo_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/foo_test.dart new file mode 100644 index 000000000000..42b4149f85b6 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/foo_test.dart @@ -0,0 +1,50 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/format_test_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/format_test_test.dart new file mode 100644 index 000000000000..93bb4ba3ca97 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/format_test_test.dart @@ -0,0 +1,92 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FormatTest +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/fruit_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/fruit_test.dart new file mode 100644 index 000000000000..e376b1d49990 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/fruit_test.dart @@ -0,0 +1,25 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/has_only_read_only_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/has_only_read_only_test.dart new file mode 100644 index 000000000000..5b33d9ca7457 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/has_only_read_only_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for HasOnlyReadOnly +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/health_check_result_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/health_check_result_test.dart new file mode 100644 index 000000000000..adc423fde5d8 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/health_check_result_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for HealthCheckResult +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/map_test_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/map_test_test.dart new file mode 100644 index 000000000000..e6efc4c58af7 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/map_test_test.dart @@ -0,0 +1,30 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for MapTest +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/mixed_properties_and_additional_properties_class_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/mixed_properties_and_additional_properties_class_test.dart new file mode 100644 index 000000000000..4f4ed38bff17 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/test/model200_response_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/model200_response_test.dart new file mode 100644 index 000000000000..217772fc7626 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/model200_response_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Model200Response +void main() { + final Model200Response? instance = /* Model200Response(...) */ null; + // TODO add properties to the entity + + group(Model200Response, () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // String classField + test('to test the property `classField`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/test/model_client_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/model_client_test.dart new file mode 100644 index 000000000000..5ea0a93ab265 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/model_client_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelClient +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/model_enum_class_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/model_enum_class_test.dart new file mode 100644 index 000000000000..fa31f816801c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/model_enum_class_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelEnumClass +void main() { + group(ModelEnumClass, () {}); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/test/model_file_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/model_file_test.dart new file mode 100644 index 000000000000..cfc5be5ba117 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/model_file_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelFile +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/model_list_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/model_list_test.dart new file mode 100644 index 000000000000..a4ff05980ee6 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/model_list_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelList +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/model_return_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/model_return_test.dart new file mode 100644 index 000000000000..2f97f6cf6ed7 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/model_return_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelReturn +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/name_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/name_test.dart new file mode 100644 index 000000000000..036c3d07845c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/name_test.dart @@ -0,0 +1,30 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/nullable_class_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/nullable_class_test.dart new file mode 100644 index 000000000000..b5b320cae68b --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/nullable_class_test.dart @@ -0,0 +1,70 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for NullableClass +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/number_only_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/number_only_test.dart new file mode 100644 index 000000000000..6764fbc7a8c5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/number_only_test.dart @@ -0,0 +1,15 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for NumberOnly +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/object_with_deprecated_fields_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/object_with_deprecated_fields_test.dart new file mode 100644 index 000000000000..dd0c27df02a3 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/test/order_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/order_test.dart new file mode 100644 index 000000000000..8d5cbc6a9df5 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/order_test.dart @@ -0,0 +1,41 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/outer_composite_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/outer_composite_test.dart new file mode 100644 index 000000000000..5d675fe37618 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/outer_composite_test.dart @@ -0,0 +1,25 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterComposite +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/outer_enum_default_value_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/outer_enum_default_value_test.dart new file mode 100644 index 000000000000..a5c83f615194 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/outer_enum_default_value_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumDefaultValue +void main() { + group(OuterEnumDefaultValue, () {}); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/test/outer_enum_integer_default_value_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/outer_enum_integer_default_value_test.dart new file mode 100644 index 000000000000..49ebbfcead7f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/outer_enum_integer_default_value_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumIntegerDefaultValue +void main() { + group(OuterEnumIntegerDefaultValue, () {}); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/test/outer_enum_integer_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/outer_enum_integer_test.dart new file mode 100644 index 000000000000..3c6b81305c71 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/outer_enum_integer_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumInteger +void main() { + group(OuterEnumInteger, () {}); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/test/outer_enum_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/outer_enum_test.dart new file mode 100644 index 000000000000..4ee10f379d5e --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/outer_enum_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnum +void main() { + group(OuterEnum, () {}); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/test/outer_object_with_enum_property_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/outer_object_with_enum_property_test.dart new file mode 100644 index 000000000000..c658fed371ec --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/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/client/echo_api/dart/dart-http-json_serializable/test/pasta_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/pasta_test.dart new file mode 100644 index 000000000000..98ba6325ac09 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/pasta_test.dart @@ -0,0 +1,45 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/path_api_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/path_api_test.dart new file mode 100644 index 000000000000..658f714ec35f --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/path_api_test.dart @@ -0,0 +1,18 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for PathApi +void main() { + final instance = Openapi().getPathApi(); + + group(PathApi, () { + // Test path parameter(s) + // + // Test path parameter(s) + // + //Future testsPathStringPathStringIntegerPathInteger(String pathString, int pathInteger) async + test('test testsPathStringPathStringIntegerPathInteger', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/test/pet_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/pet_test.dart new file mode 100644 index 000000000000..fdfc9dbd062c --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/pet_test.dart @@ -0,0 +1,41 @@ +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 + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // Category category + test('to test the property `category`', () async { + // TODO + }); + + // List 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/client/echo_api/dart/dart-http-json_serializable/test/pizza_speziale_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/pizza_speziale_test.dart new file mode 100644 index 000000000000..002deb101bfc --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/pizza_speziale_test.dart @@ -0,0 +1,45 @@ +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 + }); + + // 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/client/echo_api/dart/dart-http-json_serializable/test/pizza_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/pizza_test.dart new file mode 100644 index 000000000000..ea886dcc3a49 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/pizza_test.dart @@ -0,0 +1,45 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/query_api_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/query_api_test.dart new file mode 100644 index 000000000000..960e3b243e74 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/query_api_test.dart @@ -0,0 +1,36 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +/// tests for QueryApi +void main() { + final instance = Openapi().getQueryApi(); + + group(QueryApi, () { + // Test query parameter(s) + // + // Test query parameter(s) + // + //Future testQueryIntegerBooleanString({ int integerQuery, bool booleanQuery, String stringQuery }) async + test('test testQueryIntegerBooleanString', () async { + // TODO + }); + + // Test query parameter(s) + // + // Test query parameter(s) + // + //Future testQueryStyleFormExplodeTrueArrayString({ TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject }) async + test('test testQueryStyleFormExplodeTrueArrayString', () async { + // TODO + }); + + // Test query parameter(s) + // + // Test query parameter(s) + // + //Future testQueryStyleFormExplodeTrueObject({ Pet queryObject }) async + test('test testQueryStyleFormExplodeTrueObject', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/test/read_only_first_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/read_only_first_test.dart new file mode 100644 index 000000000000..4f4d9d207593 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/read_only_first_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ReadOnlyFirst +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/single_ref_type_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/single_ref_type_test.dart new file mode 100644 index 000000000000..2c265f0d24ae --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/single_ref_type_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for SingleRefType +void main() { + group(SingleRefType, () {}); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/test/special_model_name_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/special_model_name_test.dart new file mode 100644 index 000000000000..3a6043c9054b --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/special_model_name_test.dart @@ -0,0 +1,17 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for SpecialModelName +void main() { + final 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/client/echo_api/dart/dart-http-json_serializable/test/tag_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/tag_test.dart new file mode 100644 index 000000000000..df95f3461fd9 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/tag_test.dart @@ -0,0 +1,20 @@ +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/client/echo_api/dart/dart-http-json_serializable/test/test_query_style_form_explode_true_array_string_query_object_parameter_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/test_query_style_form_explode_true_array_string_query_object_parameter_test.dart new file mode 100644 index 000000000000..882e416d1958 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/test_query_style_form_explode_true_array_string_query_object_parameter_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter +void main() { + final TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? + instance = /* TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(...) */ null; + // TODO add properties to the entity + + group(TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter, () { + // List values + test('to test the property `values`', () async { + // TODO + }); + }); +} diff --git a/samples/client/echo_api/dart/dart-http-json_serializable/test/user_test.dart b/samples/client/echo_api/dart/dart-http-json_serializable/test/user_test.dart new file mode 100644 index 000000000000..fc1bb1cea555 --- /dev/null +++ b/samples/client/echo_api/dart/dart-http-json_serializable/test/user_test.dart @@ -0,0 +1,51 @@ +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 + }); + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/oneof/.openapi-generator/FILES deleted file mode 100644 index f1ab7b5540a3..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof/.openapi-generator/FILES +++ /dev/null @@ -1,23 +0,0 @@ -.gitignore -README.md -analysis_options.yaml -doc/Apple.md -doc/Banana.md -doc/DefaultApi.md -doc/Fruit.md -lib/openapi.dart -lib/src/api.dart -lib/src/api/default_api.dart -lib/src/api_util.dart -lib/src/auth/api_key_auth.dart -lib/src/auth/auth.dart -lib/src/auth/basic_auth.dart -lib/src/auth/bearer_auth.dart -lib/src/auth/oauth.dart -lib/src/date_serializer.dart -lib/src/model/apple.dart -lib/src/model/banana.dart -lib/src/model/date.dart -lib/src/model/fruit.dart -lib/src/serializers.dart -pubspec.yaml diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/README.md b/samples/openapi3/client/petstore/dart-dio/oneof/README.md deleted file mode 100644 index 53bfd08fec43..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof/README.md +++ /dev/null @@ -1,84 +0,0 @@ -# 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 -- Build package: org.openapitools.codegen.languages.DartDioClientCodegen - -## Requirements - -* Dart 2.12.0 or later OR Flutter 1.26.0 or later -* Dio 4.0.0+ - -## 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 DioError (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) - - -## Documentation For Authorization - - All endpoints do not require authorization. - - -## Author - - - diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart-dio/oneof/doc/DefaultApi.md deleted file mode 100644 index 41c9b6f94116..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof/doc/DefaultApi.md +++ /dev/null @@ -1,51 +0,0 @@ -# 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 DioError (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/oneof/lib/openapi.dart b/samples/openapi3/client/petstore/dart-dio/oneof/lib/openapi.dart deleted file mode 100644 index d85a16fc6ad9..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof/lib/openapi.dart +++ /dev/null @@ -1,16 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// - -export 'package:openapi/src/api.dart'; -export 'package:openapi/src/auth/api_key_auth.dart'; -export 'package:openapi/src/auth/basic_auth.dart'; -export 'package:openapi/src/auth/oauth.dart'; -export 'package:openapi/src/serializers.dart'; -export 'package:openapi/src/model/date.dart'; - -export 'package:openapi/src/api/default_api.dart'; - -export 'package:openapi/src/model/apple.dart'; -export 'package:openapi/src/model/banana.dart'; -export 'package:openapi/src/model/fruit.dart'; diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/auth/basic_auth.dart b/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/auth/basic_auth.dart deleted file mode 100644 index b6e6dce04f9c..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/auth/basic_auth.dart +++ /dev/null @@ -1,37 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// - -import 'dart:convert'; - -import 'package:dio/dio.dart'; -import 'package:openapi/src/auth/auth.dart'; - -class BasicAuthInfo { - final String username; - final String password; - - const BasicAuthInfo(this.username, this.password); -} - -class BasicAuthInterceptor extends AuthInterceptor { - final Map authInfo = {}; - - @override - void onRequest( - RequestOptions options, - RequestInterceptorHandler handler, - ) { - final metadataAuthInfo = getAuthInfo(options, (secure) => (secure['type'] == 'http' && secure['scheme'] == 'basic') || secure['type'] == 'basic'); - for (final info in metadataAuthInfo) { - final authName = info['name'] as String; - final basicAuthInfo = authInfo[authName]; - if (basicAuthInfo != null) { - final basicAuth = 'Basic ${base64Encode(utf8.encode('${basicAuthInfo.username}:${basicAuthInfo.password}'))}'; - options.headers['Authorization'] = basicAuth; - break; - } - } - super.onRequest(options, handler); - } -} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/auth/bearer_auth.dart b/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/auth/bearer_auth.dart deleted file mode 100644 index 1d4402b376c0..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/auth/bearer_auth.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// - -import 'package:dio/dio.dart'; -import 'package:openapi/src/auth/auth.dart'; - -class BearerAuthInterceptor extends AuthInterceptor { - final Map tokens = {}; - - @override - void onRequest( - RequestOptions options, - RequestInterceptorHandler handler, - ) { - final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'http' && secure['scheme'] == 'bearer'); - for (final info in authInfo) { - final token = tokens[info['name']]; - if (token != null) { - options.headers['Authorization'] = 'Bearer ${token}'; - break; - } - } - super.onRequest(options, handler); - } -} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/serializers.dart b/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/serializers.dart deleted file mode 100644 index ddb1d66a1f5e..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof/lib/src/serializers.dart +++ /dev/null @@ -1,36 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// - -// ignore_for_file: unused_import - -import 'package:one_of_serializer/any_of_serializer.dart'; -import 'package:one_of_serializer/one_of_serializer.dart'; -import 'package:built_collection/built_collection.dart'; -import 'package:built_value/json_object.dart'; -import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart'; -import 'package:built_value/iso_8601_date_time_serializer.dart'; -import 'package:openapi/src/date_serializer.dart'; -import 'package:openapi/src/model/date.dart'; - -import 'package:openapi/src/model/apple.dart'; -import 'package:openapi/src/model/banana.dart'; -import 'package:openapi/src/model/fruit.dart'; - -part 'serializers.g.dart'; - -@SerializersFor([ - Apple, - Banana, - Fruit, -]) -Serializers serializers = (_$serializers.toBuilder() - ..add(const OneOfSerializer()) - ..add(const AnyOfSerializer()) - ..add(const DateSerializer()) - ..add(Iso8601DateTimeSerializer())) - .build(); - -Serializers standardSerializers = - (serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build(); diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/pom.xml b/samples/openapi3/client/petstore/dart-dio/oneof/pom.xml deleted file mode 100644 index 810c7d48d77f..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof/pom.xml +++ /dev/null @@ -1,88 +0,0 @@ - - 4.0.0 - org.openapitools - DartDioOneOf - pom - 1.0.0-SNAPSHOT - DartDio OneOf - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory} - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - pub-get - pre-integration-test - - exec - - - pub - - get - - - - - pub-run-build-runner - pre-integration-test - - exec - - - pub - - run - build_runner - build - - - - - dart-analyze - integration-test - - exec - - - dart - - analyze - --fatal-infos - - - - - dart-test - integration-test - - exec - - - dart - - test - - - - - - - - diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio/oneof/pubspec.yaml deleted file mode 100644 index fb676f65c393..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof/pubspec.yaml +++ /dev/null @@ -1,19 +0,0 @@ -name: openapi -version: 1.0.0 -description: OpenAPI API client -homepage: homepage - -environment: - sdk: '>=2.12.0 <3.0.0' - -dependencies: - dio: '>=4.0.1 <5.0.0' - one_of: '>=1.5.0 <2.0.0' - one_of_serializer: '>=1.5.0 <2.0.0' - built_value: '>=8.4.0 <9.0.0' - built_collection: '>=5.1.1 <6.0.0' - -dev_dependencies: - built_value_generator: '>=8.4.0 <9.0.0' - build_runner: any - test: ^1.16.0 diff --git a/samples/openapi3/client/petstore/dart-dio/oneof/test/default_api_test.dart b/samples/openapi3/client/petstore/dart-dio/oneof/test/default_api_test.dart deleted file mode 100644 index 07d256d2e554..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof/test/default_api_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -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/oneof_polymorphism_and_inheritance/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/.openapi-generator/FILES deleted file mode 100644 index 52a900a19623..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/.openapi-generator/FILES +++ /dev/null @@ -1,47 +0,0 @@ -.gitignore -README.md -analysis_options.yaml -doc/Addressable.md -doc/Bar.md -doc/BarApi.md -doc/BarCreate.md -doc/BarRef.md -doc/BarRefOrValue.md -doc/Entity.md -doc/EntityRef.md -doc/Extensible.md -doc/Foo.md -doc/FooApi.md -doc/FooRef.md -doc/FooRefOrValue.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/api_util.dart -lib/src/auth/api_key_auth.dart -lib/src/auth/auth.dart -lib/src/auth/basic_auth.dart -lib/src/auth/bearer_auth.dart -lib/src/auth/oauth.dart -lib/src/date_serializer.dart -lib/src/model/addressable.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/date.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/pasta.dart -lib/src/model/pizza.dart -lib/src/model/pizza_speziale.dart -lib/src/serializers.dart -pubspec.yaml diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/README.md b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/README.md deleted file mode 100644 index 6a3fea771a12..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/README.md +++ /dev/null @@ -1,99 +0,0 @@ -# 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 -- Build package: org.openapitools.codegen.languages.DartDioClientCodegen - -## Requirements - -* Dart 2.12.0 or later OR Flutter 1.26.0 or later -* Dio 4.0.0+ - -## 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 DioError (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) - - [Bar](doc/Bar.md) - - [BarCreate](doc/BarCreate.md) - - [BarRef](doc/BarRef.md) - - [BarRefOrValue](doc/BarRefOrValue.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) - - [Pasta](doc/Pasta.md) - - [Pizza](doc/Pizza.md) - - [PizzaSpeziale](doc/PizzaSpeziale.md) - - -## Documentation For Authorization - - All endpoints do not require authorization. - - -## Author - - - diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/FooApi.md b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/FooApi.md deleted file mode 100644 index 9e8990ebb8b3..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/doc/FooApi.md +++ /dev/null @@ -1,93 +0,0 @@ -# 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 DioError (e) { - print('Exception when calling FooApi->createFoo: $e\n'); -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **foo** | [**Foo**](Foo.md)| The Foo to be created | [optional] - -### Return type - -[**FooRefOrValue**](FooRefOrValue.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json;charset=utf-8 - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **getAllFoos** -> BuiltList getAllFoos() - -GET all Foos - -### Example -```dart -import 'package:openapi/api.dart'; - -final api = Openapi().getFooApi(); - -try { - final response = api.getAllFoos(); - print(response); -} catch on DioError (e) { - print('Exception when calling FooApi->getAllFoos: $e\n'); -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -[**BuiltList<FooRefOrValue>**](FooRefOrValue.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json;charset=utf-8 - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/openapi.dart b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/openapi.dart deleted file mode 100644 index ea87a7cb4761..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/openapi.dart +++ /dev/null @@ -1,28 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// - -export 'package:openapi/src/api.dart'; -export 'package:openapi/src/auth/api_key_auth.dart'; -export 'package:openapi/src/auth/basic_auth.dart'; -export 'package:openapi/src/auth/oauth.dart'; -export 'package:openapi/src/serializers.dart'; -export 'package:openapi/src/model/date.dart'; - -export 'package:openapi/src/api/bar_api.dart'; -export 'package:openapi/src/api/foo_api.dart'; - -export 'package:openapi/src/model/addressable.dart'; -export 'package:openapi/src/model/bar.dart'; -export 'package:openapi/src/model/bar_create.dart'; -export 'package:openapi/src/model/bar_ref.dart'; -export 'package:openapi/src/model/bar_ref_or_value.dart'; -export 'package:openapi/src/model/entity.dart'; -export 'package:openapi/src/model/entity_ref.dart'; -export 'package:openapi/src/model/extensible.dart'; -export 'package:openapi/src/model/foo.dart'; -export 'package:openapi/src/model/foo_ref.dart'; -export 'package:openapi/src/model/foo_ref_or_value.dart'; -export 'package:openapi/src/model/pasta.dart'; -export 'package:openapi/src/model/pizza.dart'; -export 'package:openapi/src/model/pizza_speziale.dart'; diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api/foo_api.dart b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api/foo_api.dart deleted file mode 100644 index 232392c76a70..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api/foo_api.dart +++ /dev/null @@ -1,187 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// - -import 'dart:async'; - -import 'package:built_value/serializer.dart'; -import 'package:dio/dio.dart'; - -import 'package:built_collection/built_collection.dart'; -import 'package:openapi/src/model/foo.dart'; -import 'package:openapi/src/model/foo_ref_or_value.dart'; - -class FooApi { - - final Dio _dio; - - final Serializers _serializers; - - const FooApi(this._dio, this._serializers); - - /// 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 [DioError] 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 { - const _type = FullType(Foo); - _bodyData = foo == null ? null : _serializers.serialize(foo, specifiedType: _type); - - } catch(error, stackTrace) { - throw DioError( - requestOptions: _options.compose( - _dio.options, - _path, - ), - type: DioErrorType.other, - error: error, - )..stackTrace = stackTrace; - } - - final _response = await _dio.request( - _path, - data: _bodyData, - options: _options, - cancelToken: cancelToken, - onSendProgress: onSendProgress, - onReceiveProgress: onReceiveProgress, - ); - - FooRefOrValue _responseData; - - try { - const _responseType = FullType(FooRefOrValue); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, - ) as FooRefOrValue; - - } catch (error, stackTrace) { - throw DioError( - requestOptions: _response.requestOptions, - response: _response, - type: DioErrorType.other, - error: error, - )..stackTrace = stackTrace; - } - - return Response( - data: _responseData, - headers: _response.headers, - isRedirect: _response.isRedirect, - requestOptions: _response.requestOptions, - redirects: _response.redirects, - statusCode: _response.statusCode, - statusMessage: _response.statusMessage, - extra: _response.extra, - ); - } - - /// GET all Foos - /// - /// - /// Parameters: - /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation - /// * [headers] - Can be used to add additional headers to the request - /// * [extras] - Can be used to add flags to the request - /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response - /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress - /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress - /// - /// Returns a [Future] containing a [Response] with a [BuiltList] as data - /// Throws [DioError] 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, - ); - - BuiltList _responseData; - - try { - const _responseType = FullType(BuiltList, [FullType(FooRefOrValue)]); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, - ) as BuiltList; - - } catch (error, stackTrace) { - throw DioError( - requestOptions: _response.requestOptions, - response: _response, - type: DioErrorType.other, - 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/oneof_polymorphism_and_inheritance/lib/src/api_util.dart b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api_util.dart deleted file mode 100644 index ed3bb12f25b8..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/api_util.dart +++ /dev/null @@ -1,77 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// - -import 'dart:convert'; -import 'dart:typed_data'; - -import 'package:built_collection/built_collection.dart'; -import 'package:built_value/serializer.dart'; -import 'package:dio/dio.dart'; - -/// Format the given form parameter object into something that Dio can handle. -/// Returns primitive or String. -/// Returns List/Map if the value is BuildList/BuiltMap. -dynamic encodeFormParameter(Serializers serializers, dynamic value, FullType type) { - if (value == null) { - return ''; - } - if (value is String || value is num || value is bool) { - return value; - } - final serialized = serializers.serialize( - value as Object, - specifiedType: type, - ); - if (serialized is String) { - return serialized; - } - if (value is BuiltList || value is BuiltSet || value is BuiltMap) { - return serialized; - } - return json.encode(serialized); -} - -dynamic encodeQueryParameter( - Serializers serializers, - dynamic value, - FullType type, -) { - if (value == null) { - return ''; - } - if (value is String || value is num || value is bool) { - return value; - } - if (value is Uint8List) { - // Currently not sure how to serialize this - return value; - } - final serialized = serializers.serialize( - value as Object, - specifiedType: type, - ); - if (serialized == null) { - return ''; - } - if (serialized is String) { - return serialized; - } - return serialized; -} - -ListParam encodeCollectionQueryParameter( - Serializers serializers, - dynamic value, - FullType type, { - ListFormat format = ListFormat.multi, -}) { - final serialized = serializers.serialize( - value as Object, - specifiedType: type, - ); - if (value is BuiltList || value is BuiltSet) { - return ListParam(List.of((serialized as Iterable).cast()), format); - } - throw ArgumentError('Invalid value passed to encodeCollectionQueryParameter'); -} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/auth/auth.dart b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/auth/auth.dart deleted file mode 100644 index f7ae9bf3f11e..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/auth/auth.dart +++ /dev/null @@ -1,18 +0,0 @@ -// -// 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/oneof_polymorphism_and_inheritance/lib/src/serializers.dart b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/serializers.dart deleted file mode 100644 index 55083251e5e8..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/lib/src/serializers.dart +++ /dev/null @@ -1,67 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// - -// ignore_for_file: unused_import - -import 'package:one_of_serializer/any_of_serializer.dart'; -import 'package:one_of_serializer/one_of_serializer.dart'; -import 'package:built_collection/built_collection.dart'; -import 'package:built_value/json_object.dart'; -import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart'; -import 'package:built_value/iso_8601_date_time_serializer.dart'; -import 'package:openapi/src/date_serializer.dart'; -import 'package:openapi/src/model/date.dart'; - -import 'package:openapi/src/model/addressable.dart'; -import 'package:openapi/src/model/bar.dart'; -import 'package:openapi/src/model/bar_create.dart'; -import 'package:openapi/src/model/bar_ref.dart'; -import 'package:openapi/src/model/bar_ref_or_value.dart'; -import 'package:openapi/src/model/entity.dart'; -import 'package:openapi/src/model/entity_ref.dart'; -import 'package:openapi/src/model/extensible.dart'; -import 'package:openapi/src/model/foo.dart'; -import 'package:openapi/src/model/foo_ref.dart'; -import 'package:openapi/src/model/foo_ref_or_value.dart'; -import 'package:openapi/src/model/pasta.dart'; -import 'package:openapi/src/model/pizza.dart'; -import 'package:openapi/src/model/pizza_speziale.dart'; - -part 'serializers.g.dart'; - -@SerializersFor([ - Addressable,$Addressable, - Bar, - BarCreate, - BarRef, - BarRefOrValue, - Entity,$Entity, - EntityRef,$EntityRef, - Extensible,$Extensible, - Foo, - FooRef, - FooRefOrValue, - Pasta, - Pizza,$Pizza, - PizzaSpeziale, -]) -Serializers serializers = (_$serializers.toBuilder() - ..addBuilderFactory( - const FullType(BuiltList, [FullType(FooRefOrValue)]), - () => ListBuilder(), - ) - ..add(Addressable.serializer) - ..add(Entity.serializer) - ..add(EntityRef.serializer) - ..add(Extensible.serializer) - ..add(Pizza.serializer) - ..add(const OneOfSerializer()) - ..add(const AnyOfSerializer()) - ..add(const DateSerializer()) - ..add(Iso8601DateTimeSerializer())) - .build(); - -Serializers standardSerializers = - (serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build(); diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/pom.xml b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/pom.xml deleted file mode 100644 index 50f62b7f8dae..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/pom.xml +++ /dev/null @@ -1,88 +0,0 @@ - - 4.0.0 - org.openapitools - DartDioOneOfPolymorphismAndInheritance - pom - 1.0.0-SNAPSHOT - DartDio OneOf Polymorphism and Inheritance - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory} - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - pub-get - pre-integration-test - - exec - - - pub - - get - - - - - pub-run-build-runner - pre-integration-test - - exec - - - pub - - run - build_runner - build - - - - - dart-analyze - integration-test - - exec - - - dart - - analyze - --fatal-infos - - - - - dart-test - integration-test - - exec - - - dart - - test - - - - - - - - diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/bar_api_test.dart b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/bar_api_test.dart deleted file mode 100644 index 73be91c446e0..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/bar_api_test.dart +++ /dev/null @@ -1,18 +0,0 @@ -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/oneof_polymorphism_and_inheritance/test/foo_api_test.dart b/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/foo_api_test.dart deleted file mode 100644 index f33986a08b69..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_polymorphism_and_inheritance/test/foo_api_test.dart +++ /dev/null @@ -1,25 +0,0 @@ -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/oneof_primitive/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/.openapi-generator/FILES deleted file mode 100644 index 7f2ac59bf645..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/.openapi-generator/FILES +++ /dev/null @@ -1,21 +0,0 @@ -.gitignore -README.md -analysis_options.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/api_util.dart -lib/src/auth/api_key_auth.dart -lib/src/auth/auth.dart -lib/src/auth/basic_auth.dart -lib/src/auth/bearer_auth.dart -lib/src/auth/oauth.dart -lib/src/date_serializer.dart -lib/src/model/child.dart -lib/src/model/date.dart -lib/src/model/example.dart -lib/src/serializers.dart -pubspec.yaml diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/README.md b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/README.md deleted file mode 100644 index d73bafd4c64f..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# 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 -- Build package: org.openapitools.codegen.languages.DartDioClientCodegen - -## Requirements - -* Dart 2.12.0 or later OR Flutter 1.26.0 or later -* Dio 4.0.0+ - -## 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 DioError (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 - - All endpoints do not require authorization. - - -## Author - - - diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/doc/DefaultApi.md deleted file mode 100644 index abbf5f07f499..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/doc/DefaultApi.md +++ /dev/null @@ -1,51 +0,0 @@ -# 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 DioError (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/oneof_primitive/lib/openapi.dart b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/openapi.dart deleted file mode 100644 index 220621d6961b..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/openapi.dart +++ /dev/null @@ -1,15 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// - -export 'package:openapi/src/api.dart'; -export 'package:openapi/src/auth/api_key_auth.dart'; -export 'package:openapi/src/auth/basic_auth.dart'; -export 'package:openapi/src/auth/oauth.dart'; -export 'package:openapi/src/serializers.dart'; -export 'package:openapi/src/model/date.dart'; - -export 'package:openapi/src/api/default_api.dart'; - -export 'package:openapi/src/model/child.dart'; -export 'package:openapi/src/model/example.dart'; diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/api_util.dart b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/api_util.dart deleted file mode 100644 index ed3bb12f25b8..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/api_util.dart +++ /dev/null @@ -1,77 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// - -import 'dart:convert'; -import 'dart:typed_data'; - -import 'package:built_collection/built_collection.dart'; -import 'package:built_value/serializer.dart'; -import 'package:dio/dio.dart'; - -/// Format the given form parameter object into something that Dio can handle. -/// Returns primitive or String. -/// Returns List/Map if the value is BuildList/BuiltMap. -dynamic encodeFormParameter(Serializers serializers, dynamic value, FullType type) { - if (value == null) { - return ''; - } - if (value is String || value is num || value is bool) { - return value; - } - final serialized = serializers.serialize( - value as Object, - specifiedType: type, - ); - if (serialized is String) { - return serialized; - } - if (value is BuiltList || value is BuiltSet || value is BuiltMap) { - return serialized; - } - return json.encode(serialized); -} - -dynamic encodeQueryParameter( - Serializers serializers, - dynamic value, - FullType type, -) { - if (value == null) { - return ''; - } - if (value is String || value is num || value is bool) { - return value; - } - if (value is Uint8List) { - // Currently not sure how to serialize this - return value; - } - final serialized = serializers.serialize( - value as Object, - specifiedType: type, - ); - if (serialized == null) { - return ''; - } - if (serialized is String) { - return serialized; - } - return serialized; -} - -ListParam encodeCollectionQueryParameter( - Serializers serializers, - dynamic value, - FullType type, { - ListFormat format = ListFormat.multi, -}) { - final serialized = serializers.serialize( - value as Object, - specifiedType: type, - ); - if (value is BuiltList || value is BuiltSet) { - return ListParam(List.of((serialized as Iterable).cast()), format); - } - throw ArgumentError('Invalid value passed to encodeCollectionQueryParameter'); -} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/auth/api_key_auth.dart deleted file mode 100644 index ee16e3f0f92f..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/auth/api_key_auth.dart +++ /dev/null @@ -1,30 +0,0 @@ -// -// 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/oneof_primitive/lib/src/auth/oauth.dart b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/auth/oauth.dart deleted file mode 100644 index 337cf762b0ce..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/auth/oauth.dart +++ /dev/null @@ -1,26 +0,0 @@ -// -// 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/oneof_primitive/lib/src/date_serializer.dart b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/date_serializer.dart deleted file mode 100644 index db3c5c437db1..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/date_serializer.dart +++ /dev/null @@ -1,31 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// - -import 'package:built_collection/built_collection.dart'; -import 'package:built_value/serializer.dart'; -import 'package:openapi/src/model/date.dart'; - -class DateSerializer implements PrimitiveSerializer { - - const DateSerializer(); - - @override - Iterable get types => BuiltList.of([Date]); - - @override - String get wireName => 'Date'; - - @override - Date deserialize(Serializers serializers, Object serialized, - {FullType specifiedType = FullType.unspecified}) { - final parsed = DateTime.parse(serialized as String); - return Date(parsed.year, parsed.month, parsed.day); - } - - @override - Object serialize(Serializers serializers, Date date, - {FullType specifiedType = FullType.unspecified}) { - return date.toString(); - } -} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/model/date.dart b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/model/date.dart deleted file mode 100644 index b21c7f544bee..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/model/date.dart +++ /dev/null @@ -1,70 +0,0 @@ -/// A gregorian calendar date generated by -/// OpenAPI generator to differentiate -/// between [DateTime] and [Date] formats. -class Date implements Comparable { - final int year; - - /// January is 1. - final int month; - - /// First day is 1. - final int day; - - Date(this.year, this.month, this.day); - - /// The current date - static Date now({bool utc = false}) { - var now = DateTime.now(); - if (utc) { - now = now.toUtc(); - } - return now.toDate(); - } - - /// Convert to a [DateTime]. - DateTime toDateTime({bool utc = false}) { - if (utc) { - return DateTime.utc(year, month, day); - } else { - return DateTime(year, month, day); - } - } - - @override - int compareTo(Date other) { - int d = year.compareTo(other.year); - if (d != 0) { - return d; - } - d = month.compareTo(other.month); - if (d != 0) { - return d; - } - return day.compareTo(other.day); - } - - @override - bool operator ==(Object other) => - identical(this, other) || - other is Date && - runtimeType == other.runtimeType && - year == other.year && - month == other.month && - day == other.day; - - @override - int get hashCode => year.hashCode ^ month.hashCode ^ day.hashCode; - - @override - String toString() { - final yyyy = year.toString(); - final mm = month.toString().padLeft(2, '0'); - final dd = day.toString().padLeft(2, '0'); - - return '$yyyy-$mm-$dd'; - } -} - -extension DateTimeToDate on DateTime { - Date toDate() => Date(year, month, day); -} diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/serializers.dart b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/serializers.dart deleted file mode 100644 index cbd8870dc676..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/lib/src/serializers.dart +++ /dev/null @@ -1,34 +0,0 @@ -// -// AUTO-GENERATED FILE, DO NOT MODIFY! -// - -// ignore_for_file: unused_import - -import 'package:one_of_serializer/any_of_serializer.dart'; -import 'package:one_of_serializer/one_of_serializer.dart'; -import 'package:built_collection/built_collection.dart'; -import 'package:built_value/json_object.dart'; -import 'package:built_value/serializer.dart'; -import 'package:built_value/standard_json_plugin.dart'; -import 'package:built_value/iso_8601_date_time_serializer.dart'; -import 'package:openapi/src/date_serializer.dart'; -import 'package:openapi/src/model/date.dart'; - -import 'package:openapi/src/model/child.dart'; -import 'package:openapi/src/model/example.dart'; - -part 'serializers.g.dart'; - -@SerializersFor([ - Child, - Example, -]) -Serializers serializers = (_$serializers.toBuilder() - ..add(const OneOfSerializer()) - ..add(const AnyOfSerializer()) - ..add(const DateSerializer()) - ..add(Iso8601DateTimeSerializer())) - .build(); - -Serializers standardSerializers = - (serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build(); diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/pom.xml b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/pom.xml deleted file mode 100644 index cceaebd895f6..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/pom.xml +++ /dev/null @@ -1,88 +0,0 @@ - - 4.0.0 - org.openapitools - DartDioOneOfPrimitive - pom - 1.0.0-SNAPSHOT - DartDio OneOf Primitive - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory} - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - pub-get - pre-integration-test - - exec - - - pub - - get - - - - - pub-run-build-runner - pre-integration-test - - exec - - - pub - - run - build_runner - build - - - - - dart-analyze - integration-test - - exec - - - dart - - analyze - --fatal-infos - - - - - dart-test - integration-test - - exec - - - dart - - test - - - - - - - - diff --git a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/test/default_api_test.dart b/samples/openapi3/client/petstore/dart-dio/oneof_primitive/test/default_api_test.dart deleted file mode 100644 index e4ec57077946..000000000000 --- a/samples/openapi3/client/petstore/dart-dio/oneof_primitive/test/default_api_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -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/petstore_client_lib_fake-json_serializable/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/.openapi-generator/FILES index b34094eb0a2f..076f3ef85168 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/.openapi-generator/FILES @@ -66,12 +66,14 @@ 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/_exports.dart lib/src/auth/api_key_auth.dart lib/src/auth/auth.dart lib/src/auth/basic_auth.dart lib/src/auth/bearer_auth.dart lib/src/auth/oauth.dart lib/src/deserialize.dart +lib/src/model/_exports.dart lib/src/model/additional_properties_class.dart lib/src/model/all_of_with_single_ref.dart lib/src/model/animal.dart diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md index 0f37d1167220..d157f07330a4 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md @@ -1,4 +1,4 @@ -# openapi (EXPERIMENTAL) +# openapi 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: diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/openapi.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/openapi.dart index 3beabf11dfcd..2b5a605452bc 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/openapi.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/openapi.dart @@ -3,9 +3,7 @@ // export 'package:openapi/src/api.dart'; -export 'package:openapi/src/auth/api_key_auth.dart'; -export 'package:openapi/src/auth/basic_auth.dart'; -export 'package:openapi/src/auth/oauth.dart'; +export 'package:openapi/src/auth/_exports.dart'; export 'package:openapi/src/api/another_fake_api.dart'; @@ -16,51 +14,4 @@ export 'package:openapi/src/api/pet_api.dart'; export 'package:openapi/src/api/store_api.dart'; export 'package:openapi/src/api/user_api.dart'; -export 'package:openapi/src/model/additional_properties_class.dart'; -export 'package:openapi/src/model/all_of_with_single_ref.dart'; -export 'package:openapi/src/model/animal.dart'; -export 'package:openapi/src/model/api_response.dart'; -export 'package:openapi/src/model/array_of_array_of_number_only.dart'; -export 'package:openapi/src/model/array_of_number_only.dart'; -export 'package:openapi/src/model/array_test.dart'; -export 'package:openapi/src/model/capitalization.dart'; -export 'package:openapi/src/model/cat.dart'; -export 'package:openapi/src/model/cat_all_of.dart'; -export 'package:openapi/src/model/category.dart'; -export 'package:openapi/src/model/class_model.dart'; -export 'package:openapi/src/model/deprecated_object.dart'; -export 'package:openapi/src/model/dog.dart'; -export 'package:openapi/src/model/dog_all_of.dart'; -export 'package:openapi/src/model/enum_arrays.dart'; -export 'package:openapi/src/model/enum_test.dart'; -export 'package:openapi/src/model/file_schema_test_class.dart'; -export 'package:openapi/src/model/foo.dart'; -export 'package:openapi/src/model/foo_get_default_response.dart'; -export 'package:openapi/src/model/format_test.dart'; -export 'package:openapi/src/model/has_only_read_only.dart'; -export 'package:openapi/src/model/health_check_result.dart'; -export 'package:openapi/src/model/map_test.dart'; -export 'package:openapi/src/model/mixed_properties_and_additional_properties_class.dart'; -export 'package:openapi/src/model/model200_response.dart'; -export 'package:openapi/src/model/model_client.dart'; -export 'package:openapi/src/model/model_enum_class.dart'; -export 'package:openapi/src/model/model_file.dart'; -export 'package:openapi/src/model/model_list.dart'; -export 'package:openapi/src/model/model_return.dart'; -export 'package:openapi/src/model/name.dart'; -export 'package:openapi/src/model/nullable_class.dart'; -export 'package:openapi/src/model/number_only.dart'; -export 'package:openapi/src/model/object_with_deprecated_fields.dart'; -export 'package:openapi/src/model/order.dart'; -export 'package:openapi/src/model/outer_composite.dart'; -export 'package:openapi/src/model/outer_enum.dart'; -export 'package:openapi/src/model/outer_enum_default_value.dart'; -export 'package:openapi/src/model/outer_enum_integer.dart'; -export 'package:openapi/src/model/outer_enum_integer_default_value.dart'; -export 'package:openapi/src/model/outer_object_with_enum_property.dart'; -export 'package:openapi/src/model/pet.dart'; -export 'package:openapi/src/model/read_only_first.dart'; -export 'package:openapi/src/model/single_ref_type.dart'; -export 'package:openapi/src/model/special_model_name.dart'; -export 'package:openapi/src/model/tag.dart'; -export 'package:openapi/src/model/user.dart'; +export 'package:openapi/src/model/_exports.dart'; \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api.dart index 55cd646d296e..82ad544e6591 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api.dart @@ -3,10 +3,7 @@ // 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/auth/_exports.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'; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/_exports.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/_exports.dart new file mode 100644 index 000000000000..3bee6983bf3f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/_exports.dart @@ -0,0 +1,10 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + + +export 'api_key_auth.dart'; +export 'auth.dart'; +export 'basic_auth.dart'; +export 'bearer_auth.dart'; +export 'oauth.dart'; \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/api_key_auth.dart index ee16e3f0f92f..2d204c199d92 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/api_key_auth.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/api_key_auth.dart @@ -4,7 +4,7 @@ import 'package:dio/dio.dart'; -import 'package:openapi/src/auth/auth.dart'; +import 'auth.dart'; class ApiKeyAuthInterceptor extends AuthInterceptor { final Map apiKeys = {}; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/basic_auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/basic_auth.dart index b6e6dce04f9c..72cfa13cd9ab 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/basic_auth.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/basic_auth.dart @@ -5,7 +5,7 @@ import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:openapi/src/auth/auth.dart'; +import 'auth.dart'; class BasicAuthInfo { final String username; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/bearer_auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/bearer_auth.dart index 1d4402b376c0..7e22eaf74b07 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/bearer_auth.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/bearer_auth.dart @@ -3,7 +3,7 @@ // import 'package:dio/dio.dart'; -import 'package:openapi/src/auth/auth.dart'; +import 'auth.dart'; class BearerAuthInterceptor extends AuthInterceptor { final Map tokens = {}; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/oauth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/oauth.dart index 337cf762b0ce..2f5fa42b7e17 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/oauth.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/auth/oauth.dart @@ -3,7 +3,7 @@ // import 'package:dio/dio.dart'; -import 'package:openapi/src/auth/auth.dart'; +import 'auth.dart'; class OAuthInterceptor extends AuthInterceptor { final Map tokens = {}; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/_exports.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/_exports.dart new file mode 100644 index 000000000000..c57a76bafa9c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/_exports.dart @@ -0,0 +1,49 @@ +export 'additional_properties_class.dart'; +export 'all_of_with_single_ref.dart'; +export 'animal.dart'; +export 'api_response.dart'; +export 'array_of_array_of_number_only.dart'; +export 'array_of_number_only.dart'; +export 'array_test.dart'; +export 'capitalization.dart'; +export 'cat.dart'; +export 'cat_all_of.dart'; +export 'category.dart'; +export 'class_model.dart'; +export 'deprecated_object.dart'; +export 'dog.dart'; +export 'dog_all_of.dart'; +export 'enum_arrays.dart'; +export 'enum_test.dart'; +export 'file_schema_test_class.dart'; +export 'foo.dart'; +export 'foo_get_default_response.dart'; +export 'format_test.dart'; +export 'has_only_read_only.dart'; +export 'health_check_result.dart'; +export 'map_test.dart'; +export 'mixed_properties_and_additional_properties_class.dart'; +export 'model200_response.dart'; +export 'model_client.dart'; +export 'model_enum_class.dart'; +export 'model_file.dart'; +export 'model_list.dart'; +export 'model_return.dart'; +export 'name.dart'; +export 'nullable_class.dart'; +export 'number_only.dart'; +export 'object_with_deprecated_fields.dart'; +export 'order.dart'; +export 'outer_composite.dart'; +export 'outer_enum.dart'; +export 'outer_enum_default_value.dart'; +export 'outer_enum_integer.dart'; +export 'outer_enum_integer_default_value.dart'; +export 'outer_object_with_enum_property.dart'; +export 'pet.dart'; +export 'read_only_first.dart'; +export 'single_ref_type.dart'; +export 'special_model_name.dart'; +export 'tag.dart'; +export 'user.dart'; + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES index 1a69ee77d623..114fc0848e57 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES @@ -66,12 +66,14 @@ lib/src/api/pet_api.dart lib/src/api/store_api.dart lib/src/api/user_api.dart lib/src/api_util.dart +lib/src/auth/_exports.dart lib/src/auth/api_key_auth.dart lib/src/auth/auth.dart lib/src/auth/basic_auth.dart lib/src/auth/bearer_auth.dart lib/src/auth/oauth.dart lib/src/date_serializer.dart +lib/src/model/_exports.dart lib/src/model/additional_properties_class.dart lib/src/model/all_of_with_single_ref.dart lib/src/model/animal.dart diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md index 0f37d1167220..d157f07330a4 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md @@ -1,4 +1,4 @@ -# openapi (EXPERIMENTAL) +# openapi 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: diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/openapi.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/openapi.dart index 17f56a53fae1..60c7b440512f 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/openapi.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/openapi.dart @@ -3,11 +3,8 @@ // export 'package:openapi/src/api.dart'; -export 'package:openapi/src/auth/api_key_auth.dart'; -export 'package:openapi/src/auth/basic_auth.dart'; -export 'package:openapi/src/auth/oauth.dart'; +export 'package:openapi/src/auth/_exports.dart'; export 'package:openapi/src/serializers.dart'; -export 'package:openapi/src/model/date.dart'; export 'package:openapi/src/api/another_fake_api.dart'; export 'package:openapi/src/api/default_api.dart'; @@ -17,51 +14,4 @@ export 'package:openapi/src/api/pet_api.dart'; export 'package:openapi/src/api/store_api.dart'; export 'package:openapi/src/api/user_api.dart'; -export 'package:openapi/src/model/additional_properties_class.dart'; -export 'package:openapi/src/model/all_of_with_single_ref.dart'; -export 'package:openapi/src/model/animal.dart'; -export 'package:openapi/src/model/api_response.dart'; -export 'package:openapi/src/model/array_of_array_of_number_only.dart'; -export 'package:openapi/src/model/array_of_number_only.dart'; -export 'package:openapi/src/model/array_test.dart'; -export 'package:openapi/src/model/capitalization.dart'; -export 'package:openapi/src/model/cat.dart'; -export 'package:openapi/src/model/cat_all_of.dart'; -export 'package:openapi/src/model/category.dart'; -export 'package:openapi/src/model/class_model.dart'; -export 'package:openapi/src/model/deprecated_object.dart'; -export 'package:openapi/src/model/dog.dart'; -export 'package:openapi/src/model/dog_all_of.dart'; -export 'package:openapi/src/model/enum_arrays.dart'; -export 'package:openapi/src/model/enum_test.dart'; -export 'package:openapi/src/model/file_schema_test_class.dart'; -export 'package:openapi/src/model/foo.dart'; -export 'package:openapi/src/model/foo_get_default_response.dart'; -export 'package:openapi/src/model/format_test.dart'; -export 'package:openapi/src/model/has_only_read_only.dart'; -export 'package:openapi/src/model/health_check_result.dart'; -export 'package:openapi/src/model/map_test.dart'; -export 'package:openapi/src/model/mixed_properties_and_additional_properties_class.dart'; -export 'package:openapi/src/model/model200_response.dart'; -export 'package:openapi/src/model/model_client.dart'; -export 'package:openapi/src/model/model_enum_class.dart'; -export 'package:openapi/src/model/model_file.dart'; -export 'package:openapi/src/model/model_list.dart'; -export 'package:openapi/src/model/model_return.dart'; -export 'package:openapi/src/model/name.dart'; -export 'package:openapi/src/model/nullable_class.dart'; -export 'package:openapi/src/model/number_only.dart'; -export 'package:openapi/src/model/object_with_deprecated_fields.dart'; -export 'package:openapi/src/model/order.dart'; -export 'package:openapi/src/model/outer_composite.dart'; -export 'package:openapi/src/model/outer_enum.dart'; -export 'package:openapi/src/model/outer_enum_default_value.dart'; -export 'package:openapi/src/model/outer_enum_integer.dart'; -export 'package:openapi/src/model/outer_enum_integer_default_value.dart'; -export 'package:openapi/src/model/outer_object_with_enum_property.dart'; -export 'package:openapi/src/model/pet.dart'; -export 'package:openapi/src/model/read_only_first.dart'; -export 'package:openapi/src/model/single_ref_type.dart'; -export 'package:openapi/src/model/special_model_name.dart'; -export 'package:openapi/src/model/tag.dart'; -export 'package:openapi/src/model/user.dart'; +export 'package:openapi/src/model/_exports.dart'; \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api.dart index 21ef3bc359d6..a58d137c8705 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api.dart @@ -5,10 +5,7 @@ import 'package:dio/dio.dart'; import 'package:built_value/serializer.dart'; import 'package:openapi/src/serializers.dart'; -import 'package:openapi/src/auth/api_key_auth.dart'; -import 'package:openapi/src/auth/basic_auth.dart'; -import 'package:openapi/src/auth/bearer_auth.dart'; -import 'package:openapi/src/auth/oauth.dart'; +import 'package:openapi/src/auth/_exports.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'; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/_exports.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/_exports.dart new file mode 100644 index 000000000000..3bee6983bf3f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/_exports.dart @@ -0,0 +1,10 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + + +export 'api_key_auth.dart'; +export 'auth.dart'; +export 'basic_auth.dart'; +export 'bearer_auth.dart'; +export 'oauth.dart'; \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/api_key_auth.dart index ee16e3f0f92f..2d204c199d92 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/api_key_auth.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/api_key_auth.dart @@ -4,7 +4,7 @@ import 'package:dio/dio.dart'; -import 'package:openapi/src/auth/auth.dart'; +import 'auth.dart'; class ApiKeyAuthInterceptor extends AuthInterceptor { final Map apiKeys = {}; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/basic_auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/basic_auth.dart index b6e6dce04f9c..72cfa13cd9ab 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/basic_auth.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/basic_auth.dart @@ -5,7 +5,7 @@ import 'dart:convert'; import 'package:dio/dio.dart'; -import 'package:openapi/src/auth/auth.dart'; +import 'auth.dart'; class BasicAuthInfo { final String username; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/bearer_auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/bearer_auth.dart index 1d4402b376c0..7e22eaf74b07 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/bearer_auth.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/bearer_auth.dart @@ -3,7 +3,7 @@ // import 'package:dio/dio.dart'; -import 'package:openapi/src/auth/auth.dart'; +import 'auth.dart'; class BearerAuthInterceptor extends AuthInterceptor { final Map tokens = {}; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/oauth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/oauth.dart index 337cf762b0ce..2f5fa42b7e17 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/oauth.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/auth/oauth.dart @@ -3,7 +3,7 @@ // import 'package:dio/dio.dart'; -import 'package:openapi/src/auth/auth.dart'; +import 'auth.dart'; class OAuthInterceptor extends AuthInterceptor { final Map tokens = {}; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/_exports.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/_exports.dart new file mode 100644 index 000000000000..c2d42bf0e5d8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/_exports.dart @@ -0,0 +1,50 @@ +export 'additional_properties_class.dart'; +export 'all_of_with_single_ref.dart'; +export 'animal.dart'; +export 'api_response.dart'; +export 'array_of_array_of_number_only.dart'; +export 'array_of_number_only.dart'; +export 'array_test.dart'; +export 'capitalization.dart'; +export 'cat.dart'; +export 'cat_all_of.dart'; +export 'category.dart'; +export 'class_model.dart'; +export 'deprecated_object.dart'; +export 'dog.dart'; +export 'dog_all_of.dart'; +export 'enum_arrays.dart'; +export 'enum_test.dart'; +export 'file_schema_test_class.dart'; +export 'foo.dart'; +export 'foo_get_default_response.dart'; +export 'format_test.dart'; +export 'has_only_read_only.dart'; +export 'health_check_result.dart'; +export 'map_test.dart'; +export 'mixed_properties_and_additional_properties_class.dart'; +export 'model200_response.dart'; +export 'model_client.dart'; +export 'model_enum_class.dart'; +export 'model_file.dart'; +export 'model_list.dart'; +export 'model_return.dart'; +export 'name.dart'; +export 'nullable_class.dart'; +export 'number_only.dart'; +export 'object_with_deprecated_fields.dart'; +export 'order.dart'; +export 'outer_composite.dart'; +export 'outer_enum.dart'; +export 'outer_enum_default_value.dart'; +export 'outer_enum_integer.dart'; +export 'outer_enum_integer_default_value.dart'; +export 'outer_object_with_enum_property.dart'; +export 'pet.dart'; +export 'read_only_first.dart'; +export 'single_ref_type.dart'; +export 'special_model_name.dart'; +export 'tag.dart'; +export 'user.dart'; + +export 'date.dart';