diff --git a/bin/configs/dart-dio-petstore-client-use-lower-camel-case.yaml b/bin/configs/dart-dio-petstore-client-use-lower-camel-case.yaml new file mode 100644 index 000000000000..2863135e90a6 --- /dev/null +++ b/bin/configs/dart-dio-petstore-client-use-lower-camel-case.yaml @@ -0,0 +1,13 @@ +generatorName: dart-dio +outputDir: samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-use-lower-camel-case.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" + useLowerCamelCase: "true" diff --git a/bin/configs/dart-petstore-client-use-lower-camel-case.yaml b/bin/configs/dart-petstore-client-use-lower-camel-case.yaml new file mode 100644 index 000000000000..0e9fc7b1f8e4 --- /dev/null +++ b/bin/configs/dart-petstore-client-use-lower-camel-case.yaml @@ -0,0 +1,10 @@ +generatorName: dart +outputDir: samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-use-lower-camel-case.yaml +templateDir: modules/openapi-generator/src/main/resources/dart2 +typeMappings: + Client: "ModelClient" + File: "ModelFile" +additionalProperties: + hideGenerationTimestamp: "true" + useLowerCamelCase: "true" \ No newline at end of file diff --git a/docs/generators/dart-dio.md b/docs/generators/dart-dio.md index f93b09ffbf8d..eb4e5a962ab8 100644 --- a/docs/generators/dart-dio.md +++ b/docs/generators/dart-dio.md @@ -4,55 +4,56 @@ title: Documentation for the dart-dio Generator ## METADATA -| Property | Value | Notes | -| -------- | ----- | ----- | -| generator name | dart-dio | pass this to the generate command after -g | -| generator stability | STABLE | | -| generator type | CLIENT | | -| generator language | Dart | | -| generator default templating engine | mustache | | -| helpTxt | Generates a Dart Dio client library. | | +| Property | Value | Notes | +|-------------------------------------|--------------------------------------|--------------------------------------------| +| generator name | dart-dio | pass this to the generate command after -g | +| generator stability | STABLE | | +| generator type | CLIENT | | +| generator language | Dart | | +| generator default templating engine | mustache | | +| helpTxt | Generates a Dart Dio client library. | | ## CONFIG OPTIONS -These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. -| Option | Description | Values | Default | -| ------ | ----------- | ------ | ------- | -|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| -|dateLibrary|Specify Date library|
**core**
[DEFAULT] Dart core library (DateTime)
**timemachine**
Time Machine is date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.
|core| -|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| -|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enum's are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| -|equalityCheckMethod|Specify equality check method. Takes effect only in case if serializationLibrary is json_serializable.|
**default**
[DEFAULT] Built in hash code generation method
**equatable**
Uses equatable library for equality checking
|default| -|finalProperties|Whether properties are marked as final when using Json Serializable for serialization| |true| -|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| -|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| -|pubAuthor|Author name in generated pubspec| |Author| -|pubAuthorEmail|Email address of the author in generated pubspec| |author@homepage| -|pubDescription|Description in generated pubspec| |OpenAPI API client| -|pubHomepage|Homepage in generated pubspec| |homepage| -|pubLibrary|Library name in generated code| |openapi.api| -|pubName|Name in generated pubspec| |openapi| -|pubPublishTo|Publish_to in generated pubspec| |null| -|pubRepository|Repository in generated pubspec| |null| -|pubVersion|Version in generated pubspec| |1.0.0| -|serializationLibrary|Specify serialization library|
**built_value**
[DEFAULT] built_value
**json_serializable**
[BETA] json_serializable
|built_value| -|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| -|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| -|sourceFolder|source folder for generated code| |src| -|useEnumExtension|Allow the 'x-enum-values' extension for enums| |false| +These options may be applied as additional-properties (cli) or configOptions (plugins). Refer +to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. + +| Option | Description | Values | Default | +|------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------| +| allowUnicodeIdentifiers | boolean, toggles whether unicode identifiers are allowed in names or not, default is false | | false | +| dateLibrary | Specify Date library |
**core**
[DEFAULT] Dart core library (DateTime)
**timemachine**
Time Machine is date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.
| core | +| disallowAdditionalPropertiesIfNotPresent | If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default. |
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
| true | +| ensureUniqueParams | Whether to ensure parameter names are unique in an operation (rename parameters that are not). | | true | +| enumUnknownDefaultCase | If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case. |
**false**
No changes to the enum's are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
| false | +| equalityCheckMethod | Specify equality check method. Takes effect only in case if serializationLibrary is json_serializable. |
**default**
[DEFAULT] Built in hash code generation method
**equatable**
Uses equatable library for equality checking
| default | +| finalProperties | Whether properties are marked as final when using Json Serializable for serialization | | true | +| legacyDiscriminatorBehavior | Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default). |
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
| true | +| prependFormOrBodyParameters | Add form or body parameters to the beginning of the parameter list. | | false | +| pubAuthor | Author name in generated pubspec | | Author | +| pubAuthorEmail | Email address of the author in generated pubspec | | author@homepage | +| pubDescription | Description in generated pubspec | | OpenAPI API client | +| pubHomepage | Homepage in generated pubspec | | homepage | +| pubLibrary | Library name in generated code | | openapi.api | +| pubName | Name in generated pubspec | | openapi | +| pubPublishTo | Publish_to in generated pubspec | | null | +| pubRepository | Repository in generated pubspec | | null | +| pubVersion | Version in generated pubspec | | 1.0.0 | +| serializationLibrary | Specify serialization library |
**built_value**
[DEFAULT] built_value
**json_serializable**
[BETA] json_serializable
| built_value | +| sortModelPropertiesByRequiredFlag | Sort model properties to place required parameters before optional parameters. | | true | +| sortParamsByRequiredFlag | Sort method arguments to place required parameters before optional parameters. | | true | +| sourceFolder | source folder for generated code | | src | +| useEnumExtension | Allow the 'x-enum-values' extension for enums | | false | +| useLowerCamelCase | Use the lower camel case style |
**true**
The values and names will be in lowerCamelCase, also all screaming case values will then be in lower camel case.
**false**
The values and names can still be in screaming case.
| true | ## IMPORT MAPPING | Type/Alias | Imports | -| ---------- | ------- | - +|------------|---------| ## INSTANTIATION TYPES | Type/Alias | Instantiated By | -| ---------- | --------------- | - +|------------|-----------------| ## LANGUAGE PRIMITIVES @@ -144,119 +145,126 @@ These options may be applied as additional-properties (cli) or configOptions (pl ## FEATURE SET - ### Client Modification Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|BasePath|✓|ToolingExtension -|Authorizations|✓|ToolingExtension -|UserAgent|✓|ToolingExtension -|MockServer|✗|ToolingExtension + +| Name | Supported | Defined By | +|----------------|-----------|------------------| +| BasePath | ✓ | ToolingExtension | +| Authorizations | ✓ | ToolingExtension | +| UserAgent | ✓ | ToolingExtension | +| MockServer | ✗ | ToolingExtension | ### Data Type Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Custom|✗|OAS2,OAS3 -|Int32|✓|OAS2,OAS3 -|Int64|✓|OAS2,OAS3 -|Float|✓|OAS2,OAS3 -|Double|✓|OAS2,OAS3 -|Decimal|✓|ToolingExtension -|String|✓|OAS2,OAS3 -|Byte|✓|OAS2,OAS3 -|Binary|✓|OAS2,OAS3 -|Boolean|✓|OAS2,OAS3 -|Date|✓|OAS2,OAS3 -|DateTime|✓|OAS2,OAS3 -|Password|✓|OAS2,OAS3 -|File|✓|OAS2 -|Uuid|✗| -|Array|✓|OAS2,OAS3 -|Null|✗|OAS3 -|AnyType|✗|OAS2,OAS3 -|Object|✓|OAS2,OAS3 -|Maps|✓|ToolingExtension -|CollectionFormat|✓|OAS2 -|CollectionFormatMulti|✓|OAS2 -|Enum|✓|OAS2,OAS3 -|ArrayOfEnum|✓|ToolingExtension -|ArrayOfModel|✓|ToolingExtension -|ArrayOfCollectionOfPrimitives|✓|ToolingExtension -|ArrayOfCollectionOfModel|✓|ToolingExtension -|ArrayOfCollectionOfEnum|✓|ToolingExtension -|MapOfEnum|✓|ToolingExtension -|MapOfModel|✓|ToolingExtension -|MapOfCollectionOfPrimitives|✓|ToolingExtension -|MapOfCollectionOfModel|✓|ToolingExtension -|MapOfCollectionOfEnum|✓|ToolingExtension + +| Name | Supported | Defined By | +|-------------------------------|-----------|------------------| +| Custom | ✗ | OAS2,OAS3 | +| Int32 | ✓ | OAS2,OAS3 | +| Int64 | ✓ | OAS2,OAS3 | +| Float | ✓ | OAS2,OAS3 | +| Double | ✓ | OAS2,OAS3 | +| Decimal | ✓ | ToolingExtension | +| String | ✓ | OAS2,OAS3 | +| Byte | ✓ | OAS2,OAS3 | +| Binary | ✓ | OAS2,OAS3 | +| Boolean | ✓ | OAS2,OAS3 | +| Date | ✓ | OAS2,OAS3 | +| DateTime | ✓ | OAS2,OAS3 | +| Password | ✓ | OAS2,OAS3 | +| File | ✓ | OAS2 | +| Uuid | ✗ | | +| Array | ✓ | OAS2,OAS3 | +| Null | ✗ | OAS3 | +| AnyType | ✗ | OAS2,OAS3 | +| Object | ✓ | OAS2,OAS3 | +| Maps | ✓ | ToolingExtension | +| CollectionFormat | ✓ | OAS2 | +| CollectionFormatMulti | ✓ | OAS2 | +| Enum | ✓ | OAS2,OAS3 | +| ArrayOfEnum | ✓ | ToolingExtension | +| ArrayOfModel | ✓ | ToolingExtension | +| ArrayOfCollectionOfPrimitives | ✓ | ToolingExtension | +| ArrayOfCollectionOfModel | ✓ | ToolingExtension | +| ArrayOfCollectionOfEnum | ✓ | ToolingExtension | +| MapOfEnum | ✓ | ToolingExtension | +| MapOfModel | ✓ | ToolingExtension | +| MapOfCollectionOfPrimitives | ✓ | ToolingExtension | +| MapOfCollectionOfModel | ✓ | ToolingExtension | +| MapOfCollectionOfEnum | ✓ | ToolingExtension | ### Documentation Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Readme|✓|ToolingExtension -|Model|✓|ToolingExtension -|Api|✓|ToolingExtension + +| Name | Supported | Defined By | +|--------|-----------|------------------| +| Readme | ✓ | ToolingExtension | +| Model | ✓ | ToolingExtension | +| Api | ✓ | ToolingExtension | ### Global Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Host|✓|OAS2,OAS3 -|BasePath|✓|OAS2,OAS3 -|Info|✓|OAS2,OAS3 -|Schemes|✗|OAS2,OAS3 -|PartialSchemes|✓|OAS2,OAS3 -|Consumes|✓|OAS2 -|Produces|✓|OAS2 -|ExternalDocumentation|✓|OAS2,OAS3 -|Examples|✓|OAS2,OAS3 -|XMLStructureDefinitions|✗|OAS2,OAS3 -|MultiServer|✗|OAS3 -|ParameterizedServer|✗|OAS3 -|ParameterStyling|✗|OAS3 -|Callbacks|✗|OAS3 -|LinkObjects|✗|OAS3 + +| Name | Supported | Defined By | +|-------------------------|-----------|------------| +| Host | ✓ | OAS2,OAS3 | +| BasePath | ✓ | OAS2,OAS3 | +| Info | ✓ | OAS2,OAS3 | +| Schemes | ✗ | OAS2,OAS3 | +| PartialSchemes | ✓ | OAS2,OAS3 | +| Consumes | ✓ | OAS2 | +| Produces | ✓ | OAS2 | +| ExternalDocumentation | ✓ | OAS2,OAS3 | +| Examples | ✓ | OAS2,OAS3 | +| XMLStructureDefinitions | ✗ | OAS2,OAS3 | +| MultiServer | ✗ | OAS3 | +| ParameterizedServer | ✗ | OAS3 | +| ParameterStyling | ✗ | OAS3 | +| Callbacks | ✗ | OAS3 | +| LinkObjects | ✗ | OAS3 | ### Parameter Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Path|✓|OAS2,OAS3 -|Query|✓|OAS2,OAS3 -|Header|✓|OAS2,OAS3 -|Body|✓|OAS2 -|FormUnencoded|✓|OAS2 -|FormMultipart|✓|OAS2 -|Cookie|✓|OAS3 + +| Name | Supported | Defined By | +|---------------|-----------|------------| +| Path | ✓ | OAS2,OAS3 | +| Query | ✓ | OAS2,OAS3 | +| Header | ✓ | OAS2,OAS3 | +| Body | ✓ | OAS2 | +| FormUnencoded | ✓ | OAS2 | +| FormMultipart | ✓ | OAS2 | +| Cookie | ✓ | OAS3 | ### Schema Support Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Simple|✓|OAS2,OAS3 -|Composite|✓|OAS2,OAS3 -|Polymorphism|✓|OAS2,OAS3 -|Union|✓|OAS3 -|allOf|✓|OAS2,OAS3 -|anyOf|✓|OAS3 -|oneOf|✓|OAS3 -|not|✗|OAS3 + +| Name | Supported | Defined By | +|--------------|-----------|------------| +| Simple | ✓ | OAS2,OAS3 | +| Composite | ✓ | OAS2,OAS3 | +| Polymorphism | ✓ | OAS2,OAS3 | +| Union | ✓ | OAS3 | +| allOf | ✓ | OAS2,OAS3 | +| anyOf | ✓ | OAS3 | +| oneOf | ✓ | OAS3 | +| not | ✗ | OAS3 | ### Security Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|BasicAuth|✓|OAS2,OAS3 -|ApiKey|✓|OAS2,OAS3 -|OpenIDConnect|✗|OAS3 -|BearerToken|✓|OAS3 -|OAuth2_Implicit|✓|OAS2,OAS3 -|OAuth2_Password|✗|OAS2,OAS3 -|OAuth2_ClientCredentials|✗|OAS2,OAS3 -|OAuth2_AuthorizationCode|✗|OAS2,OAS3 -|SignatureAuth|✗|OAS3 -|AWSV4Signature|✗|ToolingExtension + +| Name | Supported | Defined By | +|--------------------------|-----------|------------------| +| BasicAuth | ✓ | OAS2,OAS3 | +| ApiKey | ✓ | OAS2,OAS3 | +| OpenIDConnect | ✗ | OAS3 | +| BearerToken | ✓ | OAS3 | +| OAuth2_Implicit | ✓ | OAS2,OAS3 | +| OAuth2_Password | ✗ | OAS2,OAS3 | +| OAuth2_ClientCredentials | ✗ | OAS2,OAS3 | +| OAuth2_AuthorizationCode | ✗ | OAS2,OAS3 | +| SignatureAuth | ✗ | OAS3 | +| AWSV4Signature | ✗ | ToolingExtension | ### Wire Format Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|JSON|✓|OAS2,OAS3 -|XML|✗|OAS2,OAS3 -|PROTOBUF|✗|ToolingExtension -|Custom|✗|OAS2,OAS3 + +| Name | Supported | Defined By | +|----------|-----------|------------------| +| JSON | ✓ | OAS2,OAS3 | +| XML | ✗ | OAS2,OAS3 | +| PROTOBUF | ✗ | ToolingExtension | +| Custom | ✗ | OAS2,OAS3 | diff --git a/docs/generators/dart.md b/docs/generators/dart.md index 79148a7e4791..f1fdae2c77ef 100644 --- a/docs/generators/dart.md +++ b/docs/generators/dart.md @@ -4,52 +4,53 @@ title: Documentation for the dart Generator ## METADATA -| Property | Value | Notes | -| -------- | ----- | ----- | -| generator name | dart | pass this to the generate command after -g | -| generator stability | STABLE | | -| generator type | CLIENT | | -| generator language | Dart | | -| generator default templating engine | mustache | | -| helpTxt | Generates a Dart client library. | | +| Property | Value | Notes | +|-------------------------------------|----------------------------------|--------------------------------------------| +| generator name | dart | pass this to the generate command after -g | +| generator stability | STABLE | | +| generator type | CLIENT | | +| generator language | Dart | | +| generator default templating engine | mustache | | +| helpTxt | Generates a Dart client library. | | ## CONFIG OPTIONS -These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. -| Option | Description | Values | Default | -| ------ | ----------- | ------ | ------- | -|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| -|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| -|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| -|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|
**false**
No changes to the enum's are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false| -|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true| -|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| -|pubAuthor|Author name in generated pubspec| |Author| -|pubAuthorEmail|Email address of the author in generated pubspec| |author@homepage| -|pubDescription|Description in generated pubspec| |OpenAPI API client| -|pubHomepage|Homepage in generated pubspec| |homepage| -|pubLibrary|Library name in generated code| |openapi.api| -|pubName|Name in generated pubspec| |openapi| -|pubPublishTo|Publish_to in generated pubspec| |null| -|pubRepository|Repository in generated pubspec| |null| -|pubVersion|Version in generated pubspec| |1.0.0| -|serializationLibrary|Specify serialization library|
**native_serialization**
Use native serializer, backwards compatible
|native_serialization| -|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| -|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| -|sourceFolder|source folder for generated code| |src| -|useEnumExtension|Allow the 'x-enum-values' extension for enums| |false| +These options may be applied as additional-properties (cli) or configOptions (plugins). Refer +to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. + +| Option | Description | Values | Default | +|------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------| +| allowUnicodeIdentifiers | boolean, toggles whether unicode identifiers are allowed in names or not, default is false | | false | +| disallowAdditionalPropertiesIfNotPresent | If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default. |
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
| true | +| ensureUniqueParams | Whether to ensure parameter names are unique in an operation (rename parameters that are not). | | true | +| enumUnknownDefaultCase | If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case. |
**false**
No changes to the enum's are made, this is the default option.
**true**
With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
| false | +| legacyDiscriminatorBehavior | Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default). |
**true**
The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
**false**
The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
| true | +| prependFormOrBodyParameters | Add form or body parameters to the beginning of the parameter list. | | false | +| pubAuthor | Author name in generated pubspec | | Author | +| pubAuthorEmail | Email address of the author in generated pubspec | | author@homepage | +| pubDescription | Description in generated pubspec | | OpenAPI API client | +| pubHomepage | Homepage in generated pubspec | | homepage | +| pubLibrary | Library name in generated code | | openapi.api | +| pubName | Name in generated pubspec | | openapi | +| pubPublishTo | Publish_to in generated pubspec | | null | +| pubRepository | Repository in generated pubspec | | null | +| pubVersion | Version in generated pubspec | | 1.0.0 | +| serializationLibrary | Specify serialization library |
**native_serialization**
Use native serializer, backwards compatible
| native_serialization | +| sortModelPropertiesByRequiredFlag | Sort model properties to place required parameters before optional parameters. | | true | +| sortParamsByRequiredFlag | Sort method arguments to place required parameters before optional parameters. | | true | +| sourceFolder | source folder for generated code | | src | +| useEnumExtension | Allow the 'x-enum-values' extension for enums | | false | +| useLowerCamelCase | Use the lower camel case style |
**true**
The values and names will be in lowerCamelCase, also all screaming case values will then be in lower camel case.
**false**
The values and names can still be in screaming case.
| true | ## IMPORT MAPPING | Type/Alias | Imports | -| ---------- | ------- | - +|------------|---------| ## INSTANTIATION TYPES | Type/Alias | Instantiated By | -| ---------- | --------------- | - +|------------|-----------------| ## LANGUAGE PRIMITIVES @@ -141,119 +142,126 @@ These options may be applied as additional-properties (cli) or configOptions (pl ## FEATURE SET - ### Client Modification Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|BasePath|✓|ToolingExtension -|Authorizations|✗|ToolingExtension -|UserAgent|✗|ToolingExtension -|MockServer|✗|ToolingExtension + +| Name | Supported | Defined By | +|----------------|-----------|------------------| +| BasePath | ✓ | ToolingExtension | +| Authorizations | ✗ | ToolingExtension | +| UserAgent | ✗ | ToolingExtension | +| MockServer | ✗ | ToolingExtension | ### Data Type Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Custom|✗|OAS2,OAS3 -|Int32|✓|OAS2,OAS3 -|Int64|✓|OAS2,OAS3 -|Float|✓|OAS2,OAS3 -|Double|✓|OAS2,OAS3 -|Decimal|✓|ToolingExtension -|String|✓|OAS2,OAS3 -|Byte|✓|OAS2,OAS3 -|Binary|✓|OAS2,OAS3 -|Boolean|✓|OAS2,OAS3 -|Date|✓|OAS2,OAS3 -|DateTime|✓|OAS2,OAS3 -|Password|✓|OAS2,OAS3 -|File|✓|OAS2 -|Uuid|✗| -|Array|✓|OAS2,OAS3 -|Null|✗|OAS3 -|AnyType|✗|OAS2,OAS3 -|Object|✓|OAS2,OAS3 -|Maps|✓|ToolingExtension -|CollectionFormat|✓|OAS2 -|CollectionFormatMulti|✓|OAS2 -|Enum|✓|OAS2,OAS3 -|ArrayOfEnum|✓|ToolingExtension -|ArrayOfModel|✓|ToolingExtension -|ArrayOfCollectionOfPrimitives|✓|ToolingExtension -|ArrayOfCollectionOfModel|✓|ToolingExtension -|ArrayOfCollectionOfEnum|✓|ToolingExtension -|MapOfEnum|✓|ToolingExtension -|MapOfModel|✓|ToolingExtension -|MapOfCollectionOfPrimitives|✓|ToolingExtension -|MapOfCollectionOfModel|✓|ToolingExtension -|MapOfCollectionOfEnum|✓|ToolingExtension + +| Name | Supported | Defined By | +|-------------------------------|-----------|------------------| +| Custom | ✗ | OAS2,OAS3 | +| Int32 | ✓ | OAS2,OAS3 | +| Int64 | ✓ | OAS2,OAS3 | +| Float | ✓ | OAS2,OAS3 | +| Double | ✓ | OAS2,OAS3 | +| Decimal | ✓ | ToolingExtension | +| String | ✓ | OAS2,OAS3 | +| Byte | ✓ | OAS2,OAS3 | +| Binary | ✓ | OAS2,OAS3 | +| Boolean | ✓ | OAS2,OAS3 | +| Date | ✓ | OAS2,OAS3 | +| DateTime | ✓ | OAS2,OAS3 | +| Password | ✓ | OAS2,OAS3 | +| File | ✓ | OAS2 | +| Uuid | ✗ | | +| Array | ✓ | OAS2,OAS3 | +| Null | ✗ | OAS3 | +| AnyType | ✗ | OAS2,OAS3 | +| Object | ✓ | OAS2,OAS3 | +| Maps | ✓ | ToolingExtension | +| CollectionFormat | ✓ | OAS2 | +| CollectionFormatMulti | ✓ | OAS2 | +| Enum | ✓ | OAS2,OAS3 | +| ArrayOfEnum | ✓ | ToolingExtension | +| ArrayOfModel | ✓ | ToolingExtension | +| ArrayOfCollectionOfPrimitives | ✓ | ToolingExtension | +| ArrayOfCollectionOfModel | ✓ | ToolingExtension | +| ArrayOfCollectionOfEnum | ✓ | ToolingExtension | +| MapOfEnum | ✓ | ToolingExtension | +| MapOfModel | ✓ | ToolingExtension | +| MapOfCollectionOfPrimitives | ✓ | ToolingExtension | +| MapOfCollectionOfModel | ✓ | ToolingExtension | +| MapOfCollectionOfEnum | ✓ | ToolingExtension | ### Documentation Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Readme|✓|ToolingExtension -|Model|✓|ToolingExtension -|Api|✓|ToolingExtension + +| Name | Supported | Defined By | +|--------|-----------|------------------| +| Readme | ✓ | ToolingExtension | +| Model | ✓ | ToolingExtension | +| Api | ✓ | ToolingExtension | ### Global Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Host|✓|OAS2,OAS3 -|BasePath|✓|OAS2,OAS3 -|Info|✓|OAS2,OAS3 -|Schemes|✗|OAS2,OAS3 -|PartialSchemes|✓|OAS2,OAS3 -|Consumes|✓|OAS2 -|Produces|✓|OAS2 -|ExternalDocumentation|✓|OAS2,OAS3 -|Examples|✓|OAS2,OAS3 -|XMLStructureDefinitions|✗|OAS2,OAS3 -|MultiServer|✗|OAS3 -|ParameterizedServer|✗|OAS3 -|ParameterStyling|✗|OAS3 -|Callbacks|✗|OAS3 -|LinkObjects|✗|OAS3 + +| Name | Supported | Defined By | +|-------------------------|-----------|------------| +| Host | ✓ | OAS2,OAS3 | +| BasePath | ✓ | OAS2,OAS3 | +| Info | ✓ | OAS2,OAS3 | +| Schemes | ✗ | OAS2,OAS3 | +| PartialSchemes | ✓ | OAS2,OAS3 | +| Consumes | ✓ | OAS2 | +| Produces | ✓ | OAS2 | +| ExternalDocumentation | ✓ | OAS2,OAS3 | +| Examples | ✓ | OAS2,OAS3 | +| XMLStructureDefinitions | ✗ | OAS2,OAS3 | +| MultiServer | ✗ | OAS3 | +| ParameterizedServer | ✗ | OAS3 | +| ParameterStyling | ✗ | OAS3 | +| Callbacks | ✗ | OAS3 | +| LinkObjects | ✗ | OAS3 | ### Parameter Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Path|✓|OAS2,OAS3 -|Query|✓|OAS2,OAS3 -|Header|✓|OAS2,OAS3 -|Body|✓|OAS2 -|FormUnencoded|✓|OAS2 -|FormMultipart|✓|OAS2 -|Cookie|✓|OAS3 + +| Name | Supported | Defined By | +|---------------|-----------|------------| +| Path | ✓ | OAS2,OAS3 | +| Query | ✓ | OAS2,OAS3 | +| Header | ✓ | OAS2,OAS3 | +| Body | ✓ | OAS2 | +| FormUnencoded | ✓ | OAS2 | +| FormMultipart | ✓ | OAS2 | +| Cookie | ✓ | OAS3 | ### Schema Support Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|Simple|✓|OAS2,OAS3 -|Composite|✗|OAS2,OAS3 -|Polymorphism|✗|OAS2,OAS3 -|Union|✗|OAS3 -|allOf|✗|OAS2,OAS3 -|anyOf|✗|OAS3 -|oneOf|✗|OAS3 -|not|✗|OAS3 + +| Name | Supported | Defined By | +|--------------|-----------|------------| +| Simple | ✓ | OAS2,OAS3 | +| Composite | ✗ | OAS2,OAS3 | +| Polymorphism | ✗ | OAS2,OAS3 | +| Union | ✗ | OAS3 | +| allOf | ✗ | OAS2,OAS3 | +| anyOf | ✗ | OAS3 | +| oneOf | ✗ | OAS3 | +| not | ✗ | OAS3 | ### Security Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|BasicAuth|✓|OAS2,OAS3 -|ApiKey|✓|OAS2,OAS3 -|OpenIDConnect|✗|OAS3 -|BearerToken|✓|OAS3 -|OAuth2_Implicit|✓|OAS2,OAS3 -|OAuth2_Password|✗|OAS2,OAS3 -|OAuth2_ClientCredentials|✗|OAS2,OAS3 -|OAuth2_AuthorizationCode|✗|OAS2,OAS3 -|SignatureAuth|✗|OAS3 -|AWSV4Signature|✗|ToolingExtension + +| Name | Supported | Defined By | +|--------------------------|-----------|------------------| +| BasicAuth | ✓ | OAS2,OAS3 | +| ApiKey | ✓ | OAS2,OAS3 | +| OpenIDConnect | ✗ | OAS3 | +| BearerToken | ✓ | OAS3 | +| OAuth2_Implicit | ✓ | OAS2,OAS3 | +| OAuth2_Password | ✗ | OAS2,OAS3 | +| OAuth2_ClientCredentials | ✗ | OAS2,OAS3 | +| OAuth2_AuthorizationCode | ✗ | OAS2,OAS3 | +| SignatureAuth | ✗ | OAS3 | +| AWSV4Signature | ✗ | ToolingExtension | ### Wire Format Feature -| Name | Supported | Defined By | -| ---- | --------- | ---------- | -|JSON|✓|OAS2,OAS3 -|XML|✗|OAS2,OAS3 -|PROTOBUF|✗|ToolingExtension -|Custom|✗|OAS2,OAS3 + +| Name | Supported | Defined By | +|----------|-----------|------------------| +| JSON | ✓ | OAS2,OAS3 | +| XML | ✗ | OAS2,OAS3 | +| PROTOBUF | ✗ | ToolingExtension | +| Custom | ✗ | OAS2,OAS3 | diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java index 79bcdf1f5b07..007c727801b0 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java @@ -46,6 +46,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen { public static final String PUB_REPOSITORY = "pubRepository"; public static final String PUB_PUBLISH_TO = "pubPublishTo"; public static final String USE_ENUM_EXTENSION = "useEnumExtension"; + public static final String USE_LOWER_CAMEL_CASE = "useLowerCamelCase"; @Setter protected String pubLibrary = "openapi.api"; @Setter protected String pubName = "openapi"; @@ -57,6 +58,7 @@ public abstract class AbstractDartCodegen extends DefaultCodegen { @Setter protected String pubRepository = null; @Setter protected String pubPublishTo = null; @Setter protected boolean useEnumExtension = false; + @Setter protected boolean useLowerCamelCase = false; @Setter protected String sourceFolder = "src"; protected String libPath = "lib" + File.separator; protected String apiDocPath = "doc/"; @@ -196,6 +198,7 @@ public AbstractDartCodegen() { addOption(PUB_REPOSITORY, "Repository in generated pubspec", pubRepository); addOption(PUB_PUBLISH_TO, "Publish_to in generated pubspec", pubPublishTo); addOption(USE_ENUM_EXTENSION, "Allow the 'x-enum-values' extension for enums", String.valueOf(useEnumExtension)); + addOption(USE_LOWER_CAMEL_CASE, "Use lower camel case", String.valueOf(useLowerCamelCase)); addOption(CodegenConstants.SOURCE_FOLDER, CodegenConstants.SOURCE_FOLDER_DESC, sourceFolder); } @@ -302,6 +305,12 @@ public void processOpts() { additionalProperties.put(USE_ENUM_EXTENSION, useEnumExtension); } + if (additionalProperties.containsKey(USE_LOWER_CAMEL_CASE)) { + this.setUseLowerCamelCase(convertPropertyToBooleanAndWriteBack(USE_LOWER_CAMEL_CASE)); + } else { + additionalProperties.put(USE_LOWER_CAMEL_CASE, useLowerCamelCase); + } + if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) { String srcFolder = (String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER); this.setSourceFolder(srcFolder.replace('/', File.separatorChar)); @@ -386,7 +395,7 @@ public String toVarName(String name) { } name = name.replaceAll("^_", ""); - // if it's all upper case, do nothing + // if it's all upper case and more than two letters if (name.matches("^[A-Z_]*$")) { return name; } @@ -400,7 +409,7 @@ public String toVarName(String name) { name = sanitizeName(name); // camelize (lower first character) the variable name - // pet_id => petId + // pet_id => petI name = camelize(name, LOWERCASE_FIRST_LETTER); if (name.matches("^\\d.*")) { @@ -732,9 +741,14 @@ public String toEnumVarName(String value, String datatype) { return enumNameMapping.get(value); } - if (value.length() == 0) { + if (value.isEmpty()) { return "empty"; } + + if (useLowerCamelCase && value.matches("^[A-Z_]*$")) { + value = value.toLowerCase(); + } + if (("number".equalsIgnoreCase(datatype) || "double".equalsIgnoreCase(datatype) || "int".equalsIgnoreCase(datatype)) && diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartClientOptionsTest.java index 87dabbbfd00d..1db5c5625b35 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartClientOptionsTest.java @@ -52,6 +52,7 @@ protected void verifyOptions() { verify(clientCodegen).setPubPublishTo(DartClientOptionsProvider.PUB_PUBLISH_TO_VALUE); verify(clientCodegen).setSourceFolder(DartClientOptionsProvider.SOURCE_FOLDER_VALUE); verify(clientCodegen).setUseEnumExtension(Boolean.parseBoolean(DartClientOptionsProvider.USE_ENUM_EXTENSION)); + verify(clientCodegen).setUseLowerCamelCase(Boolean.parseBoolean(DartClientOptionsProvider.USE_LOWER_CAMEL_CASE)); verify(clientCodegen).setEnumUnknownDefaultCase(Boolean.parseBoolean(DartClientOptionsProvider.ENUM_UNKNOWN_DEFAULT_CASE_VALUE)); } } 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 cb3350d57e2e..0437eaf86b3a 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 @@ -54,6 +54,7 @@ protected void verifyOptions() { verify(clientCodegen).setDateLibrary(DartDioClientCodegen.DATE_LIBRARY_DEFAULT); verify(clientCodegen).setLibrary(DartDioClientCodegen.SERIALIZATION_LIBRARY_DEFAULT); verify(clientCodegen).setEqualityCheckMethod(DartDioClientCodegen.EQUALITY_CHECK_METHOD_DEFAULT); + verify(clientCodegen).setUseLowerCamelCase(Boolean.parseBoolean(DartDioClientOptionsProvider.USE_LOWER_CAMEL_CASE)); verify(clientCodegen).setEnumUnknownDefaultCase(Boolean.parseBoolean(DartDioClientOptionsProvider.ENUM_UNKNOWN_DEFAULT_CASE_VALUE)); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java index 50bbfdb5e9b5..fdc5e00573bf 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java @@ -38,6 +38,7 @@ public class DartClientOptionsProvider implements OptionsProvider { public static final String PUB_PUBLISH_TO_VALUE = "Publish To"; public static final String SOURCE_FOLDER_VALUE = "src"; public static final String USE_ENUM_EXTENSION = "true"; + public static final String USE_LOWER_CAMEL_CASE = "false"; public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false"; public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true"; public static final String ENUM_UNKNOWN_DEFAULT_CASE_VALUE = "false"; @@ -64,6 +65,7 @@ public Map createOptions() { .put(DartClientCodegen.PUB_PUBLISH_TO, PUB_PUBLISH_TO_VALUE) .put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE) .put(DartClientCodegen.USE_ENUM_EXTENSION, USE_ENUM_EXTENSION) + .put(DartClientCodegen.USE_LOWER_CAMEL_CASE, USE_LOWER_CAMEL_CASE) .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE) .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioClientOptionsProvider.java index bcda220f4328..ef5c34543cc1 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartDioClientOptionsProvider.java @@ -40,6 +40,7 @@ public class DartDioClientOptionsProvider implements OptionsProvider { public static final String PUB_REPOSITORY_VALUE = "Repository"; public static final String PUB_PUBLISH_TO_VALUE = "Publish to"; public static final String ENUM_UNKNOWN_DEFAULT_CASE_VALUE = "false"; + public static final String USE_LOWER_CAMEL_CASE = "false"; @Override public String getLanguage() { @@ -67,6 +68,7 @@ public Map createOptions() { .put(DartDioClientCodegen.EQUALITY_CHECK_METHOD, DartDioClientCodegen.EQUALITY_CHECK_METHOD_DEFAULT) .put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE) .put(DartDioClientCodegen.USE_ENUM_EXTENSION, USE_ENUM_EXTENSION) + .put(DartDioClientCodegen.USE_LOWER_CAMEL_CASE, USE_LOWER_CAMEL_CASE) .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE) .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-use-lower-camel-case.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-use-lower-camel-case.yaml new file mode 100644 index 000000000000..8bb19186f3cb --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-use-lower-camel-case.yaml @@ -0,0 +1,2069 @@ +openapi: 3.0.0 +info: + description: >- + This spec is mainly for testing Petstore server and contains fake endpoints, + models. Please do not use this for any other purpose. Special characters: " + \ + version: 1.0.0 + title: OpenAPI Petstore + license: + name: Apache-2.0 + url: 'https://www.apache.org/licenses/LICENSE-2.0.html' +tags: + - name: pet + description: Everything about your Pets + - name: store + description: Access to Petstore orders + - name: user + description: Operations about user +paths: + /foo: + get: + responses: + default: + description: response + content: + application/json: + schema: + type: object + properties: + string: + $ref: '#/components/schemas/Foo' + /pet: + servers: + - url: 'http://petstore.swagger.io/v2' + - url: 'http://path-server-test.petstore.local/v2' + - url: 'http://{server}.swagger.io:{port}/v2' + description: test server with variables + variables: + server: + description: target server + enum: + - 'petstore' + - 'qa-petstore' + - 'dev-petstore' + default: 'petstore' + port: + enum: + - 80 + - 8080 + default: 80 + post: + tags: + - pet + summary: Add a new pet to the store + description: '' + operationId: addPet + responses: + '200': + description: Successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + $ref: '#/components/requestBodies/Pet' + put: + tags: + - pet + summary: Update an existing pet + description: '' + operationId: updatePet + x-webclient-blocking: true + responses: + '200': + description: Successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + $ref: '#/components/requestBodies/Pet' + /pet/findByStatus: + get: + tags: + - pet + summary: Finds Pets by status + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + x-webclient-blocking: true + parameters: + - name: status + in: query + description: Status values that need to be considered for filter + required: true + style: form + explode: false + deprecated: true + schema: + type: array + items: + type: string + enum: + - available + - pending + - sold + default: available + responses: + '200': + description: successful operation + content: + application/xml: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid status value + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + /pet/findByTags: + get: + tags: + - pet + summary: Finds Pets by tags + description: >- + Multiple tags can be provided with comma separated strings. Use tag1, + tag2, tag3 for testing. + operationId: findPetsByTags + x-webclient-blocking: true + parameters: + - name: tags + in: query + description: Tags to filter by + required: true + style: form + explode: false + schema: + type: array + items: + type: string + uniqueItems: true + responses: + '200': + description: successful operation + content: + application/xml: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + uniqueItems: true + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + uniqueItems: true + '400': + description: Invalid tag value + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + deprecated: true + '/pet/{petId}': + get: + tags: + - pet + summary: Find pet by ID + description: Returns a single pet + operationId: getPetById + x-webclient-blocking: true + parameters: + - name: petId + in: path + description: ID of pet to return + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + post: + tags: + - pet + summary: Updates a pet in the store with form data + description: '' + operationId: updatePetWithForm + parameters: + - name: petId + in: path + description: ID of pet that needs to be updated + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: Successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + delete: + tags: + - pet + summary: Deletes a pet + description: '' + operationId: deletePet + parameters: + - name: api_key + in: header + required: false + schema: + type: string + - name: petId + in: path + description: Pet id to delete + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: Successful operation + '400': + description: Invalid pet value + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + '/pet/{petId}/uploadImage': + post: + tags: + - pet + summary: uploads an image + description: '' + operationId: uploadFile + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + type: string + format: binary + /store/inventory: + get: + tags: + - store + summary: Returns pet inventories by status + description: Returns a map of status codes to quantities + operationId: getInventory + x-webclient-blocking: false + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + additionalProperties: + type: integer + format: int32 + security: + - api_key: [] + /store/order: + post: + tags: + - store + summary: Place an order for a pet + description: '' + operationId: placeOrder + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + '400': + description: Invalid Order + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + '/store/order/{order_id}': + get: + tags: + - store + summary: Find purchase order by ID + description: >- + For valid response try integer IDs with value <= 5 or > 10. Other values + will generate exceptions + operationId: getOrderById + parameters: + - name: order_id + in: path + description: ID of pet that needs to be fetched + required: true + schema: + type: integer + format: int64 + minimum: 1 + maximum: 5 + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + '400': + description: Invalid ID supplied + '404': + description: Order not found + delete: + tags: + - store + summary: Delete purchase order by ID + description: >- + For valid response try integer IDs with value < 1000. Anything above + 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - name: order_id + in: path + description: ID of the order that needs to be deleted + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + /user: + post: + tags: + - user + summary: Create user + description: This can only be done by the logged in user. + operationId: createUser + responses: + default: + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + /user/createWithArray: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithArrayInput + responses: + default: + description: successful operation + requestBody: + $ref: '#/components/requestBodies/UserArray' + /user/createWithList: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithListInput + responses: + default: + description: successful operation + requestBody: + $ref: '#/components/requestBodies/UserArray' + /user/login: + get: + tags: + - user + summary: Logs user into the system + description: '' + operationId: loginUser + parameters: + - name: username + in: query + description: The user name for login + required: true + schema: + type: string + - name: password + in: query + description: The password for login in clear text + required: true + schema: + type: string + responses: + '200': + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + type: integer + format: int32 + X-Expires-After: + description: date in UTC when token expires + schema: + type: string + format: date-time + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + '400': + description: Invalid username/password supplied + /user/logout: + get: + tags: + - user + summary: Logs out current logged in user session + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + '/user/{username}': + get: + tags: + - user + summary: Get user by user name + description: '' + operationId: getUserByName + parameters: + - name: username + in: path + description: The name that needs to be fetched. Use user1 for testing. + required: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + '400': + description: Invalid username supplied + '404': + description: User not found + put: + tags: + - user + summary: Updated user + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - name: username + in: path + description: name that need to be deleted + required: true + schema: + type: string + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + delete: + tags: + - user + summary: Delete user + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - name: username + in: path + description: The name that needs to be deleted + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + /fake_classname_test: + patch: + tags: + - 'fake_classname_tags 123#$%^' + summary: To test class name in snake case + description: To test class name in snake case + operationId: testClassname + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + security: + - api_key_query: [] + requestBody: + $ref: '#/components/requestBodies/Client' + /fake: + patch: + tags: + - fake + summary: To test "client" model + description: To test "client" model + operationId: testClientModel + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + requestBody: + $ref: '#/components/requestBodies/Client' + get: + tags: + - fake + summary: To test enum parameters + description: To test enum parameters + operationId: testEnumParameters + parameters: + - name: enum_header_string_array + in: header + description: Header parameter enum test (string array) + schema: + type: array + items: + type: string + default: $ + enum: + - '>' + - $ + - name: enum_header_string + in: header + description: Header parameter enum test (string) + schema: + type: string + enum: + - _abc + - '-efg' + - (xyz) + default: '-efg' + - name: enum_query_string_array + in: query + description: Query parameter enum test (string array) + schema: + type: array + items: + type: string + default: $ + enum: + - '>' + - $ + - name: enum_query_string + in: query + description: Query parameter enum test (string) + schema: + type: string + enum: + - _abc + - '-efg' + - (xyz) + default: '-efg' + - name: enum_query_integer + in: query + description: Query parameter enum test (double) + schema: + type: integer + format: int32 + enum: + - 1 + - -2 + - name: enum_query_double + in: query + description: Query parameter enum test (double) + schema: + type: number + format: double + enum: + - 1.1 + - -1.2 + - name: enum_query_model_array + in: query + schema: + type: array + items: + $ref: '#/components/schemas/EnumClass' + responses: + '400': + description: Invalid request + '404': + description: Not found + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + type: array + items: + type: string + default: $ + enum: + - '>' + - $ + enum_form_string: + description: Form parameter enum test (string) + type: string + enum: + - _abc + - '-efg' + - (xyz) + default: '-efg' + post: + tags: + - fake + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - http_basic_test: [] + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + integer: + description: None + type: integer + minimum: 10 + maximum: 100 + int32: + description: None + type: integer + format: int32 + minimum: 20 + maximum: 200 + int64: + description: None + type: integer + format: int64 + number: + description: None + type: number + minimum: 32.1 + maximum: 543.2 + float: + description: None + type: number + format: float + maximum: 987.6 + double: + description: None + type: number + format: double + minimum: 67.8 + maximum: 123.4 + string: + description: None + type: string + pattern: '/[a-z]/i' + pattern_without_delimiter: + description: None + type: string + pattern: '^[A-Z].*' + byte: + description: None + type: string + format: byte + binary: + description: None + type: string + format: binary + date: + description: None + type: string + format: date + dateTime: + description: None + type: string + format: date-time + password: + description: None + type: string + format: password + minLength: 10 + maxLength: 64 + callback: + description: None + type: string + required: + - number + - double + - pattern_without_delimiter + - byte + delete: + tags: + - fake + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + x-group-parameters: true + parameters: + - name: required_string_group + in: query + description: Required String in group parameters + required: true + schema: + type: integer + - name: required_boolean_group + in: header + description: Required Boolean in group parameters + required: true + schema: + type: boolean + - name: required_int64_group + in: query + description: Required Integer in group parameters + required: true + schema: + type: integer + format: int64 + - name: string_group + in: query + description: String in group parameters + schema: + type: integer + - name: boolean_group + in: header + description: Boolean in group parameters + schema: + type: boolean + - name: int64_group + in: query + description: Integer in group parameters + schema: + type: integer + format: int64 + responses: + '400': + description: Something wrong + /fake/outer/number: + post: + tags: + - fake + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + responses: + '200': + description: Output number + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterNumber' + description: Input number as post body + /fake/property/enum-int: + post: + tags: + - fake + description: Test serialization of enum (int) properties with examples + operationId: fakePropertyEnumIntegerSerialize + responses: + '200': + description: Output enum (int) + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterObjectWithEnumProperty' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/OuterObjectWithEnumProperty' + description: Input enum (int) as post body + /fake/outer/string: + post: + tags: + - fake + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + responses: + '200': + description: Output string + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterString' + description: Input string as post body + /fake/outer/boolean: + post: + tags: + - fake + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + responses: + '200': + description: Output boolean + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Input boolean as post body + /fake/outer/composite: + post: + tags: + - fake + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + responses: + '200': + description: Output composite + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterComposite' + description: Input composite as post body + /fake/BigDecimalMap: + get: + tags: + - fake + description: for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + operationId: fakeBigDecimalMap + responses: + '200': + description: successful operation + content: + '*/*': + schema: + type: object + properties: + someId: + type: number + someMap: + type: object + additionalProperties: + type: number + /fake/jsonFormData: + get: + tags: + - fake + summary: test json serialization of form data + description: '' + operationId: testJsonFormData + responses: + '200': + description: successful operation + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + /fake/additionalProperties-reference: + post: + tags: + - fake + summary: test referenced additionalProperties + description: '' + operationId: testAdditionalPropertiesReference + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true + /fake/stringMap-reference: + post: + tags: + - fake + summary: test referenced string map + description: '' + operationId: testStringMapReference + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MapOfString' + description: request body + required: true + /fake/inline-additionalProperties: + post: + tags: + - fake + summary: test inline additionalProperties + description: '' + operationId: testInlineAdditionalProperties + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + type: object + additionalProperties: + type: string + description: request body + required: true + /fake/inline-freeform-additionalProperties: + post: + tags: + - fake + summary: test inline free-form additionalProperties + description: '' + operationId: testInlineFreeformAdditionalProperties + responses: + '200': + description: successful operation + requestBody: + content: + application/json: + schema: + type: object + properties: + someProperty: + type: string + additionalProperties: true + description: request body + required: true + /fake/nullable: + post: + tags: + - fake + summary: test nullable parent property + description: "" + operationId: testNullable + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ChildWithNullable' + description: request body + required: true + responses: + "200": + description: successful operation + /fake/body-with-query-params: + put: + tags: + - fake + operationId: testBodyWithQueryParams + parameters: + - name: query + in: query + required: true + schema: + type: string + responses: + '200': + description: Success + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + /another-fake/dummy: + patch: + tags: + - $another-fake? + summary: To test special tags + description: To test special tags and operation ID starting with number + operationId: '123_test_@#$%_special_tags' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + requestBody: + $ref: '#/components/requestBodies/Client' + /fake/body-with-file-schema: + put: + tags: + - fake + description: >- + For this test, the body for this request must reference a schema named + `File`. + operationId: testBodyWithFileSchema + responses: + '200': + description: Success + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FileSchemaTestClass' + required: true + /fake/body-with-binary: + put: + tags: + - fake + description: >- + For this test, the body has to be a binary file. + operationId: testBodyWithBinary + responses: + '200': + description: Success + requestBody: + content: + image/png: + schema: + type: string + nullable: true + format: binary + description: image to upload + required: true + /fake/test-query-parameters: + put: + tags: + - fake + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - name: pipe + in: query + required: true + style: pipeDelimited + schema: + type: array + items: + type: string + - name: ioutil + in: query + required: true + style: form + explode: false + schema: + type: array + items: + type: string + - name: http + in: query + required: true + style: spaceDelimited + schema: + type: array + items: + type: string + - name: url + in: query + required: true + style: form + explode: false + schema: + type: array + items: + type: string + - name: context + in: query + required: true + explode: true + schema: + type: array + items: + type: string + - name: language + in: query + required: false + schema: + type: object + additionalProperties: + type: string + format: string + - name: allowEmpty + in: query + required: true + allowEmptyValue: true + schema: + type: string + responses: + "200": + description: Success + '/fake/{petId}/uploadImageWithRequiredFile': + post: + tags: + - pet + summary: uploads an image (required) + description: '' + operationId: uploadFileWithRequiredFile + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + type: string + format: binary + required: + - requiredFile + /fake/health: + get: + tags: + - fake + summary: Health check endpoint + responses: + 200: + description: The instance started successfully + content: + application/json: + schema: + $ref: '#/components/schemas/HealthCheckResult' + /fake/http-signature-test: + get: + tags: + - fake + summary: test http signature authentication + operationId: fake-http-signature-test + parameters: + - name: query_1 + in: query + description: query parameter + required: optional + schema: + type: string + - name: header_1 + in: header + description: header parameter + required: optional + schema: + type: string + security: + - http_signature_test: [] + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + 200: + description: The instance started successfully +servers: + - url: 'http://{server}.swagger.io:{port}/v2' + description: petstore server + variables: + server: + enum: + - 'petstore' + - 'qa-petstore' + - 'dev-petstore' + default: 'petstore' + port: + enum: + - 80 + - 8080 + default: 80 + - url: https://localhost:8080/{version} + description: The local server + variables: + version: + enum: + - 'v1' + - 'v2' + default: 'v2' + - url: https://127.0.0.1/no_varaible + description: The local server without variables +components: + requestBodies: + UserArray: + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/User' + description: List of user object + required: true + Client: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog' + scopes: + 'write:pets': modify pets in your account + 'read:pets': read your pets + api_key: + type: apiKey + name: api_key + in: header + api_key_query: + type: apiKey + name: api_key_query + in: query + http_basic_test: + type: http + scheme: basic + bearer_test: + type: http + scheme: bearer + bearerFormat: JWT + http_signature_test: + type: http + scheme: signature + schemas: + Foo: + type: object + properties: + bar: + $ref: '#/components/schemas/Bar' + Bar: + type: string + default: bar + Order: + type: object + properties: + id: + type: integer + format: int64 + petId: + type: integer + format: int64 + quantity: + type: integer + format: int32 + shipDate: + type: string + format: date-time + status: + type: string + description: Order Status + enum: + - placed + - approved + - delivered + complete: + type: boolean + default: false + xml: + name: Order + Category: + type: object + required: + - name + properties: + id: + type: integer + format: int64 + name: + type: string + default: default-name + xml: + name: Category + User: + type: object + properties: + id: + type: integer + format: int64 + x-is-unique: true + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + type: integer + format: int32 + description: User Status + xml: + name: User + Tag: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Tag + Pet: + type: object + required: + - name + - photoUrls + properties: + id: + type: integer + format: int64 + x-is-unique: true + category: + $ref: '#/components/schemas/Category' + name: + type: string + example: doggie + photoUrls: + type: array + xml: + wrapped: true + items: + type: string + xml: + name: photoUrl + uniqueItems: true + tags: + type: array + xml: + name: tag + wrapped: true + items: + $ref: '#/components/schemas/Tag' + status: + type: string + description: pet status in the store + enum: + - available + - pending + - sold + xml: + name: Pet + ApiResponse: + type: object + properties: + code: + type: integer + format: int32 + type: + type: string + message: + type: string + Return: + description: Model for testing reserved words + properties: + return: + type: integer + format: int32 + xml: + name: Return + Name: + description: Model for testing model name same as property name + required: + - name + properties: + name: + type: integer + format: int32 + snake_case: + readOnly: true + type: integer + format: int32 + property: + type: string + 123Number: + type: integer + readOnly: true + xml: + name: Name + 200_response: + description: Model for testing model name starting with number + properties: + name: + type: integer + format: int32 + class: + type: string + xml: + name: Name + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - type: object + properties: + breed: + type: string + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - type: object + properties: + declawed: + type: boolean + Animal: + type: object + discriminator: + propertyName: className + mapping: + DOG: '#/components/schemas/Dog' + CAT: '#/components/schemas/Cat' + required: + - className + properties: + className: + type: string + color: + type: string + default: red + AnimalFarm: + type: array + items: + $ref: '#/components/schemas/Animal' + format_test: + type: object + required: + - number + - byte + - date + - password + properties: + integer: + type: integer + maximum: 100 + minimum: 10 + int32: + type: integer + format: int32 + maximum: 200 + minimum: 20 + int64: + type: integer + format: int64 + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + type: number + format: float + maximum: 987.6 + minimum: 54.3 + double: + type: number + format: double + maximum: 123.4 + minimum: 67.8 + decimal: + type: string + format: number + string: + type: string + pattern: '/[a-z]/i' + byte: + type: string + format: byte + binary: + type: string + format: binary + date: + type: string + format: date + dateTime: + type: string + format: date-time + uuid: + type: string + format: uuid + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + password: + type: string + format: password + maxLength: 64 + minLength: 10 + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + type: string + pattern: '^\d{10}$' + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + type: string + pattern: '/^image_\d{1,3}$/i' + EnumClass: + type: string + default: '-efg' + enum: + - _abc + - '-efg' + - (xyz) + - TEST + - TEST_A + - TEST_A_ABC + - TEST_a + - tEST + 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 + FreeFormObject: + type: object + description: A schema consisting only of additional properties + additionalProperties: true + MapOfString: + type: object + description: A schema consisting only of additional properties of type string + additionalProperties: + type: string + 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 + ParentWithNullable: + type: object + discriminator: + propertyName: type + properties: + type: + type: string + enum: + - ChildWithNullable + nullableProperty: + type: string + nullable: true + ChildWithNullable: + allOf: + - $ref: '#/components/schemas/ParentWithNullable' + - type: object + properties: + otherProperty: + type: string + 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 diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/.gitignore b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/.gitignore new file mode 100644 index 000000000000..4298cdcbd1a2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/.gitignore @@ -0,0 +1,41 @@ +# See https://dart.dev/guides/libraries/private-files + +# Files and directories created by pub +.dart_tool/ +.buildlog +.packages +.project +.pub/ +build/ +**/packages/ + +# Files created by dart2js +# (Most Dart developers will use pub build to compile Dart, use/modify these +# rules if you intend to use dart2js directly +# Convention is to use extension '.dart.js' for Dart compiled to Javascript to +# differentiate from explicit Javascript files) +*.dart.js +*.part.js +*.js.deps +*.js.map +*.info.json + +# Directory created by dartdoc +doc/api/ + +# Don't commit pubspec lock file +# (Library packages only! Remove pattern if developing an application package) +pubspec.lock + +# Don’t commit files and directories created by other development environments. +# For example, if your development environment creates any of the following files, +# consider putting them in a global ignore file: + +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ + +# Mac +.DS_Store diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/.openapi-generator-ignore b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/.openapi-generator/FILES new file mode 100644 index 000000000000..1a5e5be75940 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/.openapi-generator/FILES @@ -0,0 +1,127 @@ +.gitignore +README.md +analysis_options.yaml +build.yaml +doc/AdditionalPropertiesClass.md +doc/AllOfWithSingleRef.md +doc/Animal.md +doc/AnotherFakeApi.md +doc/ApiResponse.md +doc/ArrayOfArrayOfNumberOnly.md +doc/ArrayOfNumberOnly.md +doc/ArrayTest.md +doc/Capitalization.md +doc/Cat.md +doc/Category.md +doc/ChildWithNullable.md +doc/ClassModel.md +doc/DefaultApi.md +doc/DeprecatedObject.md +doc/Dog.md +doc/EnumArrays.md +doc/EnumTest.md +doc/FakeApi.md +doc/FakeBigDecimalMap200Response.md +doc/FakeClassnameTags123Api.md +doc/FileSchemaTestClass.md +doc/Foo.md +doc/FooGetDefaultResponse.md +doc/FormatTest.md +doc/HasOnlyReadOnly.md +doc/HealthCheckResult.md +doc/MapTest.md +doc/MixedPropertiesAndAdditionalPropertiesClass.md +doc/Model200Response.md +doc/ModelClient.md +doc/ModelEnumClass.md +doc/ModelFile.md +doc/ModelList.md +doc/ModelReturn.md +doc/Name.md +doc/NullableClass.md +doc/NumberOnly.md +doc/ObjectWithDeprecatedFields.md +doc/Order.md +doc/OuterComposite.md +doc/OuterEnum.md +doc/OuterEnumDefaultValue.md +doc/OuterEnumInteger.md +doc/OuterEnumIntegerDefaultValue.md +doc/OuterObjectWithEnumProperty.md +doc/ParentWithNullable.md +doc/Pet.md +doc/PetApi.md +doc/ReadOnlyFirst.md +doc/SingleRefType.md +doc/SpecialModelName.md +doc/StoreApi.md +doc/Tag.md +doc/TestInlineFreeformAdditionalPropertiesRequest.md +doc/User.md +doc/UserApi.md +lib/openapi.dart +lib/src/api.dart +lib/src/api/another_fake_api.dart +lib/src/api/default_api.dart +lib/src/api/fake_api.dart +lib/src/api/fake_classname_tags123_api.dart +lib/src/api/pet_api.dart +lib/src/api/store_api.dart +lib/src/api/user_api.dart +lib/src/auth/api_key_auth.dart +lib/src/auth/auth.dart +lib/src/auth/basic_auth.dart +lib/src/auth/bearer_auth.dart +lib/src/auth/oauth.dart +lib/src/deserialize.dart +lib/src/model/additional_properties_class.dart +lib/src/model/all_of_with_single_ref.dart +lib/src/model/animal.dart +lib/src/model/api_response.dart +lib/src/model/array_of_array_of_number_only.dart +lib/src/model/array_of_number_only.dart +lib/src/model/array_test.dart +lib/src/model/capitalization.dart +lib/src/model/cat.dart +lib/src/model/category.dart +lib/src/model/child_with_nullable.dart +lib/src/model/class_model.dart +lib/src/model/deprecated_object.dart +lib/src/model/dog.dart +lib/src/model/enum_arrays.dart +lib/src/model/enum_test.dart +lib/src/model/fake_big_decimal_map200_response.dart +lib/src/model/file_schema_test_class.dart +lib/src/model/foo.dart +lib/src/model/foo_get_default_response.dart +lib/src/model/format_test.dart +lib/src/model/has_only_read_only.dart +lib/src/model/health_check_result.dart +lib/src/model/map_test.dart +lib/src/model/mixed_properties_and_additional_properties_class.dart +lib/src/model/model200_response.dart +lib/src/model/model_client.dart +lib/src/model/model_enum_class.dart +lib/src/model/model_file.dart +lib/src/model/model_list.dart +lib/src/model/model_return.dart +lib/src/model/name.dart +lib/src/model/nullable_class.dart +lib/src/model/number_only.dart +lib/src/model/object_with_deprecated_fields.dart +lib/src/model/order.dart +lib/src/model/outer_composite.dart +lib/src/model/outer_enum.dart +lib/src/model/outer_enum_default_value.dart +lib/src/model/outer_enum_integer.dart +lib/src/model/outer_enum_integer_default_value.dart +lib/src/model/outer_object_with_enum_property.dart +lib/src/model/parent_with_nullable.dart +lib/src/model/pet.dart +lib/src/model/read_only_first.dart +lib/src/model/single_ref_type.dart +lib/src/model/special_model_name.dart +lib/src/model/tag.dart +lib/src/model/test_inline_freeform_additional_properties_request.dart +lib/src/model/user.dart +pubspec.yaml diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/.openapi-generator/VERSION new file mode 100644 index 000000000000..4c631cf217a2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.14.0-SNAPSHOT diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/README.md new file mode 100644 index 000000000000..5a5211d271a0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/README.md @@ -0,0 +1,212 @@ +# openapi (EXPERIMENTAL) +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 +- Generator version: 7.14.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.DartDioClientCodegen + +## Requirements + +* Dart 2.15.0+ or Flutter 2.8.0+ +* Dio 5.0.0+ (https://pub.dev/packages/dio) +* JSON Serializable 6.1.5+ (https://pub.dev/packages/json_serializable) + +## Installation & Usage + +### pub.dev +To use the package from [pub.dev](https://pub.dev), please include the following in pubspec.yaml +```yaml +dependencies: + openapi: 1.0.0 +``` + +### Github +If this Dart package is published to Github, please include the following in pubspec.yaml +```yaml +dependencies: + openapi: + git: + url: https://github.com/GIT_USER_ID/GIT_REPO_ID.git + #ref: main +``` + +### Local development +To use the package from your local drive, please include the following in pubspec.yaml +```yaml +dependencies: + openapi: + path: /path/to/openapi +``` + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```dart +import 'package:openapi/openapi.dart'; + + +final api = Openapi().getAnotherFakeApi(); +final ModelClient modelClient = ; // ModelClient | client model + +try { + final response = await api.call123testSpecialTags(modelClient); + print(response); +} catch on DioException (e) { + print("Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n"); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +[*AnotherFakeApi*](doc/AnotherFakeApi.md) | [**call123testSpecialTags**](doc/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +[*DefaultApi*](doc/DefaultApi.md) | [**fooGet**](doc/DefaultApi.md#fooget) | **GET** /foo | +[*FakeApi*](doc/FakeApi.md) | [**fakeBigDecimalMap**](doc/FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap | +[*FakeApi*](doc/FakeApi.md) | [**fakeHealthGet**](doc/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint +[*FakeApi*](doc/FakeApi.md) | [**fakeHttpSignatureTest**](doc/FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication +[*FakeApi*](doc/FakeApi.md) | [**fakeOuterBooleanSerialize**](doc/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +[*FakeApi*](doc/FakeApi.md) | [**fakeOuterCompositeSerialize**](doc/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +[*FakeApi*](doc/FakeApi.md) | [**fakeOuterNumberSerialize**](doc/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | +[*FakeApi*](doc/FakeApi.md) | [**fakeOuterStringSerialize**](doc/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +[*FakeApi*](doc/FakeApi.md) | [**fakePropertyEnumIntegerSerialize**](doc/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | +[*FakeApi*](doc/FakeApi.md) | [**testAdditionalPropertiesReference**](doc/FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties +[*FakeApi*](doc/FakeApi.md) | [**testBodyWithBinary**](doc/FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | +[*FakeApi*](doc/FakeApi.md) | [**testBodyWithFileSchema**](doc/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | +[*FakeApi*](doc/FakeApi.md) | [**testBodyWithQueryParams**](doc/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | +[*FakeApi*](doc/FakeApi.md) | [**testClientModel**](doc/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model +[*FakeApi*](doc/FakeApi.md) | [**testEndpointParameters**](doc/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[*FakeApi*](doc/FakeApi.md) | [**testEnumParameters**](doc/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters +[*FakeApi*](doc/FakeApi.md) | [**testGroupParameters**](doc/FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[*FakeApi*](doc/FakeApi.md) | [**testInlineAdditionalProperties**](doc/FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[*FakeApi*](doc/FakeApi.md) | [**testInlineFreeformAdditionalProperties**](doc/FakeApi.md#testinlinefreeformadditionalproperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties +[*FakeApi*](doc/FakeApi.md) | [**testJsonFormData**](doc/FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +[*FakeApi*](doc/FakeApi.md) | [**testNullable**](doc/FakeApi.md#testnullable) | **POST** /fake/nullable | test nullable parent property +[*FakeApi*](doc/FakeApi.md) | [**testQueryParameterCollectionFormat**](doc/FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | +[*FakeApi*](doc/FakeApi.md) | [**testStringMapReference**](doc/FakeApi.md#teststringmapreference) | **POST** /fake/stringMap-reference | test referenced string map +[*FakeClassnameTags123Api*](doc/FakeClassnameTags123Api.md) | [**testClassname**](doc/FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case +[*PetApi*](doc/PetApi.md) | [**addPet**](doc/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +[*PetApi*](doc/PetApi.md) | [**deletePet**](doc/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[*PetApi*](doc/PetApi.md) | [**findPetsByStatus**](doc/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +[*PetApi*](doc/PetApi.md) | [**findPetsByTags**](doc/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +[*PetApi*](doc/PetApi.md) | [**getPetById**](doc/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[*PetApi*](doc/PetApi.md) | [**updatePet**](doc/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +[*PetApi*](doc/PetApi.md) | [**updatePetWithForm**](doc/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +[*PetApi*](doc/PetApi.md) | [**uploadFile**](doc/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +[*PetApi*](doc/PetApi.md) | [**uploadFileWithRequiredFile**](doc/PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +[*StoreApi*](doc/StoreApi.md) | [**deleteOrder**](doc/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[*StoreApi*](doc/StoreApi.md) | [**getInventory**](doc/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[*StoreApi*](doc/StoreApi.md) | [**getOrderById**](doc/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID +[*StoreApi*](doc/StoreApi.md) | [**placeOrder**](doc/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet +[*UserApi*](doc/UserApi.md) | [**createUser**](doc/UserApi.md#createuser) | **POST** /user | Create user +[*UserApi*](doc/UserApi.md) | [**createUsersWithArrayInput**](doc/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +[*UserApi*](doc/UserApi.md) | [**createUsersWithListInput**](doc/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +[*UserApi*](doc/UserApi.md) | [**deleteUser**](doc/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +[*UserApi*](doc/UserApi.md) | [**getUserByName**](doc/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +[*UserApi*](doc/UserApi.md) | [**loginUser**](doc/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +[*UserApi*](doc/UserApi.md) | [**logoutUser**](doc/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +[*UserApi*](doc/UserApi.md) | [**updateUser**](doc/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + +## Documentation For Models + + - [AdditionalPropertiesClass](doc/AdditionalPropertiesClass.md) + - [AllOfWithSingleRef](doc/AllOfWithSingleRef.md) + - [Animal](doc/Animal.md) + - [ApiResponse](doc/ApiResponse.md) + - [ArrayOfArrayOfNumberOnly](doc/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](doc/ArrayOfNumberOnly.md) + - [ArrayTest](doc/ArrayTest.md) + - [Capitalization](doc/Capitalization.md) + - [Cat](doc/Cat.md) + - [Category](doc/Category.md) + - [ChildWithNullable](doc/ChildWithNullable.md) + - [ClassModel](doc/ClassModel.md) + - [DeprecatedObject](doc/DeprecatedObject.md) + - [Dog](doc/Dog.md) + - [EnumArrays](doc/EnumArrays.md) + - [EnumTest](doc/EnumTest.md) + - [FakeBigDecimalMap200Response](doc/FakeBigDecimalMap200Response.md) + - [FileSchemaTestClass](doc/FileSchemaTestClass.md) + - [Foo](doc/Foo.md) + - [FooGetDefaultResponse](doc/FooGetDefaultResponse.md) + - [FormatTest](doc/FormatTest.md) + - [HasOnlyReadOnly](doc/HasOnlyReadOnly.md) + - [HealthCheckResult](doc/HealthCheckResult.md) + - [MapTest](doc/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](doc/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](doc/Model200Response.md) + - [ModelClient](doc/ModelClient.md) + - [ModelEnumClass](doc/ModelEnumClass.md) + - [ModelFile](doc/ModelFile.md) + - [ModelList](doc/ModelList.md) + - [ModelReturn](doc/ModelReturn.md) + - [Name](doc/Name.md) + - [NullableClass](doc/NullableClass.md) + - [NumberOnly](doc/NumberOnly.md) + - [ObjectWithDeprecatedFields](doc/ObjectWithDeprecatedFields.md) + - [Order](doc/Order.md) + - [OuterComposite](doc/OuterComposite.md) + - [OuterEnum](doc/OuterEnum.md) + - [OuterEnumDefaultValue](doc/OuterEnumDefaultValue.md) + - [OuterEnumInteger](doc/OuterEnumInteger.md) + - [OuterEnumIntegerDefaultValue](doc/OuterEnumIntegerDefaultValue.md) + - [OuterObjectWithEnumProperty](doc/OuterObjectWithEnumProperty.md) + - [ParentWithNullable](doc/ParentWithNullable.md) + - [Pet](doc/Pet.md) + - [ReadOnlyFirst](doc/ReadOnlyFirst.md) + - [SingleRefType](doc/SingleRefType.md) + - [SpecialModelName](doc/SpecialModelName.md) + - [Tag](doc/Tag.md) + - [TestInlineFreeformAdditionalPropertiesRequest](doc/TestInlineFreeformAdditionalPropertiesRequest.md) + - [User](doc/User.md) + + +## Documentation For Authorization + + +Authentication schemes defined for the API: +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + +### http_basic_test + +- **Type**: HTTP basic authentication + +### bearer_test + +- **Type**: HTTP Bearer Token authentication (JWT) + +### http_signature_test + +- **Type**: HTTP signature authentication + + +## Author + + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/analysis_options.yaml b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/analysis_options.yaml new file mode 100644 index 000000000000..70524126e3fe --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/analysis_options.yaml @@ -0,0 +1,10 @@ +analyzer: + language: + strict-inference: true + strict-raw-types: true + strict-casts: false + exclude: + - test/*.dart + - lib/src/model/*.g.dart + errors: + deprecated_member_use_from_same_package: ignore diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/build.yaml b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/build.yaml new file mode 100644 index 000000000000..89a4dd6e1c2e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..863b8503db83 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/AdditionalPropertiesClass.md @@ -0,0 +1,16 @@ +# openapi.model.AdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapProperty** | **Map<String, String>** | | [optional] +**mapOfMapProperty** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/AllOfWithSingleRef.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/AllOfWithSingleRef.md new file mode 100644 index 000000000000..4c6f3ab2fe11 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/AllOfWithSingleRef.md @@ -0,0 +1,16 @@ +# openapi.model.AllOfWithSingleRef + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **String** | | [optional] +**singleRefType** | [**SingleRefType**](SingleRefType.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Animal.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Animal.md new file mode 100644 index 000000000000..415b56e9bc2e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Animal.md @@ -0,0 +1,16 @@ +# openapi.model.Animal + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to 'red'] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/AnotherFakeApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/AnotherFakeApi.md new file mode 100644 index 000000000000..36a94e6bb703 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/AnotherFakeApi.md @@ -0,0 +1,57 @@ +# openapi.api.AnotherFakeApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**call123testSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags + + +# **call123testSpecialTags** +> ModelClient call123testSpecialTags(modelClient) + +To test special tags + +To test special tags and operation ID starting with number + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getAnotherFakeApi(); +final ModelClient modelClient = ; // ModelClient | client model + +try { + final response = api.call123testSpecialTags(modelClient); + print(response); +} catch on DioException (e) { + print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **modelClient** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ApiResponse.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ApiResponse.md new file mode 100644 index 000000000000..7ad5da0f89e4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/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/petstore_client_lib_use_lower_camel_case/doc/ArrayOfArrayOfNumberOnly.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..e5b9d669a436 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayArrayNumber** | [**List<List<num>>**](List.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ArrayOfNumberOnly.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..fe8e071eb45c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayNumber** | **List<num>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ArrayTest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ArrayTest.md new file mode 100644 index 000000000000..8ae11de10022 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ArrayTest.md @@ -0,0 +1,17 @@ +# openapi.model.ArrayTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayOfString** | **List<String>** | | [optional] +**arrayArrayOfInteger** | [**List<List<int>>**](List.md) | | [optional] +**arrayArrayOfModel** | [**List<List<ReadOnlyFirst>>**](List.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Capitalization.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Capitalization.md new file mode 100644 index 000000000000..4a07b4eb820d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Capitalization.md @@ -0,0 +1,20 @@ +# openapi.model.Capitalization + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**smallCamel** | **String** | | [optional] +**capitalCamel** | **String** | | [optional] +**smallSnake** | **String** | | [optional] +**capitalSnake** | **String** | | [optional] +**sCAETHFlowPoints** | **String** | | [optional] +**ATT_NAME** | **String** | Name of the pet | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Cat.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Cat.md new file mode 100644 index 000000000000..6552eea4b435 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Cat.md @@ -0,0 +1,17 @@ +# openapi.model.Cat + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to 'red'] +**declawed** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Category.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Category.md new file mode 100644 index 000000000000..ae6bc52e89d8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Category.md @@ -0,0 +1,16 @@ +# openapi.model.Category + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **String** | | [default to 'default-name'] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ChildWithNullable.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ChildWithNullable.md new file mode 100644 index 000000000000..770494fcf4cc --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ChildWithNullable.md @@ -0,0 +1,17 @@ +# openapi.model.ChildWithNullable + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | | [optional] +**nullableProperty** | **String** | | [optional] +**otherProperty** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ClassModel.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ClassModel.md new file mode 100644 index 000000000000..13ae5d3a4708 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ClassModel.md @@ -0,0 +1,15 @@ +# openapi.model.ClassModel + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/DefaultApi.md new file mode 100644 index 000000000000..6abd2b44f9c4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/DefaultApi.md @@ -0,0 +1,51 @@ +# openapi.api.DefaultApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fooGet**](DefaultApi.md#fooget) | **GET** /foo | + + +# **fooGet** +> FooGetDefaultResponse fooGet() + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getDefaultApi(); + +try { + final response = api.fooGet(); + print(response); +} catch on DioException (e) { + print('Exception when calling DefaultApi->fooGet: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/DeprecatedObject.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/DeprecatedObject.md new file mode 100644 index 000000000000..bf2ef67a26fc --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/DeprecatedObject.md @@ -0,0 +1,15 @@ +# openapi.model.DeprecatedObject + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Dog.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Dog.md new file mode 100644 index 000000000000..d36439b767bb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Dog.md @@ -0,0 +1,17 @@ +# openapi.model.Dog + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to 'red'] +**breed** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/EnumArrays.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/EnumArrays.md new file mode 100644 index 000000000000..1d4fd1363b59 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/EnumArrays.md @@ -0,0 +1,16 @@ +# openapi.model.EnumArrays + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justSymbol** | **String** | | [optional] +**arrayEnum** | **List<String>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/EnumTest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/EnumTest.md new file mode 100644 index 000000000000..7c24fe2347b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/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/petstore_client_lib_use_lower_camel_case/doc/FakeApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/FakeApi.md new file mode 100644 index 000000000000..1b5e1ca297c8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/FakeApi.md @@ -0,0 +1,1028 @@ +# openapi.api.FakeApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fakeBigDecimalMap**](FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap | +[**fakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint +[**fakeHttpSignatureTest**](FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | +[**testAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties +[**testBodyWithBinary**](FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | +[**testBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | +[**testBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | +[**testClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model +[**testEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**testEnumParameters**](FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters +[**testGroupParameters**](FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[**testInlineAdditionalProperties**](FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[**testInlineFreeformAdditionalProperties**](FakeApi.md#testinlinefreeformadditionalproperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties +[**testJsonFormData**](FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +[**testNullable**](FakeApi.md#testnullable) | **POST** /fake/nullable | test nullable parent property +[**testQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | +[**testStringMapReference**](FakeApi.md#teststringmapreference) | **POST** /fake/stringMap-reference | test referenced string map + + +# **fakeBigDecimalMap** +> FakeBigDecimalMap200Response fakeBigDecimalMap() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); + +try { + final response = api.fakeBigDecimalMap(); + print(response); +} catch on DioException (e) { + print('Exception when calling FakeApi->fakeBigDecimalMap: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakeHealthGet** +> HealthCheckResult fakeHealthGet() + +Health check endpoint + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); + +try { + final response = api.fakeHealthGet(); + print(response); +} catch on DioException (e) { + print('Exception when calling FakeApi->fakeHealthGet: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakeHttpSignatureTest** +> fakeHttpSignatureTest(pet, query1, header1) + +test http signature authentication + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store +final String query1 = query1_example; // String | query parameter +final String header1 = header1_example; // String | header parameter + +try { + api.fakeHttpSignatureTest(pet, query1, header1); +} catch on DioException (e) { + print('Exception when calling FakeApi->fakeHttpSignatureTest: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **query1** | **String**| query parameter | [optional] + **header1** | **String**| header parameter | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakeOuterBooleanSerialize** +> bool fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final bool body = true; // bool | Input boolean as post body + +try { + final response = api.fakeOuterBooleanSerialize(body); + print(response); +} catch on DioException (e) { + print('Exception when calling FakeApi->fakeOuterBooleanSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **bool**| Input boolean as post body | [optional] + +### Return type + +**bool** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(outerComposite) + + + +Test serialization of object with outer number type + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final OuterComposite outerComposite = ; // OuterComposite | Input composite as post body + +try { + final response = api.fakeOuterCompositeSerialize(outerComposite); + print(response); +} catch on DioException (e) { + print('Exception when calling FakeApi->fakeOuterCompositeSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakeOuterNumberSerialize** +> num fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final num body = 8.14; // num | Input number as post body + +try { + final response = api.fakeOuterNumberSerialize(body); + print(response); +} catch on DioException (e) { + print('Exception when calling FakeApi->fakeOuterNumberSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **num**| Input number as post body | [optional] + +### Return type + +**num** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final String body = body_example; // String | Input string as post body + +try { + final response = api.fakeOuterStringSerialize(body); + print(response); +} catch on DioException (e) { + print('Exception when calling FakeApi->fakeOuterStringSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **String**| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakePropertyEnumIntegerSerialize** +> OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty) + + + +Test serialization of enum (int) properties with examples + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final OuterObjectWithEnumProperty outerObjectWithEnumProperty = ; // OuterObjectWithEnumProperty | Input enum (int) as post body + +try { + final response = api.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty); + print(response); +} catch on DioException (e) { + print('Exception when calling FakeApi->fakePropertyEnumIntegerSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outerObjectWithEnumProperty** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | + +### Return type + +[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testAdditionalPropertiesReference** +> testAdditionalPropertiesReference(requestBody) + +test referenced additionalProperties + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final Map requestBody = Object; // Map | request body + +try { + api.testAdditionalPropertiesReference(requestBody); +} catch on DioException (e) { + print('Exception when calling FakeApi->testAdditionalPropertiesReference: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**Map<String, Object>**](Object.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testBodyWithBinary** +> testBodyWithBinary(body) + + + +For this test, the body has to be a binary file. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final MultipartFile body = BINARY_DATA_HERE; // MultipartFile | image to upload + +try { + api.testBodyWithBinary(body); +} catch on DioException (e) { + print('Exception when calling FakeApi->testBodyWithBinary: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **MultipartFile**| image to upload | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: image/png + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testBodyWithFileSchema** +> testBodyWithFileSchema(fileSchemaTestClass) + + + +For this test, the body for this request must reference a schema named `File`. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final FileSchemaTestClass fileSchemaTestClass = ; // FileSchemaTestClass | + +try { + api.testBodyWithFileSchema(fileSchemaTestClass); +} catch on DioException (e) { + print('Exception when calling FakeApi->testBodyWithFileSchema: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(query, user) + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final String query = query_example; // String | +final User user = ; // User | + +try { + api.testBodyWithQueryParams(query, user); +} catch on DioException (e) { + print('Exception when calling FakeApi->testBodyWithQueryParams: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | **String**| | + **user** | [**User**](User.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testClientModel** +> ModelClient testClientModel(modelClient) + +To test \"client\" model + +To test \"client\" model + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final ModelClient modelClient = ; // ModelClient | client model + +try { + final response = api.testClientModel(modelClient); + print(response); +} catch on DioException (e) { + print('Exception when calling FakeApi->testClientModel: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **modelClient** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testEndpointParameters** +> testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure HTTP basic authorization: http_basic_test +//defaultApiClient.getAuthentication('http_basic_test').username = 'YOUR_USERNAME' +//defaultApiClient.getAuthentication('http_basic_test').password = 'YOUR_PASSWORD'; + +final api = Openapi().getFakeApi(); +final num number = 8.14; // num | None +final double double_ = 1.2; // double | None +final String patternWithoutDelimiter = patternWithoutDelimiter_example; // String | None +final String byte = BYTE_ARRAY_DATA_HERE; // String | None +final int integer = 56; // int | None +final int int32 = 56; // int | None +final int int64 = 789; // int | None +final double float = 3.4; // double | None +final String string = string_example; // String | None +final MultipartFile binary = BINARY_DATA_HERE; // MultipartFile | None +final DateTime date = 2013-10-20; // DateTime | None +final DateTime dateTime = 2013-10-20T19:20:30+01:00; // DateTime | None +final String password = password_example; // String | None +final String callback = callback_example; // String | None + +try { + api.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); +} catch on DioException (e) { + print('Exception when calling FakeApi->testEndpointParameters: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **num**| None | + **double_** | **double**| None | + **patternWithoutDelimiter** | **String**| None | + **byte** | **String**| None | + **integer** | **int**| None | [optional] + **int32** | **int**| None | [optional] + **int64** | **int**| None | [optional] + **float** | **double**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **MultipartFile**| None | [optional] + **date** | **DateTime**| None | [optional] + **dateTime** | **DateTime**| None | [optional] + **password** | **String**| None | [optional] + **callback** | **String**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testEnumParameters** +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final List enumHeaderStringArray = ; // List | Header parameter enum test (string array) +final String enumHeaderString = enumHeaderString_example; // String | Header parameter enum test (string) +final List enumQueryStringArray = ; // List | Query parameter enum test (string array) +final String enumQueryString = enumQueryString_example; // String | Query parameter enum test (string) +final int enumQueryInteger = 56; // int | Query parameter enum test (double) +final double enumQueryDouble = 1.2; // double | Query parameter enum test (double) +final List enumQueryModelArray = ; // List | +final List enumFormStringArray = ; // List | Form parameter enum test (string array) +final String enumFormString = enumFormString_example; // String | Form parameter enum test (string) + +try { + api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString); +} catch on DioException (e) { + print('Exception when calling FakeApi->testEnumParameters: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] + **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to '-efg'] + **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] + **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to '-efg'] + **enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] + **enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] + **enumQueryModelArray** | [**List<ModelEnumClass>**](ModelEnumClass.md)| | [optional] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to '$'] + **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to '-efg'] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testGroupParameters** +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final int requiredStringGroup = 56; // int | Required String in group parameters +final bool requiredBooleanGroup = true; // bool | Required Boolean in group parameters +final int requiredInt64Group = 789; // int | Required Integer in group parameters +final int stringGroup = 56; // int | String in group parameters +final bool booleanGroup = true; // bool | Boolean in group parameters +final int int64Group = 789; // int | Integer in group parameters + +try { + api.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); +} catch on DioException (e) { + print('Exception when calling FakeApi->testGroupParameters: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requiredStringGroup** | **int**| Required String in group parameters | + **requiredBooleanGroup** | **bool**| Required Boolean in group parameters | + **requiredInt64Group** | **int**| Required Integer in group parameters | + **stringGroup** | **int**| String in group parameters | [optional] + **booleanGroup** | **bool**| Boolean in group parameters | [optional] + **int64Group** | **int**| Integer in group parameters | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[bearer_test](../README.md#bearer_test) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testInlineAdditionalProperties** +> testInlineAdditionalProperties(requestBody) + +test inline additionalProperties + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final Map requestBody = ; // Map | request body + +try { + api.testInlineAdditionalProperties(requestBody); +} catch on DioException (e) { + print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**Map<String, String>**](String.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testInlineFreeformAdditionalProperties** +> testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest) + +test inline free-form additionalProperties + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = ; // TestInlineFreeformAdditionalPropertiesRequest | request body + +try { + api.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); +} catch on DioException (e) { + print('Exception when calling FakeApi->testInlineFreeformAdditionalProperties: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **testInlineFreeformAdditionalPropertiesRequest** | [**TestInlineFreeformAdditionalPropertiesRequest**](TestInlineFreeformAdditionalPropertiesRequest.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testJsonFormData** +> testJsonFormData(param, param2) + +test json serialization of form data + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final String param = param_example; // String | field1 +final String param2 = param2_example; // String | field2 + +try { + api.testJsonFormData(param, param2); +} catch on DioException (e) { + print('Exception when calling FakeApi->testJsonFormData: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **String**| field1 | + **param2** | **String**| field2 | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testNullable** +> testNullable(childWithNullable) + +test nullable parent property + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final ChildWithNullable childWithNullable = ; // ChildWithNullable | request body + +try { + api.testNullable(childWithNullable); +} catch on DioException (e) { + print('Exception when calling FakeApi->testNullable: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **childWithNullable** | [**ChildWithNullable**](ChildWithNullable.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testQueryParameterCollectionFormat** +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) + + + +To test the collection format in query parameters + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final List pipe = ; // List | +final List ioutil = ; // List | +final List http = ; // List | +final List url = ; // List | +final List context = ; // List | +final String allowEmpty = allowEmpty_example; // String | +final Map language = ; // Map | + +try { + api.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); +} catch on DioException (e) { + print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pipe** | [**List<String>**](String.md)| | + **ioutil** | [**List<String>**](String.md)| | + **http** | [**List<String>**](String.md)| | + **url** | [**List<String>**](String.md)| | + **context** | [**List<String>**](String.md)| | + **allowEmpty** | **String**| | + **language** | [**Map<String, String>**](String.md)| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testStringMapReference** +> testStringMapReference(requestBody) + +test referenced string map + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); +final Map requestBody = ; // Map | request body + +try { + api.testStringMapReference(requestBody); +} catch on DioException (e) { + print('Exception when calling FakeApi->testStringMapReference: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**Map<String, String>**](String.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/FakeBigDecimalMap200Response.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/FakeBigDecimalMap200Response.md new file mode 100644 index 000000000000..281dfc44fd8c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/FakeBigDecimalMap200Response.md @@ -0,0 +1,16 @@ +# openapi.model.FakeBigDecimalMap200Response + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**someId** | **num** | | [optional] +**someMap** | **Map<String, num>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..645aebf399f0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/FakeClassnameTags123Api.md @@ -0,0 +1,61 @@ +# openapi.api.FakeClassnameTags123Api + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case + + +# **testClassname** +> ModelClient testClassname(modelClient) + +To test class name in snake case + +To test class name in snake case + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key_query +//defaultApiClient.getAuthentication('api_key_query').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key_query').apiKeyPrefix = 'Bearer'; + +final api = Openapi().getFakeClassnameTags123Api(); +final ModelClient modelClient = ; // ModelClient | client model + +try { + final response = api.testClassname(modelClient); + print(response); +} catch on DioException (e) { + print('Exception when calling FakeClassnameTags123Api->testClassname: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **modelClient** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/FileSchemaTestClass.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/FileSchemaTestClass.md new file mode 100644 index 000000000000..d14ac319d294 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/FileSchemaTestClass.md @@ -0,0 +1,16 @@ +# openapi.model.FileSchemaTestClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**ModelFile**](ModelFile.md) | | [optional] +**files** | [**List<ModelFile>**](ModelFile.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Foo.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Foo.md new file mode 100644 index 000000000000..185b76e3f5b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Foo.md @@ -0,0 +1,15 @@ +# openapi.model.Foo + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [default to 'bar'] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/FooGetDefaultResponse.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/FooGetDefaultResponse.md new file mode 100644 index 000000000000..10d0133abd95 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/FooGetDefaultResponse.md @@ -0,0 +1,15 @@ +# openapi.model.FooGetDefaultResponse + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/FormatTest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/FormatTest.md new file mode 100644 index 000000000000..83b60545eb61 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/FormatTest.md @@ -0,0 +1,30 @@ +# openapi.model.FormatTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | | [optional] +**int32** | **int** | | [optional] +**int64** | **int** | | [optional] +**number** | **num** | | +**float** | **double** | | [optional] +**double_** | **double** | | [optional] +**decimal** | **double** | | [optional] +**string** | **String** | | [optional] +**byte** | **String** | | +**binary** | [**MultipartFile**](MultipartFile.md) | | [optional] +**date** | [**DateTime**](DateTime.md) | | +**dateTime** | [**DateTime**](DateTime.md) | | [optional] +**uuid** | **String** | | [optional] +**password** | **String** | | +**patternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] +**patternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/HasOnlyReadOnly.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/HasOnlyReadOnly.md new file mode 100644 index 000000000000..32cae937155d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/HasOnlyReadOnly.md @@ -0,0 +1,16 @@ +# openapi.model.HasOnlyReadOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] +**foo** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/HealthCheckResult.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/HealthCheckResult.md new file mode 100644 index 000000000000..4d6aeb75d965 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/HealthCheckResult.md @@ -0,0 +1,15 @@ +# openapi.model.HealthCheckResult + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nullableMessage** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/MapTest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/MapTest.md new file mode 100644 index 000000000000..197fe780a25a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/MapTest.md @@ -0,0 +1,18 @@ +# openapi.model.MapTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] +**mapOfEnumString** | **Map<String, String>** | | [optional] +**directMap** | **Map<String, bool>** | | [optional] +**indirectMap** | **Map<String, bool>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..66d0d39c42be --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,17 @@ +# openapi.model.MixedPropertiesAndAdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **String** | | [optional] +**dateTime** | [**DateTime**](DateTime.md) | | [optional] +**map** | [**Map<String, Animal>**](Animal.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Model200Response.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Model200Response.md new file mode 100644 index 000000000000..5aa3fb97c32e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Model200Response.md @@ -0,0 +1,16 @@ +# openapi.model.Model200Response + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | [optional] +**class_** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ModelClient.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ModelClient.md new file mode 100644 index 000000000000..f7b922f4a398 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ModelClient.md @@ -0,0 +1,15 @@ +# openapi.model.ModelClient + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ModelEnumClass.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ModelEnumClass.md new file mode 100644 index 000000000000..ebaafb44c7f7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ModelEnumClass.md @@ -0,0 +1,14 @@ +# openapi.model.ModelEnumClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ModelFile.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ModelFile.md new file mode 100644 index 000000000000..4be260e93f6e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ModelFile.md @@ -0,0 +1,15 @@ +# openapi.model.ModelFile + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sourceURI** | **String** | Test capitalization | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ModelList.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ModelList.md new file mode 100644 index 000000000000..283aa1f6b711 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ModelList.md @@ -0,0 +1,15 @@ +# openapi.model.ModelList + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**n123list** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ModelReturn.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ModelReturn.md new file mode 100644 index 000000000000..bc02df7a3692 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ModelReturn.md @@ -0,0 +1,15 @@ +# openapi.model.ModelReturn + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**return_** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Name.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Name.md new file mode 100644 index 000000000000..25f49ea946b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Name.md @@ -0,0 +1,18 @@ +# openapi.model.Name + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | +**snakeCase** | **int** | | [optional] +**property** | **String** | | [optional] +**n123number** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/NullableClass.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/NullableClass.md new file mode 100644 index 000000000000..70ac1091d417 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/NullableClass.md @@ -0,0 +1,26 @@ +# openapi.model.NullableClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integerProp** | **int** | | [optional] +**numberProp** | **num** | | [optional] +**booleanProp** | **bool** | | [optional] +**stringProp** | **String** | | [optional] +**dateProp** | [**DateTime**](DateTime.md) | | [optional] +**datetimeProp** | [**DateTime**](DateTime.md) | | [optional] +**arrayNullableProp** | **List<Object>** | | [optional] +**arrayAndItemsNullableProp** | **List<Object>** | | [optional] +**arrayItemsNullable** | **List<Object>** | | [optional] +**objectNullableProp** | **Map<String, Object>** | | [optional] +**objectAndItemsNullableProp** | **Map<String, Object>** | | [optional] +**objectItemsNullable** | **Map<String, Object>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/NumberOnly.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/NumberOnly.md new file mode 100644 index 000000000000..d8096a3db37a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/NumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.NumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justNumber** | **num** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ObjectWithDeprecatedFields.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..dda2836d8d54 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ObjectWithDeprecatedFields.md @@ -0,0 +1,18 @@ +# openapi.model.ObjectWithDeprecatedFields + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **String** | | [optional] +**id** | **num** | | [optional] +**deprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] +**bars** | **List<String>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Order.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Order.md new file mode 100644 index 000000000000..bde5ffe51a2c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Order.md @@ -0,0 +1,20 @@ +# openapi.model.Order + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**petId** | **int** | | [optional] +**quantity** | **int** | | [optional] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] +**status** | **String** | Order Status | [optional] +**complete** | **bool** | | [optional] [default to false] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/OuterComposite.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/OuterComposite.md new file mode 100644 index 000000000000..04bab7eff5d1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/OuterComposite.md @@ -0,0 +1,17 @@ +# openapi.model.OuterComposite + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | **num** | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/OuterEnum.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/OuterEnum.md new file mode 100644 index 000000000000..af62ad87ab2e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/OuterEnum.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnum + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/OuterEnumDefaultValue.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..c1bf8b0dec44 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/OuterEnumDefaultValue.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumDefaultValue + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/OuterEnumInteger.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/OuterEnumInteger.md new file mode 100644 index 000000000000..8c80a9e5c85f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/OuterEnumInteger.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumInteger + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/OuterEnumIntegerDefaultValue.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..eb8b55d70249 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumIntegerDefaultValue + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/OuterObjectWithEnumProperty.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/OuterObjectWithEnumProperty.md new file mode 100644 index 000000000000..eab2ae8f66b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/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/petstore_client_lib_use_lower_camel_case/doc/ParentWithNullable.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ParentWithNullable.md new file mode 100644 index 000000000000..17aa5ca02941 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ParentWithNullable.md @@ -0,0 +1,16 @@ +# openapi.model.ParentWithNullable + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | | [optional] +**nullableProperty** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Pet.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Pet.md new file mode 100644 index 000000000000..3cd230bfb213 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Pet.md @@ -0,0 +1,20 @@ +# openapi.model.Pet + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **Set<String>** | | +**tags** | [**List<Tag>**](Tag.md) | | [optional] +**status** | **String** | pet status in the store | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/PetApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/PetApi.md new file mode 100644 index 000000000000..5fc7fbd2657f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/PetApi.md @@ -0,0 +1,439 @@ +# openapi.api.PetApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**uploadFileWithRequiredFile**](PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) + + +# **addPet** +> addPet(pet) + +Add a new pet to the store + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store + +try { + api.addPet(pet); +} catch on DioException (e) { + print('Exception when calling PetApi->addPet: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | Pet id to delete +final String apiKey = apiKey_example; // String | + +try { + api.deletePet(petId, apiKey); +} catch on DioException (e) { + print('Exception when calling PetApi->deletePet: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| Pet id to delete | + **apiKey** | **String**| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **findPetsByStatus** +> List findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final List status = ; // List | Status values that need to be considered for filter + +try { + final response = api.findPetsByStatus(status); + print(response); +} catch on DioException (e) { + print('Exception when calling PetApi->findPetsByStatus: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **findPetsByTags** +> Set findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final Set tags = ; // Set | Tags to filter by + +try { + final response = api.findPetsByTags(tags); + print(response); +} catch on DioException (e) { + print('Exception when calling PetApi->findPetsByTags: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**Set<String>**](String.md)| Tags to filter by | + +### Return type + +[**Set<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | ID of pet to return + +try { + final response = api.getPetById(petId); + print(response); +} catch on DioException (e) { + print('Exception when calling PetApi->getPetById: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **updatePet** +> updatePet(pet) + +Update an existing pet + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final Pet pet = ; // Pet | Pet object that needs to be added to the store + +try { + api.updatePet(pet); +} catch on DioException (e) { + print('Exception when calling PetApi->updatePet: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | ID of pet that needs to be updated +final String name = name_example; // String | Updated name of the pet +final String status = status_example; // String | Updated status of the pet + +try { + api.updatePetWithForm(petId, name, status); +} catch on DioException (e) { + print('Exception when calling PetApi->updatePetWithForm: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet that needs to be updated | + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **uploadFile** +> ApiResponse uploadFile(petId, additionalMetadata, file) + +uploads an image + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | ID of pet to update +final String additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server +final MultipartFile file = BINARY_DATA_HERE; // MultipartFile | file to upload + +try { + final response = api.uploadFile(petId, additionalMetadata, file); + print(response); +} catch on DioException (e) { + print('Exception when calling PetApi->uploadFile: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **MultipartFile**| file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **uploadFileWithRequiredFile** +> ApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + +uploads an image (required) + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api = Openapi().getPetApi(); +final int petId = 789; // int | ID of pet to update +final MultipartFile requiredFile = BINARY_DATA_HERE; // MultipartFile | file to upload +final String additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server + +try { + final response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + print(response); +} catch on DioException (e) { + print('Exception when calling PetApi->uploadFileWithRequiredFile: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | + **requiredFile** | **MultipartFile**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ReadOnlyFirst.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ReadOnlyFirst.md new file mode 100644 index 000000000000..8f612e8ba19f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/ReadOnlyFirst.md @@ -0,0 +1,16 @@ +# openapi.model.ReadOnlyFirst + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] +**baz** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/SingleRefType.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/SingleRefType.md new file mode 100644 index 000000000000..0dc93840cd7f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/SingleRefType.md @@ -0,0 +1,14 @@ +# openapi.model.SingleRefType + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/SpecialModelName.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/SpecialModelName.md new file mode 100644 index 000000000000..5fcfa98e0b36 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/SpecialModelName.md @@ -0,0 +1,15 @@ +# openapi.model.SpecialModelName + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/StoreApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/StoreApi.md new file mode 100644 index 000000000000..42028947229f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/StoreApi.md @@ -0,0 +1,188 @@ +# openapi.api.StoreApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getStoreApi(); +final String orderId = orderId_example; // String | ID of the order that needs to be deleted + +try { + api.deleteOrder(orderId); +} catch on DioException (e) { + print('Exception when calling StoreApi->deleteOrder: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of the order that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getInventory** +> Map getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; + +final api = Openapi().getStoreApi(); + +try { + final response = api.getInventory(); + print(response); +} catch on DioException (e) { + print('Exception when calling StoreApi->getInventory: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**Map<String, int>** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getStoreApi(); +final int orderId = 789; // int | ID of pet that needs to be fetched + +try { + final response = api.getOrderById(orderId); + print(response); +} catch on DioException (e) { + print('Exception when calling StoreApi->getOrderById: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **int**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **placeOrder** +> Order placeOrder(order) + +Place an order for a pet + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getStoreApi(); +final Order order = ; // Order | order placed for purchasing the pet + +try { + final response = api.placeOrder(order); + print(response); +} catch on DioException (e) { + print('Exception when calling StoreApi->placeOrder: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Tag.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Tag.md new file mode 100644 index 000000000000..c219f987c19c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/Tag.md @@ -0,0 +1,16 @@ +# openapi.model.Tag + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/TestInlineFreeformAdditionalPropertiesRequest.md new file mode 100644 index 000000000000..e2b2f1fd4468 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/TestInlineFreeformAdditionalPropertiesRequest.md @@ -0,0 +1,15 @@ +# openapi.model.TestInlineFreeformAdditionalPropertiesRequest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**someProperty** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/User.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/User.md new file mode 100644 index 000000000000..fa87e64d8595 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/User.md @@ -0,0 +1,22 @@ +# openapi.model.User + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**username** | **String** | | [optional] +**firstName** | **String** | | [optional] +**lastName** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**userStatus** | **int** | User Status | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/UserApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/UserApi.md new file mode 100644 index 000000000000..49b79d76b8a1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/doc/UserApi.md @@ -0,0 +1,359 @@ +# openapi.api.UserApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UserApi.md#createuser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + +# **createUser** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getUserApi(); +final User user = ; // User | Created user object + +try { + api.createUser(user); +} catch on DioException (e) { + print('Exception when calling UserApi->createUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**User**](User.md)| Created user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getUserApi(); +final List user = ; // List | List of user object + +try { + api.createUsersWithArrayInput(user); +} catch on DioException (e) { + print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List<User>**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **createUsersWithListInput** +> createUsersWithListInput(user) + +Creates list of users with given input array + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getUserApi(); +final List user = ; // List | List of user object + +try { + api.createUsersWithListInput(user); +} catch on DioException (e) { + print('Exception when calling UserApi->createUsersWithListInput: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List<User>**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getUserApi(); +final String username = username_example; // String | The name that needs to be deleted + +try { + api.deleteUser(username); +} catch on DioException (e) { + print('Exception when calling UserApi->deleteUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getUserApi(); +final String username = username_example; // String | The name that needs to be fetched. Use user1 for testing. + +try { + final response = api.getUserByName(username); + print(response); +} catch on DioException (e) { + print('Exception when calling UserApi->getUserByName: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getUserApi(); +final String username = username_example; // String | The user name for login +final String password = password_example; // String | The password for login in clear text + +try { + final response = api.loginUser(username, password); + print(response); +} catch on DioException (e) { + print('Exception when calling UserApi->loginUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getUserApi(); + +try { + api.logoutUser(); +} catch on DioException (e) { + print('Exception when calling UserApi->logoutUser: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **updateUser** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getUserApi(); +final String username = username_example; // String | name that need to be deleted +final User user = ; // User | Updated user object + +try { + api.updateUser(username, user); +} catch on DioException (e) { + print('Exception when calling UserApi->updateUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | + **user** | [**User**](User.md)| Updated user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/openapi.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/openapi.dart new file mode 100644 index 000000000000..a462009ebf73 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/openapi.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +export 'package:openapi/src/api.dart'; +export 'package:openapi/src/auth/api_key_auth.dart'; +export 'package:openapi/src/auth/basic_auth.dart'; +export 'package:openapi/src/auth/bearer_auth.dart'; +export 'package:openapi/src/auth/oauth.dart'; + + +export 'package:openapi/src/api/another_fake_api.dart'; +export 'package:openapi/src/api/default_api.dart'; +export 'package:openapi/src/api/fake_api.dart'; +export 'package:openapi/src/api/fake_classname_tags123_api.dart'; +export 'package:openapi/src/api/pet_api.dart'; +export 'package:openapi/src/api/store_api.dart'; +export 'package:openapi/src/api/user_api.dart'; + +export 'package:openapi/src/model/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/category.dart'; +export 'package:openapi/src/model/child_with_nullable.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/enum_arrays.dart'; +export 'package:openapi/src/model/enum_test.dart'; +export 'package:openapi/src/model/fake_big_decimal_map200_response.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/parent_with_nullable.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/test_inline_freeform_additional_properties_request.dart'; +export 'package:openapi/src/model/user.dart'; + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api.dart new file mode 100644 index 000000000000..835b76584b2d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api.dart @@ -0,0 +1,110 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/api_key_auth.dart'; +import 'package:openapi/src/auth/basic_auth.dart'; +import 'package:openapi/src/auth/bearer_auth.dart'; +import 'package:openapi/src/auth/oauth.dart'; +import 'package:openapi/src/api/another_fake_api.dart'; +import 'package:openapi/src/api/default_api.dart'; +import 'package:openapi/src/api/fake_api.dart'; +import 'package:openapi/src/api/fake_classname_tags123_api.dart'; +import 'package:openapi/src/api/pet_api.dart'; +import 'package:openapi/src/api/store_api.dart'; +import 'package:openapi/src/api/user_api.dart'; + +class Openapi { + static const String basePath = r'http://petstore.swagger.io:80/v2'; + + final Dio dio; + Openapi({ + Dio? dio, + String? basePathOverride, + List? interceptors, + }) : + this.dio = dio ?? + Dio(BaseOptions( + baseUrl: basePathOverride ?? basePath, + connectTimeout: const Duration(milliseconds: 5000), + receiveTimeout: const Duration(milliseconds: 3000), + )) { + if (interceptors == null) { + this.dio.interceptors.addAll([ + OAuthInterceptor(), + BasicAuthInterceptor(), + BearerAuthInterceptor(), + ApiKeyAuthInterceptor(), + ]); + } else { + this.dio.interceptors.addAll(interceptors); + } + } + + void setOAuthToken(String name, String token) { + if (this.dio.interceptors.any((i) => i is OAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is OAuthInterceptor) as OAuthInterceptor).tokens[name] = token; + } + } + + void setBearerAuth(String name, String token) { + if (this.dio.interceptors.any((i) => i is BearerAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is BearerAuthInterceptor) as BearerAuthInterceptor).tokens[name] = token; + } + } + + void setBasicAuth(String name, String username, String password) { + if (this.dio.interceptors.any((i) => i is BasicAuthInterceptor)) { + (this.dio.interceptors.firstWhere((i) => i is BasicAuthInterceptor) as BasicAuthInterceptor).authInfo[name] = BasicAuthInfo(username, password); + } + } + + void setApiKey(String name, String apiKey) { + if (this.dio.interceptors.any((i) => i is ApiKeyAuthInterceptor)) { + (this.dio.interceptors.firstWhere((element) => element is ApiKeyAuthInterceptor) as ApiKeyAuthInterceptor).apiKeys[name] = apiKey; + } + } + + /// Get AnotherFakeApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + AnotherFakeApi getAnotherFakeApi() { + return AnotherFakeApi(dio); + } + + /// Get DefaultApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + DefaultApi getDefaultApi() { + return DefaultApi(dio); + } + + /// Get FakeApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + FakeApi getFakeApi() { + return FakeApi(dio); + } + + /// Get FakeClassnameTags123Api instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + FakeClassnameTags123Api getFakeClassnameTags123Api() { + return FakeClassnameTags123Api(dio); + } + + /// Get PetApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + PetApi getPetApi() { + return PetApi(dio); + } + + /// Get StoreApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + StoreApi getStoreApi() { + return StoreApi(dio); + } + + /// Get UserApi instance, base route and serializer can be overridden by a given but be careful, + /// by doing that all interceptors will not be executed + UserApi getUserApi() { + return UserApi(dio); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/another_fake_api.dart new file mode 100644 index 000000000000..d98f3c23f4f7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/another_fake_api.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +// ignore: unused_import +import 'dart:convert'; +import 'package:openapi/src/deserialize.dart'; +import 'package:dio/dio.dart'; + +import 'package:openapi/src/model/model_client.dart'; + +class AnotherFakeApi { + + final Dio _dio; + + const AnotherFakeApi(this._dio); + + /// To test special tags + /// To test special tags and operation ID starting with number + /// + /// Parameters: + /// * [modelClient] - client model + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ModelClient] as data + /// Throws [DioException] if API call or serialization fails + Future> call123testSpecialTags({ + required ModelClient modelClient, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/another-fake/dummy'; + final _options = Options( + method: r'PATCH', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(modelClient); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ModelClient? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'ModelClient', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/default_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/default_api.dart new file mode 100644 index 000000000000..e9efb7b5b194 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/default_api.dart @@ -0,0 +1,89 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +// ignore: unused_import +import 'dart:convert'; +import 'package:openapi/src/deserialize.dart'; +import 'package:dio/dio.dart'; + +import 'package:openapi/src/model/foo_get_default_response.dart'; + +class DefaultApi { + + final Dio _dio; + + const DefaultApi(this._dio); + + /// fooGet + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FooGetDefaultResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> fooGet({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/foo'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + FooGetDefaultResponse? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'FooGetDefaultResponse', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/fake_api.dart new file mode 100644 index 000000000000..06486358eda5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/fake_api.dart @@ -0,0 +1,1712 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +// ignore: unused_import +import 'dart:convert'; +import 'package:openapi/src/deserialize.dart'; +import 'package:dio/dio.dart'; + +import 'package:openapi/src/model/child_with_nullable.dart'; +import 'package:openapi/src/model/fake_big_decimal_map200_response.dart'; +import 'package:openapi/src/model/file_schema_test_class.dart'; +import 'package:openapi/src/model/health_check_result.dart'; +import 'package:openapi/src/model/model_client.dart'; +import 'package:openapi/src/model/model_enum_class.dart'; +import 'package:openapi/src/model/outer_composite.dart'; +import 'package:openapi/src/model/outer_object_with_enum_property.dart'; +import 'package:openapi/src/model/pet.dart'; +import 'package:openapi/src/model/test_inline_freeform_additional_properties_request.dart'; +import 'package:openapi/src/model/user.dart'; + +class FakeApi { + + final Dio _dio; + + const FakeApi(this._dio); + + /// fakeBigDecimalMap + /// for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FakeBigDecimalMap200Response] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeBigDecimalMap({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/BigDecimalMap'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + FakeBigDecimalMap200Response? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'FakeBigDecimalMap200Response', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Health check endpoint + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [HealthCheckResult] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeHealthGet({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/health'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + HealthCheckResult? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'HealthCheckResult', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// test http signature authentication + /// + /// + /// Parameters: + /// * [pet] - Pet object that needs to be added to the store + /// * [query1] - query parameter + /// * [header1] - header parameter + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> fakeHttpSignatureTest({ + required Pet pet, + String? query1, + String? header1, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/http-signature-test'; + final _options = Options( + method: r'GET', + headers: { + if (header1 != null) r'header_1': header1, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'signature', + 'name': 'http_signature_test', + }, + ], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (query1 != null) r'query_1': query1, + }; + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(pet); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// fakeOuterBooleanSerialize + /// Test serialization of outer boolean types + /// + /// Parameters: + /// * [body] - Input boolean as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [bool] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterBooleanSerialize({ + bool? body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/outer/boolean'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(body); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + bool? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'bool', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// fakeOuterCompositeSerialize + /// Test serialization of object with outer number type + /// + /// Parameters: + /// * [outerComposite] - Input composite as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [OuterComposite] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterCompositeSerialize({ + OuterComposite? outerComposite, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/outer/composite'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(outerComposite); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + OuterComposite? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'OuterComposite', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// fakeOuterNumberSerialize + /// Test serialization of outer number types + /// + /// Parameters: + /// * [body] - Input number as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [num] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterNumberSerialize({ + num? body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/outer/number'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(body); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + num? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'num', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// fakeOuterStringSerialize + /// Test serialization of outer string types + /// + /// Parameters: + /// * [body] - Input string as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [String] as data + /// Throws [DioException] if API call or serialization fails + Future> fakeOuterStringSerialize({ + String? body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/outer/string'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(body); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + String? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'String', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// fakePropertyEnumIntegerSerialize + /// Test serialization of enum (int) properties with examples + /// + /// Parameters: + /// * [outerObjectWithEnumProperty] - Input enum (int) as post body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [OuterObjectWithEnumProperty] as data + /// Throws [DioException] if API call or serialization fails + Future> fakePropertyEnumIntegerSerialize({ + required OuterObjectWithEnumProperty outerObjectWithEnumProperty, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/property/enum-int'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(outerObjectWithEnumProperty); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + OuterObjectWithEnumProperty? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'OuterObjectWithEnumProperty', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// test referenced additionalProperties + /// + /// + /// Parameters: + /// * [requestBody] - request body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testAdditionalPropertiesReference({ + required Map requestBody, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/additionalProperties-reference'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(requestBody); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// testBodyWithBinary + /// For this test, the body has to be a binary file. + /// + /// Parameters: + /// * [body] - image to upload + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testBodyWithBinary({ + MultipartFile? body, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/body-with-binary'; + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'image/png', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(body); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// testBodyWithFileSchema + /// For this test, the body for this request must reference a schema named `File`. + /// + /// Parameters: + /// * [fileSchemaTestClass] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testBodyWithFileSchema({ + required FileSchemaTestClass fileSchemaTestClass, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/body-with-file-schema'; + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(fileSchemaTestClass); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// testBodyWithQueryParams + /// + /// + /// Parameters: + /// * [query] + /// * [user] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testBodyWithQueryParams({ + required String query, + required User user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/body-with-query-params'; + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'query': query, + }; + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(user); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// To test \"client\" model + /// To test \"client\" model + /// + /// Parameters: + /// * [modelClient] - client model + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ModelClient] as data + /// Throws [DioException] if API call or serialization fails + Future> testClientModel({ + required ModelClient modelClient, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'PATCH', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(modelClient); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ModelClient? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'ModelClient', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Parameters: + /// * [number] - None + /// * [double_] - None + /// * [patternWithoutDelimiter] - None + /// * [byte] - None + /// * [integer] - None + /// * [int32] - None + /// * [int64] - None + /// * [float] - None + /// * [string] - None + /// * [binary] - None + /// * [date] - None + /// * [dateTime] - None + /// * [password] - None + /// * [callback] - None + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testEndpointParameters({ + required num number, + required double double_, + required String patternWithoutDelimiter, + required String byte, + int? integer, + int? int32, + int? int64, + double? float, + String? string, + MultipartFile? binary, + DateTime? date, + DateTime? dateTime, + String? password, + String? callback, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'basic', + 'name': 'http_basic_test', + }, + ], + ...?extra, + }, + contentType: 'application/x-www-form-urlencoded', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// To test enum parameters + /// To test enum parameters + /// + /// Parameters: + /// * [enumHeaderStringArray] - Header parameter enum test (string array) + /// * [enumHeaderString] - Header parameter enum test (string) + /// * [enumQueryStringArray] - Query parameter enum test (string array) + /// * [enumQueryString] - Query parameter enum test (string) + /// * [enumQueryInteger] - Query parameter enum test (double) + /// * [enumQueryDouble] - Query parameter enum test (double) + /// * [enumQueryModelArray] + /// * [enumFormStringArray] - Form parameter enum test (string array) + /// * [enumFormString] - Form parameter enum test (string) + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testEnumParameters({ + List? enumHeaderStringArray, + String? enumHeaderString = '-efg', + List? enumQueryStringArray, + String? enumQueryString = '-efg', + int? enumQueryInteger, + double? enumQueryDouble, + List? enumQueryModelArray, + List? enumFormStringArray, + String? enumFormString, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'GET', + headers: { + if (enumHeaderStringArray != null) r'enum_header_string_array': enumHeaderStringArray, + if (enumHeaderString != null) r'enum_header_string': enumHeaderString, + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/x-www-form-urlencoded', + validateStatus: validateStatus, + ); + + final _queryParameters = { + if (enumQueryStringArray != null) r'enum_query_string_array': enumQueryStringArray, + if (enumQueryString != null) r'enum_query_string': enumQueryString, + if (enumQueryInteger != null) r'enum_query_integer': enumQueryInteger, + if (enumQueryDouble != null) r'enum_query_double': enumQueryDouble, + if (enumQueryModelArray != null) r'enum_query_model_array': enumQueryModelArray, + }; + + dynamic _bodyData; + + try { + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + queryParameters: _queryParameters, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Fake endpoint to test group parameters (optional) + /// Fake endpoint to test group parameters (optional) + /// + /// Parameters: + /// * [requiredStringGroup] - Required String in group parameters + /// * [requiredBooleanGroup] - Required Boolean in group parameters + /// * [requiredInt64Group] - Required Integer in group parameters + /// * [stringGroup] - String in group parameters + /// * [booleanGroup] - Boolean in group parameters + /// * [int64Group] - Integer in group parameters + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testGroupParameters({ + required int requiredStringGroup, + required bool requiredBooleanGroup, + required int requiredInt64Group, + int? stringGroup, + bool? booleanGroup, + int? int64Group, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake'; + final _options = Options( + method: r'DELETE', + headers: { + r'required_boolean_group': requiredBooleanGroup, + if (booleanGroup != null) r'boolean_group': booleanGroup, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'http', + 'scheme': 'bearer', + 'name': 'bearer_test', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'required_string_group': requiredStringGroup, + r'required_int64_group': requiredInt64Group, + if (stringGroup != null) r'string_group': stringGroup, + if (int64Group != null) r'int64_group': int64Group, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test inline additionalProperties + /// + /// + /// Parameters: + /// * [requestBody] - request body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testInlineAdditionalProperties({ + required Map requestBody, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/inline-additionalProperties'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(requestBody); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test inline free-form additionalProperties + /// + /// + /// Parameters: + /// * [testInlineFreeformAdditionalPropertiesRequest] - request body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testInlineFreeformAdditionalProperties({ + required TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/inline-freeform-additionalProperties'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(testInlineFreeformAdditionalPropertiesRequest); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test json serialization of form data + /// + /// + /// Parameters: + /// * [param] - field1 + /// * [param2] - field2 + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testJsonFormData({ + required String param, + required String param2, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/jsonFormData'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/x-www-form-urlencoded', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test nullable parent property + /// + /// + /// Parameters: + /// * [childWithNullable] - request body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testNullable({ + required ChildWithNullable childWithNullable, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/nullable'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(childWithNullable); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// testQueryParameterCollectionFormat + /// To test the collection format in query parameters + /// + /// Parameters: + /// * [pipe] + /// * [ioutil] + /// * [http] + /// * [url] + /// * [context] + /// * [allowEmpty] + /// * [language] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testQueryParameterCollectionFormat({ + required List pipe, + required List ioutil, + required List http, + required List url, + required List context, + required String allowEmpty, + Map? language, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/test-query-parameters'; + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'pipe': pipe, + r'ioutil': ioutil, + r'http': http, + r'url': url, + r'context': context, + if (language != null) r'language': language, + r'allowEmpty': allowEmpty, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// test referenced string map + /// + /// + /// Parameters: + /// * [requestBody] - request body + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> testStringMapReference({ + required Map requestBody, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/stringMap-reference'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(requestBody); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/fake_classname_tags123_api.dart new file mode 100644 index 000000000000..56ec33f1cace --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/fake_classname_tags123_api.dart @@ -0,0 +1,116 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +// ignore: unused_import +import 'dart:convert'; +import 'package:openapi/src/deserialize.dart'; +import 'package:dio/dio.dart'; + +import 'package:openapi/src/model/model_client.dart'; + +class FakeClassnameTags123Api { + + final Dio _dio; + + const FakeClassnameTags123Api(this._dio); + + /// To test class name in snake case + /// To test class name in snake case + /// + /// Parameters: + /// * [modelClient] - client model + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ModelClient] as data + /// Throws [DioException] if API call or serialization fails + Future> testClassname({ + required ModelClient modelClient, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake_classname_test'; + final _options = Options( + method: r'PATCH', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'apiKey', + 'name': 'api_key_query', + 'keyName': 'api_key_query', + 'where': 'query', + }, + ], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(modelClient); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ModelClient? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'ModelClient', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/pet_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/pet_api.dart new file mode 100644 index 000000000000..ec20128ee1e3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/pet_api.dart @@ -0,0 +1,727 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +// ignore: unused_import +import 'dart:convert'; +import 'package:openapi/src/deserialize.dart'; +import 'package:dio/dio.dart'; + +import 'package:openapi/src/model/api_response.dart'; +import 'package:openapi/src/model/pet.dart'; + +class PetApi { + + final Dio _dio; + + const PetApi(this._dio); + + /// Add a new pet to the store + /// + /// + /// Parameters: + /// * [pet] - Pet object that needs to be added to the store + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> addPet({ + required Pet pet, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(pet); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Deletes a pet + /// + /// + /// Parameters: + /// * [petId] - Pet id to delete + /// * [apiKey] + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> deletePet({ + required int petId, + String? apiKey, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); + final _options = Options( + method: r'DELETE', + headers: { + if (apiKey != null) r'api_key': apiKey, + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Finds Pets by status + /// Multiple status values can be provided with comma separated strings + /// + /// Parameters: + /// * [status] - Status values that need to be considered for filter + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [List] as data + /// Throws [DioException] if API call or serialization fails + Future>> findPetsByStatus({ + @Deprecated('status is deprecated') required List status, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/findByStatus'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'status': status, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + List? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, Pet>(rawData, 'List', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Finds Pets by tags + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Parameters: + /// * [tags] - Tags to filter by + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Set] as data + /// Throws [DioException] if API call or serialization fails + @Deprecated('This operation has been deprecated') + Future>> findPetsByTags({ + required Set tags, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/findByTags'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'tags': tags, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Set? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, Pet>(rawData, 'Set', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Find pet by ID + /// Returns a single pet + /// + /// Parameters: + /// * [petId] - ID of pet to return + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Pet] as data + /// Throws [DioException] if API call or serialization fails + Future> getPetById({ + required int petId, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'apiKey', + 'name': 'api_key', + 'keyName': 'api_key', + 'where': 'header', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Pet? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'Pet', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Update an existing pet + /// + /// + /// Parameters: + /// * [pet] - Pet object that needs to be added to the store + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> updatePet({ + required Pet pet, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet'; + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(pet); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Updates a pet in the store with form data + /// + /// + /// Parameters: + /// * [petId] - ID of pet that needs to be updated + /// * [name] - Updated name of the pet + /// * [status] - Updated status of the pet + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> updatePetWithForm({ + required int petId, + String? name, + String? status, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/{petId}'.replaceAll('{' r'petId' '}', petId.toString()); + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: 'application/x-www-form-urlencoded', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// uploads an image + /// + /// + /// Parameters: + /// * [petId] - ID of pet to update + /// * [additionalMetadata] - Additional data to pass to server + /// * [file] - file to upload + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ApiResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> uploadFile({ + required int petId, + String? additionalMetadata, + MultipartFile? file, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/pet/{petId}/uploadImage'.replaceAll('{' r'petId' '}', petId.toString()); + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: 'multipart/form-data', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ApiResponse? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'ApiResponse', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// uploads an image (required) + /// + /// + /// Parameters: + /// * [petId] - ID of pet to update + /// * [requiredFile] - file to upload + /// * [additionalMetadata] - Additional data to pass to server + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [ApiResponse] as data + /// Throws [DioException] if API call or serialization fails + Future> uploadFileWithRequiredFile({ + required int petId, + required MultipartFile requiredFile, + String? additionalMetadata, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/{petId}/uploadImageWithRequiredFile'.replaceAll('{' r'petId' '}', petId.toString()); + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'oauth2', + 'name': 'petstore_auth', + }, + ], + ...?extra, + }, + contentType: 'multipart/form-data', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { + + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + ApiResponse? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'ApiResponse', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/store_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/store_api.dart new file mode 100644 index 000000000000..23e8deceaea8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/store_api.dart @@ -0,0 +1,303 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +// ignore: unused_import +import 'dart:convert'; +import 'package:openapi/src/deserialize.dart'; +import 'package:dio/dio.dart'; + +import 'package:openapi/src/model/order.dart'; + +class StoreApi { + + final Dio _dio; + + const StoreApi(this._dio); + + /// Delete purchase order by ID + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Parameters: + /// * [orderId] - ID of the order that needs to be deleted + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> deleteOrder({ + required String orderId, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/store/order/{order_id}'.replaceAll('{' r'order_id' '}', orderId.toString()); + final _options = Options( + method: r'DELETE', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Returns pet inventories by status + /// Returns a map of status codes to quantities + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Map] as data + /// Throws [DioException] if API call or serialization fails + Future>> getInventory({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/store/inventory'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[ + { + 'type': 'apiKey', + 'name': 'api_key', + 'keyName': 'api_key', + 'where': 'header', + }, + ], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Map? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize, int>(rawData, 'Map', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response>( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Find purchase order by ID + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Parameters: + /// * [orderId] - ID of pet that needs to be fetched + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Order] as data + /// Throws [DioException] if API call or serialization fails + Future> getOrderById({ + required int orderId, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/store/order/{order_id}'.replaceAll('{' r'order_id' '}', orderId.toString()); + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Order? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'Order', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Place an order for a pet + /// + /// + /// Parameters: + /// * [order] - order placed for purchasing the pet + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [Order] as data + /// Throws [DioException] if API call or serialization fails + Future> placeOrder({ + required Order order, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/store/order'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(order); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + Order? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'Order', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/user_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/user_api.dart new file mode 100644 index 000000000000..24bbeb48f746 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/api/user_api.dart @@ -0,0 +1,524 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:async'; + +// ignore: unused_import +import 'dart:convert'; +import 'package:openapi/src/deserialize.dart'; +import 'package:dio/dio.dart'; + +import 'package:openapi/src/model/user.dart'; + +class UserApi { + + final Dio _dio; + + const UserApi(this._dio); + + /// Create user + /// This can only be done by the logged in user. + /// + /// Parameters: + /// * [user] - Created user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> createUser({ + required User user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(user); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Creates list of users with given input array + /// + /// + /// Parameters: + /// * [user] - List of user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> createUsersWithArrayInput({ + required List user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/createWithArray'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(user); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Creates list of users with given input array + /// + /// + /// Parameters: + /// * [user] - List of user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> createUsersWithListInput({ + required List user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/createWithList'; + final _options = Options( + method: r'POST', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(user); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Delete user + /// This can only be done by the logged in user. + /// + /// Parameters: + /// * [username] - The name that needs to be deleted + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> deleteUser({ + required String username, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/{username}'.replaceAll('{' r'username' '}', username.toString()); + final _options = Options( + method: r'DELETE', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Get user by user name + /// + /// + /// Parameters: + /// * [username] - The name that needs to be fetched. Use user1 for testing. + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [User] as data + /// Throws [DioException] if API call or serialization fails + Future> getUserByName({ + required String username, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/{username}'.replaceAll('{' r'username' '}', username.toString()); + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + User? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'User', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Logs user into the system + /// + /// + /// Parameters: + /// * [username] - The user name for login + /// * [password] - The password for login in clear text + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [String] as data + /// Throws [DioException] if API call or serialization fails + Future> loginUser({ + required String username, + required String password, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/login'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _queryParameters = { + r'username': username, + r'password': password, + }; + + final _response = await _dio.request( + _path, + options: _options, + queryParameters: _queryParameters, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + String? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'String', growable: true); + } catch (error, stackTrace) { + throw DioException( + requestOptions: _response.requestOptions, + response: _response, + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + + /// Logs out current logged in user session + /// + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> logoutUser({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/logout'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + + /// Updated user + /// This can only be done by the logged in user. + /// + /// Parameters: + /// * [username] - name that need to be deleted + /// * [user] - Updated user object + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] + /// Throws [DioException] if API call or serialization fails + Future> updateUser({ + required String username, + required User user, + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/user/{username}'.replaceAll('{' r'username' '}', username.toString()); + final _options = Options( + method: r'PUT', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + contentType: 'application/json', + validateStatus: validateStatus, + ); + + dynamic _bodyData; + + try { +_bodyData=jsonEncode(user); + } catch(error, stackTrace) { + throw DioException( + requestOptions: _options.compose( + _dio.options, + _path, + ), + type: DioExceptionType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + final _response = await _dio.request( + _path, + data: _bodyData, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + return _response; + } + +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/auth/api_key_auth.dart new file mode 100644 index 000000000000..ee16e3f0f92f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/auth/api_key_auth.dart @@ -0,0 +1,30 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/auth.dart'; + +class ApiKeyAuthInterceptor extends AuthInterceptor { + final Map apiKeys = {}; + + @override + void onRequest(RequestOptions options, RequestInterceptorHandler handler) { + final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'apiKey'); + for (final info in authInfo) { + final authName = info['name'] as String; + final authKeyName = info['keyName'] as String; + final authWhere = info['where'] as String; + final apiKey = apiKeys[authName]; + if (apiKey != null) { + if (authWhere == 'query') { + options.queryParameters[authKeyName] = apiKey; + } else { + options.headers[authKeyName] = apiKey; + } + } + } + super.onRequest(options, handler); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/auth/auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/auth/auth.dart new file mode 100644 index 000000000000..f7ae9bf3f11e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/auth/auth.dart @@ -0,0 +1,18 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; + +abstract class AuthInterceptor extends Interceptor { + /// Get auth information on given route for the given type. + /// Can return an empty list if type is not present on auth data or + /// if route doesn't need authentication. + List> getAuthInfo(RequestOptions route, bool Function(Map secure) handles) { + if (route.extra.containsKey('secure')) { + final auth = route.extra['secure'] as List>; + return auth.where((secure) => handles(secure)).toList(); + } + return []; + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/auth/basic_auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/auth/basic_auth.dart new file mode 100644 index 000000000000..b65ccb5b71f7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/auth/basic_auth.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/auth.dart'; + +class BasicAuthInfo { + final String username; + final String password; + + const BasicAuthInfo(this.username, this.password); +} + +class BasicAuthInterceptor extends AuthInterceptor { + final Map authInfo = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final metadataAuthInfo = getAuthInfo(options, (secure) => (secure['type'] == 'http' && secure['scheme']?.toLowerCase() == 'basic') || secure['type'] == 'basic'); + for (final info in metadataAuthInfo) { + final authName = info['name'] as String; + final basicAuthInfo = authInfo[authName]; + if (basicAuthInfo != null) { + final basicAuth = 'Basic ${base64Encode(utf8.encode('${basicAuthInfo.username}:${basicAuthInfo.password}'))}'; + options.headers['Authorization'] = basicAuth; + break; + } + } + super.onRequest(options, handler); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/auth/bearer_auth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/auth/bearer_auth.dart new file mode 100644 index 000000000000..8f46678761b2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/auth/bearer_auth.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/auth.dart'; + +class BearerAuthInterceptor extends AuthInterceptor { + final Map tokens = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'http' && secure['scheme']?.toLowerCase() == 'bearer'); + for (final info in authInfo) { + final token = tokens[info['name']]; + if (token != null) { + options.headers['Authorization'] = 'Bearer ${token}'; + break; + } + } + super.onRequest(options, handler); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/auth/oauth.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/auth/oauth.dart new file mode 100644 index 000000000000..337cf762b0ce --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/auth/oauth.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +import 'package:dio/dio.dart'; +import 'package:openapi/src/auth/auth.dart'; + +class OAuthInterceptor extends AuthInterceptor { + final Map tokens = {}; + + @override + void onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) { + final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'oauth' || secure['type'] == 'oauth2'); + for (final info in authInfo) { + final token = tokens[info['name']]; + if (token != null) { + options.headers['Authorization'] = 'Bearer ${token}'; + break; + } + } + super.onRequest(options, handler); + } +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/deserialize.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/deserialize.dart new file mode 100644 index 000000000000..af74c7ee5e41 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/deserialize.dart @@ -0,0 +1,195 @@ +import 'package:openapi/src/model/additional_properties_class.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/array_of_array_of_number_only.dart'; +import 'package:openapi/src/model/array_of_number_only.dart'; +import 'package:openapi/src/model/array_test.dart'; +import 'package:openapi/src/model/capitalization.dart'; +import 'package:openapi/src/model/cat.dart'; +import 'package:openapi/src/model/category.dart'; +import 'package:openapi/src/model/child_with_nullable.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/enum_arrays.dart'; +import 'package:openapi/src/model/enum_test.dart'; +import 'package:openapi/src/model/fake_big_decimal_map200_response.dart'; +import 'package:openapi/src/model/file_schema_test_class.dart'; +import 'package:openapi/src/model/foo.dart'; +import 'package:openapi/src/model/foo_get_default_response.dart'; +import 'package:openapi/src/model/format_test.dart'; +import 'package:openapi/src/model/has_only_read_only.dart'; +import 'package:openapi/src/model/health_check_result.dart'; +import 'package:openapi/src/model/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/parent_with_nullable.dart'; +import 'package:openapi/src/model/pet.dart'; +import 'package:openapi/src/model/read_only_first.dart'; +import 'package:openapi/src/model/special_model_name.dart'; +import 'package:openapi/src/model/tag.dart'; +import 'package:openapi/src/model/test_inline_freeform_additional_properties_request.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 '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 '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 'Capitalization': + return Capitalization.fromJson(value as Map) as ReturnType; + case 'Cat': + return Cat.fromJson(value as Map) as ReturnType; + case 'Category': + return Category.fromJson(value as Map) as ReturnType; + case 'ChildWithNullable': + return ChildWithNullable.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 'EnumArrays': + return EnumArrays.fromJson(value as Map) as ReturnType; + case 'EnumTest': + return EnumTest.fromJson(value as Map) as ReturnType; + case 'FakeBigDecimalMap200Response': + return FakeBigDecimalMap200Response.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 'FooGetDefaultResponse': + return FooGetDefaultResponse.fromJson(value as Map) as ReturnType; + case 'FormatTest': + return FormatTest.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 'ParentWithNullable': + return ParentWithNullable.fromJson(value as Map) as ReturnType; + case 'Pet': + return Pet.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 'TestInlineFreeformAdditionalPropertiesRequest': + return TestInlineFreeformAdditionalPropertiesRequest.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]!.trim(); // ignore: parameter_assignments + return Map.fromIterables( + value.keys as Iterable, + value.values.map((dynamic v) => deserialize(v, targetType, growable: growable)), + ) as ReturnType; + } + break; + } + throw Exception('Cannot deserialize'); + } \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/additional_properties_class.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/additional_properties_class.dart new file mode 100644 index 000000000000..8a187d3dc3c0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/additional_properties_class.dart @@ -0,0 +1,72 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/all_of_with_single_ref.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/all_of_with_single_ref.dart new file mode 100644 index 000000000000..c196447ea5e4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/all_of_with_single_ref.dart @@ -0,0 +1,74 @@ +// +// 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, + unknownEnumValue: SingleRefType.unknownDefaultOpenApi, + ) + + + 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/animal.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/animal.dart new file mode 100644 index 000000000000..732326357226 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/animal.dart @@ -0,0 +1,72 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/api_response.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/api_response.dart new file mode 100644 index 000000000000..207cea16eabe --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/api_response.dart @@ -0,0 +1,88 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'api_response.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ApiResponse { + /// Returns a new [ApiResponse] instance. + ApiResponse({ + + this.code, + + this.type, + + this.message, + }); + + @JsonKey( + + name: r'code', + required: false, + includeIfNull: false, + ) + + + final int? code; + + + + @JsonKey( + + name: r'type', + required: false, + includeIfNull: false, + ) + + + final String? type; + + + + @JsonKey( + + name: r'message', + required: false, + includeIfNull: false, + ) + + + final String? message; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ApiResponse && + other.code == code && + other.type == type && + other.message == message; + + @override + int get hashCode => + code.hashCode + + type.hashCode + + message.hashCode; + + factory ApiResponse.fromJson(Map json) => _$ApiResponseFromJson(json); + + Map toJson() => _$ApiResponseToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/array_of_array_of_number_only.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/array_of_array_of_number_only.dart new file mode 100644 index 000000000000..da8de0169296 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/array_of_array_of_number_only.dart @@ -0,0 +1,56 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/array_of_number_only.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/array_of_number_only.dart new file mode 100644 index 000000000000..4ead761e76f7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/array_of_number_only.dart @@ -0,0 +1,56 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/array_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/array_test.dart new file mode 100644 index 000000000000..0968d4b12986 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/array_test.dart @@ -0,0 +1,89 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/read_only_first.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'array_test.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ArrayTest { + /// Returns a new [ArrayTest] instance. + ArrayTest({ + + this.arrayOfString, + + this.arrayArrayOfInteger, + + this.arrayArrayOfModel, + }); + + @JsonKey( + + name: r'array_of_string', + required: false, + includeIfNull: false, + ) + + + final List? arrayOfString; + + + + @JsonKey( + + name: r'array_array_of_integer', + required: false, + includeIfNull: false, + ) + + + final List>? arrayArrayOfInteger; + + + + @JsonKey( + + name: r'array_array_of_model', + required: false, + includeIfNull: false, + ) + + + final List>? arrayArrayOfModel; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ArrayTest && + other.arrayOfString == arrayOfString && + other.arrayArrayOfInteger == arrayArrayOfInteger && + other.arrayArrayOfModel == arrayArrayOfModel; + + @override + int get hashCode => + arrayOfString.hashCode + + arrayArrayOfInteger.hashCode + + arrayArrayOfModel.hashCode; + + factory ArrayTest.fromJson(Map json) => _$ArrayTestFromJson(json); + + Map toJson() => _$ArrayTestToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/capitalization.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/capitalization.dart new file mode 100644 index 000000000000..d2bc40f33836 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/capitalization.dart @@ -0,0 +1,137 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/cat.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/cat.dart new file mode 100644 index 000000000000..e2df6f2cc557 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/cat.dart @@ -0,0 +1,91 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/category.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/category.dart new file mode 100644 index 000000000000..6d078b06ae20 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/category.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'category.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Category { + /// Returns a new [Category] instance. + Category({ + + this.id, + + this.name = 'default-name', + }); + + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false, + ) + + + final int? id; + + + + @JsonKey( + defaultValue: 'default-name', + name: r'name', + required: true, + includeIfNull: false, + ) + + + final String name; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Category && + other.id == id && + other.name == name; + + @override + int get hashCode => + id.hashCode + + name.hashCode; + + factory Category.fromJson(Map json) => _$CategoryFromJson(json); + + Map toJson() => _$CategoryToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/child_with_nullable.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/child_with_nullable.dart new file mode 100644 index 000000000000..dcda6f93ba6a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/child_with_nullable.dart @@ -0,0 +1,108 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/parent_with_nullable.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'child_with_nullable.g.dart'; + +// ignore_for_file: unused_import + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ChildWithNullable { + /// Returns a new [ChildWithNullable] instance. + ChildWithNullable({ + + this.type, + + this.nullableProperty, + + this.otherProperty, + }); + + @JsonKey( + + name: r'type', + required: false, + includeIfNull: false, + unknownEnumValue: ChildWithNullableTypeEnum.unknownDefaultOpenApi, + ) + + + final ChildWithNullableTypeEnum? type; + + + + @JsonKey( + + name: r'nullableProperty', + required: false, + includeIfNull: false, + ) + + + final String? nullableProperty; + + + + @JsonKey( + + name: r'otherProperty', + required: false, + includeIfNull: false, + ) + + + final String? otherProperty; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ChildWithNullable && + other.type == type && + other.nullableProperty == nullableProperty && + other.otherProperty == otherProperty; + + @override + int get hashCode => + type.hashCode + + (nullableProperty == null ? 0 : nullableProperty.hashCode) + + otherProperty.hashCode; + + factory ChildWithNullable.fromJson(Map json) => _$ChildWithNullableFromJson(json); + + Map toJson() => _$ChildWithNullableToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + + +enum ChildWithNullableTypeEnum { +@JsonValue(r'ChildWithNullable') +childWithNullable(r'ChildWithNullable'), +@JsonValue(r'unknown_default_open_api') +unknownDefaultOpenApi(r'unknown_default_open_api'); + +const ChildWithNullableTypeEnum(this.value); + +final String value; + +@override +String toString() => value; +} + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/class_model.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/class_model.dart new file mode 100644 index 000000000000..40b6b45ac3c4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/class_model.dart @@ -0,0 +1,56 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'class_model.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ClassModel { + /// Returns a new [ClassModel] instance. + ClassModel({ + + this.class_, + }); + + @JsonKey( + + name: r'_class', + required: false, + includeIfNull: false, + ) + + + final String? class_; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ClassModel && + other.class_ == class_; + + @override + int get hashCode => + class_.hashCode; + + factory ClassModel.fromJson(Map json) => _$ClassModelFromJson(json); + + Map toJson() => _$ClassModelToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/deprecated_object.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/deprecated_object.dart new file mode 100644 index 000000000000..68d1df4016c1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/deprecated_object.dart @@ -0,0 +1,57 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'deprecated_object.g.dart'; + + +@Deprecated('DeprecatedObject has been deprecated') +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class DeprecatedObject { + /// Returns a new [DeprecatedObject] instance. + DeprecatedObject({ + + this.name, + }); + + @JsonKey( + + name: r'name', + required: false, + includeIfNull: false, + ) + + + final String? name; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is DeprecatedObject && + other.name == name; + + @override + int get hashCode => + name.hashCode; + + factory DeprecatedObject.fromJson(Map json) => _$DeprecatedObjectFromJson(json); + + Map toJson() => _$DeprecatedObjectToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/dog.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/dog.dart new file mode 100644 index 000000000000..deb271b6dc3b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/dog.dart @@ -0,0 +1,91 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/enum_arrays.dart new file mode 100644 index 000000000000..632fd933d6e8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/enum_arrays.dart @@ -0,0 +1,110 @@ +// +// 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, + unknownEnumValue: EnumArraysJustSymbolEnum.unknownDefaultOpenApi, + ) + + + final EnumArraysJustSymbolEnum? justSymbol; + + + + @JsonKey( + + name: r'array_enum', + required: false, + includeIfNull: false, + unknownEnumValue: List.unknownDefaultOpenApi, + ) + + + 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(r'>='), +@JsonValue(r'$') +dollar(r'$'), +@JsonValue(r'unknown_default_open_api') +unknownDefaultOpenApi(r'unknown_default_open_api'); + +const EnumArraysJustSymbolEnum(this.value); + +final String value; + +@override +String toString() => value; +} + + + +enum EnumArraysArrayEnumEnum { +@JsonValue(r'fish') +fish(r'fish'), +@JsonValue(r'crab') +crab(r'crab'), +@JsonValue(r'unknown_default_open_api') +unknownDefaultOpenApi(r'unknown_default_open_api'); + +const EnumArraysArrayEnumEnum(this.value); + +final String value; + +@override +String toString() => value; +} + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/enum_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/enum_test.dart new file mode 100644 index 000000000000..e0fe59151071 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/enum_test.dart @@ -0,0 +1,256 @@ +// +// 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, + unknownEnumValue: EnumTestEnumStringEnum.unknownDefaultOpenApi, + ) + + + final EnumTestEnumStringEnum? enumString; + + + + @JsonKey( + + name: r'enum_string_required', + required: true, + includeIfNull: false, + unknownEnumValue: EnumTestEnumStringRequiredEnum.unknownDefaultOpenApi, + ) + + + final EnumTestEnumStringRequiredEnum enumStringRequired; + + + + @JsonKey( + + name: r'enum_integer', + required: false, + includeIfNull: false, + unknownEnumValue: EnumTestEnumIntegerEnum.unknownDefaultOpenApi, + ) + + + final EnumTestEnumIntegerEnum? enumInteger; + + + + @JsonKey( + + name: r'enum_number', + required: false, + includeIfNull: false, + unknownEnumValue: EnumTestEnumNumberEnum.unknownDefaultOpenApi, + ) + + + final EnumTestEnumNumberEnum? enumNumber; + + + + @JsonKey( + + name: r'outerEnum', + required: false, + includeIfNull: false, + unknownEnumValue: OuterEnum.unknownDefaultOpenApi, + ) + + + final OuterEnum? outerEnum; + + + + @JsonKey( + + name: r'outerEnumInteger', + required: false, + includeIfNull: false, + unknownEnumValue: OuterEnumInteger.unknownDefaultOpenApi, + ) + + + final OuterEnumInteger? outerEnumInteger; + + + + @JsonKey( + + name: r'outerEnumDefaultValue', + required: false, + includeIfNull: false, + unknownEnumValue: OuterEnumDefaultValue.unknownDefaultOpenApi, + ) + + + final OuterEnumDefaultValue? outerEnumDefaultValue; + + + + @JsonKey( + + name: r'outerEnumIntegerDefaultValue', + required: false, + includeIfNull: false, + unknownEnumValue: OuterEnumIntegerDefaultValue.unknownDefaultOpenApi, + ) + + + 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(r'UPPER'), +@JsonValue(r'lower') +lower(r'lower'), +@JsonValue(r'') +empty(r''), +@JsonValue(r'unknown_default_open_api') +unknownDefaultOpenApi(r'unknown_default_open_api'); + +const EnumTestEnumStringEnum(this.value); + +final String value; + +@override +String toString() => value; +} + + + +enum EnumTestEnumStringRequiredEnum { +@JsonValue(r'UPPER') +upper(r'UPPER'), +@JsonValue(r'lower') +lower(r'lower'), +@JsonValue(r'') +empty(r''), +@JsonValue(r'unknown_default_open_api') +unknownDefaultOpenApi(r'unknown_default_open_api'); + +const EnumTestEnumStringRequiredEnum(this.value); + +final String value; + +@override +String toString() => value; +} + + + +enum EnumTestEnumIntegerEnum { +@JsonValue(1) +number1('1'), +@JsonValue(-1) +numberNegative1('-1'), +@JsonValue(11184809) +unknownDefaultOpenApi('11184809'); + +const EnumTestEnumIntegerEnum(this.value); + +final String value; + +@override +String toString() => value; +} + + + +enum EnumTestEnumNumberEnum { +@JsonValue('1.1') +number1Period1(''1.1''), +@JsonValue('-1.2') +numberNegative1Period2(''-1.2''), +@JsonValue('11184809') +unknownDefaultOpenApi(''11184809''); + +const EnumTestEnumNumberEnum(this.value); + +final String value; + +@override +String toString() => value; +} + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/fake_big_decimal_map200_response.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/fake_big_decimal_map200_response.dart new file mode 100644 index 000000000000..1f0f2950a71c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/fake_big_decimal_map200_response.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'fake_big_decimal_map200_response.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FakeBigDecimalMap200Response { + /// Returns a new [FakeBigDecimalMap200Response] instance. + FakeBigDecimalMap200Response({ + + this.someId, + + this.someMap, + }); + + @JsonKey( + + name: r'someId', + required: false, + includeIfNull: false, + ) + + + final num? someId; + + + + @JsonKey( + + name: r'someMap', + required: false, + includeIfNull: false, + ) + + + final Map? someMap; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FakeBigDecimalMap200Response && + other.someId == someId && + other.someMap == someMap; + + @override + int get hashCode => + someId.hashCode + + someMap.hashCode; + + factory FakeBigDecimalMap200Response.fromJson(Map json) => _$FakeBigDecimalMap200ResponseFromJson(json); + + Map toJson() => _$FakeBigDecimalMap200ResponseToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/file_schema_test_class.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/file_schema_test_class.dart new file mode 100644 index 000000000000..cde81139a620 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/file_schema_test_class.dart @@ -0,0 +1,73 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/foo.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/foo.dart new file mode 100644 index 000000000000..13d38bc30f0d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/foo.dart @@ -0,0 +1,56 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'foo.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Foo { + /// Returns a new [Foo] instance. + Foo({ + + this.bar = 'bar', + }); + + @JsonKey( + defaultValue: 'bar', + name: r'bar', + required: false, + includeIfNull: false, + ) + + + final String? bar; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Foo && + other.bar == bar; + + @override + int get hashCode => + bar.hashCode; + + factory Foo.fromJson(Map json) => _$FooFromJson(json); + + Map toJson() => _$FooToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/foo_get_default_response.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/foo_get_default_response.dart new file mode 100644 index 000000000000..e153e16cce1a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/foo_get_default_response.dart @@ -0,0 +1,57 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/foo.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'foo_get_default_response.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FooGetDefaultResponse { + /// Returns a new [FooGetDefaultResponse] instance. + FooGetDefaultResponse({ + + this.string, + }); + + @JsonKey( + + name: r'string', + required: false, + includeIfNull: false, + ) + + + final Foo? string; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FooGetDefaultResponse && + other.string == string; + + @override + int get hashCode => + string.hashCode; + + factory FooGetDefaultResponse.fromJson(Map json) => _$FooGetDefaultResponseFromJson(json); + + Map toJson() => _$FooGetDefaultResponseToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/format_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/format_test.dart new file mode 100644 index 000000000000..a20ba417fa54 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/format_test.dart @@ -0,0 +1,304 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/has_only_read_only.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/has_only_read_only.dart new file mode 100644 index 000000000000..ef63a2980c30 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/has_only_read_only.dart @@ -0,0 +1,72 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/health_check_result.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/health_check_result.dart new file mode 100644 index 000000000000..6fd362cdf351 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/health_check_result.dart @@ -0,0 +1,56 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/map_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/map_test.dart new file mode 100644 index 000000000000..d87a07d10357 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/map_test.dart @@ -0,0 +1,123 @@ +// +// 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, + unknownEnumValue: Map.unknownDefaultOpenApi, + ) + + + 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(r'UPPER'), +@JsonValue(r'lower') +lower(r'lower'), +@JsonValue(r'unknown_default_open_api') +unknownDefaultOpenApi(r'unknown_default_open_api'); + +const MapTestMapOfEnumStringEnum(this.value); + +final String value; + +@override +String toString() => value; +} + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/mixed_properties_and_additional_properties_class.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/mixed_properties_and_additional_properties_class.dart new file mode 100644 index 000000000000..458d2bd0534b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/mixed_properties_and_additional_properties_class.dart @@ -0,0 +1,89 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/animal.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part '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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/model200_response.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/model200_response.dart new file mode 100644 index 000000000000..47609c700da2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/model200_response.dart @@ -0,0 +1,72 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'model200_response.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Model200Response { + /// Returns a new [Model200Response] instance. + Model200Response({ + + this.name, + + this.class_, + }); + + @JsonKey( + + name: r'name', + required: false, + includeIfNull: false, + ) + + + final int? name; + + + + @JsonKey( + + name: r'class', + required: false, + includeIfNull: false, + ) + + + final String? class_; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Model200Response && + other.name == name && + other.class_ == class_; + + @override + int get hashCode => + name.hashCode + + class_.hashCode; + + factory Model200Response.fromJson(Map json) => _$Model200ResponseFromJson(json); + + Map toJson() => _$Model200ResponseToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/model_client.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/model_client.dart new file mode 100644 index 000000000000..8ff470611f22 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/model_client.dart @@ -0,0 +1,56 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/model_enum_class.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/model_enum_class.dart new file mode 100644 index 000000000000..ec3d9ceee533 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/model_enum_class.dart @@ -0,0 +1,35 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + + +enum ModelEnumClass { + @JsonValue(r'_abc') + abc(r'_abc'), + @JsonValue(r'-efg') + efg(r'-efg'), + @JsonValue(r'(xyz)') + leftParenthesisXyzRightParenthesis(r'(xyz)'), + @JsonValue(r'TEST') + test(r'TEST'), + @JsonValue(r'TEST_A') + testA(r'TEST_A'), + @JsonValue(r'TEST_A_ABC') + testAAbc(r'TEST_A_ABC'), + @JsonValue(r'TEST_a') + tESTA(r'TEST_a'), + @JsonValue(r'tEST') + tEST(r'tEST'), + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi(r'unknown_default_open_api'); + + const ModelEnumClass(this.value); + + final String value; + + @override + String toString() => value; +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/model_file.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/model_file.dart new file mode 100644 index 000000000000..cccca0412f46 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/model_file.dart @@ -0,0 +1,57 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/model_list.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/model_list.dart new file mode 100644 index 000000000000..11421881ae57 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/model_list.dart @@ -0,0 +1,56 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/model_return.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/model_return.dart new file mode 100644 index 000000000000..ea5427115232 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/model_return.dart @@ -0,0 +1,56 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/name.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/name.dart new file mode 100644 index 000000000000..3d16d98780b3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/name.dart @@ -0,0 +1,104 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/nullable_class.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/nullable_class.dart new file mode 100644 index 000000000000..6f6a484551e4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/nullable_class.dart @@ -0,0 +1,232 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/number_only.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/number_only.dart new file mode 100644 index 000000000000..44e9d41a189d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/number_only.dart @@ -0,0 +1,56 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/object_with_deprecated_fields.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/object_with_deprecated_fields.dart new file mode 100644 index 000000000000..5a36ffb5147e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/object_with_deprecated_fields.dart @@ -0,0 +1,108 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/deprecated_object.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'object_with_deprecated_fields.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ObjectWithDeprecatedFields { + /// Returns a new [ObjectWithDeprecatedFields] instance. + ObjectWithDeprecatedFields({ + + this.uuid, + + this.id, + + this.deprecatedRef, + + this.bars, + }); + + @JsonKey( + + name: r'uuid', + required: false, + includeIfNull: false, + ) + + + final String? uuid; + + + + @Deprecated('id has been deprecated') + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false, + ) + + + final num? id; + + + + @Deprecated('deprecatedRef has been deprecated') + @JsonKey( + + name: r'deprecatedRef', + required: false, + includeIfNull: false, + ) + + + final DeprecatedObject? deprecatedRef; + + + + @Deprecated('bars has been deprecated') + @JsonKey( + + name: r'bars', + required: false, + includeIfNull: false, + ) + + + final List? bars; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ObjectWithDeprecatedFields && + other.uuid == uuid && + other.id == id && + other.deprecatedRef == deprecatedRef && + other.bars == bars; + + @override + int get hashCode => + uuid.hashCode + + id.hashCode + + deprecatedRef.hashCode + + bars.hashCode; + + factory ObjectWithDeprecatedFields.fromJson(Map json) => _$ObjectWithDeprecatedFieldsFromJson(json); + + Map toJson() => _$ObjectWithDeprecatedFieldsToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/order.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/order.dart new file mode 100644 index 000000000000..dfbc4f5c5e41 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/order.dart @@ -0,0 +1,162 @@ +// +// 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, + unknownEnumValue: OrderStatusEnum.unknownDefaultOpenApi, + ) + + + 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 { + /// Order Status +@JsonValue(r'placed') +placed(r'placed'), + /// Order Status +@JsonValue(r'approved') +approved(r'approved'), + /// Order Status +@JsonValue(r'delivered') +delivered(r'delivered'), + /// Order Status +@JsonValue(r'unknown_default_open_api') +unknownDefaultOpenApi(r'unknown_default_open_api'); + +const OrderStatusEnum(this.value); + +final String value; + +@override +String toString() => value; +} + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/outer_composite.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/outer_composite.dart new file mode 100644 index 000000000000..a4df9cc62544 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/outer_composite.dart @@ -0,0 +1,88 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/outer_enum.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/outer_enum.dart new file mode 100644 index 000000000000..e7687f47c55b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/outer_enum.dart @@ -0,0 +1,25 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + + +enum OuterEnum { + @JsonValue(r'placed') + placed(r'placed'), + @JsonValue(r'approved') + approved(r'approved'), + @JsonValue(r'delivered') + delivered(r'delivered'), + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi(r'unknown_default_open_api'); + + const OuterEnum(this.value); + + final String value; + + @override + String toString() => value; +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/outer_enum_default_value.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/outer_enum_default_value.dart new file mode 100644 index 000000000000..e232c230492f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/outer_enum_default_value.dart @@ -0,0 +1,25 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + + +enum OuterEnumDefaultValue { + @JsonValue(r'placed') + placed(r'placed'), + @JsonValue(r'approved') + approved(r'approved'), + @JsonValue(r'delivered') + delivered(r'delivered'), + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi(r'unknown_default_open_api'); + + const OuterEnumDefaultValue(this.value); + + final String value; + + @override + String toString() => value; +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/outer_enum_integer.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/outer_enum_integer.dart new file mode 100644 index 000000000000..304ecf5f51ff --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/outer_enum_integer.dart @@ -0,0 +1,25 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + + +enum OuterEnumInteger { + @JsonValue(0) + number0('0'), + @JsonValue(1) + number1('1'), + @JsonValue(2) + number2('2'), + @JsonValue(11184809) + unknownDefaultOpenApi('11184809'); + + const OuterEnumInteger(this.value); + + final String value; + + @override + String toString() => value; +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/outer_enum_integer_default_value.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/outer_enum_integer_default_value.dart new file mode 100644 index 000000000000..6483e0b837fe --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/outer_enum_integer_default_value.dart @@ -0,0 +1,25 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + + +enum OuterEnumIntegerDefaultValue { + @JsonValue(0) + number0('0'), + @JsonValue(1) + number1('1'), + @JsonValue(2) + number2('2'), + @JsonValue(11184809) + unknownDefaultOpenApi('11184809'); + + const OuterEnumIntegerDefaultValue(this.value); + + final String value; + + @override + String toString() => value; +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/outer_object_with_enum_property.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/outer_object_with_enum_property.dart new file mode 100644 index 000000000000..f78d6b5c8b3d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/outer_object_with_enum_property.dart @@ -0,0 +1,58 @@ +// +// 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, + unknownEnumValue: OuterEnumInteger.unknownDefaultOpenApi, + ) + + + 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/parent_with_nullable.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/parent_with_nullable.dart new file mode 100644 index 000000000000..bda5847df5ad --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/parent_with_nullable.dart @@ -0,0 +1,89 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'parent_with_nullable.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class ParentWithNullable { + /// Returns a new [ParentWithNullable] instance. + ParentWithNullable({ + + this.type, + + this.nullableProperty, + }); + + @JsonKey( + + name: r'type', + required: false, + includeIfNull: false, + unknownEnumValue: ParentWithNullableTypeEnum.unknownDefaultOpenApi, + ) + + + final ParentWithNullableTypeEnum? type; + + + + @JsonKey( + + name: r'nullableProperty', + required: false, + includeIfNull: false, + ) + + + final String? nullableProperty; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is ParentWithNullable && + other.type == type && + other.nullableProperty == nullableProperty; + + @override + int get hashCode => + type.hashCode + + (nullableProperty == null ? 0 : nullableProperty.hashCode); + + factory ParentWithNullable.fromJson(Map json) => _$ParentWithNullableFromJson(json); + + Map toJson() => _$ParentWithNullableToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + + +enum ParentWithNullableTypeEnum { +@JsonValue(r'ChildWithNullable') +childWithNullable(r'ChildWithNullable'), +@JsonValue(r'unknown_default_open_api') +unknownDefaultOpenApi(r'unknown_default_open_api'); + +const ParentWithNullableTypeEnum(this.value); + +final String value; + +@override +String toString() => value; +} + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/pet.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/pet.dart new file mode 100644 index 000000000000..fdb70f9ce89a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/pet.dart @@ -0,0 +1,164 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:openapi/src/model/category.dart'; +import 'package:openapi/src/model/tag.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'pet.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class Pet { + /// Returns a new [Pet] instance. + Pet({ + + this.id, + + this.category, + + required this.name, + + required this.photoUrls, + + this.tags, + + this.status, + }); + + @JsonKey( + + name: r'id', + required: false, + includeIfNull: false, + ) + + + final int? id; + + + + @JsonKey( + + name: r'category', + required: false, + includeIfNull: false, + ) + + + final Category? category; + + + + @JsonKey( + + name: r'name', + required: true, + includeIfNull: false, + ) + + + final String name; + + + + @JsonKey( + + name: r'photoUrls', + required: true, + includeIfNull: false, + ) + + + final Set photoUrls; + + + + @JsonKey( + + name: r'tags', + required: false, + includeIfNull: false, + ) + + + final List? tags; + + + + /// pet status in the store + @JsonKey( + + name: r'status', + required: false, + includeIfNull: false, + unknownEnumValue: PetStatusEnum.unknownDefaultOpenApi, + ) + + + final PetStatusEnum? status; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is Pet && + other.id == id && + other.category == category && + other.name == name && + other.photoUrls == photoUrls && + other.tags == tags && + other.status == status; + + @override + int get hashCode => + id.hashCode + + category.hashCode + + name.hashCode + + photoUrls.hashCode + + tags.hashCode + + status.hashCode; + + factory Pet.fromJson(Map json) => _$PetFromJson(json); + + Map toJson() => _$PetToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + +/// pet status in the store +enum PetStatusEnum { + /// pet status in the store +@JsonValue(r'available') +available(r'available'), + /// pet status in the store +@JsonValue(r'pending') +pending(r'pending'), + /// pet status in the store +@JsonValue(r'sold') +sold(r'sold'), + /// pet status in the store +@JsonValue(r'unknown_default_open_api') +unknownDefaultOpenApi(r'unknown_default_open_api'); + +const PetStatusEnum(this.value); + +final String value; + +@override +String toString() => value; +} + + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/read_only_first.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/read_only_first.dart new file mode 100644 index 000000000000..0ec8a7710c60 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/read_only_first.dart @@ -0,0 +1,72 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/single_ref_type.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/single_ref_type.dart new file mode 100644 index 000000000000..3ea636c76a1e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/single_ref_type.dart @@ -0,0 +1,23 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + + +enum SingleRefType { + @JsonValue(r'admin') + admin(r'admin'), + @JsonValue(r'user') + user(r'user'), + @JsonValue(r'unknown_default_open_api') + unknownDefaultOpenApi(r'unknown_default_open_api'); + + const SingleRefType(this.value); + + final String value; + + @override + String toString() => value; +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/special_model_name.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/special_model_name.dart new file mode 100644 index 000000000000..175b6fb274ce --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/special_model_name.dart @@ -0,0 +1,56 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/tag.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/tag.dart new file mode 100644 index 000000000000..abe588b27d6f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/tag.dart @@ -0,0 +1,72 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/test_inline_freeform_additional_properties_request.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/test_inline_freeform_additional_properties_request.dart new file mode 100644 index 000000000000..5eda7d48b384 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/test_inline_freeform_additional_properties_request.dart @@ -0,0 +1,56 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'test_inline_freeform_additional_properties_request.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class TestInlineFreeformAdditionalPropertiesRequest { + /// Returns a new [TestInlineFreeformAdditionalPropertiesRequest] instance. + TestInlineFreeformAdditionalPropertiesRequest({ + + this.someProperty, + }); + + @JsonKey( + + name: r'someProperty', + required: false, + includeIfNull: false, + ) + + + final String? someProperty; + + + + + + @override + bool operator ==(Object other) => identical(this, other) || other is TestInlineFreeformAdditionalPropertiesRequest && + other.someProperty == someProperty; + + @override + int get hashCode => + someProperty.hashCode; + + factory TestInlineFreeformAdditionalPropertiesRequest.fromJson(Map json) => _$TestInlineFreeformAdditionalPropertiesRequestFromJson(json); + + Map toJson() => _$TestInlineFreeformAdditionalPropertiesRequestToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/user.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/user.dart new file mode 100644 index 000000000000..56c95cb75f15 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/lib/src/model/user.dart @@ -0,0 +1,169 @@ +// +// 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/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/pubspec.yaml b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/pubspec.yaml new file mode 100644 index 000000000000..cbfddf172a6c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/pubspec.yaml @@ -0,0 +1,17 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client +homepage: homepage + + +environment: + sdk: '>=3.5.0 <4.0.0' + +dependencies: + dio: '^5.7.0' + json_annotation: '^4.9.0' + +dev_dependencies: + build_runner: any + json_serializable: '^6.9.3' + test: '^1.16.0' diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/additional_properties_class_test.dart new file mode 100644 index 000000000000..fd8299fb998f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/additional_properties_class_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AdditionalPropertiesClass +void main() { + final AdditionalPropertiesClass? instance = /* AdditionalPropertiesClass(...) */ null; + // TODO add properties to the entity + + group(AdditionalPropertiesClass, () { + // Map mapProperty + test('to test the property `mapProperty`', () async { + // TODO + }); + + // Map> mapOfMapProperty + test('to test the property `mapOfMapProperty`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/all_of_with_single_ref_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/all_of_with_single_ref_test.dart new file mode 100644 index 000000000000..942dce5f1a73 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/all_of_with_single_ref_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for AllOfWithSingleRef +void main() { + final AllOfWithSingleRef? instance = /* AllOfWithSingleRef(...) */ null; + // TODO add properties to the entity + + group(AllOfWithSingleRef, () { + // String username + test('to test the property `username`', () async { + // TODO + }); + + // SingleRefType singlereftype + test('to test the property `singlereftype`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/animal_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/animal_test.dart new file mode 100644 index 000000000000..822f19607ab1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/animal_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Animal +void main() { + final Animal? instance = /* Animal(...) */ null; + // TODO add properties to the entity + + group(Animal, () { + // String classname + test('to test the property `classname`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/another_fake_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/another_fake_api_test.dart new file mode 100644 index 000000000000..a55048c12e73 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/another_fake_api_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + + +/// tests for AnotherFakeApi +void main() { + final instance = Openapi().getAnotherFakeApi(); + + group(AnotherFakeApi, () { + // To test special tags + // + // To test special tags and operation ID starting with number + // + //Future call123testSpecialTags(ModelClient modelclient) async + test('test call123testSpecialTags', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/api_response_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/api_response_test.dart new file mode 100644 index 000000000000..9487afd7f58c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/api_response_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ApiResponse +void main() { + final ApiResponse? instance = /* ApiResponse(...) */ null; + // TODO add properties to the entity + + group(ApiResponse, () { + // int code + test('to test the property `code`', () async { + // TODO + }); + + // String type + test('to test the property `type`', () async { + // TODO + }); + + // String message + test('to test the property `message`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/array_of_array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/array_of_array_of_number_only_test.dart new file mode 100644 index 000000000000..1c0903ca7a6b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/array_of_array_of_number_only_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayOfArrayOfNumberOnly +void main() { + final ArrayOfArrayOfNumberOnly? instance = /* ArrayOfArrayOfNumberOnly(...) */ null; + // TODO add properties to the entity + + group(ArrayOfArrayOfNumberOnly, () { + // List> arrayarraynumber + test('to test the property `arrayarraynumber`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/array_of_number_only_test.dart new file mode 100644 index 000000000000..da172c44024c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/array_of_number_only_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayOfNumberOnly +void main() { + final ArrayOfNumberOnly? instance = /* ArrayOfNumberOnly(...) */ null; + // TODO add properties to the entity + + group(ArrayOfNumberOnly, () { + // List arraynumber + test('to test the property `arraynumber`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/array_test_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/array_test_test.dart new file mode 100644 index 000000000000..bfe7c84fd122 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/array_test_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ArrayTest +void main() { + final ArrayTest? instance = /* ArrayTest(...) */ null; + // TODO add properties to the entity + + group(ArrayTest, () { + // List arrayOfString + test('to test the property `arrayOfString`', () async { + // TODO + }); + + // List> arrayArrayOfInteger + test('to test the property `arrayArrayOfInteger`', () async { + // TODO + }); + + // List> arrayArrayOfModel + test('to test the property `arrayArrayOfModel`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/capitalization_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/capitalization_test.dart new file mode 100644 index 000000000000..56d5d65c9cdb --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/capitalization_test.dart @@ -0,0 +1,42 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Capitalization +void main() { + final Capitalization? instance = /* Capitalization(...) */ null; + // TODO add properties to the entity + + group(Capitalization, () { + // String smallcamel + test('to test the property `smallcamel`', () async { + // TODO + }); + + // String capitalcamel + test('to test the property `capitalcamel`', () async { + // TODO + }); + + // String smallSnake + test('to test the property `smallSnake`', () async { + // TODO + }); + + // String capitalSnake + test('to test the property `capitalSnake`', () async { + // TODO + }); + + // String scaEthFlowPoints + test('to test the property `scaEthFlowPoints`', () async { + // TODO + }); + + // Name of the pet + // String attName + test('to test the property `attName`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/cat_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/cat_test.dart new file mode 100644 index 000000000000..0f0cb8c7f036 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/cat_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Cat +void main() { + final Cat? instance = /* Cat(...) */ null; + // TODO add properties to the entity + + group(Cat, () { + // String classname + test('to test the property `classname`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + // bool declawed + test('to test the property `declawed`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/category_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/category_test.dart new file mode 100644 index 000000000000..0ed6921ae7fc --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/category_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Category +void main() { + final Category? instance = /* Category(...) */ null; + // TODO add properties to the entity + + group(Category, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name (default value: 'default-name') + test('to test the property `name`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/child_with_nullable_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/child_with_nullable_test.dart new file mode 100644 index 000000000000..e46cb7f088c8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/child_with_nullable_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ChildWithNullable +void main() { + final ChildWithNullable? instance = /* ChildWithNullable(...) */ null; + // TODO add properties to the entity + + group(ChildWithNullable, () { + // String type + test('to test the property `type`', () async { + // TODO + }); + + // String nullableproperty + test('to test the property `nullableproperty`', () async { + // TODO + }); + + // String otherproperty + test('to test the property `otherproperty`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/class_model_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/class_model_test.dart new file mode 100644 index 000000000000..e2dda7bab74e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/class_model_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ClassModel +void main() { + final ClassModel? instance = /* ClassModel(...) */ null; + // TODO add properties to the entity + + group(ClassModel, () { + // String class_ + test('to test the property `class_`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/default_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/default_api_test.dart new file mode 100644 index 000000000000..f079565f9785 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/default_api_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + + +/// tests for DefaultApi +void main() { + final instance = Openapi().getDefaultApi(); + + group(DefaultApi, () { + //Future fooGet() async + test('test fooGet', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/deprecated_object_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/deprecated_object_test.dart new file mode 100644 index 000000000000..1b2214668577 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/deprecated_object_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for DeprecatedObject +void main() { + final DeprecatedObject? instance = /* DeprecatedObject(...) */ null; + // TODO add properties to the entity + + group(DeprecatedObject, () { + // String name + test('to test the property `name`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/dog_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/dog_test.dart new file mode 100644 index 000000000000..334507603f2f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/dog_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Dog +void main() { + final Dog? instance = /* Dog(...) */ null; + // TODO add properties to the entity + + group(Dog, () { + // String classname + test('to test the property `classname`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + // String breed + test('to test the property `breed`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/enum_arrays_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/enum_arrays_test.dart new file mode 100644 index 000000000000..30d12204ba17 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/enum_arrays_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EnumArrays +void main() { + final EnumArrays? instance = /* EnumArrays(...) */ null; + // TODO add properties to the entity + + group(EnumArrays, () { + // String justSymbol + test('to test the property `justSymbol`', () async { + // TODO + }); + + // List arrayEnum + test('to test the property `arrayEnum`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/enum_test_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/enum_test_test.dart new file mode 100644 index 000000000000..1f0b3d7aab11 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/enum_test_test.dart @@ -0,0 +1,51 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for EnumTest +void main() { + final EnumTest? instance = /* EnumTest(...) */ null; + // TODO add properties to the entity + + group(EnumTest, () { + // String enumString + test('to test the property `enumString`', () async { + // TODO + }); + + // String enumStringRequired + test('to test the property `enumStringRequired`', () async { + // TODO + }); + + // int enumInteger + test('to test the property `enumInteger`', () async { + // TODO + }); + + // double enumNumber + test('to test the property `enumNumber`', () async { + // TODO + }); + + // OuterEnum outerenum + test('to test the property `outerenum`', () async { + // TODO + }); + + // OuterEnumInteger outerenuminteger + test('to test the property `outerenuminteger`', () async { + // TODO + }); + + // OuterEnumDefaultValue outerenumdefaultvalue + test('to test the property `outerenumdefaultvalue`', () async { + // TODO + }); + + // OuterEnumIntegerDefaultValue outerenumintegerdefaultvalue + test('to test the property `outerenumintegerdefaultvalue`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/fake_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/fake_api_test.dart new file mode 100644 index 000000000000..2e343b405587 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/fake_api_test.dart @@ -0,0 +1,183 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + + +/// tests for FakeApi +void main() { + final instance = Openapi().getFakeApi(); + + group(FakeApi, () { + // for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + // + //Future fakeBigDecimalMap() async + test('test fakeBigDecimalMap', () async { + // TODO + }); + + // Health check endpoint + // + //Future fakeHealthGet() async + test('test fakeHealthGet', () async { + // TODO + }); + + // test http signature authentication + // + //Future fakeHttpSignatureTest(Pet pet, { String query1, String header1 }) async + test('test fakeHttpSignatureTest', () async { + // TODO + }); + + // Test serialization of outer boolean types + // + //Future fakeOuterBooleanSerialize({ bool body }) async + test('test fakeOuterBooleanSerialize', () async { + // TODO + }); + + // Test serialization of object with outer number type + // + //Future fakeOuterCompositeSerialize({ OuterComposite outercomposite }) async + test('test fakeOuterCompositeSerialize', () async { + // TODO + }); + + // Test serialization of outer number types + // + //Future fakeOuterNumberSerialize({ num body }) async + test('test fakeOuterNumberSerialize', () async { + // TODO + }); + + // Test serialization of outer string types + // + //Future fakeOuterStringSerialize({ String body }) async + test('test fakeOuterStringSerialize', () async { + // TODO + }); + + // Test serialization of enum (int) properties with examples + // + //Future fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerobjectwithenumproperty) async + test('test fakePropertyEnumIntegerSerialize', () async { + // TODO + }); + + // test referenced additionalProperties + // + // + // + //Future testAdditionalPropertiesReference(Map requestBody) async + test('test testAdditionalPropertiesReference', () async { + // TODO + }); + + // For this test, the body has to be a binary file. + // + //Future testBodyWithBinary(MultipartFile body) async + test('test testBodyWithBinary', () async { + // TODO + }); + + // For this test, the body for this request must reference a schema named `File`. + // + //Future testBodyWithFileSchema(FileSchemaTestClass fileschematestclass) async + test('test testBodyWithFileSchema', () async { + // TODO + }); + + //Future testBodyWithQueryParams(String query, User user) async + test('test testBodyWithQueryParams', () async { + // TODO + }); + + // To test \"client\" model + // + // To test \"client\" model + // + //Future testClientModel(ModelClient modelclient) async + test('test testClientModel', () async { + // TODO + }); + + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + // + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + // + //Future testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime datetime, String password, String callback }) async + test('test testEndpointParameters', () async { + // TODO + }); + + // To test enum parameters + // + // To test enum parameters + // + //Future testEnumParameters({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumQueryModelArray, List enumFormStringArray, String enumFormString }) async + test('test testEnumParameters', () async { + // TODO + }); + + // Fake endpoint to test group parameters (optional) + // + // Fake endpoint to test group parameters (optional) + // + //Future testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group }) async + test('test testGroupParameters', () async { + // TODO + }); + + // test inline additionalProperties + // + // + // + //Future testInlineAdditionalProperties(Map requestBody) async + test('test testInlineAdditionalProperties', () async { + // TODO + }); + + // test inline free-form additionalProperties + // + // + // + //Future testInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testinlinefreeformadditionalpropertiesrequest) async + test('test testInlineFreeformAdditionalProperties', () async { + // TODO + }); + + // test json serialization of form data + // + // + // + //Future testJsonFormData(String param, String param2) async + test('test testJsonFormData', () async { + // TODO + }); + + // test nullable parent property + // + // + // + //Future testNullable(ChildWithNullable childwithnullable) async + test('test testNullable', () async { + // TODO + }); + + // To test the collection format in query parameters + // + //Future testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, String allowempty, { Map language }) async + test('test testQueryParameterCollectionFormat', () async { + // TODO + }); + + // test referenced string map + // + // + // + //Future testStringMapReference(Map requestBody) async + test('test testStringMapReference', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/fake_big_decimal_map200_response_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/fake_big_decimal_map200_response_test.dart new file mode 100644 index 000000000000..2889fce8cdaa --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/fake_big_decimal_map200_response_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FakeBigDecimalMap200Response +void main() { + final FakeBigDecimalMap200Response? instance = /* FakeBigDecimalMap200Response(...) */ null; + // TODO add properties to the entity + + group(FakeBigDecimalMap200Response, () { + // num someid + test('to test the property `someid`', () async { + // TODO + }); + + // Map somemap + test('to test the property `somemap`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/fake_classname_tags123_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/fake_classname_tags123_api_test.dart new file mode 100644 index 000000000000..c81f9cf0db45 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/fake_classname_tags123_api_test.dart @@ -0,0 +1,20 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + + +/// tests for FakeClassnameTags123Api +void main() { + final instance = Openapi().getFakeClassnameTags123Api(); + + group(FakeClassnameTags123Api, () { + // To test class name in snake case + // + // To test class name in snake case + // + //Future testClassname(ModelClient modelclient) async + test('test testClassname', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/file_schema_test_class_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/file_schema_test_class_test.dart new file mode 100644 index 000000000000..2ccd0d450ce7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/file_schema_test_class_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FileSchemaTestClass +void main() { + final FileSchemaTestClass? instance = /* FileSchemaTestClass(...) */ null; + // TODO add properties to the entity + + group(FileSchemaTestClass, () { + // ModelFile file + test('to test the property `file`', () async { + // TODO + }); + + // List files + test('to test the property `files`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/foo_get_default_response_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/foo_get_default_response_test.dart new file mode 100644 index 000000000000..4282326fe61f --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/foo_get_default_response_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FooGetDefaultResponse +void main() { + final FooGetDefaultResponse? instance = /* FooGetDefaultResponse(...) */ null; + // TODO add properties to the entity + + group(FooGetDefaultResponse, () { + // Foo string + test('to test the property `string`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/foo_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/foo_test.dart new file mode 100644 index 000000000000..28ae9a5b5e13 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/foo_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Foo +void main() { + final Foo? instance = /* Foo(...) */ null; + // TODO add properties to the entity + + group(Foo, () { + // String bar (default value: 'bar') + test('to test the property `bar`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/format_test_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/format_test_test.dart new file mode 100644 index 000000000000..424f668640a6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/format_test_test.dart @@ -0,0 +1,93 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FormatTest +void main() { + final FormatTest? instance = /* FormatTest(...) */ null; + // TODO add properties to the entity + + group(FormatTest, () { + // int integer + test('to test the property `integer`', () async { + // TODO + }); + + // int int32 + test('to test the property `int32`', () async { + // TODO + }); + + // int int64 + test('to test the property `int64`', () async { + // TODO + }); + + // num number + test('to test the property `number`', () async { + // TODO + }); + + // double float + test('to test the property `float`', () async { + // TODO + }); + + // double double_ + test('to test the property `double_`', () async { + // TODO + }); + + // double decimal + test('to test the property `decimal`', () async { + // TODO + }); + + // String string + test('to test the property `string`', () async { + // TODO + }); + + // String byte + test('to test the property `byte`', () async { + // TODO + }); + + // MultipartFile binary + test('to test the property `binary`', () async { + // TODO + }); + + // DateTime date + test('to test the property `date`', () async { + // TODO + }); + + // DateTime datetime + test('to test the property `datetime`', () async { + // TODO + }); + + // String uuid + test('to test the property `uuid`', () async { + // TODO + }); + + // String password + test('to test the property `password`', () async { + // TODO + }); + + // A string that is a 10 digit number. Can have leading zeros. + // String patternWithDigits + test('to test the property `patternWithDigits`', () async { + // TODO + }); + + // A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + // String patternWithDigitsAndDelimiter + test('to test the property `patternWithDigitsAndDelimiter`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/has_only_read_only_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/has_only_read_only_test.dart new file mode 100644 index 000000000000..d72429a31bb5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/has_only_read_only_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for HasOnlyReadOnly +void main() { + final HasOnlyReadOnly? instance = /* HasOnlyReadOnly(...) */ null; + // TODO add properties to the entity + + group(HasOnlyReadOnly, () { + // String bar + test('to test the property `bar`', () async { + // TODO + }); + + // String foo + test('to test the property `foo`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/health_check_result_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/health_check_result_test.dart new file mode 100644 index 000000000000..6e227376da00 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/health_check_result_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for HealthCheckResult +void main() { + final HealthCheckResult? instance = /* HealthCheckResult(...) */ null; + // TODO add properties to the entity + + group(HealthCheckResult, () { + // String nullablemessage + test('to test the property `nullablemessage`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/map_test_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/map_test_test.dart new file mode 100644 index 000000000000..909415df7540 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/map_test_test.dart @@ -0,0 +1,31 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for MapTest +void main() { + final MapTest? instance = /* MapTest(...) */ null; + // TODO add properties to the entity + + group(MapTest, () { + // Map> mapMapOfString + test('to test the property `mapMapOfString`', () async { + // TODO + }); + + // Map mapOfEnumString + test('to test the property `mapOfEnumString`', () async { + // TODO + }); + + // Map directMap + test('to test the property `directMap`', () async { + // TODO + }); + + // Map indirectMap + test('to test the property `indirectMap`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/mixed_properties_and_additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/mixed_properties_and_additional_properties_class_test.dart new file mode 100644 index 000000000000..b4c5162189e7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/mixed_properties_and_additional_properties_class_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for MixedPropertiesAndAdditionalPropertiesClass +void main() { + final MixedPropertiesAndAdditionalPropertiesClass? instance = /* MixedPropertiesAndAdditionalPropertiesClass(...) */ null; + // TODO add properties to the entity + + group(MixedPropertiesAndAdditionalPropertiesClass, () { + // String uuid + test('to test the property `uuid`', () async { + // TODO + }); + + // DateTime datetime + test('to test the property `datetime`', () async { + // TODO + }); + + // Map map + test('to test the property `map`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/model200_response_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/model200_response_test.dart new file mode 100644 index 000000000000..de8cf3037b6b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/model200_response_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Model200Response +void main() { + final Model200Response? instance = /* Model200Response(...) */ null; + // TODO add properties to the entity + + group(Model200Response, () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // String class_ + test('to test the property `class_`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/model_client_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/model_client_test.dart new file mode 100644 index 000000000000..44faf62f15b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/model_client_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelClient +void main() { + final ModelClient? instance = /* ModelClient(...) */ null; + // TODO add properties to the entity + + group(ModelClient, () { + // String client + test('to test the property `client`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/model_enum_class_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/model_enum_class_test.dart new file mode 100644 index 000000000000..03e5855bf004 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/model_enum_class_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelEnumClass +void main() { + + group(ModelEnumClass, () { + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/model_file_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/model_file_test.dart new file mode 100644 index 000000000000..2f6c1687e7a7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/model_file_test.dart @@ -0,0 +1,17 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelFile +void main() { + final ModelFile? instance = /* ModelFile(...) */ null; + // TODO add properties to the entity + + group(ModelFile, () { + // Test capitalization + // String sourceuri + test('to test the property `sourceuri`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/model_list_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/model_list_test.dart new file mode 100644 index 000000000000..f748eee993ac --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/model_list_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelList +void main() { + final ModelList? instance = /* ModelList(...) */ null; + // TODO add properties to the entity + + group(ModelList, () { + // String n123list + test('to test the property `n123list`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/model_return_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/model_return_test.dart new file mode 100644 index 000000000000..cfc17807c151 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/model_return_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ModelReturn +void main() { + final ModelReturn? instance = /* ModelReturn(...) */ null; + // TODO add properties to the entity + + group(ModelReturn, () { + // int return_ + test('to test the property `return_`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/name_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/name_test.dart new file mode 100644 index 000000000000..4f3f7f633728 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/name_test.dart @@ -0,0 +1,31 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Name +void main() { + final Name? instance = /* Name(...) */ null; + // TODO add properties to the entity + + group(Name, () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // int snakeCase + test('to test the property `snakeCase`', () async { + // TODO + }); + + // String property + test('to test the property `property`', () async { + // TODO + }); + + // int n123number + test('to test the property `n123number`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/nullable_class_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/nullable_class_test.dart new file mode 100644 index 000000000000..0ab76167983b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/nullable_class_test.dart @@ -0,0 +1,71 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for NullableClass +void main() { + final NullableClass? instance = /* NullableClass(...) */ null; + // TODO add properties to the entity + + group(NullableClass, () { + // int integerProp + test('to test the property `integerProp`', () async { + // TODO + }); + + // num numberProp + test('to test the property `numberProp`', () async { + // TODO + }); + + // bool booleanProp + test('to test the property `booleanProp`', () async { + // TODO + }); + + // String stringProp + test('to test the property `stringProp`', () async { + // TODO + }); + + // DateTime dateProp + test('to test the property `dateProp`', () async { + // TODO + }); + + // DateTime datetimeProp + test('to test the property `datetimeProp`', () async { + // TODO + }); + + // List arrayNullableProp + test('to test the property `arrayNullableProp`', () async { + // TODO + }); + + // List arrayAndItemsNullableProp + test('to test the property `arrayAndItemsNullableProp`', () async { + // TODO + }); + + // List arrayItemsNullable + test('to test the property `arrayItemsNullable`', () async { + // TODO + }); + + // Map objectNullableProp + test('to test the property `objectNullableProp`', () async { + // TODO + }); + + // Map objectAndItemsNullableProp + test('to test the property `objectAndItemsNullableProp`', () async { + // TODO + }); + + // Map objectItemsNullable + test('to test the property `objectItemsNullable`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/number_only_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/number_only_test.dart new file mode 100644 index 000000000000..92ec051454c3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/number_only_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for NumberOnly +void main() { + final NumberOnly? instance = /* NumberOnly(...) */ null; + // TODO add properties to the entity + + group(NumberOnly, () { + // num justnumber + test('to test the property `justnumber`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/object_with_deprecated_fields_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/object_with_deprecated_fields_test.dart new file mode 100644 index 000000000000..d58af9e3e093 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/object_with_deprecated_fields_test.dart @@ -0,0 +1,31 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ObjectWithDeprecatedFields +void main() { + final ObjectWithDeprecatedFields? instance = /* ObjectWithDeprecatedFields(...) */ null; + // TODO add properties to the entity + + group(ObjectWithDeprecatedFields, () { + // String uuid + test('to test the property `uuid`', () async { + // TODO + }); + + // num id + test('to test the property `id`', () async { + // TODO + }); + + // DeprecatedObject deprecatedref + test('to test the property `deprecatedref`', () async { + // TODO + }); + + // List bars + test('to test the property `bars`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/order_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/order_test.dart new file mode 100644 index 000000000000..dda808fc14dd --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/order_test.dart @@ -0,0 +1,42 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Order +void main() { + final Order? instance = /* Order(...) */ null; + // TODO add properties to the entity + + group(Order, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // int petid + test('to test the property `petid`', () async { + // TODO + }); + + // int quantity + test('to test the property `quantity`', () async { + // TODO + }); + + // DateTime shipdate + test('to test the property `shipdate`', () async { + // TODO + }); + + // Order Status + // String status + test('to test the property `status`', () async { + // TODO + }); + + // bool complete (default value: false) + test('to test the property `complete`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/outer_composite_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/outer_composite_test.dart new file mode 100644 index 000000000000..a5f0172ba21c --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/outer_composite_test.dart @@ -0,0 +1,26 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterComposite +void main() { + final OuterComposite? instance = /* OuterComposite(...) */ null; + // TODO add properties to the entity + + group(OuterComposite, () { + // num myNumber + test('to test the property `myNumber`', () async { + // TODO + }); + + // String myString + test('to test the property `myString`', () async { + // TODO + }); + + // bool myBoolean + test('to test the property `myBoolean`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/outer_enum_default_value_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/outer_enum_default_value_test.dart new file mode 100644 index 000000000000..502c8326be58 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/outer_enum_default_value_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumDefaultValue +void main() { + + group(OuterEnumDefaultValue, () { + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/outer_enum_integer_default_value_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/outer_enum_integer_default_value_test.dart new file mode 100644 index 000000000000..c535fe8ac354 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/outer_enum_integer_default_value_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumIntegerDefaultValue +void main() { + + group(OuterEnumIntegerDefaultValue, () { + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/outer_enum_integer_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/outer_enum_integer_test.dart new file mode 100644 index 000000000000..d945bc8c489d --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/outer_enum_integer_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnumInteger +void main() { + + group(OuterEnumInteger, () { + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/outer_enum_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/outer_enum_test.dart new file mode 100644 index 000000000000..8e11eb02fb8a --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/outer_enum_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterEnum +void main() { + + group(OuterEnum, () { + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/outer_object_with_enum_property_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/outer_object_with_enum_property_test.dart new file mode 100644 index 000000000000..3d72c6188e17 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/outer_object_with_enum_property_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for OuterObjectWithEnumProperty +void main() { + final OuterObjectWithEnumProperty? instance = /* OuterObjectWithEnumProperty(...) */ null; + // TODO add properties to the entity + + group(OuterObjectWithEnumProperty, () { + // OuterEnumInteger value + test('to test the property `value`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/parent_with_nullable_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/parent_with_nullable_test.dart new file mode 100644 index 000000000000..b1b208e5f610 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/parent_with_nullable_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ParentWithNullable +void main() { + final ParentWithNullable? instance = /* ParentWithNullable(...) */ null; + // TODO add properties to the entity + + group(ParentWithNullable, () { + // String type + test('to test the property `type`', () async { + // TODO + }); + + // String nullableproperty + test('to test the property `nullableproperty`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/pet_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/pet_api_test.dart new file mode 100644 index 000000000000..0b2a5e75b1c7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/pet_api_test.dart @@ -0,0 +1,92 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + + +/// tests for PetApi +void main() { + final instance = Openapi().getPetApi(); + + group(PetApi, () { + // Add a new pet to the store + // + // + // + //Future addPet(Pet pet) async + test('test addPet', () async { + // TODO + }); + + // Deletes a pet + // + // + // + //Future deletePet(int petid, { String apiKey }) async + test('test deletePet', () async { + // TODO + }); + + // Finds Pets by status + // + // Multiple status values can be provided with comma separated strings + // + //Future> findPetsByStatus(List status) async + test('test findPetsByStatus', () async { + // TODO + }); + + // Finds Pets by tags + // + // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + // + //Future> findPetsByTags(Set tags) async + test('test findPetsByTags', () async { + // TODO + }); + + // Find pet by ID + // + // Returns a single pet + // + //Future getPetById(int petid) async + test('test getPetById', () async { + // TODO + }); + + // Update an existing pet + // + // + // + //Future updatePet(Pet pet) async + test('test updatePet', () async { + // TODO + }); + + // Updates a pet in the store with form data + // + // + // + //Future updatePetWithForm(int petid, { String name, String status }) async + test('test updatePetWithForm', () async { + // TODO + }); + + // uploads an image + // + // + // + //Future uploadFile(int petid, { String additionalmetadata, MultipartFile file }) async + test('test uploadFile', () async { + // TODO + }); + + // uploads an image (required) + // + // + // + //Future uploadFileWithRequiredFile(int petid, MultipartFile requiredfile, { String additionalmetadata }) async + test('test uploadFileWithRequiredFile', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/pet_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/pet_test.dart new file mode 100644 index 000000000000..9bdf6ba520e7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/pet_test.dart @@ -0,0 +1,42 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Pet +void main() { + final Pet? instance = /* Pet(...) */ null; + // TODO add properties to the entity + + group(Pet, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // Category category + test('to test the property `category`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // Set photourls + test('to test the property `photourls`', () async { + // TODO + }); + + // List tags + test('to test the property `tags`', () async { + // TODO + }); + + // pet status in the store + // String status + test('to test the property `status`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/read_only_first_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/read_only_first_test.dart new file mode 100644 index 000000000000..bcefd75befb6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/read_only_first_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for ReadOnlyFirst +void main() { + final ReadOnlyFirst? instance = /* ReadOnlyFirst(...) */ null; + // TODO add properties to the entity + + group(ReadOnlyFirst, () { + // String bar + test('to test the property `bar`', () async { + // TODO + }); + + // String baz + test('to test the property `baz`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/single_ref_type_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/single_ref_type_test.dart new file mode 100644 index 000000000000..5cd85add393e --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/single_ref_type_test.dart @@ -0,0 +1,9 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for SingleRefType +void main() { + + group(SingleRefType, () { + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/special_model_name_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/special_model_name_test.dart new file mode 100644 index 000000000000..64de795ef175 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/special_model_name_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for SpecialModelName +void main() { + final SpecialModelName? instance = /* SpecialModelName(...) */ null; + // TODO add properties to the entity + + group(SpecialModelName, () { + // int dollarSpecialleftSquareBracketPropertyperiodNamerightSquareBracket + test('to test the property `dollarSpecialleftSquareBracketPropertyperiodNamerightSquareBracket`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/store_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/store_api_test.dart new file mode 100644 index 000000000000..08f7f738043b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/store_api_test.dart @@ -0,0 +1,47 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + + +/// tests for StoreApi +void main() { + final instance = Openapi().getStoreApi(); + + group(StoreApi, () { + // Delete purchase order by ID + // + // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + // + //Future deleteOrder(String orderId) async + test('test deleteOrder', () async { + // TODO + }); + + // Returns pet inventories by status + // + // Returns a map of status codes to quantities + // + //Future> getInventory() async + test('test getInventory', () async { + // TODO + }); + + // Find purchase order by ID + // + // For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + // + //Future getOrderById(int orderId) async + test('test getOrderById', () async { + // TODO + }); + + // Place an order for a pet + // + // + // + //Future placeOrder(Order order) async + test('test placeOrder', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/tag_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/tag_test.dart new file mode 100644 index 000000000000..ffe49b3179c3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/tag_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for Tag +void main() { + final Tag? instance = /* Tag(...) */ null; + // TODO add properties to the entity + + group(Tag, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/test_inline_freeform_additional_properties_request_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/test_inline_freeform_additional_properties_request_test.dart new file mode 100644 index 000000000000..c4e0cb7ef1f2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/test_inline_freeform_additional_properties_request_test.dart @@ -0,0 +1,16 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for TestInlineFreeformAdditionalPropertiesRequest +void main() { + final TestInlineFreeformAdditionalPropertiesRequest? instance = /* TestInlineFreeformAdditionalPropertiesRequest(...) */ null; + // TODO add properties to the entity + + group(TestInlineFreeformAdditionalPropertiesRequest, () { + // String someproperty + test('to test the property `someproperty`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/user_api_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/user_api_test.dart new file mode 100644 index 000000000000..4bf28b67623b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/user_api_test.dart @@ -0,0 +1,83 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + + +/// tests for UserApi +void main() { + final instance = Openapi().getUserApi(); + + group(UserApi, () { + // Create user + // + // This can only be done by the logged in user. + // + //Future createUser(User user) async + test('test createUser', () async { + // TODO + }); + + // Creates list of users with given input array + // + // + // + //Future createUsersWithArrayInput(List user) async + test('test createUsersWithArrayInput', () async { + // TODO + }); + + // Creates list of users with given input array + // + // + // + //Future createUsersWithListInput(List user) async + test('test createUsersWithListInput', () async { + // TODO + }); + + // Delete user + // + // This can only be done by the logged in user. + // + //Future deleteUser(String username) async + test('test deleteUser', () async { + // TODO + }); + + // Get user by user name + // + // + // + //Future getUserByName(String username) async + test('test getUserByName', () async { + // TODO + }); + + // Logs user into the system + // + // + // + //Future loginUser(String username, String password) async + test('test loginUser', () async { + // TODO + }); + + // Logs out current logged in user session + // + // + // + //Future logoutUser() async + test('test logoutUser', () async { + // TODO + }); + + // Updated user + // + // This can only be done by the logged in user. + // + //Future updateUser(String username, User user) async + test('test updateUser', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/user_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/user_test.dart new file mode 100644 index 000000000000..9c5d4fec87f7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_use_lower_camel_case/test/user_test.dart @@ -0,0 +1,52 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for User +void main() { + final User? instance = /* User(...) */ null; + // TODO add properties to the entity + + group(User, () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String username + test('to test the property `username`', () async { + // TODO + }); + + // String firstname + test('to test the property `firstname`', () async { + // TODO + }); + + // String lastname + test('to test the property `lastname`', () async { + // TODO + }); + + // String email + test('to test the property `email`', () async { + // TODO + }); + + // String password + test('to test the property `password`', () async { + // TODO + }); + + // String phone + test('to test the property `phone`', () async { + // TODO + }); + + // User Status + // int userstatus + test('to test the property `userstatus`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/.gitignore b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/.gitignore new file mode 100644 index 000000000000..0f74d293b989 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/.gitignore @@ -0,0 +1,19 @@ +# See https://dart.dev/guides/libraries/private-files + +.dart_tool/ +.packages +build/ + +# Except for application packages +pubspec.lock + +doc/api/ + +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ + +# Mac +.DS_Store diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/.openapi-generator-ignore b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/.openapi-generator/FILES new file mode 100644 index 000000000000..fbfe8cdd1809 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/.openapi-generator/FILES @@ -0,0 +1,129 @@ +.gitignore +.travis.yml +README.md +analysis_options.yaml +doc/AdditionalPropertiesClass.md +doc/AllOfWithSingleRef.md +doc/Animal.md +doc/AnotherFakeApi.md +doc/ApiResponse.md +doc/ArrayOfArrayOfNumberOnly.md +doc/ArrayOfNumberOnly.md +doc/ArrayTest.md +doc/Capitalization.md +doc/Cat.md +doc/Category.md +doc/ChildWithNullable.md +doc/ClassModel.md +doc/DefaultApi.md +doc/DeprecatedObject.md +doc/Dog.md +doc/EnumArrays.md +doc/EnumClass.md +doc/EnumTest.md +doc/FakeApi.md +doc/FakeBigDecimalMap200Response.md +doc/FakeClassnameTags123Api.md +doc/FileSchemaTestClass.md +doc/Foo.md +doc/FooGetDefaultResponse.md +doc/FormatTest.md +doc/HasOnlyReadOnly.md +doc/HealthCheckResult.md +doc/MapTest.md +doc/MixedPropertiesAndAdditionalPropertiesClass.md +doc/Model200Response.md +doc/ModelClient.md +doc/ModelFile.md +doc/ModelList.md +doc/ModelReturn.md +doc/Name.md +doc/NullableClass.md +doc/NumberOnly.md +doc/ObjectWithDeprecatedFields.md +doc/Order.md +doc/OuterComposite.md +doc/OuterEnum.md +doc/OuterEnumDefaultValue.md +doc/OuterEnumInteger.md +doc/OuterEnumIntegerDefaultValue.md +doc/OuterObjectWithEnumProperty.md +doc/ParentWithNullable.md +doc/Pet.md +doc/PetApi.md +doc/ReadOnlyFirst.md +doc/SingleRefType.md +doc/SpecialModelName.md +doc/StoreApi.md +doc/Tag.md +doc/TestInlineFreeformAdditionalPropertiesRequest.md +doc/User.md +doc/UserApi.md +git_push.sh +lib/api.dart +lib/api/another_fake_api.dart +lib/api/default_api.dart +lib/api/fake_api.dart +lib/api/fake_classname_tags123_api.dart +lib/api/pet_api.dart +lib/api/store_api.dart +lib/api/user_api.dart +lib/api_client.dart +lib/api_exception.dart +lib/api_helper.dart +lib/auth/api_key_auth.dart +lib/auth/authentication.dart +lib/auth/http_basic_auth.dart +lib/auth/http_bearer_auth.dart +lib/auth/oauth.dart +lib/model/additional_properties_class.dart +lib/model/all_of_with_single_ref.dart +lib/model/animal.dart +lib/model/api_response.dart +lib/model/array_of_array_of_number_only.dart +lib/model/array_of_number_only.dart +lib/model/array_test.dart +lib/model/capitalization.dart +lib/model/cat.dart +lib/model/category.dart +lib/model/child_with_nullable.dart +lib/model/class_model.dart +lib/model/deprecated_object.dart +lib/model/dog.dart +lib/model/enum_arrays.dart +lib/model/enum_class.dart +lib/model/enum_test.dart +lib/model/fake_big_decimal_map200_response.dart +lib/model/file_schema_test_class.dart +lib/model/foo.dart +lib/model/foo_get_default_response.dart +lib/model/format_test.dart +lib/model/has_only_read_only.dart +lib/model/health_check_result.dart +lib/model/map_test.dart +lib/model/mixed_properties_and_additional_properties_class.dart +lib/model/model200_response.dart +lib/model/model_client.dart +lib/model/model_file.dart +lib/model/model_list.dart +lib/model/model_return.dart +lib/model/name.dart +lib/model/nullable_class.dart +lib/model/number_only.dart +lib/model/object_with_deprecated_fields.dart +lib/model/order.dart +lib/model/outer_composite.dart +lib/model/outer_enum.dart +lib/model/outer_enum_default_value.dart +lib/model/outer_enum_integer.dart +lib/model/outer_enum_integer_default_value.dart +lib/model/outer_object_with_enum_property.dart +lib/model/parent_with_nullable.dart +lib/model/pet.dart +lib/model/read_only_first.dart +lib/model/single_ref_type.dart +lib/model/special_model_name.dart +lib/model/tag.dart +lib/model/test_inline_freeform_additional_properties_request.dart +lib/model/user.dart +pubspec.yaml diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/.openapi-generator/VERSION new file mode 100644 index 000000000000..4c631cf217a2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.14.0-SNAPSHOT diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/.travis.yml b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/.travis.yml new file mode 100644 index 000000000000..2774ccbba0e9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/.travis.yml @@ -0,0 +1,14 @@ +# +# AUTO-GENERATED FILE, DO NOT MODIFY! +# +# https://docs.travis-ci.com/user/languages/dart/ +# +language: dart +dart: +# Install a specific stable release +- "2.12" +install: +- pub get + +script: +- pub run test diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/README.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/README.md new file mode 100644 index 000000000000..5a8c345c8de3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/README.md @@ -0,0 +1,205 @@ +# 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: + +- API version: 1.0.0 +- Generator version: 7.14.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.DartClientCodegen + +## Requirements + +Dart 2.12 or later + +## Installation & Usage + +### Github +If this Dart package is published to Github, add the following dependency to your pubspec.yaml +``` +dependencies: + openapi: + git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git +``` + +### Local +To use the package in your local drive, add the following dependency to your pubspec.yaml +``` +dependencies: + openapi: + path: /path/to/openapi +``` + +## Tests + +TODO + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```dart +import 'package:openapi/api.dart'; + + +final api_instance = AnotherFakeApi(); +final modelClient = ModelClient(); // ModelClient | client model + +try { + final result = api_instance.call123testSpecialTags(modelClient); + print(result); +} catch (e) { + print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n'); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**call123testSpecialTags**](doc//AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +*DefaultApi* | [**fooGet**](doc//DefaultApi.md#fooget) | **GET** /foo | +*FakeApi* | [**fakeBigDecimalMap**](doc//FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap | +*FakeApi* | [**fakeHealthGet**](doc//FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint +*FakeApi* | [**fakeHttpSignatureTest**](doc//FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication +*FakeApi* | [**fakeOuterBooleanSerialize**](doc//FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +*FakeApi* | [**fakeOuterCompositeSerialize**](doc//FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +*FakeApi* | [**fakeOuterNumberSerialize**](doc//FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | +*FakeApi* | [**fakeOuterStringSerialize**](doc//FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +*FakeApi* | [**fakePropertyEnumIntegerSerialize**](doc//FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | +*FakeApi* | [**testAdditionalPropertiesReference**](doc//FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties +*FakeApi* | [**testBodyWithBinary**](doc//FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | +*FakeApi* | [**testBodyWithFileSchema**](doc//FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | +*FakeApi* | [**testBodyWithQueryParams**](doc//FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | +*FakeApi* | [**testClientModel**](doc//FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model +*FakeApi* | [**testEndpointParameters**](doc//FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**testEnumParameters**](doc//FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters +*FakeApi* | [**testGroupParameters**](doc//FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**testInlineAdditionalProperties**](doc//FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**testInlineFreeformAdditionalProperties**](doc//FakeApi.md#testinlinefreeformadditionalproperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties +*FakeApi* | [**testJsonFormData**](doc//FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**testNullable**](doc//FakeApi.md#testnullable) | **POST** /fake/nullable | test nullable parent property +*FakeApi* | [**testQueryParameterCollectionFormat**](doc//FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | +*FakeApi* | [**testStringMapReference**](doc//FakeApi.md#teststringmapreference) | **POST** /fake/stringMap-reference | test referenced string map +*FakeClassnameTags123Api* | [**testClassname**](doc//FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case +*PetApi* | [**addPet**](doc//PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](doc//PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](doc//PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](doc//PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](doc//PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](doc//PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](doc//PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](doc//PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithRequiredFile**](doc//PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**deleteOrder**](doc//StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**getInventory**](doc//StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](doc//StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**placeOrder**](doc//StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](doc//UserApi.md#createuser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](doc//UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](doc//UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](doc//UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](doc//UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](doc//UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](doc//UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](doc//UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + +## Documentation For Models + + - [AdditionalPropertiesClass](doc//AdditionalPropertiesClass.md) + - [AllOfWithSingleRef](doc//AllOfWithSingleRef.md) + - [Animal](doc//Animal.md) + - [ApiResponse](doc//ApiResponse.md) + - [ArrayOfArrayOfNumberOnly](doc//ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](doc//ArrayOfNumberOnly.md) + - [ArrayTest](doc//ArrayTest.md) + - [Capitalization](doc//Capitalization.md) + - [Cat](doc//Cat.md) + - [Category](doc//Category.md) + - [ChildWithNullable](doc//ChildWithNullable.md) + - [ClassModel](doc//ClassModel.md) + - [DeprecatedObject](doc//DeprecatedObject.md) + - [Dog](doc//Dog.md) + - [EnumArrays](doc//EnumArrays.md) + - [EnumClass](doc//EnumClass.md) + - [EnumTest](doc//EnumTest.md) + - [FakeBigDecimalMap200Response](doc//FakeBigDecimalMap200Response.md) + - [FileSchemaTestClass](doc//FileSchemaTestClass.md) + - [Foo](doc//Foo.md) + - [FooGetDefaultResponse](doc//FooGetDefaultResponse.md) + - [FormatTest](doc//FormatTest.md) + - [HasOnlyReadOnly](doc//HasOnlyReadOnly.md) + - [HealthCheckResult](doc//HealthCheckResult.md) + - [MapTest](doc//MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](doc//MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](doc//Model200Response.md) + - [ModelClient](doc//ModelClient.md) + - [ModelFile](doc//ModelFile.md) + - [ModelList](doc//ModelList.md) + - [ModelReturn](doc//ModelReturn.md) + - [Name](doc//Name.md) + - [NullableClass](doc//NullableClass.md) + - [NumberOnly](doc//NumberOnly.md) + - [ObjectWithDeprecatedFields](doc//ObjectWithDeprecatedFields.md) + - [Order](doc//Order.md) + - [OuterComposite](doc//OuterComposite.md) + - [OuterEnum](doc//OuterEnum.md) + - [OuterEnumDefaultValue](doc//OuterEnumDefaultValue.md) + - [OuterEnumInteger](doc//OuterEnumInteger.md) + - [OuterEnumIntegerDefaultValue](doc//OuterEnumIntegerDefaultValue.md) + - [OuterObjectWithEnumProperty](doc//OuterObjectWithEnumProperty.md) + - [ParentWithNullable](doc//ParentWithNullable.md) + - [Pet](doc//Pet.md) + - [ReadOnlyFirst](doc//ReadOnlyFirst.md) + - [SingleRefType](doc//SingleRefType.md) + - [SpecialModelName](doc//SpecialModelName.md) + - [Tag](doc//Tag.md) + - [TestInlineFreeformAdditionalPropertiesRequest](doc//TestInlineFreeformAdditionalPropertiesRequest.md) + - [User](doc//User.md) + + +## Documentation For Authorization + + +Authentication schemes defined for the API: +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + +### http_basic_test + +- **Type**: HTTP Basic authentication + +### bearer_test + +- **Type**: HTTP Bearer authentication + +### http_signature_test + +- **Type**: HTTP signature authentication + + +## Author + + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/analysis_options.yaml b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/analysis_options.yaml new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..859d4d0b7a0c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/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** | | [optional] [default to const {}] +**mapOfMapProperty** | [**Map>**](Map.md) | | [optional] [default to const {}] + +[[Back to Model list]](../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/dart2/petstore_client_lib_use_lower_camel_case/doc/AllOfWithSingleRef.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/AllOfWithSingleRef.md new file mode 100644 index 000000000000..4c6f3ab2fe11 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/AllOfWithSingleRef.md @@ -0,0 +1,16 @@ +# openapi.model.AllOfWithSingleRef + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **String** | | [optional] +**singleRefType** | [**SingleRefType**](SingleRefType.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Animal.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Animal.md new file mode 100644 index 000000000000..415b56e9bc2e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Animal.md @@ -0,0 +1,16 @@ +# openapi.model.Animal + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to 'red'] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/AnotherFakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/AnotherFakeApi.md new file mode 100644 index 000000000000..241c82e575d4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/AnotherFakeApi.md @@ -0,0 +1,57 @@ +# openapi.api.AnotherFakeApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**call123testSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags + + +# **call123testSpecialTags** +> ModelClient call123testSpecialTags(modelClient) + +To test special tags + +To test special tags and operation ID starting with number + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = AnotherFakeApi(); +final modelClient = ModelClient(); // ModelClient | client model + +try { + final result = api_instance.call123testSpecialTags(modelClient); + print(result); +} catch (e) { + print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **modelClient** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ApiResponse.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ApiResponse.md new file mode 100644 index 000000000000..7ad5da0f89e4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/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/dart2/petstore_client_lib_use_lower_camel_case/doc/ArrayOfArrayOfNumberOnly.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..0a0dc2a7b752 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/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.md) | | [optional] [default to const []] + +[[Back to Model list]](../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/dart2/petstore_client_lib_use_lower_camel_case/doc/ArrayOfNumberOnly.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..01b6f58870ff --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/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** | | [optional] [default to const []] + +[[Back to Model list]](../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/dart2/petstore_client_lib_use_lower_camel_case/doc/ArrayTest.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ArrayTest.md new file mode 100644 index 000000000000..598a895bb209 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/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** | | [optional] [default to const []] +**arrayArrayOfInteger** | [**List>**](List.md) | | [optional] [default to const []] +**arrayArrayOfModel** | [**List>**](List.md) | | [optional] [default to const []] + +[[Back to Model list]](../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/dart2/petstore_client_lib_use_lower_camel_case/doc/Capitalization.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Capitalization.md new file mode 100644 index 000000000000..4a07b4eb820d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Capitalization.md @@ -0,0 +1,20 @@ +# openapi.model.Capitalization + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**smallCamel** | **String** | | [optional] +**capitalCamel** | **String** | | [optional] +**smallSnake** | **String** | | [optional] +**capitalSnake** | **String** | | [optional] +**sCAETHFlowPoints** | **String** | | [optional] +**ATT_NAME** | **String** | Name of the pet | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Cat.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Cat.md new file mode 100644 index 000000000000..6552eea4b435 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Cat.md @@ -0,0 +1,17 @@ +# openapi.model.Cat + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to 'red'] +**declawed** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Category.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Category.md new file mode 100644 index 000000000000..ae6bc52e89d8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Category.md @@ -0,0 +1,16 @@ +# openapi.model.Category + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **String** | | [default to 'default-name'] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ChildWithNullable.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ChildWithNullable.md new file mode 100644 index 000000000000..770494fcf4cc --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ChildWithNullable.md @@ -0,0 +1,17 @@ +# openapi.model.ChildWithNullable + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | | [optional] +**nullableProperty** | **String** | | [optional] +**otherProperty** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ClassModel.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ClassModel.md new file mode 100644 index 000000000000..13ae5d3a4708 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ClassModel.md @@ -0,0 +1,15 @@ +# openapi.model.ClassModel + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/DefaultApi.md new file mode 100644 index 000000000000..1ae3cbc5ef46 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/DefaultApi.md @@ -0,0 +1,51 @@ +# openapi.api.DefaultApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fooGet**](DefaultApi.md#fooget) | **GET** /foo | + + +# **fooGet** +> FooGetDefaultResponse fooGet() + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = DefaultApi(); + +try { + final result = api_instance.fooGet(); + print(result); +} catch (e) { + print('Exception when calling DefaultApi->fooGet: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/DeprecatedObject.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/DeprecatedObject.md new file mode 100644 index 000000000000..bf2ef67a26fc --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/DeprecatedObject.md @@ -0,0 +1,15 @@ +# openapi.model.DeprecatedObject + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Dog.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Dog.md new file mode 100644 index 000000000000..d36439b767bb --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Dog.md @@ -0,0 +1,17 @@ +# openapi.model.Dog + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to 'red'] +**breed** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/EnumArrays.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/EnumArrays.md new file mode 100644 index 000000000000..2c12a0e6168d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/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** | | [optional] [default to const []] + +[[Back to Model list]](../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/dart2/petstore_client_lib_use_lower_camel_case/doc/EnumClass.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/EnumClass.md new file mode 100644 index 000000000000..a9ed4c1f0c8b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/EnumClass.md @@ -0,0 +1,14 @@ +# openapi.model.EnumClass + +## 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/dart2/petstore_client_lib_use_lower_camel_case/doc/EnumTest.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/EnumTest.md new file mode 100644 index 000000000000..7c24fe2347b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/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/dart2/petstore_client_lib_use_lower_camel_case/doc/FakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/FakeApi.md new file mode 100644 index 000000000000..e5c71555c9a8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/FakeApi.md @@ -0,0 +1,1034 @@ +# openapi.api.FakeApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fakeBigDecimalMap**](FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap | +[**fakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint +[**fakeHttpSignatureTest**](FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | +[**testAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties +[**testBodyWithBinary**](FakeApi.md#testbodywithbinary) | **PUT** /fake/body-with-binary | +[**testBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | +[**testBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | +[**testClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model +[**testEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**testEnumParameters**](FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters +[**testGroupParameters**](FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[**testInlineAdditionalProperties**](FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[**testInlineFreeformAdditionalProperties**](FakeApi.md#testinlinefreeformadditionalproperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties +[**testJsonFormData**](FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +[**testNullable**](FakeApi.md#testnullable) | **POST** /fake/nullable | test nullable parent property +[**testQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | +[**testStringMapReference**](FakeApi.md#teststringmapreference) | **POST** /fake/stringMap-reference | test referenced string map + + +# **fakeBigDecimalMap** +> FakeBigDecimalMap200Response fakeBigDecimalMap() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); + +try { + final result = api_instance.fakeBigDecimalMap(); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeBigDecimalMap: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakeHealthGet** +> HealthCheckResult fakeHealthGet() + +Health check endpoint + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); + +try { + final result = api_instance.fakeHealthGet(); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeHealthGet: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakeHttpSignatureTest** +> fakeHttpSignatureTest(pet, query1, header1) + +test http signature authentication + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final pet = Pet(); // Pet | Pet object that needs to be added to the store +final query1 = query1_example; // String | query parameter +final header1 = header1_example; // String | header parameter + +try { + api_instance.fakeHttpSignatureTest(pet, query1, header1); +} catch (e) { + print('Exception when calling FakeApi->fakeHttpSignatureTest: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **query1** | **String**| query parameter | [optional] + **header1** | **String**| header parameter | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakeOuterBooleanSerialize** +> bool fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final body = bool(); // bool | Input boolean as post body + +try { + final result = api_instance.fakeOuterBooleanSerialize(body); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeOuterBooleanSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **bool**| Input boolean as post body | [optional] + +### Return type + +**bool** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(outerComposite) + + + +Test serialization of object with outer number type + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final outerComposite = OuterComposite(); // OuterComposite | Input composite as post body + +try { + final result = api_instance.fakeOuterCompositeSerialize(outerComposite); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeOuterCompositeSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakeOuterNumberSerialize** +> num fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final body = num(); // num | Input number as post body + +try { + final result = api_instance.fakeOuterNumberSerialize(body); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeOuterNumberSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **num**| Input number as post body | [optional] + +### Return type + +**num** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final body = String(); // String | Input string as post body + +try { + final result = api_instance.fakeOuterStringSerialize(body); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeOuterStringSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **String**| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fakePropertyEnumIntegerSerialize** +> OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty) + + + +Test serialization of enum (int) properties with examples + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final outerObjectWithEnumProperty = OuterObjectWithEnumProperty(); // OuterObjectWithEnumProperty | Input enum (int) as post body + +try { + final result = api_instance.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakePropertyEnumIntegerSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outerObjectWithEnumProperty** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | + +### Return type + +[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testAdditionalPropertiesReference** +> testAdditionalPropertiesReference(requestBody) + +test referenced additionalProperties + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final requestBody = Map(); // Map | request body + +try { + api_instance.testAdditionalPropertiesReference(requestBody); +} catch (e) { + print('Exception when calling FakeApi->testAdditionalPropertiesReference: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**Map**](Object.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testBodyWithBinary** +> testBodyWithBinary(body) + + + +For this test, the body has to be a binary file. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final body = MultipartFile(); // MultipartFile | image to upload + +try { + api_instance.testBodyWithBinary(body); +} catch (e) { + print('Exception when calling FakeApi->testBodyWithBinary: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **MultipartFile**| image to upload | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: image/png + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testBodyWithFileSchema** +> testBodyWithFileSchema(fileSchemaTestClass) + + + +For this test, the body for this request must reference a schema named `File`. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final fileSchemaTestClass = FileSchemaTestClass(); // FileSchemaTestClass | + +try { + api_instance.testBodyWithFileSchema(fileSchemaTestClass); +} catch (e) { + print('Exception when calling FakeApi->testBodyWithFileSchema: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(query, user) + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final query = query_example; // String | +final user = User(); // User | + +try { + api_instance.testBodyWithQueryParams(query, user); +} catch (e) { + print('Exception when calling FakeApi->testBodyWithQueryParams: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | **String**| | + **user** | [**User**](User.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testClientModel** +> ModelClient testClientModel(modelClient) + +To test \"client\" model + +To test \"client\" model + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final modelClient = ModelClient(); // ModelClient | client model + +try { + final result = api_instance.testClientModel(modelClient); + print(result); +} catch (e) { + print('Exception when calling FakeApi->testClientModel: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **modelClient** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testEndpointParameters** +> testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure HTTP basic authorization: http_basic_test +//defaultApiClient.getAuthentication('http_basic_test').username = 'YOUR_USERNAME' +//defaultApiClient.getAuthentication('http_basic_test').password = 'YOUR_PASSWORD'; + +final api_instance = FakeApi(); +final number = 8.14; // num | None +final double_ = 1.2; // double | None +final patternWithoutDelimiter = patternWithoutDelimiter_example; // String | None +final byte = BYTE_ARRAY_DATA_HERE; // String | None +final integer = 56; // int | None +final int32 = 56; // int | None +final int64 = 789; // int | None +final float = 3.4; // double | None +final string = string_example; // String | None +final binary = BINARY_DATA_HERE; // MultipartFile | None +final date = 2013-10-20; // DateTime | None +final dateTime = 2013-10-20T19:20:30+01:00; // DateTime | None +final password = password_example; // String | None +final callback = callback_example; // String | None + +try { + api_instance.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); +} catch (e) { + print('Exception when calling FakeApi->testEndpointParameters: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **num**| None | + **double_** | **double**| None | + **patternWithoutDelimiter** | **String**| None | + **byte** | **String**| None | + **integer** | **int**| None | [optional] + **int32** | **int**| None | [optional] + **int64** | **int**| None | [optional] + **float** | **double**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **MultipartFile**| None | [optional] + **date** | **DateTime**| None | [optional] + **dateTime** | **DateTime**| None | [optional] + **password** | **String**| None | [optional] + **callback** | **String**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testEnumParameters** +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final enumHeaderStringArray = []; // List | Header parameter enum test (string array) +final enumHeaderString = enumHeaderString_example; // String | Header parameter enum test (string) +final enumQueryStringArray = []; // List | Query parameter enum test (string array) +final enumQueryString = enumQueryString_example; // String | Query parameter enum test (string) +final enumQueryInteger = 56; // int | Query parameter enum test (double) +final enumQueryDouble = 1.2; // double | Query parameter enum test (double) +final enumQueryModelArray = []; // List | +final enumFormStringArray = []; // List | Form parameter enum test (string array) +final enumFormString = enumFormString_example; // String | Form parameter enum test (string) + +try { + api_instance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumQueryModelArray, enumFormStringArray, enumFormString); +} catch (e) { + print('Exception when calling FakeApi->testEnumParameters: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**List**](String.md)| Header parameter enum test (string array) | [optional] [default to const []] + **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to '-efg'] + **enumQueryStringArray** | [**List**](String.md)| Query parameter enum test (string array) | [optional] [default to const []] + **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to '-efg'] + **enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] + **enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] + **enumQueryModelArray** | [**List**](EnumClass.md)| | [optional] [default to const []] + **enumFormStringArray** | [**List**](String.md)| Form parameter enum test (string array) | [optional] [default to '$'] + **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to '-efg'] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testGroupParameters** +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure HTTP Bearer authorization: bearer_test +// Case 1. Use String Token +//defaultApiClient.getAuthentication('bearer_test').setAccessToken('YOUR_ACCESS_TOKEN'); +// Case 2. Use Function which generate token. +// String yourTokenGeneratorFunction() { ... } +//defaultApiClient.getAuthentication('bearer_test').setAccessToken(yourTokenGeneratorFunction); + +final api_instance = FakeApi(); +final requiredStringGroup = 56; // int | Required String in group parameters +final requiredBooleanGroup = true; // bool | Required Boolean in group parameters +final requiredInt64Group = 789; // int | Required Integer in group parameters +final stringGroup = 56; // int | String in group parameters +final booleanGroup = true; // bool | Boolean in group parameters +final int64Group = 789; // int | Integer in group parameters + +try { + api_instance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); +} catch (e) { + print('Exception when calling FakeApi->testGroupParameters: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requiredStringGroup** | **int**| Required String in group parameters | + **requiredBooleanGroup** | **bool**| Required Boolean in group parameters | + **requiredInt64Group** | **int**| Required Integer in group parameters | + **stringGroup** | **int**| String in group parameters | [optional] + **booleanGroup** | **bool**| Boolean in group parameters | [optional] + **int64Group** | **int**| Integer in group parameters | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[bearer_test](../README.md#bearer_test) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testInlineAdditionalProperties** +> testInlineAdditionalProperties(requestBody) + +test inline additionalProperties + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final requestBody = Map(); // Map | request body + +try { + api_instance.testInlineAdditionalProperties(requestBody); +} catch (e) { + print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**Map**](String.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testInlineFreeformAdditionalProperties** +> testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest) + +test inline free-form additionalProperties + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final testInlineFreeformAdditionalPropertiesRequest = TestInlineFreeformAdditionalPropertiesRequest(); // TestInlineFreeformAdditionalPropertiesRequest | request body + +try { + api_instance.testInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); +} catch (e) { + print('Exception when calling FakeApi->testInlineFreeformAdditionalProperties: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **testInlineFreeformAdditionalPropertiesRequest** | [**TestInlineFreeformAdditionalPropertiesRequest**](TestInlineFreeformAdditionalPropertiesRequest.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testJsonFormData** +> testJsonFormData(param, param2) + +test json serialization of form data + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final param = param_example; // String | field1 +final param2 = param2_example; // String | field2 + +try { + api_instance.testJsonFormData(param, param2); +} catch (e) { + print('Exception when calling FakeApi->testJsonFormData: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **String**| field1 | + **param2** | **String**| field2 | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testNullable** +> testNullable(childWithNullable) + +test nullable parent property + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final childWithNullable = ChildWithNullable(); // ChildWithNullable | request body + +try { + api_instance.testNullable(childWithNullable); +} catch (e) { + print('Exception when calling FakeApi->testNullable: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **childWithNullable** | [**ChildWithNullable**](ChildWithNullable.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testQueryParameterCollectionFormat** +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language) + + + +To test the collection format in query parameters + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final pipe = []; // List | +final ioutil = []; // List | +final http = []; // List | +final url = []; // List | +final context = []; // List | +final allowEmpty = allowEmpty_example; // String | +final language = ; // Map | + +try { + api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context, allowEmpty, language); +} catch (e) { + print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pipe** | [**List**](String.md)| | [default to const []] + **ioutil** | [**List**](String.md)| | [default to const []] + **http** | [**List**](String.md)| | [default to const []] + **url** | [**List**](String.md)| | [default to const []] + **context** | [**List**](String.md)| | [default to const []] + **allowEmpty** | **String**| | + **language** | [**Map**](String.md)| | [optional] [default to const {}] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **testStringMapReference** +> testStringMapReference(requestBody) + +test referenced string map + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final requestBody = Map(); // Map | request body + +try { + api_instance.testStringMapReference(requestBody); +} catch (e) { + print('Exception when calling FakeApi->testStringMapReference: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**Map**](String.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/FakeBigDecimalMap200Response.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/FakeBigDecimalMap200Response.md new file mode 100644 index 000000000000..21ccf6ec012f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/FakeBigDecimalMap200Response.md @@ -0,0 +1,16 @@ +# openapi.model.FakeBigDecimalMap200Response + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**someId** | **num** | | [optional] +**someMap** | **Map** | | [optional] [default to const {}] + +[[Back to Model list]](../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/dart2/petstore_client_lib_use_lower_camel_case/doc/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..5518c67403ff --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/FakeClassnameTags123Api.md @@ -0,0 +1,61 @@ +# openapi.api.FakeClassnameTags123Api + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case + + +# **testClassname** +> ModelClient testClassname(modelClient) + +To test class name in snake case + +To test class name in snake case + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key_query +//defaultApiClient.getAuthentication('api_key_query').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key_query').apiKeyPrefix = 'Bearer'; + +final api_instance = FakeClassnameTags123Api(); +final modelClient = ModelClient(); // ModelClient | client model + +try { + final result = api_instance.testClassname(modelClient); + print(result); +} catch (e) { + print('Exception when calling FakeClassnameTags123Api->testClassname: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **modelClient** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/FileSchemaTestClass.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/FileSchemaTestClass.md new file mode 100644 index 000000000000..eae1dfbe979f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/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.md) | | [optional] [default to const []] + +[[Back to Model list]](../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/dart2/petstore_client_lib_use_lower_camel_case/doc/Foo.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Foo.md new file mode 100644 index 000000000000..185b76e3f5b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Foo.md @@ -0,0 +1,15 @@ +# openapi.model.Foo + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [default to 'bar'] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/FooGetDefaultResponse.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/FooGetDefaultResponse.md new file mode 100644 index 000000000000..10d0133abd95 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/FooGetDefaultResponse.md @@ -0,0 +1,15 @@ +# openapi.model.FooGetDefaultResponse + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/FormatTest.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/FormatTest.md new file mode 100644 index 000000000000..83b60545eb61 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/FormatTest.md @@ -0,0 +1,30 @@ +# openapi.model.FormatTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | | [optional] +**int32** | **int** | | [optional] +**int64** | **int** | | [optional] +**number** | **num** | | +**float** | **double** | | [optional] +**double_** | **double** | | [optional] +**decimal** | **double** | | [optional] +**string** | **String** | | [optional] +**byte** | **String** | | +**binary** | [**MultipartFile**](MultipartFile.md) | | [optional] +**date** | [**DateTime**](DateTime.md) | | +**dateTime** | [**DateTime**](DateTime.md) | | [optional] +**uuid** | **String** | | [optional] +**password** | **String** | | +**patternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] +**patternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/HasOnlyReadOnly.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/HasOnlyReadOnly.md new file mode 100644 index 000000000000..f2d30e9fb688 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/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] [readonly] +**foo** | **String** | | [optional] [readonly] + +[[Back to Model list]](../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/dart2/petstore_client_lib_use_lower_camel_case/doc/HealthCheckResult.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/HealthCheckResult.md new file mode 100644 index 000000000000..4d6aeb75d965 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/HealthCheckResult.md @@ -0,0 +1,15 @@ +# openapi.model.HealthCheckResult + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nullableMessage** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/MapTest.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/MapTest.md new file mode 100644 index 000000000000..a1732207bfc9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/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>**](Map.md) | | [optional] [default to const {}] +**mapOfEnumString** | **Map** | | [optional] [default to const {}] +**directMap** | **Map** | | [optional] [default to const {}] +**indirectMap** | **Map** | | [optional] [default to const {}] + +[[Back to Model list]](../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/dart2/petstore_client_lib_use_lower_camel_case/doc/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..1f7f66b684fd --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/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**](Animal.md) | | [optional] [default to const {}] + +[[Back to Model list]](../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/dart2/petstore_client_lib_use_lower_camel_case/doc/Model200Response.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Model200Response.md new file mode 100644 index 000000000000..5aa3fb97c32e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Model200Response.md @@ -0,0 +1,16 @@ +# openapi.model.Model200Response + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | [optional] +**class_** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ModelClient.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ModelClient.md new file mode 100644 index 000000000000..f7b922f4a398 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ModelClient.md @@ -0,0 +1,15 @@ +# openapi.model.ModelClient + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ModelFile.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ModelFile.md new file mode 100644 index 000000000000..4be260e93f6e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ModelFile.md @@ -0,0 +1,15 @@ +# openapi.model.ModelFile + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sourceURI** | **String** | Test capitalization | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ModelList.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ModelList.md new file mode 100644 index 000000000000..283aa1f6b711 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ModelList.md @@ -0,0 +1,15 @@ +# openapi.model.ModelList + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**n123list** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ModelReturn.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ModelReturn.md new file mode 100644 index 000000000000..bc02df7a3692 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ModelReturn.md @@ -0,0 +1,15 @@ +# openapi.model.ModelReturn + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**return_** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Name.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Name.md new file mode 100644 index 000000000000..9da6e75fbf5e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/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] [readonly] +**property** | **String** | | [optional] +**n123number** | **int** | | [optional] [readonly] + +[[Back to Model list]](../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/dart2/petstore_client_lib_use_lower_camel_case/doc/NullableClass.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/NullableClass.md new file mode 100644 index 000000000000..9b2e46df0a09 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/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.md) | | [optional] [default to const []] +**arrayAndItemsNullableProp** | [**List**](Object.md) | | [optional] [default to const []] +**arrayItemsNullable** | [**List**](Object.md) | | [optional] [default to const []] +**objectNullableProp** | [**Map**](Object.md) | | [optional] [default to const {}] +**objectAndItemsNullableProp** | [**Map**](Object.md) | | [optional] [default to const {}] +**objectItemsNullable** | [**Map**](Object.md) | | [optional] [default to const {}] + +[[Back to Model list]](../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/dart2/petstore_client_lib_use_lower_camel_case/doc/NumberOnly.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/NumberOnly.md new file mode 100644 index 000000000000..d8096a3db37a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/NumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.NumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justNumber** | **num** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ObjectWithDeprecatedFields.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..566816d8d278 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/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** | | [optional] [default to const []] + +[[Back to Model list]](../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/dart2/petstore_client_lib_use_lower_camel_case/doc/Order.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Order.md new file mode 100644 index 000000000000..bde5ffe51a2c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Order.md @@ -0,0 +1,20 @@ +# openapi.model.Order + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**petId** | **int** | | [optional] +**quantity** | **int** | | [optional] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] +**status** | **String** | Order Status | [optional] +**complete** | **bool** | | [optional] [default to false] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/OuterComposite.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/OuterComposite.md new file mode 100644 index 000000000000..04bab7eff5d1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/OuterComposite.md @@ -0,0 +1,17 @@ +# openapi.model.OuterComposite + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | **num** | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/OuterEnum.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/OuterEnum.md new file mode 100644 index 000000000000..af62ad87ab2e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/OuterEnum.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnum + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/OuterEnumDefaultValue.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..c1bf8b0dec44 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/OuterEnumDefaultValue.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumDefaultValue + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/OuterEnumInteger.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/OuterEnumInteger.md new file mode 100644 index 000000000000..8c80a9e5c85f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/OuterEnumInteger.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumInteger + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/OuterEnumIntegerDefaultValue.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..eb8b55d70249 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumIntegerDefaultValue + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/OuterObjectWithEnumProperty.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/OuterObjectWithEnumProperty.md new file mode 100644 index 000000000000..eab2ae8f66b4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/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/dart2/petstore_client_lib_use_lower_camel_case/doc/ParentWithNullable.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ParentWithNullable.md new file mode 100644 index 000000000000..17aa5ca02941 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ParentWithNullable.md @@ -0,0 +1,16 @@ +# openapi.model.ParentWithNullable + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | | [optional] +**nullableProperty** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Pet.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Pet.md new file mode 100644 index 000000000000..b6fdea5299ba --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Pet.md @@ -0,0 +1,20 @@ +# openapi.model.Pet + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **Set** | | [default to const {}] +**tags** | [**List**](Tag.md) | | [optional] [default to const []] +**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/dart2/petstore_client_lib_use_lower_camel_case/doc/PetApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/PetApi.md new file mode 100644 index 000000000000..3883a9e96a00 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/PetApi.md @@ -0,0 +1,439 @@ +# openapi.api.PetApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**uploadFileWithRequiredFile**](PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) + + +# **addPet** +> addPet(pet) + +Add a new pet to the store + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = PetApi(); +final pet = Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.addPet(pet); +} catch (e) { + print('Exception when calling PetApi->addPet: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = PetApi(); +final petId = 789; // int | Pet id to delete +final apiKey = apiKey_example; // String | + +try { + api_instance.deletePet(petId, apiKey); +} catch (e) { + print('Exception when calling PetApi->deletePet: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| Pet id to delete | + **apiKey** | **String**| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **findPetsByStatus** +> List findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = PetApi(); +final status = []; // List | Status values that need to be considered for filter + +try { + final result = api_instance.findPetsByStatus(status); + print(result); +} catch (e) { + print('Exception when calling PetApi->findPetsByStatus: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List**](String.md)| Status values that need to be considered for filter | [default to const []] + +### Return type + +[**List**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **findPetsByTags** +> Set findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = PetApi(); +final tags = []; // Set | Tags to filter by + +try { + final result = api_instance.findPetsByTags(tags); + print(result); +} catch (e) { + print('Exception when calling PetApi->findPetsByTags: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**Set**](String.md)| Tags to filter by | [default to const {}] + +### Return type + +[**Set**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; + +final api_instance = PetApi(); +final petId = 789; // int | ID of pet to return + +try { + final result = api_instance.getPetById(petId); + print(result); +} catch (e) { + print('Exception when calling PetApi->getPetById: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **updatePet** +> updatePet(pet) + +Update an existing pet + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = PetApi(); +final pet = Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.updatePet(pet); +} catch (e) { + print('Exception when calling PetApi->updatePet: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = PetApi(); +final petId = 789; // int | ID of pet that needs to be updated +final name = name_example; // String | Updated name of the pet +final status = status_example; // String | Updated status of the pet + +try { + api_instance.updatePetWithForm(petId, name, status); +} catch (e) { + print('Exception when calling PetApi->updatePetWithForm: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet that needs to be updated | + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **uploadFile** +> ApiResponse uploadFile(petId, additionalMetadata, file) + +uploads an image + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = PetApi(); +final petId = 789; // int | ID of pet to update +final additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server +final file = BINARY_DATA_HERE; // MultipartFile | file to upload + +try { + final result = api_instance.uploadFile(petId, additionalMetadata, file); + print(result); +} catch (e) { + print('Exception when calling PetApi->uploadFile: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **MultipartFile**| file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **uploadFileWithRequiredFile** +> ApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + +uploads an image (required) + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = PetApi(); +final petId = 789; // int | ID of pet to update +final requiredFile = BINARY_DATA_HERE; // MultipartFile | file to upload +final additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server + +try { + final result = api_instance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + print(result); +} catch (e) { + print('Exception when calling PetApi->uploadFileWithRequiredFile: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | + **requiredFile** | **MultipartFile**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ReadOnlyFirst.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/ReadOnlyFirst.md new file mode 100644 index 000000000000..fa6f9e4305d4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/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] [readonly] +**baz** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/SingleRefType.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/SingleRefType.md new file mode 100644 index 000000000000..0dc93840cd7f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/SingleRefType.md @@ -0,0 +1,14 @@ +# openapi.model.SingleRefType + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/SpecialModelName.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/SpecialModelName.md new file mode 100644 index 000000000000..5fcfa98e0b36 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/SpecialModelName.md @@ -0,0 +1,15 @@ +# openapi.model.SpecialModelName + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket** | **int** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/StoreApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/StoreApi.md new file mode 100644 index 000000000000..d91bad051601 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/StoreApi.md @@ -0,0 +1,188 @@ +# openapi.api.StoreApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = StoreApi(); +final orderId = orderId_example; // String | ID of the order that needs to be deleted + +try { + api_instance.deleteOrder(orderId); +} catch (e) { + print('Exception when calling StoreApi->deleteOrder: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of the order that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getInventory** +> Map getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; + +final api_instance = StoreApi(); + +try { + final result = api_instance.getInventory(); + print(result); +} catch (e) { + print('Exception when calling StoreApi->getInventory: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**Map** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = StoreApi(); +final orderId = 789; // int | ID of pet that needs to be fetched + +try { + final result = api_instance.getOrderById(orderId); + print(result); +} catch (e) { + print('Exception when calling StoreApi->getOrderById: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **int**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **placeOrder** +> Order placeOrder(order) + +Place an order for a pet + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = StoreApi(); +final order = Order(); // Order | order placed for purchasing the pet + +try { + final result = api_instance.placeOrder(order); + print(result); +} catch (e) { + print('Exception when calling StoreApi->placeOrder: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Tag.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Tag.md new file mode 100644 index 000000000000..c219f987c19c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/Tag.md @@ -0,0 +1,16 @@ +# openapi.model.Tag + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/TestInlineFreeformAdditionalPropertiesRequest.md new file mode 100644 index 000000000000..e2b2f1fd4468 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/TestInlineFreeformAdditionalPropertiesRequest.md @@ -0,0 +1,15 @@ +# openapi.model.TestInlineFreeformAdditionalPropertiesRequest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**someProperty** | **String** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/User.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/User.md new file mode 100644 index 000000000000..fa87e64d8595 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/User.md @@ -0,0 +1,22 @@ +# openapi.model.User + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**username** | **String** | | [optional] +**firstName** | **String** | | [optional] +**lastName** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**userStatus** | **int** | User Status | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/UserApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/UserApi.md new file mode 100644 index 000000000000..ee26762d9336 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/doc/UserApi.md @@ -0,0 +1,359 @@ +# openapi.api.UserApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UserApi.md#createuser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + +# **createUser** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = UserApi(); +final user = User(); // User | Created user object + +try { + api_instance.createUser(user); +} catch (e) { + print('Exception when calling UserApi->createUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**User**](User.md)| Created user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = UserApi(); +final user = [List()]; // List | List of user object + +try { + api_instance.createUsersWithArrayInput(user); +} catch (e) { + print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **createUsersWithListInput** +> createUsersWithListInput(user) + +Creates list of users with given input array + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = UserApi(); +final user = [List()]; // List | List of user object + +try { + api_instance.createUsersWithListInput(user); +} catch (e) { + print('Exception when calling UserApi->createUsersWithListInput: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = UserApi(); +final username = username_example; // String | The name that needs to be deleted + +try { + api_instance.deleteUser(username); +} catch (e) { + print('Exception when calling UserApi->deleteUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = UserApi(); +final username = username_example; // String | The name that needs to be fetched. Use user1 for testing. + +try { + final result = api_instance.getUserByName(username); + print(result); +} catch (e) { + print('Exception when calling UserApi->getUserByName: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = UserApi(); +final username = username_example; // String | The user name for login +final password = password_example; // String | The password for login in clear text + +try { + final result = api_instance.loginUser(username, password); + print(result); +} catch (e) { + print('Exception when calling UserApi->loginUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = UserApi(); + +try { + api_instance.logoutUser(); +} catch (e) { + print('Exception when calling UserApi->logoutUser: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **updateUser** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = UserApi(); +final username = username_example; // String | name that need to be deleted +final user = User(); // User | Updated user object + +try { + api_instance.updateUser(username, user); +} catch (e) { + print('Exception when calling UserApi->updateUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | + **user** | [**User**](User.md)| Updated user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/git_push.sh b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/git_push.sh new file mode 100644 index 000000000000..f53a75d4fabe --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api.dart new file mode 100644 index 000000000000..e2a18ff4f827 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api.dart @@ -0,0 +1,103 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +library openapi.api; + +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:collection/collection.dart'; +import 'package:http/http.dart'; +import 'package:intl/intl.dart'; +import 'package:meta/meta.dart'; + +part 'api_client.dart'; +part 'api_helper.dart'; +part 'api_exception.dart'; +part 'auth/authentication.dart'; +part 'auth/api_key_auth.dart'; +part 'auth/oauth.dart'; +part 'auth/http_basic_auth.dart'; +part 'auth/http_bearer_auth.dart'; + +part 'api/another_fake_api.dart'; +part 'api/default_api.dart'; +part 'api/fake_api.dart'; +part 'api/fake_classname_tags123_api.dart'; +part 'api/pet_api.dart'; +part 'api/store_api.dart'; +part 'api/user_api.dart'; + +part 'model/additional_properties_class.dart'; +part 'model/all_of_with_single_ref.dart'; +part 'model/animal.dart'; +part 'model/api_response.dart'; +part 'model/array_of_array_of_number_only.dart'; +part 'model/array_of_number_only.dart'; +part 'model/array_test.dart'; +part 'model/capitalization.dart'; +part 'model/cat.dart'; +part 'model/category.dart'; +part 'model/child_with_nullable.dart'; +part 'model/class_model.dart'; +part 'model/deprecated_object.dart'; +part 'model/dog.dart'; +part 'model/enum_arrays.dart'; +part 'model/enum_class.dart'; +part 'model/enum_test.dart'; +part 'model/fake_big_decimal_map200_response.dart'; +part 'model/file_schema_test_class.dart'; +part 'model/foo.dart'; +part 'model/foo_get_default_response.dart'; +part 'model/format_test.dart'; +part 'model/has_only_read_only.dart'; +part 'model/health_check_result.dart'; +part 'model/map_test.dart'; +part 'model/mixed_properties_and_additional_properties_class.dart'; +part 'model/model200_response.dart'; +part 'model/model_client.dart'; +part 'model/model_file.dart'; +part 'model/model_list.dart'; +part 'model/model_return.dart'; +part 'model/name.dart'; +part 'model/nullable_class.dart'; +part 'model/number_only.dart'; +part 'model/object_with_deprecated_fields.dart'; +part 'model/order.dart'; +part 'model/outer_composite.dart'; +part 'model/outer_enum.dart'; +part 'model/outer_enum_default_value.dart'; +part 'model/outer_enum_integer.dart'; +part 'model/outer_enum_integer_default_value.dart'; +part 'model/outer_object_with_enum_property.dart'; +part 'model/parent_with_nullable.dart'; +part 'model/pet.dart'; +part 'model/read_only_first.dart'; +part 'model/single_ref_type.dart'; +part 'model/special_model_name.dart'; +part 'model/tag.dart'; +part 'model/test_inline_freeform_additional_properties_request.dart'; +part 'model/user.dart'; + + +/// An [ApiClient] instance that uses the default values obtained from +/// the OpenAPI specification file. +var defaultApiClient = ApiClient(); + +const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; +const _dateEpochMarker = 'epoch'; +const _deepEquality = DeepCollectionEquality(); +final _dateFormatter = DateFormat('yyyy-MM-dd'); +final _regList = RegExp(r'^List<(.*)>$'); +final _regSet = RegExp(r'^Set<(.*)>$'); +final _regMap = RegExp(r'^Map$'); + +bool _isEpochMarker(String? pattern) => pattern == _dateEpochMarker || pattern == '/$_dateEpochMarker/'; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/another_fake_api.dart new file mode 100644 index 000000000000..81ab2d859dda --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/another_fake_api.dart @@ -0,0 +1,76 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class AnotherFakeApi { + AnotherFakeApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// To test special tags + /// + /// To test special tags and operation ID starting with number + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [ModelClient] modelClient (required): + /// client model + Future call123testSpecialTagsWithHttpInfo(ModelClient modelClient,) async { + // ignore: prefer_const_declarations + final path = r'/another-fake/dummy'; + + // ignore: prefer_final_locals + Object? postBody = modelClient; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'PATCH', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// To test special tags + /// + /// To test special tags and operation ID starting with number + /// + /// Parameters: + /// + /// * [ModelClient] modelClient (required): + /// client model + Future call123testSpecialTags(ModelClient modelClient,) async { + final response = await call123testSpecialTagsWithHttpInfo(modelClient,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient; + + } + return null; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/default_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/default_api.dart new file mode 100644 index 000000000000..059deb8d5e32 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/default_api.dart @@ -0,0 +1,59 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class DefaultApi { + DefaultApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Performs an HTTP 'GET /foo' operation and returns the [Response]. + Future fooGetWithHttpInfo() async { + // ignore: prefer_const_declarations + final path = r'/foo'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + Future fooGet() async { + final response = await fooGetWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'FooGetDefaultResponse',) as FooGetDefaultResponse; + + } + return null; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/fake_api.dart new file mode 100644 index 000000000000..1fa377f864dd --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/fake_api.dart @@ -0,0 +1,1411 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class FakeApi { + FakeApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + /// + /// Note: This method returns the HTTP [Response]. + Future fakeBigDecimalMapWithHttpInfo() async { + // ignore: prefer_const_declarations + final path = r'/fake/BigDecimalMap'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + Future fakeBigDecimalMap() async { + final response = await fakeBigDecimalMapWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'FakeBigDecimalMap200Response',) as FakeBigDecimalMap200Response; + + } + return null; + } + + /// Health check endpoint + /// + /// Note: This method returns the HTTP [Response]. + Future fakeHealthGetWithHttpInfo() async { + // ignore: prefer_const_declarations + final path = r'/fake/health'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Health check endpoint + Future fakeHealthGet() async { + final response = await fakeHealthGetWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'HealthCheckResult',) as HealthCheckResult; + + } + return null; + } + + /// test http signature authentication + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + /// + /// * [String] query1: + /// query parameter + /// + /// * [String] header1: + /// header parameter + Future fakeHttpSignatureTestWithHttpInfo(Pet pet, { String? query1, String? header1, }) async { + // ignore: prefer_const_declarations + final path = r'/fake/http-signature-test'; + + // ignore: prefer_final_locals + Object? postBody = pet; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + if (query1 != null) { + queryParams.addAll(_queryParams('', 'query_1', query1)); + } + + if (header1 != null) { + headerParams[r'header_1'] = parameterToString(header1); + } + + const contentTypes = ['application/json', 'application/xml']; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// test http signature authentication + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + /// + /// * [String] query1: + /// query parameter + /// + /// * [String] header1: + /// header parameter + Future fakeHttpSignatureTest(Pet pet, { String? query1, String? header1, }) async { + final response = await fakeHttpSignatureTestWithHttpInfo(pet, query1: query1, header1: header1, ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// Test serialization of outer boolean types + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [bool] body: + /// Input boolean as post body + Future fakeOuterBooleanSerializeWithHttpInfo({ bool? body, }) async { + // ignore: prefer_const_declarations + final path = r'/fake/outer/boolean'; + + // ignore: prefer_final_locals + Object? postBody = body; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Test serialization of outer boolean types + /// + /// Parameters: + /// + /// * [bool] body: + /// Input boolean as post body + Future fakeOuterBooleanSerialize({ bool? body, }) async { + final response = await fakeOuterBooleanSerializeWithHttpInfo( body: body, ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'bool',) as bool; + + } + return null; + } + + /// Test serialization of object with outer number type + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [OuterComposite] outerComposite: + /// Input composite as post body + Future fakeOuterCompositeSerializeWithHttpInfo({ OuterComposite? outerComposite, }) async { + // ignore: prefer_const_declarations + final path = r'/fake/outer/composite'; + + // ignore: prefer_final_locals + Object? postBody = outerComposite; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Test serialization of object with outer number type + /// + /// Parameters: + /// + /// * [OuterComposite] outerComposite: + /// Input composite as post body + Future fakeOuterCompositeSerialize({ OuterComposite? outerComposite, }) async { + final response = await fakeOuterCompositeSerializeWithHttpInfo( outerComposite: outerComposite, ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OuterComposite',) as OuterComposite; + + } + return null; + } + + /// Test serialization of outer number types + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [num] body: + /// Input number as post body + Future fakeOuterNumberSerializeWithHttpInfo({ num? body, }) async { + // ignore: prefer_const_declarations + final path = r'/fake/outer/number'; + + // ignore: prefer_final_locals + Object? postBody = body; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Test serialization of outer number types + /// + /// Parameters: + /// + /// * [num] body: + /// Input number as post body + Future fakeOuterNumberSerialize({ num? body, }) async { + final response = await fakeOuterNumberSerializeWithHttpInfo( body: body, ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'num',) as num; + + } + return null; + } + + /// Test serialization of outer string types + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] body: + /// Input string as post body + Future fakeOuterStringSerializeWithHttpInfo({ String? body, }) async { + // ignore: prefer_const_declarations + final path = r'/fake/outer/string'; + + // ignore: prefer_final_locals + Object? postBody = body; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Test serialization of outer string types + /// + /// Parameters: + /// + /// * [String] body: + /// Input string as post body + Future fakeOuterStringSerialize({ String? body, }) async { + final response = await fakeOuterStringSerializeWithHttpInfo( body: body, ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String; + + } + return null; + } + + /// Test serialization of enum (int) properties with examples + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [OuterObjectWithEnumProperty] outerObjectWithEnumProperty (required): + /// Input enum (int) as post body + Future fakePropertyEnumIntegerSerializeWithHttpInfo(OuterObjectWithEnumProperty outerObjectWithEnumProperty,) async { + // ignore: prefer_const_declarations + final path = r'/fake/property/enum-int'; + + // ignore: prefer_final_locals + Object? postBody = outerObjectWithEnumProperty; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Test serialization of enum (int) properties with examples + /// + /// Parameters: + /// + /// * [OuterObjectWithEnumProperty] outerObjectWithEnumProperty (required): + /// Input enum (int) as post body + Future fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty,) async { + final response = await fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OuterObjectWithEnumProperty',) as OuterObjectWithEnumProperty; + + } + return null; + } + + /// test referenced additionalProperties + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Map] requestBody (required): + /// request body + Future testAdditionalPropertiesReferenceWithHttpInfo(Map requestBody,) async { + // ignore: prefer_const_declarations + final path = r'/fake/additionalProperties-reference'; + + // ignore: prefer_final_locals + Object? postBody = requestBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// test referenced additionalProperties + /// + /// + /// + /// Parameters: + /// + /// * [Map] requestBody (required): + /// request body + Future testAdditionalPropertiesReference(Map requestBody,) async { + final response = await testAdditionalPropertiesReferenceWithHttpInfo(requestBody,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// For this test, the body has to be a binary file. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [MultipartFile] body (required): + /// image to upload + Future testBodyWithBinaryWithHttpInfo(MultipartFile body,) async { + // ignore: prefer_const_declarations + final path = r'/fake/body-with-binary'; + + // ignore: prefer_final_locals + Object? postBody = body; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['image/png']; + + + return apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// For this test, the body has to be a binary file. + /// + /// Parameters: + /// + /// * [MultipartFile] body (required): + /// image to upload + Future testBodyWithBinary(MultipartFile body,) async { + final response = await testBodyWithBinaryWithHttpInfo(body,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// For this test, the body for this request must reference a schema named `File`. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [FileSchemaTestClass] fileSchemaTestClass (required): + Future testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass,) async { + // ignore: prefer_const_declarations + final path = r'/fake/body-with-file-schema'; + + // ignore: prefer_final_locals + Object? postBody = fileSchemaTestClass; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// For this test, the body for this request must reference a schema named `File`. + /// + /// Parameters: + /// + /// * [FileSchemaTestClass] fileSchemaTestClass (required): + Future testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass,) async { + final response = await testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// Performs an HTTP 'PUT /fake/body-with-query-params' operation and returns the [Response]. + /// Parameters: + /// + /// * [String] query (required): + /// + /// * [User] user (required): + Future testBodyWithQueryParamsWithHttpInfo(String query, User user,) async { + // ignore: prefer_const_declarations + final path = r'/fake/body-with-query-params'; + + // ignore: prefer_final_locals + Object? postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_queryParams('', 'query', query)); + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Parameters: + /// + /// * [String] query (required): + /// + /// * [User] user (required): + Future testBodyWithQueryParams(String query, User user,) async { + final response = await testBodyWithQueryParamsWithHttpInfo(query, user,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// To test \"client\" model + /// + /// To test \"client\" model + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [ModelClient] modelClient (required): + /// client model + Future testClientModelWithHttpInfo(ModelClient modelClient,) async { + // ignore: prefer_const_declarations + final path = r'/fake'; + + // ignore: prefer_final_locals + Object? postBody = modelClient; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'PATCH', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// To test \"client\" model + /// + /// To test \"client\" model + /// + /// Parameters: + /// + /// * [ModelClient] modelClient (required): + /// client model + Future testClientModel(ModelClient modelClient,) async { + final response = await testClientModelWithHttpInfo(modelClient,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient; + + } + return null; + } + + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [num] number (required): + /// None + /// + /// * [double] double_ (required): + /// None + /// + /// * [String] patternWithoutDelimiter (required): + /// None + /// + /// * [String] byte (required): + /// None + /// + /// * [int] integer: + /// None + /// + /// * [int] int32: + /// None + /// + /// * [int] int64: + /// None + /// + /// * [double] float: + /// None + /// + /// * [String] string: + /// None + /// + /// * [MultipartFile] binary: + /// None + /// + /// * [DateTime] date: + /// None + /// + /// * [DateTime] dateTime: + /// None + /// + /// * [String] password: + /// None + /// + /// * [String] callback: + /// None + Future testEndpointParametersWithHttpInfo(num number, double double_, String patternWithoutDelimiter, String byte, { int? integer, int? int32, int? int64, double? float, String? string, MultipartFile? binary, DateTime? date, DateTime? dateTime, String? password, String? callback, }) async { + // ignore: prefer_const_declarations + final path = r'/fake'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/x-www-form-urlencoded']; + + if (integer != null) { + formParams[r'integer'] = parameterToString(integer); + } + if (int32 != null) { + formParams[r'int32'] = parameterToString(int32); + } + if (int64 != null) { + formParams[r'int64'] = parameterToString(int64); + } + if (number != null) { + formParams[r'number'] = parameterToString(number); + } + if (float != null) { + formParams[r'float'] = parameterToString(float); + } + if (double_ != null) { + formParams[r'double'] = parameterToString(double_); + } + if (string != null) { + formParams[r'string'] = parameterToString(string); + } + if (patternWithoutDelimiter != null) { + formParams[r'pattern_without_delimiter'] = parameterToString(patternWithoutDelimiter); + } + if (byte != null) { + formParams[r'byte'] = parameterToString(byte); + } + if (date != null) { + formParams[r'date'] = parameterToString(date); + } + if (dateTime != null) { + formParams[r'dateTime'] = parameterToString(dateTime); + } + if (password != null) { + formParams[r'password'] = parameterToString(password); + } + if (callback != null) { + formParams[r'callback'] = parameterToString(callback); + } + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Parameters: + /// + /// * [num] number (required): + /// None + /// + /// * [double] double_ (required): + /// None + /// + /// * [String] patternWithoutDelimiter (required): + /// None + /// + /// * [String] byte (required): + /// None + /// + /// * [int] integer: + /// None + /// + /// * [int] int32: + /// None + /// + /// * [int] int64: + /// None + /// + /// * [double] float: + /// None + /// + /// * [String] string: + /// None + /// + /// * [MultipartFile] binary: + /// None + /// + /// * [DateTime] date: + /// None + /// + /// * [DateTime] dateTime: + /// None + /// + /// * [String] password: + /// None + /// + /// * [String] callback: + /// None + Future testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int? integer, int? int32, int? int64, double? float, String? string, MultipartFile? binary, DateTime? date, DateTime? dateTime, String? password, String? callback, }) async { + final response = await testEndpointParametersWithHttpInfo(number, double_, patternWithoutDelimiter, byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback, ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// To test enum parameters + /// + /// To test enum parameters + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] enumHeaderStringArray: + /// Header parameter enum test (string array) + /// + /// * [String] enumHeaderString: + /// Header parameter enum test (string) + /// + /// * [List] enumQueryStringArray: + /// Query parameter enum test (string array) + /// + /// * [String] enumQueryString: + /// Query parameter enum test (string) + /// + /// * [int] enumQueryInteger: + /// Query parameter enum test (double) + /// + /// * [double] enumQueryDouble: + /// Query parameter enum test (double) + /// + /// * [List] enumQueryModelArray: + /// + /// * [List] enumFormStringArray: + /// Form parameter enum test (string array) + /// + /// * [String] enumFormString: + /// Form parameter enum test (string) + Future testEnumParametersWithHttpInfo({ List? enumHeaderStringArray, String? enumHeaderString, List? enumQueryStringArray, String? enumQueryString, int? enumQueryInteger, double? enumQueryDouble, List? enumQueryModelArray, List? enumFormStringArray, String? enumFormString, }) async { + // ignore: prefer_const_declarations + final path = r'/fake'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + if (enumQueryStringArray != null) { + queryParams.addAll(_queryParams('multi', 'enum_query_string_array', enumQueryStringArray)); + } + if (enumQueryString != null) { + queryParams.addAll(_queryParams('', 'enum_query_string', enumQueryString)); + } + if (enumQueryInteger != null) { + queryParams.addAll(_queryParams('', 'enum_query_integer', enumQueryInteger)); + } + if (enumQueryDouble != null) { + queryParams.addAll(_queryParams('', 'enum_query_double', enumQueryDouble)); + } + if (enumQueryModelArray != null) { + queryParams.addAll(_queryParams('multi', 'enum_query_model_array', enumQueryModelArray)); + } + + if (enumHeaderStringArray != null) { + headerParams[r'enum_header_string_array'] = parameterToString(enumHeaderStringArray); + } + if (enumHeaderString != null) { + headerParams[r'enum_header_string'] = parameterToString(enumHeaderString); + } + + const contentTypes = ['application/x-www-form-urlencoded']; + + if (enumFormStringArray != null) { + formParams[r'enum_form_string_array'] = parameterToString(enumFormStringArray); + } + if (enumFormString != null) { + formParams[r'enum_form_string'] = parameterToString(enumFormString); + } + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// To test enum parameters + /// + /// To test enum parameters + /// + /// Parameters: + /// + /// * [List] enumHeaderStringArray: + /// Header parameter enum test (string array) + /// + /// * [String] enumHeaderString: + /// Header parameter enum test (string) + /// + /// * [List] enumQueryStringArray: + /// Query parameter enum test (string array) + /// + /// * [String] enumQueryString: + /// Query parameter enum test (string) + /// + /// * [int] enumQueryInteger: + /// Query parameter enum test (double) + /// + /// * [double] enumQueryDouble: + /// Query parameter enum test (double) + /// + /// * [List] enumQueryModelArray: + /// + /// * [List] enumFormStringArray: + /// Form parameter enum test (string array) + /// + /// * [String] enumFormString: + /// Form parameter enum test (string) + Future testEnumParameters({ List? enumHeaderStringArray, String? enumHeaderString, List? enumQueryStringArray, String? enumQueryString, int? enumQueryInteger, double? enumQueryDouble, List? enumQueryModelArray, List? enumFormStringArray, String? enumFormString, }) async { + final response = await testEnumParametersWithHttpInfo( enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumQueryModelArray: enumQueryModelArray, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// Fake endpoint to test group parameters (optional) + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] requiredStringGroup (required): + /// Required String in group parameters + /// + /// * [bool] requiredBooleanGroup (required): + /// Required Boolean in group parameters + /// + /// * [int] requiredInt64Group (required): + /// Required Integer in group parameters + /// + /// * [int] stringGroup: + /// String in group parameters + /// + /// * [bool] booleanGroup: + /// Boolean in group parameters + /// + /// * [int] int64Group: + /// Integer in group parameters + Future testGroupParametersWithHttpInfo(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int? stringGroup, bool? booleanGroup, int? int64Group, }) async { + // ignore: prefer_const_declarations + final path = r'/fake'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_queryParams('', 'required_string_group', requiredStringGroup)); + queryParams.addAll(_queryParams('', 'required_int64_group', requiredInt64Group)); + if (stringGroup != null) { + queryParams.addAll(_queryParams('', 'string_group', stringGroup)); + } + if (int64Group != null) { + queryParams.addAll(_queryParams('', 'int64_group', int64Group)); + } + + headerParams[r'required_boolean_group'] = parameterToString(requiredBooleanGroup); + if (booleanGroup != null) { + headerParams[r'boolean_group'] = parameterToString(booleanGroup); + } + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Fake endpoint to test group parameters (optional) + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Parameters: + /// + /// * [int] requiredStringGroup (required): + /// Required String in group parameters + /// + /// * [bool] requiredBooleanGroup (required): + /// Required Boolean in group parameters + /// + /// * [int] requiredInt64Group (required): + /// Required Integer in group parameters + /// + /// * [int] stringGroup: + /// String in group parameters + /// + /// * [bool] booleanGroup: + /// Boolean in group parameters + /// + /// * [int] int64Group: + /// Integer in group parameters + Future testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int? stringGroup, bool? booleanGroup, int? int64Group, }) async { + final response = await testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group, ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// test inline additionalProperties + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Map] requestBody (required): + /// request body + Future testInlineAdditionalPropertiesWithHttpInfo(Map requestBody,) async { + // ignore: prefer_const_declarations + final path = r'/fake/inline-additionalProperties'; + + // ignore: prefer_final_locals + Object? postBody = requestBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// test inline additionalProperties + /// + /// + /// + /// Parameters: + /// + /// * [Map] requestBody (required): + /// request body + Future testInlineAdditionalProperties(Map requestBody,) async { + final response = await testInlineAdditionalPropertiesWithHttpInfo(requestBody,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// test inline free-form additionalProperties + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [TestInlineFreeformAdditionalPropertiesRequest] testInlineFreeformAdditionalPropertiesRequest (required): + /// request body + Future testInlineFreeformAdditionalPropertiesWithHttpInfo(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest,) async { + // ignore: prefer_const_declarations + final path = r'/fake/inline-freeform-additionalProperties'; + + // ignore: prefer_final_locals + Object? postBody = testInlineFreeformAdditionalPropertiesRequest; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// test inline free-form additionalProperties + /// + /// + /// + /// Parameters: + /// + /// * [TestInlineFreeformAdditionalPropertiesRequest] testInlineFreeformAdditionalPropertiesRequest (required): + /// request body + Future testInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest,) async { + final response = await testInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// test json serialization of form data + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] param (required): + /// field1 + /// + /// * [String] param2 (required): + /// field2 + Future testJsonFormDataWithHttpInfo(String param, String param2,) async { + // ignore: prefer_const_declarations + final path = r'/fake/jsonFormData'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/x-www-form-urlencoded']; + + if (param != null) { + formParams[r'param'] = parameterToString(param); + } + if (param2 != null) { + formParams[r'param2'] = parameterToString(param2); + } + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// test json serialization of form data + /// + /// + /// + /// Parameters: + /// + /// * [String] param (required): + /// field1 + /// + /// * [String] param2 (required): + /// field2 + Future testJsonFormData(String param, String param2,) async { + final response = await testJsonFormDataWithHttpInfo(param, param2,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// test nullable parent property + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [ChildWithNullable] childWithNullable (required): + /// request body + Future testNullableWithHttpInfo(ChildWithNullable childWithNullable,) async { + // ignore: prefer_const_declarations + final path = r'/fake/nullable'; + + // ignore: prefer_final_locals + Object? postBody = childWithNullable; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// test nullable parent property + /// + /// + /// + /// Parameters: + /// + /// * [ChildWithNullable] childWithNullable (required): + /// request body + Future testNullable(ChildWithNullable childWithNullable,) async { + final response = await testNullableWithHttpInfo(childWithNullable,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// To test the collection format in query parameters + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] pipe (required): + /// + /// * [List] ioutil (required): + /// + /// * [List] http (required): + /// + /// * [List] url (required): + /// + /// * [List] context (required): + /// + /// * [String] allowEmpty (required): + /// + /// * [Map] language: + Future testQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, String allowEmpty, { Map? language, }) async { + // ignore: prefer_const_declarations + final path = r'/fake/test-query-parameters'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_queryParams('pipes', 'pipe', pipe)); + queryParams.addAll(_queryParams('csv', 'ioutil', ioutil)); + queryParams.addAll(_queryParams('ssv', 'http', http)); + queryParams.addAll(_queryParams('csv', 'url', url)); + queryParams.addAll(_queryParams('multi', 'context', context)); + if (language != null) { + queryParams.addAll(_queryParams('', 'language', language)); + } + queryParams.addAll(_queryParams('', 'allowEmpty', allowEmpty)); + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// To test the collection format in query parameters + /// + /// Parameters: + /// + /// * [List] pipe (required): + /// + /// * [List] ioutil (required): + /// + /// * [List] http (required): + /// + /// * [List] url (required): + /// + /// * [List] context (required): + /// + /// * [String] allowEmpty (required): + /// + /// * [Map] language: + Future testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, String allowEmpty, { Map? language, }) async { + final response = await testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, allowEmpty, language: language, ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// test referenced string map + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Map] requestBody (required): + /// request body + Future testStringMapReferenceWithHttpInfo(Map requestBody,) async { + // ignore: prefer_const_declarations + final path = r'/fake/stringMap-reference'; + + // ignore: prefer_final_locals + Object? postBody = requestBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// test referenced string map + /// + /// + /// + /// Parameters: + /// + /// * [Map] requestBody (required): + /// request body + Future testStringMapReference(Map requestBody,) async { + final response = await testStringMapReferenceWithHttpInfo(requestBody,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/fake_classname_tags123_api.dart new file mode 100644 index 000000000000..7689f51b6884 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/fake_classname_tags123_api.dart @@ -0,0 +1,76 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class FakeClassnameTags123Api { + FakeClassnameTags123Api([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// To test class name in snake case + /// + /// To test class name in snake case + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [ModelClient] modelClient (required): + /// client model + Future testClassnameWithHttpInfo(ModelClient modelClient,) async { + // ignore: prefer_const_declarations + final path = r'/fake_classname_test'; + + // ignore: prefer_final_locals + Object? postBody = modelClient; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'PATCH', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// To test class name in snake case + /// + /// To test class name in snake case + /// + /// Parameters: + /// + /// * [ModelClient] modelClient (required): + /// client model + Future testClassname(ModelClient modelClient,) async { + final response = await testClassnameWithHttpInfo(modelClient,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ModelClient',) as ModelClient; + + } + return null; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/pet_api.dart new file mode 100644 index 000000000000..61fd1666af49 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/pet_api.dart @@ -0,0 +1,601 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class PetApi { + PetApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Add a new pet to the store + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + Future addPetWithHttpInfo(Pet pet,) async { + // ignore: prefer_const_declarations + final path = r'/pet'; + + // ignore: prefer_final_locals + Object? postBody = pet; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json', 'application/xml']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Add a new pet to the store + /// + /// + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + Future addPet(Pet pet,) async { + final response = await addPetWithHttpInfo(pet,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// Deletes a pet + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// Pet id to delete + /// + /// * [String] apiKey: + Future deletePetWithHttpInfo(int petId, { String? apiKey, }) async { + // ignore: prefer_const_declarations + final path = r'/pet/{petId}' + .replaceAll('{petId}', petId.toString()); + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + if (apiKey != null) { + headerParams[r'api_key'] = parameterToString(apiKey); + } + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Deletes a pet + /// + /// + /// + /// Parameters: + /// + /// * [int] petId (required): + /// Pet id to delete + /// + /// * [String] apiKey: + Future deletePet(int petId, { String? apiKey, }) async { + final response = await deletePetWithHttpInfo(petId, apiKey: apiKey, ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// Finds Pets by status + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] status (required): + /// Status values that need to be considered for filter + Future findPetsByStatusWithHttpInfo(List status,) async { + // ignore: prefer_const_declarations + final path = r'/pet/findByStatus'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_queryParams('csv', 'status', status)); + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Finds Pets by status + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Parameters: + /// + /// * [List] status (required): + /// Status values that need to be considered for filter + Future?> findPetsByStatus(List status,) async { + final response = await findPetsByStatusWithHttpInfo(status,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + final responseBody = await _decodeBodyBytes(response); + return (await apiClient.deserializeAsync(responseBody, 'List') as List) + .cast() + .toList(growable: false); + + } + return null; + } + + /// Finds Pets by tags + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Set] tags (required): + /// Tags to filter by + Future findPetsByTagsWithHttpInfo(Set tags,) async { + // ignore: prefer_const_declarations + final path = r'/pet/findByTags'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_queryParams('csv', 'tags', tags)); + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Finds Pets by tags + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Parameters: + /// + /// * [Set] tags (required): + /// Tags to filter by + Future?> findPetsByTags(Set tags,) async { + final response = await findPetsByTagsWithHttpInfo(tags,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + final responseBody = await _decodeBodyBytes(response); + return (await apiClient.deserializeAsync(responseBody, 'Set') as List) + .cast() + .toSet(); + + } + return null; + } + + /// Find pet by ID + /// + /// Returns a single pet + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to return + Future getPetByIdWithHttpInfo(int petId,) async { + // ignore: prefer_const_declarations + final path = r'/pet/{petId}' + .replaceAll('{petId}', petId.toString()); + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Find pet by ID + /// + /// Returns a single pet + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to return + Future getPetById(int petId,) async { + final response = await getPetByIdWithHttpInfo(petId,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Pet',) as Pet; + + } + return null; + } + + /// Update an existing pet + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + Future updatePetWithHttpInfo(Pet pet,) async { + // ignore: prefer_const_declarations + final path = r'/pet'; + + // ignore: prefer_final_locals + Object? postBody = pet; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json', 'application/xml']; + + + return apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Update an existing pet + /// + /// + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + Future updatePet(Pet pet,) async { + final response = await updatePetWithHttpInfo(pet,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// Updates a pet in the store with form data + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet that needs to be updated + /// + /// * [String] name: + /// Updated name of the pet + /// + /// * [String] status: + /// Updated status of the pet + Future updatePetWithFormWithHttpInfo(int petId, { String? name, String? status, }) async { + // ignore: prefer_const_declarations + final path = r'/pet/{petId}' + .replaceAll('{petId}', petId.toString()); + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/x-www-form-urlencoded']; + + if (name != null) { + formParams[r'name'] = parameterToString(name); + } + if (status != null) { + formParams[r'status'] = parameterToString(status); + } + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Updates a pet in the store with form data + /// + /// + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet that needs to be updated + /// + /// * [String] name: + /// Updated name of the pet + /// + /// * [String] status: + /// Updated status of the pet + Future updatePetWithForm(int petId, { String? name, String? status, }) async { + final response = await updatePetWithFormWithHttpInfo(petId, name: name, status: status, ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// uploads an image + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to update + /// + /// * [String] additionalMetadata: + /// Additional data to pass to server + /// + /// * [MultipartFile] file: + /// file to upload + Future uploadFileWithHttpInfo(int petId, { String? additionalMetadata, MultipartFile? file, }) async { + // ignore: prefer_const_declarations + final path = r'/pet/{petId}/uploadImage' + .replaceAll('{petId}', petId.toString()); + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['multipart/form-data']; + + bool hasFields = false; + final mp = MultipartRequest('POST', Uri.parse(path)); + if (additionalMetadata != null) { + hasFields = true; + mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); + } + if (file != null) { + hasFields = true; + mp.fields[r'file'] = file.field; + mp.files.add(file); + } + if (hasFields) { + postBody = mp; + } + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// uploads an image + /// + /// + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to update + /// + /// * [String] additionalMetadata: + /// Additional data to pass to server + /// + /// * [MultipartFile] file: + /// file to upload + Future uploadFile(int petId, { String? additionalMetadata, MultipartFile? file, }) async { + final response = await uploadFileWithHttpInfo(petId, additionalMetadata: additionalMetadata, file: file, ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse; + + } + return null; + } + + /// uploads an image (required) + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to update + /// + /// * [MultipartFile] requiredFile (required): + /// file to upload + /// + /// * [String] additionalMetadata: + /// Additional data to pass to server + Future uploadFileWithRequiredFileWithHttpInfo(int petId, MultipartFile requiredFile, { String? additionalMetadata, }) async { + // ignore: prefer_const_declarations + final path = r'/fake/{petId}/uploadImageWithRequiredFile' + .replaceAll('{petId}', petId.toString()); + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['multipart/form-data']; + + bool hasFields = false; + final mp = MultipartRequest('POST', Uri.parse(path)); + if (additionalMetadata != null) { + hasFields = true; + mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); + } + if (requiredFile != null) { + hasFields = true; + mp.fields[r'requiredFile'] = requiredFile.field; + mp.files.add(requiredFile); + } + if (hasFields) { + postBody = mp; + } + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// uploads an image (required) + /// + /// + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to update + /// + /// * [MultipartFile] requiredFile (required): + /// file to upload + /// + /// * [String] additionalMetadata: + /// Additional data to pass to server + Future uploadFileWithRequiredFile(int petId, MultipartFile requiredFile, { String? additionalMetadata, }) async { + final response = await uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata: additionalMetadata, ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ApiResponse',) as ApiResponse; + + } + return null; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/store_api.dart new file mode 100644 index 000000000000..7236e3de94fe --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/store_api.dart @@ -0,0 +1,234 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class StoreApi { + StoreApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Delete purchase order by ID + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] orderId (required): + /// ID of the order that needs to be deleted + Future deleteOrderWithHttpInfo(String orderId,) async { + // ignore: prefer_const_declarations + final path = r'/store/order/{order_id}' + .replaceAll('{order_id}', orderId); + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Delete purchase order by ID + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Parameters: + /// + /// * [String] orderId (required): + /// ID of the order that needs to be deleted + Future deleteOrder(String orderId,) async { + final response = await deleteOrderWithHttpInfo(orderId,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// Returns pet inventories by status + /// + /// Returns a map of status codes to quantities + /// + /// Note: This method returns the HTTP [Response]. + Future getInventoryWithHttpInfo() async { + // ignore: prefer_const_declarations + final path = r'/store/inventory'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Returns pet inventories by status + /// + /// Returns a map of status codes to quantities + Future?> getInventory() async { + final response = await getInventoryWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return Map.from(await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Map'),); + + } + return null; + } + + /// Find purchase order by ID + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] orderId (required): + /// ID of pet that needs to be fetched + Future getOrderByIdWithHttpInfo(int orderId,) async { + // ignore: prefer_const_declarations + final path = r'/store/order/{order_id}' + .replaceAll('{order_id}', orderId.toString()); + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Find purchase order by ID + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Parameters: + /// + /// * [int] orderId (required): + /// ID of pet that needs to be fetched + Future getOrderById(int orderId,) async { + final response = await getOrderByIdWithHttpInfo(orderId,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; + + } + return null; + } + + /// Place an order for a pet + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Order] order (required): + /// order placed for purchasing the pet + Future placeOrderWithHttpInfo(Order order,) async { + // ignore: prefer_const_declarations + final path = r'/store/order'; + + // ignore: prefer_final_locals + Object? postBody = order; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Place an order for a pet + /// + /// + /// + /// Parameters: + /// + /// * [Order] order (required): + /// order placed for purchasing the pet + Future placeOrder(Order order,) async { + final response = await placeOrderWithHttpInfo(order,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Order',) as Order; + + } + return null; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/user_api.dart new file mode 100644 index 000000000000..4c59eb21f63e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api/user_api.dart @@ -0,0 +1,442 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class UserApi { + UserApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Create user + /// + /// This can only be done by the logged in user. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [User] user (required): + /// Created user object + Future createUserWithHttpInfo(User user,) async { + // ignore: prefer_const_declarations + final path = r'/user'; + + // ignore: prefer_final_locals + Object? postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Create user + /// + /// This can only be done by the logged in user. + /// + /// Parameters: + /// + /// * [User] user (required): + /// Created user object + Future createUser(User user,) async { + final response = await createUserWithHttpInfo(user,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// Creates list of users with given input array + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] user (required): + /// List of user object + Future createUsersWithArrayInputWithHttpInfo(List user,) async { + // ignore: prefer_const_declarations + final path = r'/user/createWithArray'; + + // ignore: prefer_final_locals + Object? postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Creates list of users with given input array + /// + /// + /// + /// Parameters: + /// + /// * [List] user (required): + /// List of user object + Future createUsersWithArrayInput(List user,) async { + final response = await createUsersWithArrayInputWithHttpInfo(user,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// Creates list of users with given input array + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] user (required): + /// List of user object + Future createUsersWithListInputWithHttpInfo(List user,) async { + // ignore: prefer_const_declarations + final path = r'/user/createWithList'; + + // ignore: prefer_final_locals + Object? postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Creates list of users with given input array + /// + /// + /// + /// Parameters: + /// + /// * [List] user (required): + /// List of user object + Future createUsersWithListInput(List user,) async { + final response = await createUsersWithListInputWithHttpInfo(user,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// Delete user + /// + /// This can only be done by the logged in user. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] username (required): + /// The name that needs to be deleted + Future deleteUserWithHttpInfo(String username,) async { + // ignore: prefer_const_declarations + final path = r'/user/{username}' + .replaceAll('{username}', username); + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Delete user + /// + /// This can only be done by the logged in user. + /// + /// Parameters: + /// + /// * [String] username (required): + /// The name that needs to be deleted + Future deleteUser(String username,) async { + final response = await deleteUserWithHttpInfo(username,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// Get user by user name + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] username (required): + /// The name that needs to be fetched. Use user1 for testing. + Future getUserByNameWithHttpInfo(String username,) async { + // ignore: prefer_const_declarations + final path = r'/user/{username}' + .replaceAll('{username}', username); + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Get user by user name + /// + /// + /// + /// Parameters: + /// + /// * [String] username (required): + /// The name that needs to be fetched. Use user1 for testing. + Future getUserByName(String username,) async { + final response = await getUserByNameWithHttpInfo(username,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'User',) as User; + + } + return null; + } + + /// Logs user into the system + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] username (required): + /// The user name for login + /// + /// * [String] password (required): + /// The password for login in clear text + Future loginUserWithHttpInfo(String username, String password,) async { + // ignore: prefer_const_declarations + final path = r'/user/login'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_queryParams('', 'username', username)); + queryParams.addAll(_queryParams('', 'password', password)); + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Logs user into the system + /// + /// + /// + /// Parameters: + /// + /// * [String] username (required): + /// The user name for login + /// + /// * [String] password (required): + /// The password for login in clear text + Future loginUser(String username, String password,) async { + final response = await loginUserWithHttpInfo(username, password,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'String',) as String; + + } + return null; + } + + /// Logs out current logged in user session + /// + /// + /// + /// Note: This method returns the HTTP [Response]. + Future logoutUserWithHttpInfo() async { + // ignore: prefer_const_declarations + final path = r'/user/logout'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Logs out current logged in user session + /// + /// + Future logoutUser() async { + final response = await logoutUserWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + + /// Updated user + /// + /// This can only be done by the logged in user. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] username (required): + /// name that need to be deleted + /// + /// * [User] user (required): + /// Updated user object + Future updateUserWithHttpInfo(String username, User user,) async { + // ignore: prefer_const_declarations + final path = r'/user/{username}' + .replaceAll('{username}', username); + + // ignore: prefer_final_locals + Object? postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Updated user + /// + /// This can only be done by the logged in user. + /// + /// Parameters: + /// + /// * [String] username (required): + /// name that need to be deleted + /// + /// * [User] user (required): + /// Updated user object + Future updateUser(String username, User user,) async { + final response = await updateUserWithHttpInfo(username, user,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api_client.dart new file mode 100644 index 000000000000..b23eea980a86 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api_client.dart @@ -0,0 +1,356 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApiClient { + ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2', 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', + ); + } + + Future deserializeAsync(String value, String targetType, {bool growable = false,}) async => + // ignore: deprecated_member_use_from_same_package + deserialize(value, targetType, growable: growable); + + @Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use deserializeAsync() instead.') + dynamic deserialize(String value, 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' + ? value + : fromJson(json.decode(value), targetType, growable: growable); + } + + // 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); + + /// Returns a native instance of an OpenAPI class matching the [specified type][targetType]. + static dynamic fromJson(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); + case 'AdditionalPropertiesClass': + return AdditionalPropertiesClass.fromJson(value); + case 'AllOfWithSingleRef': + return AllOfWithSingleRef.fromJson(value); + case 'Animal': + return Animal.fromJson(value); + case 'ApiResponse': + return ApiResponse.fromJson(value); + case 'ArrayOfArrayOfNumberOnly': + return ArrayOfArrayOfNumberOnly.fromJson(value); + case 'ArrayOfNumberOnly': + return ArrayOfNumberOnly.fromJson(value); + case 'ArrayTest': + return ArrayTest.fromJson(value); + case 'Capitalization': + return Capitalization.fromJson(value); + case 'Cat': + return Cat.fromJson(value); + case 'Category': + return Category.fromJson(value); + case 'ChildWithNullable': + return ChildWithNullable.fromJson(value); + case 'ClassModel': + return ClassModel.fromJson(value); + case 'DeprecatedObject': + return DeprecatedObject.fromJson(value); + case 'Dog': + return Dog.fromJson(value); + case 'EnumArrays': + return EnumArrays.fromJson(value); + case 'EnumClass': + return EnumClassTypeTransformer().decode(value); + case 'EnumTest': + return EnumTest.fromJson(value); + case 'FakeBigDecimalMap200Response': + return FakeBigDecimalMap200Response.fromJson(value); + case 'FileSchemaTestClass': + return FileSchemaTestClass.fromJson(value); + case 'Foo': + return Foo.fromJson(value); + case 'FooGetDefaultResponse': + return FooGetDefaultResponse.fromJson(value); + case 'FormatTest': + return FormatTest.fromJson(value); + case 'HasOnlyReadOnly': + return HasOnlyReadOnly.fromJson(value); + case 'HealthCheckResult': + return HealthCheckResult.fromJson(value); + case 'MapTest': + return MapTest.fromJson(value); + case 'MixedPropertiesAndAdditionalPropertiesClass': + return MixedPropertiesAndAdditionalPropertiesClass.fromJson(value); + case 'Model200Response': + return Model200Response.fromJson(value); + case 'ModelClient': + return ModelClient.fromJson(value); + case 'ModelFile': + return ModelFile.fromJson(value); + case 'ModelList': + return ModelList.fromJson(value); + case 'ModelReturn': + return ModelReturn.fromJson(value); + case 'Name': + return Name.fromJson(value); + case 'NullableClass': + return NullableClass.fromJson(value); + case 'NumberOnly': + return NumberOnly.fromJson(value); + case 'ObjectWithDeprecatedFields': + return ObjectWithDeprecatedFields.fromJson(value); + case 'Order': + return Order.fromJson(value); + case 'OuterComposite': + return OuterComposite.fromJson(value); + case 'OuterEnum': + return OuterEnumTypeTransformer().decode(value); + case 'OuterEnumDefaultValue': + return OuterEnumDefaultValueTypeTransformer().decode(value); + case 'OuterEnumInteger': + return OuterEnumIntegerTypeTransformer().decode(value); + case 'OuterEnumIntegerDefaultValue': + return OuterEnumIntegerDefaultValueTypeTransformer().decode(value); + case 'OuterObjectWithEnumProperty': + return OuterObjectWithEnumProperty.fromJson(value); + case 'ParentWithNullable': + return ParentWithNullable.fromJson(value); + case 'Pet': + return Pet.fromJson(value); + case 'ReadOnlyFirst': + return ReadOnlyFirst.fromJson(value); + case 'SingleRefType': + return SingleRefTypeTypeTransformer().decode(value); + case 'SpecialModelName': + return SpecialModelName.fromJson(value); + case 'Tag': + return Tag.fromJson(value); + case 'TestInlineFreeformAdditionalPropertiesRequest': + return TestInlineFreeformAdditionalPropertiesRequest.fromJson(value); + case 'User': + return User.fromJson(value); + default: + dynamic match; + if (value is List && (match = _regList.firstMatch(targetType)?.group(1)) != null) { + return value + .map((dynamic v) => fromJson(v, match, growable: growable,)) + .toList(growable: growable); + } + if (value is Set && (match = _regSet.firstMatch(targetType)?.group(1)) != null) { + return value + .map((dynamic v) => fromJson(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) => fromJson(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',); + } +} + +/// 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 decodeAsync(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 + : json.decode(message.json); +} + +/// 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.fromJson( + json.decode(message.json), + targetType, + growable: message.growable, + ); +} + +/// Primarily intended for use in an isolate. +Future serializeAsync(Object? value) async => value == null ? '' : json.encode(value); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api_exception.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api_exception.dart new file mode 100644 index 000000000000..53077d686df6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api_exception.dart @@ -0,0 +1,33 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +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/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api_helper.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api_helper.dart new file mode 100644 index 000000000000..a07a5497a661 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/api_helper.dart @@ -0,0 +1,122 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +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; +} + +/// Format the given parameter object into a [String]. +String parameterToString(dynamic value) { + if (value == null) { + return ''; + } + if (value is DateTime) { + return value.toUtc().toIso8601String(); + } + if (value is EnumClass) { + return EnumClassTypeTransformer().encode(value).toString(); + } + if (value is OuterEnum) { + return OuterEnumTypeTransformer().encode(value).toString(); + } + if (value is OuterEnumDefaultValue) { + return OuterEnumDefaultValueTypeTransformer().encode(value).toString(); + } + if (value is OuterEnumInteger) { + return OuterEnumIntegerTypeTransformer().encode(value).toString(); + } + if (value is OuterEnumIntegerDefaultValue) { + return OuterEnumIntegerDefaultValueTypeTransformer().encode(value).toString(); + } + if (value is SingleRefType) { + return SingleRefTypeTypeTransformer().encode(value).toString(); + } + return value.toString(); +} + +/// 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; +} + +/// Returns a valid [T] value found at the specified Map [key], null otherwise. +T? mapValueOfType(dynamic map, String key) { + final dynamic value = map is Map ? map[key] : null; + if (T == double && value is int) { + return value.toDouble() as T; + } + return value is T ? value : null; +} + +/// Returns a valid Map found at the specified Map [key], null otherwise. +Map? mapCastOfType(dynamic map, String key) { + final dynamic value = map is Map ? map[key] : null; + return value is Map ? value.cast() : null; +} + +/// Returns a valid [DateTime] found at the specified Map [key], null otherwise. +DateTime? mapDateTime(dynamic map, String key, [String? pattern]) { + final dynamic value = map is Map ? map[key] : null; + if (value != null) { + int? millis; + if (value is int) { + millis = value; + } else if (value is String) { + if (_isEpochMarker(pattern)) { + millis = int.tryParse(value); + } else { + return DateTime.tryParse(value); + } + } + if (millis != null) { + return DateTime.fromMillisecondsSinceEpoch(millis, isUtc: true); + } + } + return null; +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/auth/api_key_auth.dart new file mode 100644 index 000000000000..6c5621798f9e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/auth/api_key_auth.dart @@ -0,0 +1,40 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +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/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/auth/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/auth/authentication.dart new file mode 100644 index 000000000000..5377fb6f34c1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/auth/authentication.dart @@ -0,0 +1,17 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +// 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/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/auth/http_basic_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/auth/http_basic_auth.dart new file mode 100644 index 000000000000..5e8b1c4147eb --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/auth/http_basic_auth.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +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/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/auth/http_bearer_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/auth/http_bearer_auth.dart new file mode 100644 index 000000000000..847dc056e100 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/auth/http_bearer_auth.dart @@ -0,0 +1,49 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +typedef HttpBearerAuthProvider = String Function(); + +class HttpBearerAuth implements Authentication { + HttpBearerAuth(); + + dynamic _accessToken; + + dynamic get accessToken => _accessToken; + + set accessToken(dynamic accessToken) { + if (accessToken is! String && accessToken is! HttpBearerAuthProvider) { + throw ArgumentError('accessToken value must be either a String or a String Function().'); + } + _accessToken = accessToken; + } + + @override + Future applyToParams(List queryParams, Map headerParams,) async { + if (_accessToken == null) { + return; + } + + String accessToken; + + if (_accessToken is String) { + accessToken = _accessToken; + } else if (_accessToken is HttpBearerAuthProvider) { + accessToken = _accessToken!(); + } else { + return; + } + + if (accessToken.isNotEmpty) { + headerParams['Authorization'] = 'Bearer $accessToken'; + } + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/auth/oauth.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/auth/oauth.dart new file mode 100644 index 000000000000..73fd8202dcb0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/auth/oauth.dart @@ -0,0 +1,24 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +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/dart2/petstore_client_lib_use_lower_camel_case/lib/model/additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/additional_properties_class.dart new file mode 100644 index 000000000000..1986d67dc9d9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/additional_properties_class.dart @@ -0,0 +1,115 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class AdditionalPropertiesClass { + /// Returns a new [AdditionalPropertiesClass] instance. + AdditionalPropertiesClass({ + this.mapProperty = const {}, + this.mapOfMapProperty = const {}, + }); + + Map mapProperty; + + Map> mapOfMapProperty; + + @override + bool operator ==(Object other) => identical(this, other) || other is AdditionalPropertiesClass && + _deepEquality.equals(other.mapProperty, mapProperty) && + _deepEquality.equals(other.mapOfMapProperty, mapOfMapProperty); + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (mapProperty.hashCode) + + (mapOfMapProperty.hashCode); + + @override + String toString() => 'AdditionalPropertiesClass[mapProperty=$mapProperty, mapOfMapProperty=$mapOfMapProperty]'; + + Map toJson() { + final json = {}; + json[r'map_property'] = this.mapProperty; + json[r'map_of_map_property'] = this.mapOfMapProperty; + return json; + } + + /// Returns a new [AdditionalPropertiesClass] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static AdditionalPropertiesClass? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "AdditionalPropertiesClass[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "AdditionalPropertiesClass[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return AdditionalPropertiesClass( + mapProperty: mapCastOfType(json, r'map_property') ?? const {}, + mapOfMapProperty: mapCastOfType(json, r'map_of_map_property') ?? const {}, + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = AdditionalPropertiesClass.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = AdditionalPropertiesClass.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of AdditionalPropertiesClass-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = AdditionalPropertiesClass.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/all_of_with_single_ref.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/all_of_with_single_ref.dart new file mode 100644 index 000000000000..0411ccc2b7a1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/all_of_with_single_ref.dart @@ -0,0 +1,135 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class AllOfWithSingleRef { + /// Returns a new [AllOfWithSingleRef] instance. + AllOfWithSingleRef({ + this.username, + this.singleRefType, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? username; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + SingleRefType? singleRefType; + + @override + bool operator ==(Object other) => identical(this, other) || other is AllOfWithSingleRef && + other.username == username && + other.singleRefType == singleRefType; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (username == null ? 0 : username!.hashCode) + + (singleRefType == null ? 0 : singleRefType!.hashCode); + + @override + String toString() => 'AllOfWithSingleRef[username=$username, singleRefType=$singleRefType]'; + + Map toJson() { + final json = {}; + if (this.username != null) { + json[r'username'] = this.username; + } else { + json[r'username'] = null; + } + if (this.singleRefType != null) { + json[r'SingleRefType'] = this.singleRefType; + } else { + json[r'SingleRefType'] = null; + } + return json; + } + + /// Returns a new [AllOfWithSingleRef] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static AllOfWithSingleRef? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "AllOfWithSingleRef[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "AllOfWithSingleRef[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return AllOfWithSingleRef( + username: mapValueOfType(json, r'username'), + singleRefType: SingleRefType.fromJson(json[r'SingleRefType']), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = AllOfWithSingleRef.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = AllOfWithSingleRef.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of AllOfWithSingleRef-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = AllOfWithSingleRef.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/animal.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/animal.dart new file mode 100644 index 000000000000..a562a11becce --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/animal.dart @@ -0,0 +1,116 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Animal { + /// Returns a new [Animal] instance. + Animal({ + required this.className, + this.color = 'red', + }); + + String className; + + String color; + + @override + bool operator ==(Object other) => identical(this, other) || other is Animal && + other.className == className && + other.color == color; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (className.hashCode) + + (color.hashCode); + + @override + String toString() => 'Animal[className=$className, color=$color]'; + + Map toJson() { + final json = {}; + json[r'className'] = this.className; + json[r'color'] = this.color; + return json; + } + + /// Returns a new [Animal] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static Animal? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Animal[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Animal[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Animal( + className: mapValueOfType(json, r'className')!, + color: mapValueOfType(json, r'color') ?? 'red', + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Animal.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Animal.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of Animal-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = Animal.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'className', + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/api_response.dart new file mode 100644 index 000000000000..5f9ddf484d20 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/api_response.dart @@ -0,0 +1,152 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApiResponse { + /// Returns a new [ApiResponse] instance. + ApiResponse({ + this.code, + this.type, + this.message, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? code; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? type; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + 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 => + // ignore: unnecessary_parenthesis + (code == null ? 0 : code!.hashCode) + + (type == null ? 0 : type!.hashCode) + + (message == null ? 0 : message!.hashCode); + + @override + String toString() => 'ApiResponse[code=$code, type=$type, message=$message]'; + + Map toJson() { + final json = {}; + if (this.code != null) { + json[r'code'] = this.code; + } else { + json[r'code'] = null; + } + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; + } + if (this.message != null) { + json[r'message'] = this.message; + } else { + json[r'message'] = null; + } + return json; + } + + /// Returns a new [ApiResponse] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ApiResponse? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ApiResponse[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ApiResponse[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ApiResponse( + code: mapValueOfType(json, r'code'), + type: mapValueOfType(json, r'type'), + message: mapValueOfType(json, r'message'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ApiResponse.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ApiResponse.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ApiResponse-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ApiResponse.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/array_of_array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/array_of_array_of_number_only.dart new file mode 100644 index 000000000000..04a9e99e986f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/array_of_array_of_number_only.dart @@ -0,0 +1,112 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ArrayOfArrayOfNumberOnly { + /// Returns a new [ArrayOfArrayOfNumberOnly] instance. + ArrayOfArrayOfNumberOnly({ + this.arrayArrayNumber = const [], + }); + + List> arrayArrayNumber; + + @override + bool operator ==(Object other) => identical(this, other) || other is ArrayOfArrayOfNumberOnly && + _deepEquality.equals(other.arrayArrayNumber, arrayArrayNumber); + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (arrayArrayNumber.hashCode); + + @override + String toString() => 'ArrayOfArrayOfNumberOnly[arrayArrayNumber=$arrayArrayNumber]'; + + Map toJson() { + final json = {}; + json[r'ArrayArrayNumber'] = this.arrayArrayNumber; + return json; + } + + /// Returns a new [ArrayOfArrayOfNumberOnly] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ArrayOfArrayOfNumberOnly? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ArrayOfArrayOfNumberOnly[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ArrayOfArrayOfNumberOnly[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ArrayOfArrayOfNumberOnly( + arrayArrayNumber: json[r'ArrayArrayNumber'] is List + ? (json[r'ArrayArrayNumber'] as List).map((e) => + e == null ? const [] : (e as List).cast() + ).toList() + : const [], + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ArrayOfArrayOfNumberOnly.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ArrayOfArrayOfNumberOnly.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ArrayOfArrayOfNumberOnly-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ArrayOfArrayOfNumberOnly.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/array_of_number_only.dart new file mode 100644 index 000000000000..ccf33088a3e1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/array_of_number_only.dart @@ -0,0 +1,110 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ArrayOfNumberOnly { + /// Returns a new [ArrayOfNumberOnly] instance. + ArrayOfNumberOnly({ + this.arrayNumber = const [], + }); + + List arrayNumber; + + @override + bool operator ==(Object other) => identical(this, other) || other is ArrayOfNumberOnly && + _deepEquality.equals(other.arrayNumber, arrayNumber); + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (arrayNumber.hashCode); + + @override + String toString() => 'ArrayOfNumberOnly[arrayNumber=$arrayNumber]'; + + Map toJson() { + final json = {}; + json[r'ArrayNumber'] = this.arrayNumber; + return json; + } + + /// Returns a new [ArrayOfNumberOnly] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ArrayOfNumberOnly? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ArrayOfNumberOnly[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ArrayOfNumberOnly[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ArrayOfNumberOnly( + arrayNumber: json[r'ArrayNumber'] is Iterable + ? (json[r'ArrayNumber'] as Iterable).cast().toList(growable: false) + : const [], + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ArrayOfNumberOnly.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ArrayOfNumberOnly.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ArrayOfNumberOnly-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ArrayOfNumberOnly.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/array_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/array_test.dart new file mode 100644 index 000000000000..ae7b08dbd3b9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/array_test.dart @@ -0,0 +1,132 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ArrayTest { + /// Returns a new [ArrayTest] instance. + ArrayTest({ + this.arrayOfString = const [], + this.arrayArrayOfInteger = const [], + this.arrayArrayOfModel = const [], + }); + + List arrayOfString; + + List> arrayArrayOfInteger; + + List> arrayArrayOfModel; + + @override + bool operator ==(Object other) => identical(this, other) || other is ArrayTest && + _deepEquality.equals(other.arrayOfString, arrayOfString) && + _deepEquality.equals(other.arrayArrayOfInteger, arrayArrayOfInteger) && + _deepEquality.equals(other.arrayArrayOfModel, arrayArrayOfModel); + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (arrayOfString.hashCode) + + (arrayArrayOfInteger.hashCode) + + (arrayArrayOfModel.hashCode); + + @override + String toString() => 'ArrayTest[arrayOfString=$arrayOfString, arrayArrayOfInteger=$arrayArrayOfInteger, arrayArrayOfModel=$arrayArrayOfModel]'; + + Map toJson() { + final json = {}; + json[r'array_of_string'] = this.arrayOfString; + json[r'array_array_of_integer'] = this.arrayArrayOfInteger; + json[r'array_array_of_model'] = this.arrayArrayOfModel; + return json; + } + + /// Returns a new [ArrayTest] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ArrayTest? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ArrayTest[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ArrayTest[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ArrayTest( + arrayOfString: json[r'array_of_string'] is Iterable + ? (json[r'array_of_string'] as Iterable).cast().toList(growable: false) + : const [], + arrayArrayOfInteger: json[r'array_array_of_integer'] is List + ? (json[r'array_array_of_integer'] as List).map((e) => + e == null ? const [] : (e as List).cast() + ).toList() + : const [], + arrayArrayOfModel: json[r'array_array_of_model'] is List + ? (json[r'array_array_of_model'] as List).map((e) => + ReadOnlyFirst.listFromJson(json[r'array_array_of_model']) + ).toList() + : const [], + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ArrayTest.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ArrayTest.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ArrayTest-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ArrayTest.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/capitalization.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/capitalization.dart new file mode 100644 index 000000000000..0f525b45dd87 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/capitalization.dart @@ -0,0 +1,204 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Capitalization { + /// Returns a new [Capitalization] instance. + Capitalization({ + this.smallCamel, + this.capitalCamel, + this.smallSnake, + this.capitalSnake, + this.sCAETHFlowPoints, + this.ATT_NAME, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? smallCamel; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? capitalCamel; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? smallSnake; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? capitalSnake; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? sCAETHFlowPoints; + + /// Name of the pet + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + 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 => + // ignore: unnecessary_parenthesis + (smallCamel == null ? 0 : smallCamel!.hashCode) + + (capitalCamel == null ? 0 : capitalCamel!.hashCode) + + (smallSnake == null ? 0 : smallSnake!.hashCode) + + (capitalSnake == null ? 0 : capitalSnake!.hashCode) + + (sCAETHFlowPoints == null ? 0 : sCAETHFlowPoints!.hashCode) + + (ATT_NAME == null ? 0 : ATT_NAME!.hashCode); + + @override + String toString() => 'Capitalization[smallCamel=$smallCamel, capitalCamel=$capitalCamel, smallSnake=$smallSnake, capitalSnake=$capitalSnake, sCAETHFlowPoints=$sCAETHFlowPoints, ATT_NAME=$ATT_NAME]'; + + Map toJson() { + final json = {}; + if (this.smallCamel != null) { + json[r'smallCamel'] = this.smallCamel; + } else { + json[r'smallCamel'] = null; + } + if (this.capitalCamel != null) { + json[r'CapitalCamel'] = this.capitalCamel; + } else { + json[r'CapitalCamel'] = null; + } + if (this.smallSnake != null) { + json[r'small_Snake'] = this.smallSnake; + } else { + json[r'small_Snake'] = null; + } + if (this.capitalSnake != null) { + json[r'Capital_Snake'] = this.capitalSnake; + } else { + json[r'Capital_Snake'] = null; + } + if (this.sCAETHFlowPoints != null) { + json[r'SCA_ETH_Flow_Points'] = this.sCAETHFlowPoints; + } else { + json[r'SCA_ETH_Flow_Points'] = null; + } + if (this.ATT_NAME != null) { + json[r'ATT_NAME'] = this.ATT_NAME; + } else { + json[r'ATT_NAME'] = null; + } + return json; + } + + /// Returns a new [Capitalization] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static Capitalization? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Capitalization[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Capitalization[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Capitalization( + smallCamel: mapValueOfType(json, r'smallCamel'), + capitalCamel: mapValueOfType(json, r'CapitalCamel'), + smallSnake: mapValueOfType(json, r'small_Snake'), + capitalSnake: mapValueOfType(json, r'Capital_Snake'), + sCAETHFlowPoints: mapValueOfType(json, r'SCA_ETH_Flow_Points'), + ATT_NAME: mapValueOfType(json, r'ATT_NAME'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Capitalization.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Capitalization.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of Capitalization-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = Capitalization.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/cat.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/cat.dart new file mode 100644 index 000000000000..398fd8525280 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/cat.dart @@ -0,0 +1,133 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Cat { + /// Returns a new [Cat] instance. + Cat({ + required this.className, + this.color = 'red', + this.declawed, + }); + + String className; + + String color; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + 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 => + // ignore: unnecessary_parenthesis + (className.hashCode) + + (color.hashCode) + + (declawed == null ? 0 : declawed!.hashCode); + + @override + String toString() => 'Cat[className=$className, color=$color, declawed=$declawed]'; + + Map toJson() { + final json = {}; + json[r'className'] = this.className; + json[r'color'] = this.color; + if (this.declawed != null) { + json[r'declawed'] = this.declawed; + } else { + json[r'declawed'] = null; + } + return json; + } + + /// Returns a new [Cat] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static Cat? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Cat[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Cat[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Cat( + className: mapValueOfType(json, r'className')!, + color: mapValueOfType(json, r'color') ?? 'red', + declawed: mapValueOfType(json, r'declawed'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Cat.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Cat.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of Cat-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = Cat.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'className', + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/category.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/category.dart new file mode 100644 index 000000000000..7a2841cd9dcd --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/category.dart @@ -0,0 +1,126 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Category { + /// Returns a new [Category] instance. + Category({ + this.id, + this.name = 'default-name', + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? id; + + String name; + + @override + bool operator ==(Object other) => identical(this, other) || other is Category && + other.id == id && + other.name == name; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (id == null ? 0 : id!.hashCode) + + (name.hashCode); + + @override + String toString() => 'Category[id=$id, name=$name]'; + + Map toJson() { + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; + } + json[r'name'] = this.name; + return json; + } + + /// Returns a new [Category] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static Category? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Category[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Category[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Category( + id: mapValueOfType(json, r'id'), + name: mapValueOfType(json, r'name')!, + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Category.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Category.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of Category-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = Category.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'name', + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/child_with_nullable.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/child_with_nullable.dart new file mode 100644 index 000000000000..2092b2c76845 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/child_with_nullable.dart @@ -0,0 +1,211 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ChildWithNullable { + /// Returns a new [ChildWithNullable] instance. + ChildWithNullable({ + this.type, + this.nullableProperty, + this.otherProperty, + }); + + ChildWithNullableTypeEnum? type; + + String? nullableProperty; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? otherProperty; + + @override + bool operator ==(Object other) => identical(this, other) || other is ChildWithNullable && + other.type == type && + other.nullableProperty == nullableProperty && + other.otherProperty == otherProperty; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (type == null ? 0 : type!.hashCode) + + (nullableProperty == null ? 0 : nullableProperty!.hashCode) + + (otherProperty == null ? 0 : otherProperty!.hashCode); + + @override + String toString() => 'ChildWithNullable[type=$type, nullableProperty=$nullableProperty, otherProperty=$otherProperty]'; + + Map toJson() { + final json = {}; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; + } + if (this.nullableProperty != null) { + json[r'nullableProperty'] = this.nullableProperty; + } else { + json[r'nullableProperty'] = null; + } + if (this.otherProperty != null) { + json[r'otherProperty'] = this.otherProperty; + } else { + json[r'otherProperty'] = null; + } + return json; + } + + /// Returns a new [ChildWithNullable] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ChildWithNullable? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ChildWithNullable[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ChildWithNullable[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ChildWithNullable( + type: ChildWithNullableTypeEnum.fromJson(json[r'type']), + nullableProperty: mapValueOfType(json, r'nullableProperty'), + otherProperty: mapValueOfType(json, r'otherProperty'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ChildWithNullable.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ChildWithNullable.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ChildWithNullable-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ChildWithNullable.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + + +class ChildWithNullableTypeEnum { + /// Instantiate a new enum with the provided [value]. + const ChildWithNullableTypeEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const childWithNullable = ChildWithNullableTypeEnum._(r'ChildWithNullable'); + + /// List of all possible values in this [enum][ChildWithNullableTypeEnum]. + static const values = [ + childWithNullable, + ]; + + static ChildWithNullableTypeEnum? fromJson(dynamic value) => ChildWithNullableTypeEnumTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ChildWithNullableTypeEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [ChildWithNullableTypeEnum] to String, +/// and [decode] dynamic data back to [ChildWithNullableTypeEnum]. +class ChildWithNullableTypeEnumTypeTransformer { + factory ChildWithNullableTypeEnumTypeTransformer() => _instance ??= const ChildWithNullableTypeEnumTypeTransformer._(); + + const ChildWithNullableTypeEnumTypeTransformer._(); + + String encode(ChildWithNullableTypeEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a ChildWithNullableTypeEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + ChildWithNullableTypeEnum? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'ChildWithNullable': return ChildWithNullableTypeEnum.childWithNullable; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [ChildWithNullableTypeEnumTypeTransformer] instance. + static ChildWithNullableTypeEnumTypeTransformer? _instance; +} + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/class_model.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/class_model.dart new file mode 100644 index 000000000000..abf08d64bdfd --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/class_model.dart @@ -0,0 +1,118 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ClassModel { + /// Returns a new [ClassModel] instance. + ClassModel({ + this.class_, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? class_; + + @override + bool operator ==(Object other) => identical(this, other) || other is ClassModel && + other.class_ == class_; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (class_ == null ? 0 : class_!.hashCode); + + @override + String toString() => 'ClassModel[class_=$class_]'; + + Map toJson() { + final json = {}; + if (this.class_ != null) { + json[r'_class'] = this.class_; + } else { + json[r'_class'] = null; + } + return json; + } + + /// Returns a new [ClassModel] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ClassModel? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ClassModel[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ClassModel[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ClassModel( + class_: mapValueOfType(json, r'_class'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ClassModel.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ClassModel.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ClassModel-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ClassModel.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/deprecated_object.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/deprecated_object.dart new file mode 100644 index 000000000000..9b5f9d3bb472 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/deprecated_object.dart @@ -0,0 +1,118 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class DeprecatedObject { + /// Returns a new [DeprecatedObject] instance. + DeprecatedObject({ + this.name, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? name; + + @override + bool operator ==(Object other) => identical(this, other) || other is DeprecatedObject && + other.name == name; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (name == null ? 0 : name!.hashCode); + + @override + String toString() => 'DeprecatedObject[name=$name]'; + + Map toJson() { + final json = {}; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; + } + return json; + } + + /// Returns a new [DeprecatedObject] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static DeprecatedObject? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "DeprecatedObject[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "DeprecatedObject[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return DeprecatedObject( + name: mapValueOfType(json, r'name'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = DeprecatedObject.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = DeprecatedObject.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of DeprecatedObject-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = DeprecatedObject.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/dog.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/dog.dart new file mode 100644 index 000000000000..d7677510b91c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/dog.dart @@ -0,0 +1,133 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Dog { + /// Returns a new [Dog] instance. + Dog({ + required this.className, + this.color = 'red', + this.breed, + }); + + String className; + + String color; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + 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 => + // ignore: unnecessary_parenthesis + (className.hashCode) + + (color.hashCode) + + (breed == null ? 0 : breed!.hashCode); + + @override + String toString() => 'Dog[className=$className, color=$color, breed=$breed]'; + + Map toJson() { + final json = {}; + json[r'className'] = this.className; + json[r'color'] = this.color; + if (this.breed != null) { + json[r'breed'] = this.breed; + } else { + json[r'breed'] = null; + } + return json; + } + + /// Returns a new [Dog] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static Dog? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Dog[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Dog[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Dog( + className: mapValueOfType(json, r'className')!, + color: mapValueOfType(json, r'color') ?? 'red', + breed: mapValueOfType(json, r'breed'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Dog.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Dog.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of Dog-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = Dog.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'className', + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/enum_arrays.dart new file mode 100644 index 000000000000..74c68b096792 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/enum_arrays.dart @@ -0,0 +1,267 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class EnumArrays { + /// Returns a new [EnumArrays] instance. + EnumArrays({ + this.justSymbol, + this.arrayEnum = const [], + }); + + EnumArraysJustSymbolEnum? justSymbol; + + List arrayEnum; + + @override + bool operator ==(Object other) => identical(this, other) || other is EnumArrays && + other.justSymbol == justSymbol && + _deepEquality.equals(other.arrayEnum, arrayEnum); + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (justSymbol == null ? 0 : justSymbol!.hashCode) + + (arrayEnum.hashCode); + + @override + String toString() => 'EnumArrays[justSymbol=$justSymbol, arrayEnum=$arrayEnum]'; + + Map toJson() { + final json = {}; + if (this.justSymbol != null) { + json[r'just_symbol'] = this.justSymbol; + } else { + json[r'just_symbol'] = null; + } + json[r'array_enum'] = this.arrayEnum; + return json; + } + + /// Returns a new [EnumArrays] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static EnumArrays? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "EnumArrays[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "EnumArrays[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return EnumArrays( + justSymbol: EnumArraysJustSymbolEnum.fromJson(json[r'just_symbol']), + arrayEnum: EnumArraysArrayEnumEnum.listFromJson(json[r'array_enum']), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EnumArrays.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = EnumArrays.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of EnumArrays-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = EnumArrays.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + + +class EnumArraysJustSymbolEnum { + /// Instantiate a new enum with the provided [value]. + const EnumArraysJustSymbolEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const greaterThanEqual = EnumArraysJustSymbolEnum._(r'>='); + static const dollar = EnumArraysJustSymbolEnum._(r'$'); + + /// List of all possible values in this [enum][EnumArraysJustSymbolEnum]. + static const values = [ + greaterThanEqual, + dollar, + ]; + + static EnumArraysJustSymbolEnum? fromJson(dynamic value) => EnumArraysJustSymbolEnumTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EnumArraysJustSymbolEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [EnumArraysJustSymbolEnum] to String, +/// and [decode] dynamic data back to [EnumArraysJustSymbolEnum]. +class EnumArraysJustSymbolEnumTypeTransformer { + factory EnumArraysJustSymbolEnumTypeTransformer() => _instance ??= const EnumArraysJustSymbolEnumTypeTransformer._(); + + const EnumArraysJustSymbolEnumTypeTransformer._(); + + String encode(EnumArraysJustSymbolEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a EnumArraysJustSymbolEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + EnumArraysJustSymbolEnum? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'>=': return EnumArraysJustSymbolEnum.greaterThanEqual; + case r'$': return EnumArraysJustSymbolEnum.dollar; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [EnumArraysJustSymbolEnumTypeTransformer] instance. + static EnumArraysJustSymbolEnumTypeTransformer? _instance; +} + + + +class EnumArraysArrayEnumEnum { + /// Instantiate a new enum with the provided [value]. + const EnumArraysArrayEnumEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const fish = EnumArraysArrayEnumEnum._(r'fish'); + static const crab = EnumArraysArrayEnumEnum._(r'crab'); + + /// List of all possible values in this [enum][EnumArraysArrayEnumEnum]. + static const values = [ + fish, + crab, + ]; + + static EnumArraysArrayEnumEnum? fromJson(dynamic value) => EnumArraysArrayEnumEnumTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EnumArraysArrayEnumEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [EnumArraysArrayEnumEnum] to String, +/// and [decode] dynamic data back to [EnumArraysArrayEnumEnum]. +class EnumArraysArrayEnumEnumTypeTransformer { + factory EnumArraysArrayEnumEnumTypeTransformer() => _instance ??= const EnumArraysArrayEnumEnumTypeTransformer._(); + + const EnumArraysArrayEnumEnumTypeTransformer._(); + + String encode(EnumArraysArrayEnumEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a EnumArraysArrayEnumEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + EnumArraysArrayEnumEnum? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'fish': return EnumArraysArrayEnumEnum.fish; + case r'crab': return EnumArraysArrayEnumEnum.crab; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [EnumArraysArrayEnumEnumTypeTransformer] instance. + static EnumArraysArrayEnumEnumTypeTransformer? _instance; +} + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/enum_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/enum_class.dart new file mode 100644 index 000000000000..584186d9a016 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/enum_class.dart @@ -0,0 +1,103 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class EnumClass { + /// Instantiate a new enum with the provided [value]. + const EnumClass._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const abc = EnumClass._(r'_abc'); + static const efg = EnumClass._(r'-efg'); + static const leftParenthesisXyzRightParenthesis = EnumClass._(r'(xyz)'); + static const test = EnumClass._(r'TEST'); + static const testA = EnumClass._(r'TEST_A'); + static const testAAbc = EnumClass._(r'TEST_A_ABC'); + static const tESTA = EnumClass._(r'TEST_a'); + static const tEST = EnumClass._(r'tEST'); + + /// List of all possible values in this [enum][EnumClass]. + static const values = [ + abc, + efg, + leftParenthesisXyzRightParenthesis, + test, + testA, + testAAbc, + tESTA, + tEST, + ]; + + static EnumClass? fromJson(dynamic value) => EnumClassTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EnumClass.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [EnumClass] to String, +/// and [decode] dynamic data back to [EnumClass]. +class EnumClassTypeTransformer { + factory EnumClassTypeTransformer() => _instance ??= const EnumClassTypeTransformer._(); + + const EnumClassTypeTransformer._(); + + String encode(EnumClass data) => data.value; + + /// Decodes a [dynamic value][data] to a EnumClass. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + EnumClass? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'_abc': return EnumClass.abc; + case r'-efg': return EnumClass.efg; + case r'(xyz)': return EnumClass.leftParenthesisXyzRightParenthesis; + case r'TEST': return EnumClass.test; + case r'TEST_A': return EnumClass.testA; + case r'TEST_A_ABC': return EnumClass.testAAbc; + case r'TEST_a': return EnumClass.tESTA; + case r'tEST': return EnumClass.tEST; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [EnumClassTypeTransformer] instance. + static EnumClassTypeTransformer? _instance; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/enum_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/enum_test.dart new file mode 100644 index 000000000000..bca1e2d81d44 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/enum_test.dart @@ -0,0 +1,506 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +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, + }); + + EnumTestEnumStringEnum? enumString; + + EnumTestEnumStringRequiredEnum enumStringRequired; + + EnumTestEnumIntegerEnum? enumInteger; + + EnumTestEnumNumberEnum? enumNumber; + + OuterEnum? outerEnum; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + OuterEnumInteger? outerEnumInteger; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + OuterEnumDefaultValue? outerEnumDefaultValue; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + 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 => + // ignore: unnecessary_parenthesis + (enumString == null ? 0 : enumString!.hashCode) + + (enumStringRequired.hashCode) + + (enumInteger == null ? 0 : enumInteger!.hashCode) + + (enumNumber == null ? 0 : enumNumber!.hashCode) + + (outerEnum == null ? 0 : outerEnum!.hashCode) + + (outerEnumInteger == null ? 0 : outerEnumInteger!.hashCode) + + (outerEnumDefaultValue == null ? 0 : outerEnumDefaultValue!.hashCode) + + (outerEnumIntegerDefaultValue == null ? 0 : outerEnumIntegerDefaultValue!.hashCode); + + @override + String toString() => 'EnumTest[enumString=$enumString, enumStringRequired=$enumStringRequired, enumInteger=$enumInteger, enumNumber=$enumNumber, outerEnum=$outerEnum, outerEnumInteger=$outerEnumInteger, outerEnumDefaultValue=$outerEnumDefaultValue, outerEnumIntegerDefaultValue=$outerEnumIntegerDefaultValue]'; + + Map toJson() { + final json = {}; + if (this.enumString != null) { + json[r'enum_string'] = this.enumString; + } else { + json[r'enum_string'] = null; + } + json[r'enum_string_required'] = this.enumStringRequired; + if (this.enumInteger != null) { + json[r'enum_integer'] = this.enumInteger; + } else { + json[r'enum_integer'] = null; + } + if (this.enumNumber != null) { + json[r'enum_number'] = this.enumNumber; + } else { + json[r'enum_number'] = null; + } + if (this.outerEnum != null) { + json[r'outerEnum'] = this.outerEnum; + } else { + json[r'outerEnum'] = null; + } + if (this.outerEnumInteger != null) { + json[r'outerEnumInteger'] = this.outerEnumInteger; + } else { + json[r'outerEnumInteger'] = null; + } + if (this.outerEnumDefaultValue != null) { + json[r'outerEnumDefaultValue'] = this.outerEnumDefaultValue; + } else { + json[r'outerEnumDefaultValue'] = null; + } + if (this.outerEnumIntegerDefaultValue != null) { + json[r'outerEnumIntegerDefaultValue'] = this.outerEnumIntegerDefaultValue; + } else { + json[r'outerEnumIntegerDefaultValue'] = null; + } + return json; + } + + /// Returns a new [EnumTest] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static EnumTest? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "EnumTest[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "EnumTest[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return EnumTest( + enumString: EnumTestEnumStringEnum.fromJson(json[r'enum_string']), + enumStringRequired: EnumTestEnumStringRequiredEnum.fromJson(json[r'enum_string_required'])!, + enumInteger: EnumTestEnumIntegerEnum.fromJson(json[r'enum_integer']), + enumNumber: EnumTestEnumNumberEnum.fromJson(json[r'enum_number']), + outerEnum: OuterEnum.fromJson(json[r'outerEnum']), + outerEnumInteger: OuterEnumInteger.fromJson(json[r'outerEnumInteger']), + outerEnumDefaultValue: OuterEnumDefaultValue.fromJson(json[r'outerEnumDefaultValue']), + outerEnumIntegerDefaultValue: OuterEnumIntegerDefaultValue.fromJson(json[r'outerEnumIntegerDefaultValue']), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EnumTest.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = EnumTest.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of EnumTest-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = EnumTest.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'enum_string_required', + }; +} + + +class EnumTestEnumStringEnum { + /// Instantiate a new enum with the provided [value]. + const EnumTestEnumStringEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const upper = EnumTestEnumStringEnum._(r'UPPER'); + static const lower = EnumTestEnumStringEnum._(r'lower'); + static const empty = EnumTestEnumStringEnum._(r''); + + /// List of all possible values in this [enum][EnumTestEnumStringEnum]. + static const values = [ + upper, + lower, + empty, + ]; + + static EnumTestEnumStringEnum? fromJson(dynamic value) => EnumTestEnumStringEnumTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EnumTestEnumStringEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [EnumTestEnumStringEnum] to String, +/// and [decode] dynamic data back to [EnumTestEnumStringEnum]. +class EnumTestEnumStringEnumTypeTransformer { + factory EnumTestEnumStringEnumTypeTransformer() => _instance ??= const EnumTestEnumStringEnumTypeTransformer._(); + + const EnumTestEnumStringEnumTypeTransformer._(); + + String encode(EnumTestEnumStringEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a EnumTestEnumStringEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + EnumTestEnumStringEnum? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'UPPER': return EnumTestEnumStringEnum.upper; + case r'lower': return EnumTestEnumStringEnum.lower; + case r'': return EnumTestEnumStringEnum.empty; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [EnumTestEnumStringEnumTypeTransformer] instance. + static EnumTestEnumStringEnumTypeTransformer? _instance; +} + + + +class EnumTestEnumStringRequiredEnum { + /// Instantiate a new enum with the provided [value]. + const EnumTestEnumStringRequiredEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const upper = EnumTestEnumStringRequiredEnum._(r'UPPER'); + static const lower = EnumTestEnumStringRequiredEnum._(r'lower'); + static const empty = EnumTestEnumStringRequiredEnum._(r''); + + /// List of all possible values in this [enum][EnumTestEnumStringRequiredEnum]. + static const values = [ + upper, + lower, + empty, + ]; + + static EnumTestEnumStringRequiredEnum? fromJson(dynamic value) => EnumTestEnumStringRequiredEnumTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EnumTestEnumStringRequiredEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [EnumTestEnumStringRequiredEnum] to String, +/// and [decode] dynamic data back to [EnumTestEnumStringRequiredEnum]. +class EnumTestEnumStringRequiredEnumTypeTransformer { + factory EnumTestEnumStringRequiredEnumTypeTransformer() => _instance ??= const EnumTestEnumStringRequiredEnumTypeTransformer._(); + + const EnumTestEnumStringRequiredEnumTypeTransformer._(); + + String encode(EnumTestEnumStringRequiredEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a EnumTestEnumStringRequiredEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + EnumTestEnumStringRequiredEnum? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'UPPER': return EnumTestEnumStringRequiredEnum.upper; + case r'lower': return EnumTestEnumStringRequiredEnum.lower; + case r'': return EnumTestEnumStringRequiredEnum.empty; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [EnumTestEnumStringRequiredEnumTypeTransformer] instance. + static EnumTestEnumStringRequiredEnumTypeTransformer? _instance; +} + + + +class EnumTestEnumIntegerEnum { + /// Instantiate a new enum with the provided [value]. + const EnumTestEnumIntegerEnum._(this.value); + + /// The underlying value of this enum member. + final int value; + + @override + String toString() => value.toString(); + + int toJson() => value; + + static const number1 = EnumTestEnumIntegerEnum._(1); + static const numberNegative1 = EnumTestEnumIntegerEnum._(-1); + + /// List of all possible values in this [enum][EnumTestEnumIntegerEnum]. + static const values = [ + number1, + numberNegative1, + ]; + + static EnumTestEnumIntegerEnum? fromJson(dynamic value) => EnumTestEnumIntegerEnumTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EnumTestEnumIntegerEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [EnumTestEnumIntegerEnum] to int, +/// and [decode] dynamic data back to [EnumTestEnumIntegerEnum]. +class EnumTestEnumIntegerEnumTypeTransformer { + factory EnumTestEnumIntegerEnumTypeTransformer() => _instance ??= const EnumTestEnumIntegerEnumTypeTransformer._(); + + const EnumTestEnumIntegerEnumTypeTransformer._(); + + int encode(EnumTestEnumIntegerEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a EnumTestEnumIntegerEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + EnumTestEnumIntegerEnum? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case 1: return EnumTestEnumIntegerEnum.number1; + case -1: return EnumTestEnumIntegerEnum.numberNegative1; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [EnumTestEnumIntegerEnumTypeTransformer] instance. + static EnumTestEnumIntegerEnumTypeTransformer? _instance; +} + + + +class EnumTestEnumNumberEnum { + /// Instantiate a new enum with the provided [value]. + const EnumTestEnumNumberEnum._(this.value); + + /// The underlying value of this enum member. + final double value; + + @override + String toString() => value.toString(); + + double toJson() => value; + + static const number1Period1 = EnumTestEnumNumberEnum._('1.1'); + static const numberNegative1Period2 = EnumTestEnumNumberEnum._('-1.2'); + + /// List of all possible values in this [enum][EnumTestEnumNumberEnum]. + static const values = [ + number1Period1, + numberNegative1Period2, + ]; + + static EnumTestEnumNumberEnum? fromJson(dynamic value) => EnumTestEnumNumberEnumTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = EnumTestEnumNumberEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [EnumTestEnumNumberEnum] to double, +/// and [decode] dynamic data back to [EnumTestEnumNumberEnum]. +class EnumTestEnumNumberEnumTypeTransformer { + factory EnumTestEnumNumberEnumTypeTransformer() => _instance ??= const EnumTestEnumNumberEnumTypeTransformer._(); + + const EnumTestEnumNumberEnumTypeTransformer._(); + + double encode(EnumTestEnumNumberEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a EnumTestEnumNumberEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + EnumTestEnumNumberEnum? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case '1.1': return EnumTestEnumNumberEnum.number1Period1; + case '-1.2': return EnumTestEnumNumberEnum.numberNegative1Period2; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [EnumTestEnumNumberEnumTypeTransformer] instance. + static EnumTestEnumNumberEnumTypeTransformer? _instance; +} + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/fake_big_decimal_map200_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/fake_big_decimal_map200_response.dart new file mode 100644 index 000000000000..55de1b12e981 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/fake_big_decimal_map200_response.dart @@ -0,0 +1,125 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class FakeBigDecimalMap200Response { + /// Returns a new [FakeBigDecimalMap200Response] instance. + FakeBigDecimalMap200Response({ + this.someId, + this.someMap = const {}, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + num? someId; + + Map someMap; + + @override + bool operator ==(Object other) => identical(this, other) || other is FakeBigDecimalMap200Response && + other.someId == someId && + _deepEquality.equals(other.someMap, someMap); + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (someId == null ? 0 : someId!.hashCode) + + (someMap.hashCode); + + @override + String toString() => 'FakeBigDecimalMap200Response[someId=$someId, someMap=$someMap]'; + + Map toJson() { + final json = {}; + if (this.someId != null) { + json[r'someId'] = this.someId; + } else { + json[r'someId'] = null; + } + json[r'someMap'] = this.someMap; + return json; + } + + /// Returns a new [FakeBigDecimalMap200Response] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static FakeBigDecimalMap200Response? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "FakeBigDecimalMap200Response[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "FakeBigDecimalMap200Response[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return FakeBigDecimalMap200Response( + someId: num.parse('${json[r'someId']}'), + someMap: mapCastOfType(json, r'someMap') ?? const {}, + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = FakeBigDecimalMap200Response.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = FakeBigDecimalMap200Response.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of FakeBigDecimalMap200Response-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = FakeBigDecimalMap200Response.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/file_schema_test_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/file_schema_test_class.dart new file mode 100644 index 000000000000..ff956bc14916 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/file_schema_test_class.dart @@ -0,0 +1,125 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class FileSchemaTestClass { + /// Returns a new [FileSchemaTestClass] instance. + FileSchemaTestClass({ + this.file, + this.files = const [], + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + ModelFile? file; + + List files; + + @override + bool operator ==(Object other) => identical(this, other) || other is FileSchemaTestClass && + other.file == file && + _deepEquality.equals(other.files, files); + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (file == null ? 0 : file!.hashCode) + + (files.hashCode); + + @override + String toString() => 'FileSchemaTestClass[file=$file, files=$files]'; + + Map toJson() { + final json = {}; + if (this.file != null) { + json[r'file'] = this.file; + } else { + json[r'file'] = null; + } + json[r'files'] = this.files; + return json; + } + + /// Returns a new [FileSchemaTestClass] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static FileSchemaTestClass? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "FileSchemaTestClass[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "FileSchemaTestClass[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return FileSchemaTestClass( + file: ModelFile.fromJson(json[r'file']), + files: ModelFile.listFromJson(json[r'files']), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = FileSchemaTestClass.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = FileSchemaTestClass.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of FileSchemaTestClass-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = FileSchemaTestClass.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/foo.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/foo.dart new file mode 100644 index 000000000000..6334191a11e8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/foo.dart @@ -0,0 +1,108 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Foo { + /// Returns a new [Foo] instance. + Foo({ + this.bar = 'bar', + }); + + String bar; + + @override + bool operator ==(Object other) => identical(this, other) || other is Foo && + other.bar == bar; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (bar.hashCode); + + @override + String toString() => 'Foo[bar=$bar]'; + + Map toJson() { + final json = {}; + json[r'bar'] = this.bar; + return json; + } + + /// Returns a new [Foo] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static Foo? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Foo[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Foo[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Foo( + bar: mapValueOfType(json, r'bar') ?? 'bar', + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Foo.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Foo.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of Foo-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = Foo.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/foo_get_default_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/foo_get_default_response.dart new file mode 100644 index 000000000000..1d562914d307 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/foo_get_default_response.dart @@ -0,0 +1,118 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class FooGetDefaultResponse { + /// Returns a new [FooGetDefaultResponse] instance. + FooGetDefaultResponse({ + this.string, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + Foo? string; + + @override + bool operator ==(Object other) => identical(this, other) || other is FooGetDefaultResponse && + other.string == string; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (string == null ? 0 : string!.hashCode); + + @override + String toString() => 'FooGetDefaultResponse[string=$string]'; + + Map toJson() { + final json = {}; + if (this.string != null) { + json[r'string'] = this.string; + } else { + json[r'string'] = null; + } + return json; + } + + /// Returns a new [FooGetDefaultResponse] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static FooGetDefaultResponse? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "FooGetDefaultResponse[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "FooGetDefaultResponse[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return FooGetDefaultResponse( + string: Foo.fromJson(json[r'string']), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = FooGetDefaultResponse.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = FooGetDefaultResponse.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of FooGetDefaultResponse-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = FooGetDefaultResponse.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/format_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/format_test.dart new file mode 100644 index 000000000000..b0edc2e38e14 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/format_test.dart @@ -0,0 +1,349 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +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 value: 10 + /// Maximum value: 100 + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? integer; + + /// Minimum value: 20 + /// Maximum value: 200 + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? int32; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? int64; + + /// Minimum value: 32.1 + /// Maximum value: 543.2 + num number; + + /// Minimum value: 54.3 + /// Maximum value: 987.6 + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + double? float; + + /// Minimum value: 67.8 + /// Maximum value: 123.4 + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + double? double_; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + double? decimal; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? string; + + String byte; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + MultipartFile? binary; + + DateTime date; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + DateTime? dateTime; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? uuid; + + String password; + + /// A string that is a 10 digit number. Can have leading zeros. + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? patternWithDigits; + + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + 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 => + // ignore: unnecessary_parenthesis + (integer == null ? 0 : integer!.hashCode) + + (int32 == null ? 0 : int32!.hashCode) + + (int64 == null ? 0 : int64!.hashCode) + + (number.hashCode) + + (float == null ? 0 : float!.hashCode) + + (double_ == null ? 0 : double_!.hashCode) + + (decimal == null ? 0 : decimal!.hashCode) + + (string == null ? 0 : string!.hashCode) + + (byte.hashCode) + + (binary == null ? 0 : binary!.hashCode) + + (date.hashCode) + + (dateTime == null ? 0 : dateTime!.hashCode) + + (uuid == null ? 0 : uuid!.hashCode) + + (password.hashCode) + + (patternWithDigits == null ? 0 : patternWithDigits!.hashCode) + + (patternWithDigitsAndDelimiter == null ? 0 : patternWithDigitsAndDelimiter!.hashCode); + + @override + String toString() => 'FormatTest[integer=$integer, int32=$int32, int64=$int64, number=$number, float=$float, double_=$double_, decimal=$decimal, string=$string, byte=$byte, binary=$binary, date=$date, dateTime=$dateTime, uuid=$uuid, password=$password, patternWithDigits=$patternWithDigits, patternWithDigitsAndDelimiter=$patternWithDigitsAndDelimiter]'; + + Map toJson() { + final json = {}; + if (this.integer != null) { + json[r'integer'] = this.integer; + } else { + json[r'integer'] = null; + } + if (this.int32 != null) { + json[r'int32'] = this.int32; + } else { + json[r'int32'] = null; + } + if (this.int64 != null) { + json[r'int64'] = this.int64; + } else { + json[r'int64'] = null; + } + json[r'number'] = this.number; + if (this.float != null) { + json[r'float'] = this.float; + } else { + json[r'float'] = null; + } + if (this.double_ != null) { + json[r'double'] = this.double_; + } else { + json[r'double'] = null; + } + if (this.decimal != null) { + json[r'decimal'] = this.decimal; + } else { + json[r'decimal'] = null; + } + if (this.string != null) { + json[r'string'] = this.string; + } else { + json[r'string'] = null; + } + json[r'byte'] = this.byte; + if (this.binary != null) { + json[r'binary'] = this.binary; + } else { + json[r'binary'] = null; + } + json[r'date'] = _dateFormatter.format(this.date.toUtc()); + if (this.dateTime != null) { + json[r'dateTime'] = this.dateTime!.toUtc().toIso8601String(); + } else { + json[r'dateTime'] = null; + } + if (this.uuid != null) { + json[r'uuid'] = this.uuid; + } else { + json[r'uuid'] = null; + } + json[r'password'] = this.password; + if (this.patternWithDigits != null) { + json[r'pattern_with_digits'] = this.patternWithDigits; + } else { + json[r'pattern_with_digits'] = null; + } + if (this.patternWithDigitsAndDelimiter != null) { + json[r'pattern_with_digits_and_delimiter'] = this.patternWithDigitsAndDelimiter; + } else { + json[r'pattern_with_digits_and_delimiter'] = null; + } + return json; + } + + /// Returns a new [FormatTest] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static FormatTest? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "FormatTest[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "FormatTest[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return FormatTest( + integer: mapValueOfType(json, r'integer'), + int32: mapValueOfType(json, r'int32'), + int64: mapValueOfType(json, r'int64'), + number: num.parse('${json[r'number']}'), + float: mapValueOfType(json, r'float'), + double_: mapValueOfType(json, r'double'), + decimal: mapValueOfType(json, r'decimal'), + string: mapValueOfType(json, r'string'), + byte: mapValueOfType(json, r'byte')!, + binary: null, // No support for decoding binary content from JSON + date: mapDateTime(json, r'date', r'')!, + dateTime: mapDateTime(json, r'dateTime', r''), + uuid: mapValueOfType(json, r'uuid'), + password: mapValueOfType(json, r'password')!, + patternWithDigits: mapValueOfType(json, r'pattern_with_digits'), + patternWithDigitsAndDelimiter: mapValueOfType(json, r'pattern_with_digits_and_delimiter'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = FormatTest.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = FormatTest.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of FormatTest-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = FormatTest.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'number', + 'byte', + 'date', + 'password', + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/has_only_read_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/has_only_read_only.dart new file mode 100644 index 000000000000..6a753c10fee5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/has_only_read_only.dart @@ -0,0 +1,135 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class HasOnlyReadOnly { + /// Returns a new [HasOnlyReadOnly] instance. + HasOnlyReadOnly({ + this.bar, + this.foo, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? bar; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? foo; + + @override + bool operator ==(Object other) => identical(this, other) || other is HasOnlyReadOnly && + other.bar == bar && + other.foo == foo; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (bar == null ? 0 : bar!.hashCode) + + (foo == null ? 0 : foo!.hashCode); + + @override + String toString() => 'HasOnlyReadOnly[bar=$bar, foo=$foo]'; + + Map toJson() { + final json = {}; + if (this.bar != null) { + json[r'bar'] = this.bar; + } else { + json[r'bar'] = null; + } + if (this.foo != null) { + json[r'foo'] = this.foo; + } else { + json[r'foo'] = null; + } + return json; + } + + /// Returns a new [HasOnlyReadOnly] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static HasOnlyReadOnly? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "HasOnlyReadOnly[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "HasOnlyReadOnly[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return HasOnlyReadOnly( + bar: mapValueOfType(json, r'bar'), + foo: mapValueOfType(json, r'foo'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = HasOnlyReadOnly.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = HasOnlyReadOnly.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of HasOnlyReadOnly-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = HasOnlyReadOnly.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/health_check_result.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/health_check_result.dart new file mode 100644 index 000000000000..b3a3f7cb8e0f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/health_check_result.dart @@ -0,0 +1,112 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class HealthCheckResult { + /// Returns a new [HealthCheckResult] instance. + HealthCheckResult({ + this.nullableMessage, + }); + + String? nullableMessage; + + @override + bool operator ==(Object other) => identical(this, other) || other is HealthCheckResult && + other.nullableMessage == nullableMessage; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (nullableMessage == null ? 0 : nullableMessage!.hashCode); + + @override + String toString() => 'HealthCheckResult[nullableMessage=$nullableMessage]'; + + Map toJson() { + final json = {}; + if (this.nullableMessage != null) { + json[r'NullableMessage'] = this.nullableMessage; + } else { + json[r'NullableMessage'] = null; + } + return json; + } + + /// Returns a new [HealthCheckResult] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static HealthCheckResult? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "HealthCheckResult[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "HealthCheckResult[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return HealthCheckResult( + nullableMessage: mapValueOfType(json, r'NullableMessage'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = HealthCheckResult.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = HealthCheckResult.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of HealthCheckResult-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = HealthCheckResult.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/map_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/map_test.dart new file mode 100644 index 000000000000..a0a7241e6889 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/map_test.dart @@ -0,0 +1,203 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class MapTest { + /// Returns a new [MapTest] instance. + MapTest({ + this.mapMapOfString = const {}, + this.mapOfEnumString = const {}, + this.directMap = const {}, + this.indirectMap = const {}, + }); + + Map> mapMapOfString; + + Map mapOfEnumString; + + Map directMap; + + Map indirectMap; + + @override + bool operator ==(Object other) => identical(this, other) || other is MapTest && + _deepEquality.equals(other.mapMapOfString, mapMapOfString) && + _deepEquality.equals(other.mapOfEnumString, mapOfEnumString) && + _deepEquality.equals(other.directMap, directMap) && + _deepEquality.equals(other.indirectMap, indirectMap); + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (mapMapOfString.hashCode) + + (mapOfEnumString.hashCode) + + (directMap.hashCode) + + (indirectMap.hashCode); + + @override + String toString() => 'MapTest[mapMapOfString=$mapMapOfString, mapOfEnumString=$mapOfEnumString, directMap=$directMap, indirectMap=$indirectMap]'; + + Map toJson() { + final json = {}; + json[r'map_map_of_string'] = this.mapMapOfString; + json[r'map_of_enum_string'] = this.mapOfEnumString; + json[r'direct_map'] = this.directMap; + json[r'indirect_map'] = this.indirectMap; + return json; + } + + /// Returns a new [MapTest] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static MapTest? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "MapTest[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "MapTest[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return MapTest( + mapMapOfString: mapCastOfType(json, r'map_map_of_string') ?? const {}, + mapOfEnumString: mapCastOfType(json, r'map_of_enum_string') ?? const {}, + directMap: mapCastOfType(json, r'direct_map') ?? const {}, + indirectMap: mapCastOfType(json, r'indirect_map') ?? const {}, + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = MapTest.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = MapTest.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of MapTest-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = MapTest.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + + +class MapTestMapOfEnumStringEnum { + /// Instantiate a new enum with the provided [value]. + const MapTestMapOfEnumStringEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const upper = MapTestMapOfEnumStringEnum._(r'UPPER'); + static const lower = MapTestMapOfEnumStringEnum._(r'lower'); + + /// List of all possible values in this [enum][MapTestMapOfEnumStringEnum]. + static const values = [ + upper, + lower, + ]; + + static MapTestMapOfEnumStringEnum? fromJson(dynamic value) => MapTestMapOfEnumStringEnumTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = MapTestMapOfEnumStringEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [MapTestMapOfEnumStringEnum] to String, +/// and [decode] dynamic data back to [MapTestMapOfEnumStringEnum]. +class MapTestMapOfEnumStringEnumTypeTransformer { + factory MapTestMapOfEnumStringEnumTypeTransformer() => _instance ??= const MapTestMapOfEnumStringEnumTypeTransformer._(); + + const MapTestMapOfEnumStringEnumTypeTransformer._(); + + String encode(MapTestMapOfEnumStringEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a MapTestMapOfEnumStringEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + MapTestMapOfEnumStringEnum? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'UPPER': return MapTestMapOfEnumStringEnum.upper; + case r'lower': return MapTestMapOfEnumStringEnum.lower; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [MapTestMapOfEnumStringEnumTypeTransformer] instance. + static MapTestMapOfEnumStringEnumTypeTransformer? _instance; +} + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/mixed_properties_and_additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/mixed_properties_and_additional_properties_class.dart new file mode 100644 index 000000000000..edc224b79248 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/mixed_properties_and_additional_properties_class.dart @@ -0,0 +1,142 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class MixedPropertiesAndAdditionalPropertiesClass { + /// Returns a new [MixedPropertiesAndAdditionalPropertiesClass] instance. + MixedPropertiesAndAdditionalPropertiesClass({ + this.uuid, + this.dateTime, + this.map = const {}, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? uuid; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + DateTime? dateTime; + + Map map; + + @override + bool operator ==(Object other) => identical(this, other) || other is MixedPropertiesAndAdditionalPropertiesClass && + other.uuid == uuid && + other.dateTime == dateTime && + _deepEquality.equals(other.map, map); + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (uuid == null ? 0 : uuid!.hashCode) + + (dateTime == null ? 0 : dateTime!.hashCode) + + (map.hashCode); + + @override + String toString() => 'MixedPropertiesAndAdditionalPropertiesClass[uuid=$uuid, dateTime=$dateTime, map=$map]'; + + Map toJson() { + final json = {}; + if (this.uuid != null) { + json[r'uuid'] = this.uuid; + } else { + json[r'uuid'] = null; + } + if (this.dateTime != null) { + json[r'dateTime'] = this.dateTime!.toUtc().toIso8601String(); + } else { + json[r'dateTime'] = null; + } + json[r'map'] = this.map; + return json; + } + + /// Returns a new [MixedPropertiesAndAdditionalPropertiesClass] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static MixedPropertiesAndAdditionalPropertiesClass? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "MixedPropertiesAndAdditionalPropertiesClass[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "MixedPropertiesAndAdditionalPropertiesClass[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return MixedPropertiesAndAdditionalPropertiesClass( + uuid: mapValueOfType(json, r'uuid'), + dateTime: mapDateTime(json, r'dateTime', r''), + map: Animal.mapFromJson(json[r'map']), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = MixedPropertiesAndAdditionalPropertiesClass.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = MixedPropertiesAndAdditionalPropertiesClass.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of MixedPropertiesAndAdditionalPropertiesClass-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = MixedPropertiesAndAdditionalPropertiesClass.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/model200_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/model200_response.dart new file mode 100644 index 000000000000..2dd008e72e26 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/model200_response.dart @@ -0,0 +1,135 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Model200Response { + /// Returns a new [Model200Response] instance. + Model200Response({ + this.name, + this.class_, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? name; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? class_; + + @override + bool operator ==(Object other) => identical(this, other) || other is Model200Response && + other.name == name && + other.class_ == class_; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (name == null ? 0 : name!.hashCode) + + (class_ == null ? 0 : class_!.hashCode); + + @override + String toString() => 'Model200Response[name=$name, class_=$class_]'; + + Map toJson() { + final json = {}; + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; + } + if (this.class_ != null) { + json[r'class'] = this.class_; + } else { + json[r'class'] = null; + } + return json; + } + + /// Returns a new [Model200Response] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static Model200Response? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Model200Response[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Model200Response[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Model200Response( + name: mapValueOfType(json, r'name'), + class_: mapValueOfType(json, r'class'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Model200Response.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Model200Response.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of Model200Response-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = Model200Response.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/model_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/model_client.dart new file mode 100644 index 000000000000..15f48a054876 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/model_client.dart @@ -0,0 +1,118 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ModelClient { + /// Returns a new [ModelClient] instance. + ModelClient({ + this.client, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? client; + + @override + bool operator ==(Object other) => identical(this, other) || other is ModelClient && + other.client == client; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (client == null ? 0 : client!.hashCode); + + @override + String toString() => 'ModelClient[client=$client]'; + + Map toJson() { + final json = {}; + if (this.client != null) { + json[r'client'] = this.client; + } else { + json[r'client'] = null; + } + return json; + } + + /// Returns a new [ModelClient] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ModelClient? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ModelClient[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ModelClient[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ModelClient( + client: mapValueOfType(json, r'client'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ModelClient.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ModelClient.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ModelClient-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ModelClient.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/model_file.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/model_file.dart new file mode 100644 index 000000000000..5183e0f98e49 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/model_file.dart @@ -0,0 +1,119 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ModelFile { + /// Returns a new [ModelFile] instance. + ModelFile({ + this.sourceURI, + }); + + /// Test capitalization + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? sourceURI; + + @override + bool operator ==(Object other) => identical(this, other) || other is ModelFile && + other.sourceURI == sourceURI; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (sourceURI == null ? 0 : sourceURI!.hashCode); + + @override + String toString() => 'ModelFile[sourceURI=$sourceURI]'; + + Map toJson() { + final json = {}; + if (this.sourceURI != null) { + json[r'sourceURI'] = this.sourceURI; + } else { + json[r'sourceURI'] = null; + } + return json; + } + + /// Returns a new [ModelFile] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ModelFile? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ModelFile[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ModelFile[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ModelFile( + sourceURI: mapValueOfType(json, r'sourceURI'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ModelFile.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ModelFile.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ModelFile-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ModelFile.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/model_list.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/model_list.dart new file mode 100644 index 000000000000..40a2767daa8b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/model_list.dart @@ -0,0 +1,118 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ModelList { + /// Returns a new [ModelList] instance. + ModelList({ + this.n123list, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? n123list; + + @override + bool operator ==(Object other) => identical(this, other) || other is ModelList && + other.n123list == n123list; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (n123list == null ? 0 : n123list!.hashCode); + + @override + String toString() => 'ModelList[n123list=$n123list]'; + + Map toJson() { + final json = {}; + if (this.n123list != null) { + json[r'123-list'] = this.n123list; + } else { + json[r'123-list'] = null; + } + return json; + } + + /// Returns a new [ModelList] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ModelList? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ModelList[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ModelList[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ModelList( + n123list: mapValueOfType(json, r'123-list'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ModelList.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ModelList.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ModelList-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ModelList.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/model_return.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/model_return.dart new file mode 100644 index 000000000000..610500530533 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/model_return.dart @@ -0,0 +1,118 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ModelReturn { + /// Returns a new [ModelReturn] instance. + ModelReturn({ + this.return_, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? return_; + + @override + bool operator ==(Object other) => identical(this, other) || other is ModelReturn && + other.return_ == return_; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (return_ == null ? 0 : return_!.hashCode); + + @override + String toString() => 'ModelReturn[return_=$return_]'; + + Map toJson() { + final json = {}; + if (this.return_ != null) { + json[r'return'] = this.return_; + } else { + json[r'return'] = null; + } + return json; + } + + /// Returns a new [ModelReturn] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ModelReturn? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ModelReturn[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ModelReturn[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ModelReturn( + return_: mapValueOfType(json, r'return'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ModelReturn.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ModelReturn.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ModelReturn-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ModelReturn.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/name.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/name.dart new file mode 100644 index 000000000000..7d366892b58c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/name.dart @@ -0,0 +1,160 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Name { + /// Returns a new [Name] instance. + Name({ + required this.name, + this.snakeCase, + this.property, + this.n123number, + }); + + int name; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? snakeCase; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? property; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + 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 => + // ignore: unnecessary_parenthesis + (name.hashCode) + + (snakeCase == null ? 0 : snakeCase!.hashCode) + + (property == null ? 0 : property!.hashCode) + + (n123number == null ? 0 : n123number!.hashCode); + + @override + String toString() => 'Name[name=$name, snakeCase=$snakeCase, property=$property, n123number=$n123number]'; + + Map toJson() { + final json = {}; + json[r'name'] = this.name; + if (this.snakeCase != null) { + json[r'snake_case'] = this.snakeCase; + } else { + json[r'snake_case'] = null; + } + if (this.property != null) { + json[r'property'] = this.property; + } else { + json[r'property'] = null; + } + if (this.n123number != null) { + json[r'123Number'] = this.n123number; + } else { + json[r'123Number'] = null; + } + return json; + } + + /// Returns a new [Name] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static Name? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Name[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Name[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Name( + name: mapValueOfType(json, r'name')!, + snakeCase: mapValueOfType(json, r'snake_case'), + property: mapValueOfType(json, r'property'), + n123number: mapValueOfType(json, r'123Number'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Name.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Name.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of Name-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = Name.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'name', + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/nullable_class.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/nullable_class.dart new file mode 100644 index 000000000000..25e70c05d92b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/nullable_class.dart @@ -0,0 +1,227 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class NullableClass { + /// Returns a new [NullableClass] instance. + NullableClass({ + this.integerProp, + this.numberProp, + this.booleanProp, + this.stringProp, + this.dateProp, + this.datetimeProp, + this.arrayNullableProp = const [], + this.arrayAndItemsNullableProp = const [], + this.arrayItemsNullable = const [], + this.objectNullableProp = const {}, + this.objectAndItemsNullableProp = const {}, + this.objectItemsNullable = const {}, + }); + + int? integerProp; + + num? numberProp; + + bool? booleanProp; + + String? stringProp; + + DateTime? dateProp; + + DateTime? datetimeProp; + + List? arrayNullableProp; + + List? arrayAndItemsNullableProp; + + List arrayItemsNullable; + + Map? objectNullableProp; + + Map? objectAndItemsNullableProp; + + 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 && + _deepEquality.equals(other.arrayNullableProp, arrayNullableProp) && + _deepEquality.equals(other.arrayAndItemsNullableProp, arrayAndItemsNullableProp) && + _deepEquality.equals(other.arrayItemsNullable, arrayItemsNullable) && + _deepEquality.equals(other.objectNullableProp, objectNullableProp) && + _deepEquality.equals(other.objectAndItemsNullableProp, objectAndItemsNullableProp) && + _deepEquality.equals(other.objectItemsNullable, objectItemsNullable); + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (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); + + @override + String toString() => 'NullableClass[integerProp=$integerProp, numberProp=$numberProp, booleanProp=$booleanProp, stringProp=$stringProp, dateProp=$dateProp, datetimeProp=$datetimeProp, arrayNullableProp=$arrayNullableProp, arrayAndItemsNullableProp=$arrayAndItemsNullableProp, arrayItemsNullable=$arrayItemsNullable, objectNullableProp=$objectNullableProp, objectAndItemsNullableProp=$objectAndItemsNullableProp, objectItemsNullable=$objectItemsNullable]'; + + Map toJson() { + final json = {}; + if (this.integerProp != null) { + json[r'integer_prop'] = this.integerProp; + } else { + json[r'integer_prop'] = null; + } + if (this.numberProp != null) { + json[r'number_prop'] = this.numberProp; + } else { + json[r'number_prop'] = null; + } + if (this.booleanProp != null) { + json[r'boolean_prop'] = this.booleanProp; + } else { + json[r'boolean_prop'] = null; + } + if (this.stringProp != null) { + json[r'string_prop'] = this.stringProp; + } else { + json[r'string_prop'] = null; + } + if (this.dateProp != null) { + json[r'date_prop'] = _dateFormatter.format(this.dateProp!.toUtc()); + } else { + json[r'date_prop'] = null; + } + if (this.datetimeProp != null) { + json[r'datetime_prop'] = this.datetimeProp!.toUtc().toIso8601String(); + } else { + json[r'datetime_prop'] = null; + } + if (this.arrayNullableProp != null) { + json[r'array_nullable_prop'] = this.arrayNullableProp; + } else { + json[r'array_nullable_prop'] = null; + } + if (this.arrayAndItemsNullableProp != null) { + json[r'array_and_items_nullable_prop'] = this.arrayAndItemsNullableProp; + } else { + json[r'array_and_items_nullable_prop'] = null; + } + json[r'array_items_nullable'] = this.arrayItemsNullable; + if (this.objectNullableProp != null) { + json[r'object_nullable_prop'] = this.objectNullableProp; + } else { + json[r'object_nullable_prop'] = null; + } + if (this.objectAndItemsNullableProp != null) { + json[r'object_and_items_nullable_prop'] = this.objectAndItemsNullableProp; + } else { + json[r'object_and_items_nullable_prop'] = null; + } + json[r'object_items_nullable'] = this.objectItemsNullable; + return json; + } + + /// Returns a new [NullableClass] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static NullableClass? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "NullableClass[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "NullableClass[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return NullableClass( + integerProp: mapValueOfType(json, r'integer_prop'), + numberProp: json[r'number_prop'] == null + ? null + : num.parse('${json[r'number_prop']}'), + booleanProp: mapValueOfType(json, r'boolean_prop'), + stringProp: mapValueOfType(json, r'string_prop'), + dateProp: mapDateTime(json, r'date_prop', r''), + datetimeProp: mapDateTime(json, r'datetime_prop', r''), + arrayNullableProp: Object.listFromJson(json[r'array_nullable_prop']), + arrayAndItemsNullableProp: Object.listFromJson(json[r'array_and_items_nullable_prop']), + arrayItemsNullable: Object.listFromJson(json[r'array_items_nullable']), + objectNullableProp: mapCastOfType(json, r'object_nullable_prop') ?? const {}, + objectAndItemsNullableProp: mapCastOfType(json, r'object_and_items_nullable_prop') ?? const {}, + objectItemsNullable: mapCastOfType(json, r'object_items_nullable') ?? const {}, + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = NullableClass.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = NullableClass.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of NullableClass-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = NullableClass.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/number_only.dart new file mode 100644 index 000000000000..a27a5682533e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/number_only.dart @@ -0,0 +1,118 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class NumberOnly { + /// Returns a new [NumberOnly] instance. + NumberOnly({ + this.justNumber, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + num? justNumber; + + @override + bool operator ==(Object other) => identical(this, other) || other is NumberOnly && + other.justNumber == justNumber; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (justNumber == null ? 0 : justNumber!.hashCode); + + @override + String toString() => 'NumberOnly[justNumber=$justNumber]'; + + Map toJson() { + final json = {}; + if (this.justNumber != null) { + json[r'JustNumber'] = this.justNumber; + } else { + json[r'JustNumber'] = null; + } + return json; + } + + /// Returns a new [NumberOnly] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static NumberOnly? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "NumberOnly[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "NumberOnly[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return NumberOnly( + justNumber: num.parse('${json[r'JustNumber']}'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = NumberOnly.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = NumberOnly.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of NumberOnly-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = NumberOnly.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/object_with_deprecated_fields.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/object_with_deprecated_fields.dart new file mode 100644 index 000000000000..5c7386821aa3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/object_with_deprecated_fields.dart @@ -0,0 +1,161 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ObjectWithDeprecatedFields { + /// Returns a new [ObjectWithDeprecatedFields] instance. + ObjectWithDeprecatedFields({ + this.uuid, + this.id, + this.deprecatedRef, + this.bars = const [], + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? uuid; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + num? id; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + DeprecatedObject? deprecatedRef; + + List bars; + + @override + bool operator ==(Object other) => identical(this, other) || other is ObjectWithDeprecatedFields && + other.uuid == uuid && + other.id == id && + other.deprecatedRef == deprecatedRef && + _deepEquality.equals(other.bars, bars); + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (uuid == null ? 0 : uuid!.hashCode) + + (id == null ? 0 : id!.hashCode) + + (deprecatedRef == null ? 0 : deprecatedRef!.hashCode) + + (bars.hashCode); + + @override + String toString() => 'ObjectWithDeprecatedFields[uuid=$uuid, id=$id, deprecatedRef=$deprecatedRef, bars=$bars]'; + + Map toJson() { + final json = {}; + if (this.uuid != null) { + json[r'uuid'] = this.uuid; + } else { + json[r'uuid'] = null; + } + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; + } + if (this.deprecatedRef != null) { + json[r'deprecatedRef'] = this.deprecatedRef; + } else { + json[r'deprecatedRef'] = null; + } + json[r'bars'] = this.bars; + return json; + } + + /// Returns a new [ObjectWithDeprecatedFields] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ObjectWithDeprecatedFields? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ObjectWithDeprecatedFields[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ObjectWithDeprecatedFields[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ObjectWithDeprecatedFields( + uuid: mapValueOfType(json, r'uuid'), + id: num.parse('${json[r'id']}'), + deprecatedRef: DeprecatedObject.fromJson(json[r'deprecatedRef']), + bars: json[r'bars'] is Iterable + ? (json[r'bars'] as Iterable).cast().toList(growable: false) + : const [], + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ObjectWithDeprecatedFields.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ObjectWithDeprecatedFields.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ObjectWithDeprecatedFields-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ObjectWithDeprecatedFields.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/order.dart new file mode 100644 index 000000000000..bc591de9fab9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/order.dart @@ -0,0 +1,265 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Order { + /// Returns a new [Order] instance. + Order({ + this.id, + this.petId, + this.quantity, + this.shipDate, + this.status, + this.complete = false, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? id; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? petId; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? quantity; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + DateTime? shipDate; + + /// Order Status + OrderStatusEnum? status; + + 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 => + // ignore: unnecessary_parenthesis + (id == null ? 0 : id!.hashCode) + + (petId == null ? 0 : petId!.hashCode) + + (quantity == null ? 0 : quantity!.hashCode) + + (shipDate == null ? 0 : shipDate!.hashCode) + + (status == null ? 0 : status!.hashCode) + + (complete.hashCode); + + @override + String toString() => 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete]'; + + Map toJson() { + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; + } + if (this.petId != null) { + json[r'petId'] = this.petId; + } else { + json[r'petId'] = null; + } + if (this.quantity != null) { + json[r'quantity'] = this.quantity; + } else { + json[r'quantity'] = null; + } + if (this.shipDate != null) { + json[r'shipDate'] = this.shipDate!.toUtc().toIso8601String(); + } else { + json[r'shipDate'] = null; + } + if (this.status != null) { + json[r'status'] = this.status; + } else { + json[r'status'] = null; + } + json[r'complete'] = this.complete; + return json; + } + + /// Returns a new [Order] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static Order? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Order[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Order[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Order( + id: mapValueOfType(json, r'id'), + petId: mapValueOfType(json, r'petId'), + quantity: mapValueOfType(json, r'quantity'), + shipDate: mapDateTime(json, r'shipDate', r''), + status: OrderStatusEnum.fromJson(json[r'status']), + complete: mapValueOfType(json, r'complete') ?? false, + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Order.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Order.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of Order-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = Order.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + +/// Order Status +class OrderStatusEnum { + /// Instantiate a new enum with the provided [value]. + const OrderStatusEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const placed = OrderStatusEnum._(r'placed'); + static const approved = OrderStatusEnum._(r'approved'); + static const delivered = OrderStatusEnum._(r'delivered'); + + /// List of all possible values in this [enum][OrderStatusEnum]. + static const values = [ + placed, + approved, + delivered, + ]; + + static OrderStatusEnum? fromJson(dynamic value) => OrderStatusEnumTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = OrderStatusEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [OrderStatusEnum] to String, +/// and [decode] dynamic data back to [OrderStatusEnum]. +class OrderStatusEnumTypeTransformer { + factory OrderStatusEnumTypeTransformer() => _instance ??= const OrderStatusEnumTypeTransformer._(); + + const OrderStatusEnumTypeTransformer._(); + + String encode(OrderStatusEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a OrderStatusEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + OrderStatusEnum? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'placed': return OrderStatusEnum.placed; + case r'approved': return OrderStatusEnum.approved; + case r'delivered': return OrderStatusEnum.delivered; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [OrderStatusEnumTypeTransformer] instance. + static OrderStatusEnumTypeTransformer? _instance; +} + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/outer_composite.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/outer_composite.dart new file mode 100644 index 000000000000..5a8757f61984 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/outer_composite.dart @@ -0,0 +1,152 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class OuterComposite { + /// Returns a new [OuterComposite] instance. + OuterComposite({ + this.myNumber, + this.myString, + this.myBoolean, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + num? myNumber; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? myString; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + 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 => + // ignore: unnecessary_parenthesis + (myNumber == null ? 0 : myNumber!.hashCode) + + (myString == null ? 0 : myString!.hashCode) + + (myBoolean == null ? 0 : myBoolean!.hashCode); + + @override + String toString() => 'OuterComposite[myNumber=$myNumber, myString=$myString, myBoolean=$myBoolean]'; + + Map toJson() { + final json = {}; + if (this.myNumber != null) { + json[r'my_number'] = this.myNumber; + } else { + json[r'my_number'] = null; + } + if (this.myString != null) { + json[r'my_string'] = this.myString; + } else { + json[r'my_string'] = null; + } + if (this.myBoolean != null) { + json[r'my_boolean'] = this.myBoolean; + } else { + json[r'my_boolean'] = null; + } + return json; + } + + /// Returns a new [OuterComposite] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static OuterComposite? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "OuterComposite[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "OuterComposite[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return OuterComposite( + myNumber: num.parse('${json[r'my_number']}'), + myString: mapValueOfType(json, r'my_string'), + myBoolean: mapValueOfType(json, r'my_boolean'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = OuterComposite.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = OuterComposite.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of OuterComposite-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = OuterComposite.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/outer_enum.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/outer_enum.dart new file mode 100644 index 000000000000..9ee834d09bab --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/outer_enum.dart @@ -0,0 +1,88 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class OuterEnum { + /// Instantiate a new enum with the provided [value]. + const OuterEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const placed = OuterEnum._(r'placed'); + static const approved = OuterEnum._(r'approved'); + static const delivered = OuterEnum._(r'delivered'); + + /// List of all possible values in this [enum][OuterEnum]. + static const values = [ + placed, + approved, + delivered, + ]; + + static OuterEnum? fromJson(dynamic value) => OuterEnumTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = OuterEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [OuterEnum] to String, +/// and [decode] dynamic data back to [OuterEnum]. +class OuterEnumTypeTransformer { + factory OuterEnumTypeTransformer() => _instance ??= const OuterEnumTypeTransformer._(); + + const OuterEnumTypeTransformer._(); + + String encode(OuterEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a OuterEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + OuterEnum? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'placed': return OuterEnum.placed; + case r'approved': return OuterEnum.approved; + case r'delivered': return OuterEnum.delivered; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [OuterEnumTypeTransformer] instance. + static OuterEnumTypeTransformer? _instance; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/outer_enum_default_value.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/outer_enum_default_value.dart new file mode 100644 index 000000000000..3eb74df05c04 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/outer_enum_default_value.dart @@ -0,0 +1,88 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class OuterEnumDefaultValue { + /// Instantiate a new enum with the provided [value]. + const OuterEnumDefaultValue._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const placed = OuterEnumDefaultValue._(r'placed'); + static const approved = OuterEnumDefaultValue._(r'approved'); + static const delivered = OuterEnumDefaultValue._(r'delivered'); + + /// List of all possible values in this [enum][OuterEnumDefaultValue]. + static const values = [ + placed, + approved, + delivered, + ]; + + static OuterEnumDefaultValue? fromJson(dynamic value) => OuterEnumDefaultValueTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = OuterEnumDefaultValue.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [OuterEnumDefaultValue] to String, +/// and [decode] dynamic data back to [OuterEnumDefaultValue]. +class OuterEnumDefaultValueTypeTransformer { + factory OuterEnumDefaultValueTypeTransformer() => _instance ??= const OuterEnumDefaultValueTypeTransformer._(); + + const OuterEnumDefaultValueTypeTransformer._(); + + String encode(OuterEnumDefaultValue data) => data.value; + + /// Decodes a [dynamic value][data] to a OuterEnumDefaultValue. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + OuterEnumDefaultValue? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'placed': return OuterEnumDefaultValue.placed; + case r'approved': return OuterEnumDefaultValue.approved; + case r'delivered': return OuterEnumDefaultValue.delivered; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [OuterEnumDefaultValueTypeTransformer] instance. + static OuterEnumDefaultValueTypeTransformer? _instance; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/outer_enum_integer.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/outer_enum_integer.dart new file mode 100644 index 000000000000..ca3f669d7c8a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/outer_enum_integer.dart @@ -0,0 +1,88 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class OuterEnumInteger { + /// Instantiate a new enum with the provided [value]. + const OuterEnumInteger._(this.value); + + /// The underlying value of this enum member. + final int value; + + @override + String toString() => value.toString(); + + int toJson() => value; + + static const number0 = OuterEnumInteger._(0); + static const number1 = OuterEnumInteger._(1); + static const number2 = OuterEnumInteger._(2); + + /// List of all possible values in this [enum][OuterEnumInteger]. + static const values = [ + number0, + number1, + number2, + ]; + + static OuterEnumInteger? fromJson(dynamic value) => OuterEnumIntegerTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = OuterEnumInteger.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [OuterEnumInteger] to int, +/// and [decode] dynamic data back to [OuterEnumInteger]. +class OuterEnumIntegerTypeTransformer { + factory OuterEnumIntegerTypeTransformer() => _instance ??= const OuterEnumIntegerTypeTransformer._(); + + const OuterEnumIntegerTypeTransformer._(); + + int encode(OuterEnumInteger data) => data.value; + + /// Decodes a [dynamic value][data] to a OuterEnumInteger. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + OuterEnumInteger? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case 0: return OuterEnumInteger.number0; + case 1: return OuterEnumInteger.number1; + case 2: return OuterEnumInteger.number2; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [OuterEnumIntegerTypeTransformer] instance. + static OuterEnumIntegerTypeTransformer? _instance; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/outer_enum_integer_default_value.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/outer_enum_integer_default_value.dart new file mode 100644 index 000000000000..7dcc72b79c93 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/outer_enum_integer_default_value.dart @@ -0,0 +1,88 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class OuterEnumIntegerDefaultValue { + /// Instantiate a new enum with the provided [value]. + const OuterEnumIntegerDefaultValue._(this.value); + + /// The underlying value of this enum member. + final int value; + + @override + String toString() => value.toString(); + + int toJson() => value; + + static const number0 = OuterEnumIntegerDefaultValue._(0); + static const number1 = OuterEnumIntegerDefaultValue._(1); + static const number2 = OuterEnumIntegerDefaultValue._(2); + + /// List of all possible values in this [enum][OuterEnumIntegerDefaultValue]. + static const values = [ + number0, + number1, + number2, + ]; + + static OuterEnumIntegerDefaultValue? fromJson(dynamic value) => OuterEnumIntegerDefaultValueTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = OuterEnumIntegerDefaultValue.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [OuterEnumIntegerDefaultValue] to int, +/// and [decode] dynamic data back to [OuterEnumIntegerDefaultValue]. +class OuterEnumIntegerDefaultValueTypeTransformer { + factory OuterEnumIntegerDefaultValueTypeTransformer() => _instance ??= const OuterEnumIntegerDefaultValueTypeTransformer._(); + + const OuterEnumIntegerDefaultValueTypeTransformer._(); + + int encode(OuterEnumIntegerDefaultValue data) => data.value; + + /// Decodes a [dynamic value][data] to a OuterEnumIntegerDefaultValue. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + OuterEnumIntegerDefaultValue? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case 0: return OuterEnumIntegerDefaultValue.number0; + case 1: return OuterEnumIntegerDefaultValue.number1; + case 2: return OuterEnumIntegerDefaultValue.number2; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [OuterEnumIntegerDefaultValueTypeTransformer] instance. + static OuterEnumIntegerDefaultValueTypeTransformer? _instance; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/outer_object_with_enum_property.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/outer_object_with_enum_property.dart new file mode 100644 index 000000000000..96a121ffc6f5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/outer_object_with_enum_property.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class OuterObjectWithEnumProperty { + /// Returns a new [OuterObjectWithEnumProperty] instance. + OuterObjectWithEnumProperty({ + required this.value, + }); + + OuterEnumInteger value; + + @override + bool operator ==(Object other) => identical(this, other) || other is OuterObjectWithEnumProperty && + other.value == value; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (value.hashCode); + + @override + String toString() => 'OuterObjectWithEnumProperty[value=$value]'; + + Map toJson() { + final json = {}; + json[r'value'] = this.value; + return json; + } + + /// Returns a new [OuterObjectWithEnumProperty] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static OuterObjectWithEnumProperty? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "OuterObjectWithEnumProperty[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "OuterObjectWithEnumProperty[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return OuterObjectWithEnumProperty( + value: OuterEnumInteger.fromJson(json[r'value'])!, + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = OuterObjectWithEnumProperty.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = OuterObjectWithEnumProperty.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of OuterObjectWithEnumProperty-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = OuterObjectWithEnumProperty.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'value', + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/parent_with_nullable.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/parent_with_nullable.dart new file mode 100644 index 000000000000..219967ad59fa --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/parent_with_nullable.dart @@ -0,0 +1,194 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ParentWithNullable { + /// Returns a new [ParentWithNullable] instance. + ParentWithNullable({ + this.type, + this.nullableProperty, + }); + + ParentWithNullableTypeEnum? type; + + String? nullableProperty; + + @override + bool operator ==(Object other) => identical(this, other) || other is ParentWithNullable && + other.type == type && + other.nullableProperty == nullableProperty; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (type == null ? 0 : type!.hashCode) + + (nullableProperty == null ? 0 : nullableProperty!.hashCode); + + @override + String toString() => 'ParentWithNullable[type=$type, nullableProperty=$nullableProperty]'; + + Map toJson() { + final json = {}; + if (this.type != null) { + json[r'type'] = this.type; + } else { + json[r'type'] = null; + } + if (this.nullableProperty != null) { + json[r'nullableProperty'] = this.nullableProperty; + } else { + json[r'nullableProperty'] = null; + } + return json; + } + + /// Returns a new [ParentWithNullable] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ParentWithNullable? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ParentWithNullable[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ParentWithNullable[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ParentWithNullable( + type: ParentWithNullableTypeEnum.fromJson(json[r'type']), + nullableProperty: mapValueOfType(json, r'nullableProperty'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ParentWithNullable.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ParentWithNullable.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ParentWithNullable-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ParentWithNullable.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + + +class ParentWithNullableTypeEnum { + /// Instantiate a new enum with the provided [value]. + const ParentWithNullableTypeEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const childWithNullable = ParentWithNullableTypeEnum._(r'ChildWithNullable'); + + /// List of all possible values in this [enum][ParentWithNullableTypeEnum]. + static const values = [ + childWithNullable, + ]; + + static ParentWithNullableTypeEnum? fromJson(dynamic value) => ParentWithNullableTypeEnumTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ParentWithNullableTypeEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [ParentWithNullableTypeEnum] to String, +/// and [decode] dynamic data back to [ParentWithNullableTypeEnum]. +class ParentWithNullableTypeEnumTypeTransformer { + factory ParentWithNullableTypeEnumTypeTransformer() => _instance ??= const ParentWithNullableTypeEnumTypeTransformer._(); + + const ParentWithNullableTypeEnumTypeTransformer._(); + + String encode(ParentWithNullableTypeEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a ParentWithNullableTypeEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + ParentWithNullableTypeEnum? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'ChildWithNullable': return ParentWithNullableTypeEnum.childWithNullable; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [ParentWithNullableTypeEnumTypeTransformer] instance. + static ParentWithNullableTypeEnumTypeTransformer? _instance; +} + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/pet.dart new file mode 100644 index 000000000000..806f91e41ace --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/pet.dart @@ -0,0 +1,249 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Pet { + /// Returns a new [Pet] instance. + Pet({ + this.id, + this.category, + required this.name, + this.photoUrls = const {}, + this.tags = const [], + this.status, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? id; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + Category? category; + + String name; + + Set photoUrls; + + List tags; + + /// pet status in the store + PetStatusEnum? status; + + @override + bool operator ==(Object other) => identical(this, other) || other is Pet && + other.id == id && + other.category == category && + other.name == name && + _deepEquality.equals(other.photoUrls, photoUrls) && + _deepEquality.equals(other.tags, tags) && + other.status == status; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (id == null ? 0 : id!.hashCode) + + (category == null ? 0 : category!.hashCode) + + (name.hashCode) + + (photoUrls.hashCode) + + (tags.hashCode) + + (status == null ? 0 : status!.hashCode); + + @override + String toString() => 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status]'; + + Map toJson() { + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; + } + if (this.category != null) { + json[r'category'] = this.category; + } else { + json[r'category'] = null; + } + json[r'name'] = this.name; + json[r'photoUrls'] = this.photoUrls.toList(growable: false); + json[r'tags'] = this.tags; + if (this.status != null) { + json[r'status'] = this.status; + } else { + json[r'status'] = null; + } + return json; + } + + /// Returns a new [Pet] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static Pet? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Pet[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Pet[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Pet( + id: mapValueOfType(json, r'id'), + category: Category.fromJson(json[r'category']), + name: mapValueOfType(json, r'name')!, + photoUrls: json[r'photoUrls'] is Iterable + ? (json[r'photoUrls'] as Iterable).cast().toSet() + : const {}, + tags: Tag.listFromJson(json[r'tags']), + status: PetStatusEnum.fromJson(json[r'status']), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Pet.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Pet.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of Pet-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = Pet.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'name', + 'photoUrls', + }; +} + +/// pet status in the store +class PetStatusEnum { + /// Instantiate a new enum with the provided [value]. + const PetStatusEnum._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const available = PetStatusEnum._(r'available'); + static const pending = PetStatusEnum._(r'pending'); + static const sold = PetStatusEnum._(r'sold'); + + /// List of all possible values in this [enum][PetStatusEnum]. + static const values = [ + available, + pending, + sold, + ]; + + static PetStatusEnum? fromJson(dynamic value) => PetStatusEnumTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = PetStatusEnum.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [PetStatusEnum] to String, +/// and [decode] dynamic data back to [PetStatusEnum]. +class PetStatusEnumTypeTransformer { + factory PetStatusEnumTypeTransformer() => _instance ??= const PetStatusEnumTypeTransformer._(); + + const PetStatusEnumTypeTransformer._(); + + String encode(PetStatusEnum data) => data.value; + + /// Decodes a [dynamic value][data] to a PetStatusEnum. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + PetStatusEnum? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'available': return PetStatusEnum.available; + case r'pending': return PetStatusEnum.pending; + case r'sold': return PetStatusEnum.sold; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [PetStatusEnumTypeTransformer] instance. + static PetStatusEnumTypeTransformer? _instance; +} + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/read_only_first.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/read_only_first.dart new file mode 100644 index 000000000000..7088ae4195bf --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/read_only_first.dart @@ -0,0 +1,135 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ReadOnlyFirst { + /// Returns a new [ReadOnlyFirst] instance. + ReadOnlyFirst({ + this.bar, + this.baz, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? bar; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? baz; + + @override + bool operator ==(Object other) => identical(this, other) || other is ReadOnlyFirst && + other.bar == bar && + other.baz == baz; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (bar == null ? 0 : bar!.hashCode) + + (baz == null ? 0 : baz!.hashCode); + + @override + String toString() => 'ReadOnlyFirst[bar=$bar, baz=$baz]'; + + Map toJson() { + final json = {}; + if (this.bar != null) { + json[r'bar'] = this.bar; + } else { + json[r'bar'] = null; + } + if (this.baz != null) { + json[r'baz'] = this.baz; + } else { + json[r'baz'] = null; + } + return json; + } + + /// Returns a new [ReadOnlyFirst] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static ReadOnlyFirst? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "ReadOnlyFirst[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "ReadOnlyFirst[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return ReadOnlyFirst( + bar: mapValueOfType(json, r'bar'), + baz: mapValueOfType(json, r'baz'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = ReadOnlyFirst.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = ReadOnlyFirst.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of ReadOnlyFirst-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = ReadOnlyFirst.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/single_ref_type.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/single_ref_type.dart new file mode 100644 index 000000000000..332a19c56fee --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/single_ref_type.dart @@ -0,0 +1,85 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class SingleRefType { + /// Instantiate a new enum with the provided [value]. + const SingleRefType._(this.value); + + /// The underlying value of this enum member. + final String value; + + @override + String toString() => value; + + String toJson() => value; + + static const admin = SingleRefType._(r'admin'); + static const user = SingleRefType._(r'user'); + + /// List of all possible values in this [enum][SingleRefType]. + static const values = [ + admin, + user, + ]; + + static SingleRefType? fromJson(dynamic value) => SingleRefTypeTypeTransformer().decode(value); + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = SingleRefType.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } +} + +/// Transformation class that can [encode] an instance of [SingleRefType] to String, +/// and [decode] dynamic data back to [SingleRefType]. +class SingleRefTypeTypeTransformer { + factory SingleRefTypeTypeTransformer() => _instance ??= const SingleRefTypeTypeTransformer._(); + + const SingleRefTypeTypeTransformer._(); + + String encode(SingleRefType data) => data.value; + + /// Decodes a [dynamic value][data] to a SingleRefType. + /// + /// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully, + /// then null is returned. However, if [allowNull] is false and the [dynamic value][data] + /// cannot be decoded successfully, then an [UnimplementedError] is thrown. + /// + /// The [allowNull] is very handy when an API changes and a new enum value is added or removed, + /// and users are still using an old app with the old code. + SingleRefType? decode(dynamic data, {bool allowNull = true}) { + if (data != null) { + switch (data) { + case r'admin': return SingleRefType.admin; + case r'user': return SingleRefType.user; + default: + if (!allowNull) { + throw ArgumentError('Unknown enum value to decode: $data'); + } + } + } + return null; + } + + /// Singleton [SingleRefTypeTypeTransformer] instance. + static SingleRefTypeTypeTransformer? _instance; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/special_model_name.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/special_model_name.dart new file mode 100644 index 000000000000..aeb25a138f07 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/special_model_name.dart @@ -0,0 +1,118 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class SpecialModelName { + /// Returns a new [SpecialModelName] instance. + SpecialModelName({ + this.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + + @override + bool operator ==(Object other) => identical(this, other) || other is SpecialModelName && + other.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket == dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket == null ? 0 : dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket!.hashCode); + + @override + String toString() => 'SpecialModelName[dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket=$dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket]'; + + Map toJson() { + final json = {}; + if (this.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket != null) { + json[r'$special[property.name]'] = this.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + } else { + json[r'$special[property.name]'] = null; + } + return json; + } + + /// Returns a new [SpecialModelName] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static SpecialModelName? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "SpecialModelName[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "SpecialModelName[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return SpecialModelName( + dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket: mapValueOfType(json, r'$special[property.name]'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = SpecialModelName.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = SpecialModelName.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of SpecialModelName-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = SpecialModelName.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/tag.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/tag.dart new file mode 100644 index 000000000000..b8b5696cf9b5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/tag.dart @@ -0,0 +1,135 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class Tag { + /// Returns a new [Tag] instance. + Tag({ + this.id, + this.name, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? id; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? name; + + @override + bool operator ==(Object other) => identical(this, other) || other is Tag && + other.id == id && + other.name == name; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (id == null ? 0 : id!.hashCode) + + (name == null ? 0 : name!.hashCode); + + @override + String toString() => 'Tag[id=$id, name=$name]'; + + Map toJson() { + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; + } + if (this.name != null) { + json[r'name'] = this.name; + } else { + json[r'name'] = null; + } + return json; + } + + /// Returns a new [Tag] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static Tag? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "Tag[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "Tag[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return Tag( + id: mapValueOfType(json, r'id'), + name: mapValueOfType(json, r'name'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = Tag.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = Tag.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of Tag-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = Tag.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/test_inline_freeform_additional_properties_request.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/test_inline_freeform_additional_properties_request.dart new file mode 100644 index 000000000000..8e2316a619dc --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/test_inline_freeform_additional_properties_request.dart @@ -0,0 +1,118 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class TestInlineFreeformAdditionalPropertiesRequest { + /// Returns a new [TestInlineFreeformAdditionalPropertiesRequest] instance. + TestInlineFreeformAdditionalPropertiesRequest({ + this.someProperty, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? someProperty; + + @override + bool operator ==(Object other) => identical(this, other) || other is TestInlineFreeformAdditionalPropertiesRequest && + other.someProperty == someProperty; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (someProperty == null ? 0 : someProperty!.hashCode); + + @override + String toString() => 'TestInlineFreeformAdditionalPropertiesRequest[someProperty=$someProperty]'; + + Map toJson() { + final json = {}; + if (this.someProperty != null) { + json[r'someProperty'] = this.someProperty; + } else { + json[r'someProperty'] = null; + } + return json; + } + + /// Returns a new [TestInlineFreeformAdditionalPropertiesRequest] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static TestInlineFreeformAdditionalPropertiesRequest? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "TestInlineFreeformAdditionalPropertiesRequest[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "TestInlineFreeformAdditionalPropertiesRequest[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return TestInlineFreeformAdditionalPropertiesRequest( + someProperty: mapValueOfType(json, r'someProperty'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = TestInlineFreeformAdditionalPropertiesRequest.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = TestInlineFreeformAdditionalPropertiesRequest.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of TestInlineFreeformAdditionalPropertiesRequest-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = TestInlineFreeformAdditionalPropertiesRequest.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/user.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/user.dart new file mode 100644 index 000000000000..395f9e38e043 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/lib/model/user.dart @@ -0,0 +1,238 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class User { + /// Returns a new [User] instance. + User({ + this.id, + this.username, + this.firstName, + this.lastName, + this.email, + this.password, + this.phone, + this.userStatus, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + int? id; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? username; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? firstName; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? lastName; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? email; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? password; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + String? phone; + + /// User Status + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + 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 => + // ignore: unnecessary_parenthesis + (id == null ? 0 : id!.hashCode) + + (username == null ? 0 : username!.hashCode) + + (firstName == null ? 0 : firstName!.hashCode) + + (lastName == null ? 0 : lastName!.hashCode) + + (email == null ? 0 : email!.hashCode) + + (password == null ? 0 : password!.hashCode) + + (phone == null ? 0 : phone!.hashCode) + + (userStatus == null ? 0 : userStatus!.hashCode); + + @override + String toString() => 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus]'; + + Map toJson() { + final json = {}; + if (this.id != null) { + json[r'id'] = this.id; + } else { + json[r'id'] = null; + } + if (this.username != null) { + json[r'username'] = this.username; + } else { + json[r'username'] = null; + } + if (this.firstName != null) { + json[r'firstName'] = this.firstName; + } else { + json[r'firstName'] = null; + } + if (this.lastName != null) { + json[r'lastName'] = this.lastName; + } else { + json[r'lastName'] = null; + } + if (this.email != null) { + json[r'email'] = this.email; + } else { + json[r'email'] = null; + } + if (this.password != null) { + json[r'password'] = this.password; + } else { + json[r'password'] = null; + } + if (this.phone != null) { + json[r'phone'] = this.phone; + } else { + json[r'phone'] = null; + } + if (this.userStatus != null) { + json[r'userStatus'] = this.userStatus; + } else { + json[r'userStatus'] = null; + } + return json; + } + + /// Returns a new [User] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static User? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "User[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "User[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return User( + id: mapValueOfType(json, r'id'), + username: mapValueOfType(json, r'username'), + firstName: mapValueOfType(json, r'firstName'), + lastName: mapValueOfType(json, r'lastName'), + email: mapValueOfType(json, r'email'), + password: mapValueOfType(json, r'password'), + phone: mapValueOfType(json, r'phone'), + userStatus: mapValueOfType(json, r'userStatus'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = User.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = User.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of User-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = User.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/pubspec.yaml b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/pubspec.yaml new file mode 100644 index 000000000000..8a7210966700 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/pubspec.yaml @@ -0,0 +1,17 @@ +# +# AUTO-GENERATED FILE, DO NOT MODIFY! +# + +name: 'openapi' +version: '1.0.0' +description: 'OpenAPI API client' +homepage: 'homepage' +environment: + sdk: '>=2.12.0 <4.0.0' +dependencies: + collection: '>=1.17.0 <2.0.0' + http: '>=0.13.0 <2.0.0' + intl: any + meta: '>=1.1.8 <2.0.0' +dev_dependencies: + test: '>=1.21.6 <1.22.0' diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/additional_properties_class_test.dart new file mode 100644 index 000000000000..2d8f6c5016cd --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/additional_properties_class_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for AdditionalPropertiesClass +void main() { + // final instance = AdditionalPropertiesClass(); + + group('test AdditionalPropertiesClass', () { + // Map mapProperty (default value: const {}) + test('to test the property `mapProperty`', () async { + // TODO + }); + + // Map> mapOfMapProperty (default value: const {}) + test('to test the property `mapOfMapProperty`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/all_of_with_single_ref_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/all_of_with_single_ref_test.dart new file mode 100644 index 000000000000..b86d0401fbc5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/all_of_with_single_ref_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for AllOfWithSingleRef +void main() { + // final instance = AllOfWithSingleRef(); + + group('test AllOfWithSingleRef', () { + // String username + test('to test the property `username`', () async { + // TODO + }); + + // SingleRefType singlereftype + test('to test the property `singlereftype`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/animal_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/animal_test.dart new file mode 100644 index 000000000000..add666f12d71 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/animal_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Animal +void main() { + // final instance = Animal(); + + group('test Animal', () { + // String classname + test('to test the property `classname`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/another_fake_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/another_fake_api_test.dart new file mode 100644 index 000000000000..c6dbce9afa79 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/another_fake_api_test.dart @@ -0,0 +1,30 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for AnotherFakeApi +void main() { + // final instance = AnotherFakeApi(); + + group('tests for AnotherFakeApi', () { + // To test special tags + // + // To test special tags and operation ID starting with number + // + //Future call123testSpecialTags(ModelClient modelclient) async + test('test call123testSpecialTags', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/api_response_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/api_response_test.dart new file mode 100644 index 000000000000..ee118ec81e02 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/api_response_test.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ApiResponse +void main() { + // final instance = ApiResponse(); + + group('test 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/dart2/petstore_client_lib_use_lower_camel_case/test/array_of_array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/array_of_array_of_number_only_test.dart new file mode 100644 index 000000000000..f295f377b076 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/array_of_array_of_number_only_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ArrayOfArrayOfNumberOnly +void main() { + // final instance = ArrayOfArrayOfNumberOnly(); + + group('test ArrayOfArrayOfNumberOnly', () { + // List> arrayarraynumber (default value: const []) + test('to test the property `arrayarraynumber`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/array_of_number_only_test.dart new file mode 100644 index 000000000000..a7d4090cc6a7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/array_of_number_only_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ArrayOfNumberOnly +void main() { + // final instance = ArrayOfNumberOnly(); + + group('test ArrayOfNumberOnly', () { + // List arraynumber (default value: const []) + test('to test the property `arraynumber`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/array_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/array_test_test.dart new file mode 100644 index 000000000000..888cfe72101a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/array_test_test.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ArrayTest +void main() { + // final instance = ArrayTest(); + + group('test ArrayTest', () { + // List arrayOfString (default value: const []) + test('to test the property `arrayOfString`', () async { + // TODO + }); + + // List> arrayArrayOfInteger (default value: const []) + test('to test the property `arrayArrayOfInteger`', () async { + // TODO + }); + + // List> arrayArrayOfModel (default value: const []) + test('to test the property `arrayArrayOfModel`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/capitalization_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/capitalization_test.dart new file mode 100644 index 000000000000..6b8248c57c74 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/capitalization_test.dart @@ -0,0 +1,53 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Capitalization +void main() { + // final instance = Capitalization(); + + group('test 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 attName + test('to test the property `attName`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/cat_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/cat_test.dart new file mode 100644 index 000000000000..332cc962ad57 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/cat_test.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Cat +void main() { + // final instance = Cat(); + + group('test Cat', () { + // String classname + test('to test the property `classname`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + // bool declawed + test('to test the property `declawed`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/category_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/category_test.dart new file mode 100644 index 000000000000..f463d6f760fd --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/category_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Category +void main() { + // final instance = Category(); + + group('test Category', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name (default value: 'default-name') + test('to test the property `name`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/child_with_nullable_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/child_with_nullable_test.dart new file mode 100644 index 000000000000..d7f703087a99 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/child_with_nullable_test.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ChildWithNullable +void main() { + // final instance = ChildWithNullable(); + + group('test ChildWithNullable', () { + // String type + test('to test the property `type`', () async { + // TODO + }); + + // String nullableproperty + test('to test the property `nullableproperty`', () async { + // TODO + }); + + // String otherproperty + test('to test the property `otherproperty`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/class_model_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/class_model_test.dart new file mode 100644 index 000000000000..be11ea6968ff --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/class_model_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ClassModel +void main() { + // final instance = ClassModel(); + + group('test ClassModel', () { + // String class_ + test('to test the property `class_`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/default_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/default_api_test.dart new file mode 100644 index 000000000000..114c98209b61 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/default_api_test.dart @@ -0,0 +1,26 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for DefaultApi +void main() { + // final instance = DefaultApi(); + + group('tests for DefaultApi', () { + //Future fooGet() async + test('test fooGet', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/deprecated_object_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/deprecated_object_test.dart new file mode 100644 index 000000000000..01d2d9a5200e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/deprecated_object_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for DeprecatedObject +void main() { + // final instance = DeprecatedObject(); + + group('test DeprecatedObject', () { + // String name + test('to test the property `name`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/dog_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/dog_test.dart new file mode 100644 index 000000000000..58108210f7c3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/dog_test.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Dog +void main() { + // final instance = Dog(); + + group('test 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/dart2/petstore_client_lib_use_lower_camel_case/test/enum_arrays_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/enum_arrays_test.dart new file mode 100644 index 000000000000..c138856233ad --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/enum_arrays_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for EnumArrays +void main() { + // final instance = EnumArrays(); + + group('test EnumArrays', () { + // String justSymbol + test('to test the property `justSymbol`', () async { + // TODO + }); + + // List arrayEnum (default value: const []) + test('to test the property `arrayEnum`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/enum_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/enum_class_test.dart new file mode 100644 index 000000000000..19603ea30129 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/enum_class_test.dart @@ -0,0 +1,21 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for EnumClass +void main() { + + group('test EnumClass', () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/enum_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/enum_test_test.dart new file mode 100644 index 000000000000..50ff85cfd334 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/enum_test_test.dart @@ -0,0 +1,62 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for EnumTest +void main() { + // final instance = EnumTest(); + + group('test EnumTest', () { + // String enumString + test('to test the property `enumString`', () async { + // TODO + }); + + // String enumStringRequired + test('to test the property `enumStringRequired`', () async { + // TODO + }); + + // int enumInteger + test('to test the property `enumInteger`', () async { + // TODO + }); + + // double enumNumber + test('to test the property `enumNumber`', () async { + // TODO + }); + + // OuterEnum outerenum + test('to test the property `outerenum`', () async { + // TODO + }); + + // OuterEnumInteger outerenuminteger + test('to test the property `outerenuminteger`', () async { + // TODO + }); + + // OuterEnumDefaultValue outerenumdefaultvalue + test('to test the property `outerenumdefaultvalue`', () async { + // TODO + }); + + // OuterEnumIntegerDefaultValue outerenumintegerdefaultvalue + test('to test the property `outerenumintegerdefaultvalue`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/fake_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/fake_api_test.dart new file mode 100644 index 000000000000..ee395bb53d66 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/fake_api_test.dart @@ -0,0 +1,193 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for FakeApi +void main() { + // final instance = FakeApi(); + + group('tests for FakeApi', () { + // for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + // + //Future fakeBigDecimalMap() async + test('test fakeBigDecimalMap', () async { + // TODO + }); + + // Health check endpoint + // + //Future fakeHealthGet() async + test('test fakeHealthGet', () async { + // TODO + }); + + // test http signature authentication + // + //Future fakeHttpSignatureTest(Pet pet, { String query1, String header1 }) async + test('test fakeHttpSignatureTest', () async { + // TODO + }); + + // Test serialization of outer boolean types + // + //Future fakeOuterBooleanSerialize({ bool body }) async + test('test fakeOuterBooleanSerialize', () async { + // TODO + }); + + // Test serialization of object with outer number type + // + //Future fakeOuterCompositeSerialize({ OuterComposite outercomposite }) async + test('test fakeOuterCompositeSerialize', () async { + // TODO + }); + + // Test serialization of outer number types + // + //Future fakeOuterNumberSerialize({ num body }) async + test('test fakeOuterNumberSerialize', () async { + // TODO + }); + + // Test serialization of outer string types + // + //Future fakeOuterStringSerialize({ String body }) async + test('test fakeOuterStringSerialize', () async { + // TODO + }); + + // Test serialization of enum (int) properties with examples + // + //Future fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerobjectwithenumproperty) async + test('test fakePropertyEnumIntegerSerialize', () async { + // TODO + }); + + // test referenced additionalProperties + // + // + // + //Future testAdditionalPropertiesReference(Map requestBody) async + test('test testAdditionalPropertiesReference', () async { + // TODO + }); + + // For this test, the body has to be a binary file. + // + //Future testBodyWithBinary(MultipartFile body) async + test('test testBodyWithBinary', () async { + // TODO + }); + + // For this test, the body for this request must reference a schema named `File`. + // + //Future testBodyWithFileSchema(FileSchemaTestClass fileschematestclass) async + test('test testBodyWithFileSchema', () async { + // TODO + }); + + //Future testBodyWithQueryParams(String query, User user) async + test('test testBodyWithQueryParams', () async { + // TODO + }); + + // To test \"client\" model + // + // To test \"client\" model + // + //Future testClientModel(ModelClient modelclient) async + test('test testClientModel', () async { + // TODO + }); + + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + // + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + // + //Future testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime datetime, String password, String callback }) async + test('test testEndpointParameters', () async { + // TODO + }); + + // To test enum parameters + // + // To test enum parameters + // + //Future testEnumParameters({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumQueryModelArray, List enumFormStringArray, String enumFormString }) async + test('test testEnumParameters', () async { + // TODO + }); + + // Fake endpoint to test group parameters (optional) + // + // Fake endpoint to test group parameters (optional) + // + //Future testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group }) async + test('test testGroupParameters', () async { + // TODO + }); + + // test inline additionalProperties + // + // + // + //Future testInlineAdditionalProperties(Map requestBody) async + test('test testInlineAdditionalProperties', () async { + // TODO + }); + + // test inline free-form additionalProperties + // + // + // + //Future testInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testinlinefreeformadditionalpropertiesrequest) async + test('test testInlineFreeformAdditionalProperties', () async { + // TODO + }); + + // test json serialization of form data + // + // + // + //Future testJsonFormData(String param, String param2) async + test('test testJsonFormData', () async { + // TODO + }); + + // test nullable parent property + // + // + // + //Future testNullable(ChildWithNullable childwithnullable) async + test('test testNullable', () async { + // TODO + }); + + // To test the collection format in query parameters + // + //Future testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, String allowempty, { Map language }) async + test('test testQueryParameterCollectionFormat', () async { + // TODO + }); + + // test referenced string map + // + // + // + //Future testStringMapReference(Map requestBody) async + test('test testStringMapReference', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/fake_big_decimal_map200_response_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/fake_big_decimal_map200_response_test.dart new file mode 100644 index 000000000000..1e59ed782914 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/fake_big_decimal_map200_response_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for FakeBigDecimalMap200Response +void main() { + // final instance = FakeBigDecimalMap200Response(); + + group('test FakeBigDecimalMap200Response', () { + // num someid + test('to test the property `someid`', () async { + // TODO + }); + + // Map somemap (default value: const {}) + test('to test the property `somemap`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/fake_classname_tags123_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/fake_classname_tags123_api_test.dart new file mode 100644 index 000000000000..1df72df2dc41 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/fake_classname_tags123_api_test.dart @@ -0,0 +1,30 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for FakeClassnameTags123Api +void main() { + // final instance = FakeClassnameTags123Api(); + + group('tests for FakeClassnameTags123Api', () { + // To test class name in snake case + // + // To test class name in snake case + // + //Future testClassname(ModelClient modelclient) async + test('test testClassname', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/file_schema_test_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/file_schema_test_class_test.dart new file mode 100644 index 000000000000..6b9a34f502b7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/file_schema_test_class_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for FileSchemaTestClass +void main() { + // final instance = FileSchemaTestClass(); + + group('test FileSchemaTestClass', () { + // ModelFile file + test('to test the property `file`', () async { + // TODO + }); + + // List files (default value: const []) + test('to test the property `files`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/foo_get_default_response_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/foo_get_default_response_test.dart new file mode 100644 index 000000000000..907eaa37eca3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/foo_get_default_response_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for FooGetDefaultResponse +void main() { + // final instance = FooGetDefaultResponse(); + + group('test FooGetDefaultResponse', () { + // Foo string + test('to test the property `string`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/foo_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/foo_test.dart new file mode 100644 index 000000000000..6dd3993f4875 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/foo_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Foo +void main() { + // final instance = Foo(); + + group('test Foo', () { + // String bar (default value: 'bar') + test('to test the property `bar`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/format_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/format_test_test.dart new file mode 100644 index 000000000000..391691f27d30 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/format_test_test.dart @@ -0,0 +1,104 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for FormatTest +void main() { + // final instance = FormatTest(); + + group('test FormatTest', () { + // int integer + test('to test the property `integer`', () async { + // TODO + }); + + // int int32 + test('to test the property `int32`', () async { + // TODO + }); + + // int int64 + test('to test the property `int64`', () async { + // TODO + }); + + // num number + test('to test the property `number`', () async { + // TODO + }); + + // double float + test('to test the property `float`', () async { + // TODO + }); + + // double double_ + test('to test the property `double_`', () async { + // TODO + }); + + // double decimal + test('to test the property `decimal`', () async { + // TODO + }); + + // String string + test('to test the property `string`', () async { + // TODO + }); + + // String byte + test('to test the property `byte`', () async { + // TODO + }); + + // MultipartFile binary + test('to test the property `binary`', () async { + // TODO + }); + + // DateTime date + test('to test the property `date`', () async { + // TODO + }); + + // DateTime datetime + test('to test the property `datetime`', () async { + // TODO + }); + + // String uuid + test('to test the property `uuid`', () async { + // TODO + }); + + // String password + test('to test the property `password`', () async { + // TODO + }); + + // A string that is a 10 digit number. Can have leading zeros. + // String patternWithDigits + test('to test the property `patternWithDigits`', () async { + // TODO + }); + + // A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + // String patternWithDigitsAndDelimiter + test('to test the property `patternWithDigitsAndDelimiter`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/has_only_read_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/has_only_read_only_test.dart new file mode 100644 index 000000000000..f535c23fa962 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/has_only_read_only_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for HasOnlyReadOnly +void main() { + // final instance = HasOnlyReadOnly(); + + group('test HasOnlyReadOnly', () { + // String bar + test('to test the property `bar`', () async { + // TODO + }); + + // String foo + test('to test the property `foo`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/health_check_result_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/health_check_result_test.dart new file mode 100644 index 000000000000..51c27a5ffd6f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/health_check_result_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for HealthCheckResult +void main() { + // final instance = HealthCheckResult(); + + group('test HealthCheckResult', () { + // String nullablemessage + test('to test the property `nullablemessage`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/map_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/map_test_test.dart new file mode 100644 index 000000000000..ed11d6d1227b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/map_test_test.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for MapTest +void main() { + // final instance = MapTest(); + + group('test MapTest', () { + // Map> mapMapOfString (default value: const {}) + test('to test the property `mapMapOfString`', () async { + // TODO + }); + + // Map mapOfEnumString (default value: const {}) + test('to test the property `mapOfEnumString`', () async { + // TODO + }); + + // Map directMap (default value: const {}) + test('to test the property `directMap`', () async { + // TODO + }); + + // Map indirectMap (default value: const {}) + test('to test the property `indirectMap`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/mixed_properties_and_additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/mixed_properties_and_additional_properties_class_test.dart new file mode 100644 index 000000000000..dc1fda906e94 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/mixed_properties_and_additional_properties_class_test.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for MixedPropertiesAndAdditionalPropertiesClass +void main() { + // final instance = MixedPropertiesAndAdditionalPropertiesClass(); + + group('test MixedPropertiesAndAdditionalPropertiesClass', () { + // String uuid + test('to test the property `uuid`', () async { + // TODO + }); + + // DateTime datetime + test('to test the property `datetime`', () async { + // TODO + }); + + // Map map (default value: const {}) + test('to test the property `map`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/model200_response_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/model200_response_test.dart new file mode 100644 index 000000000000..431de0928582 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/model200_response_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Model200Response +void main() { + // final instance = Model200Response(); + + group('test Model200Response', () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // String class_ + test('to test the property `class_`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/model_client_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/model_client_test.dart new file mode 100644 index 000000000000..614f136b9134 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/model_client_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ModelClient +void main() { + // final instance = ModelClient(); + + group('test ModelClient', () { + // String client + test('to test the property `client`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/model_file_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/model_file_test.dart new file mode 100644 index 000000000000..3f2f88d29ca4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/model_file_test.dart @@ -0,0 +1,28 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ModelFile +void main() { + // final instance = ModelFile(); + + group('test ModelFile', () { + // Test capitalization + // String sourceuri + test('to test the property `sourceuri`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/model_list_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/model_list_test.dart new file mode 100644 index 000000000000..6f6707fee36b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/model_list_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ModelList +void main() { + // final instance = ModelList(); + + group('test ModelList', () { + // String n123list + test('to test the property `n123list`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/model_return_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/model_return_test.dart new file mode 100644 index 000000000000..6a1888f0883e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/model_return_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ModelReturn +void main() { + // final instance = ModelReturn(); + + group('test ModelReturn', () { + // int return_ + test('to test the property `return_`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/name_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/name_test.dart new file mode 100644 index 000000000000..15aca54b0cf8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/name_test.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Name +void main() { + // final instance = Name(); + + group('test Name', () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // int snakeCase + test('to test the property `snakeCase`', () async { + // TODO + }); + + // String property + test('to test the property `property`', () async { + // TODO + }); + + // int n123number + test('to test the property `n123number`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/nullable_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/nullable_class_test.dart new file mode 100644 index 000000000000..6258a447760f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/nullable_class_test.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for NullableClass +void main() { + // final instance = NullableClass(); + + group('test 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 (default value: const []) + test('to test the property `arrayNullableProp`', () async { + // TODO + }); + + // List arrayAndItemsNullableProp (default value: const []) + test('to test the property `arrayAndItemsNullableProp`', () async { + // TODO + }); + + // List arrayItemsNullable (default value: const []) + test('to test the property `arrayItemsNullable`', () async { + // TODO + }); + + // Map objectNullableProp (default value: const {}) + test('to test the property `objectNullableProp`', () async { + // TODO + }); + + // Map objectAndItemsNullableProp (default value: const {}) + test('to test the property `objectAndItemsNullableProp`', () async { + // TODO + }); + + // Map objectItemsNullable (default value: const {}) + test('to test the property `objectItemsNullable`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/number_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/number_only_test.dart new file mode 100644 index 000000000000..4e62aaa8b551 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/number_only_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for NumberOnly +void main() { + // final instance = NumberOnly(); + + group('test NumberOnly', () { + // num justnumber + test('to test the property `justnumber`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/object_with_deprecated_fields_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/object_with_deprecated_fields_test.dart new file mode 100644 index 000000000000..8d43c8627753 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/object_with_deprecated_fields_test.dart @@ -0,0 +1,42 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ObjectWithDeprecatedFields +void main() { + // final instance = ObjectWithDeprecatedFields(); + + group('test 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 (default value: const []) + test('to test the property `bars`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/order_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/order_test.dart new file mode 100644 index 000000000000..425571e1f644 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/order_test.dart @@ -0,0 +1,53 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Order +void main() { + // final instance = Order(); + + group('test Order', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // int petid + test('to test the property `petid`', () async { + // TODO + }); + + // int quantity + test('to test the property `quantity`', () async { + // TODO + }); + + // DateTime shipdate + test('to test the property `shipdate`', () async { + // TODO + }); + + // Order Status + // String status + test('to test the property `status`', () async { + // TODO + }); + + // bool complete (default value: false) + test('to test the property `complete`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/outer_composite_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/outer_composite_test.dart new file mode 100644 index 000000000000..bacb1c0dc321 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/outer_composite_test.dart @@ -0,0 +1,37 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for OuterComposite +void main() { + // final instance = OuterComposite(); + + group('test OuterComposite', () { + // num myNumber + test('to test the property `myNumber`', () async { + // TODO + }); + + // String myString + test('to test the property `myString`', () async { + // TODO + }); + + // bool myBoolean + test('to test the property `myBoolean`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/outer_enum_default_value_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/outer_enum_default_value_test.dart new file mode 100644 index 000000000000..b8bccd1b0569 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/outer_enum_default_value_test.dart @@ -0,0 +1,21 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for OuterEnumDefaultValue +void main() { + + group('test OuterEnumDefaultValue', () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/outer_enum_integer_default_value_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/outer_enum_integer_default_value_test.dart new file mode 100644 index 000000000000..08acf7056dc8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/outer_enum_integer_default_value_test.dart @@ -0,0 +1,21 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for OuterEnumIntegerDefaultValue +void main() { + + group('test OuterEnumIntegerDefaultValue', () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/outer_enum_integer_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/outer_enum_integer_test.dart new file mode 100644 index 000000000000..5adf20a20d92 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/outer_enum_integer_test.dart @@ -0,0 +1,21 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for OuterEnumInteger +void main() { + + group('test OuterEnumInteger', () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/outer_enum_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/outer_enum_test.dart new file mode 100644 index 000000000000..8c51aa895529 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/outer_enum_test.dart @@ -0,0 +1,21 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for OuterEnum +void main() { + + group('test OuterEnum', () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/outer_object_with_enum_property_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/outer_object_with_enum_property_test.dart new file mode 100644 index 000000000000..9fffef0c1db1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/outer_object_with_enum_property_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for OuterObjectWithEnumProperty +void main() { + // final instance = OuterObjectWithEnumProperty(); + + group('test OuterObjectWithEnumProperty', () { + // OuterEnumInteger value + test('to test the property `value`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/parent_with_nullable_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/parent_with_nullable_test.dart new file mode 100644 index 000000000000..958c4ae019d4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/parent_with_nullable_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ParentWithNullable +void main() { + // final instance = ParentWithNullable(); + + group('test ParentWithNullable', () { + // String type + test('to test the property `type`', () async { + // TODO + }); + + // String nullableproperty + test('to test the property `nullableproperty`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/pet_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/pet_api_test.dart new file mode 100644 index 000000000000..52d58c42de4a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/pet_api_test.dart @@ -0,0 +1,102 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for PetApi +void main() { + // final instance = PetApi(); + + group('tests for PetApi', () { + // Add a new pet to the store + // + // + // + //Future addPet(Pet pet) async + test('test addPet', () async { + // TODO + }); + + // Deletes a pet + // + // + // + //Future deletePet(int petid, { String apiKey }) async + test('test deletePet', () async { + // TODO + }); + + // Finds Pets by status + // + // Multiple status values can be provided with comma separated strings + // + //Future> findPetsByStatus(List status) async + test('test findPetsByStatus', () async { + // TODO + }); + + // Finds Pets by tags + // + // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + // + //Future> findPetsByTags(Set tags) async + test('test findPetsByTags', () async { + // TODO + }); + + // Find pet by ID + // + // Returns a single pet + // + //Future getPetById(int petid) async + test('test getPetById', () async { + // TODO + }); + + // Update an existing pet + // + // + // + //Future updatePet(Pet pet) async + test('test updatePet', () async { + // TODO + }); + + // Updates a pet in the store with form data + // + // + // + //Future updatePetWithForm(int petid, { String name, String status }) async + test('test updatePetWithForm', () async { + // TODO + }); + + // uploads an image + // + // + // + //Future uploadFile(int petid, { String additionalmetadata, MultipartFile file }) async + test('test uploadFile', () async { + // TODO + }); + + // uploads an image (required) + // + // + // + //Future uploadFileWithRequiredFile(int petid, MultipartFile requiredfile, { String additionalmetadata }) async + test('test uploadFileWithRequiredFile', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/pet_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/pet_test.dart new file mode 100644 index 000000000000..602c4c84cdbb --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/pet_test.dart @@ -0,0 +1,53 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Pet +void main() { + // final instance = Pet(); + + group('test Pet', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // Category category + test('to test the property `category`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // Set photourls (default value: const {}) + test('to test the property `photourls`', () async { + // TODO + }); + + // List tags (default value: const []) + 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/dart2/petstore_client_lib_use_lower_camel_case/test/read_only_first_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/read_only_first_test.dart new file mode 100644 index 000000000000..9d84c9e3d0c9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/read_only_first_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ReadOnlyFirst +void main() { + // final instance = ReadOnlyFirst(); + + group('test ReadOnlyFirst', () { + // String bar + test('to test the property `bar`', () async { + // TODO + }); + + // String baz + test('to test the property `baz`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/single_ref_type_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/single_ref_type_test.dart new file mode 100644 index 000000000000..aee6e38412e8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/single_ref_type_test.dart @@ -0,0 +1,21 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for SingleRefType +void main() { + + group('test SingleRefType', () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/special_model_name_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/special_model_name_test.dart new file mode 100644 index 000000000000..a7c80ced1801 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/special_model_name_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for SpecialModelName +void main() { + // final instance = SpecialModelName(); + + group('test SpecialModelName', () { + // int dollarSpecialleftSquareBracketPropertyperiodNamerightSquareBracket + test('to test the property `dollarSpecialleftSquareBracketPropertyperiodNamerightSquareBracket`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/store_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/store_api_test.dart new file mode 100644 index 000000000000..ea91b78f7079 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/store_api_test.dart @@ -0,0 +1,57 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for StoreApi +void main() { + // final instance = StoreApi(); + + group('tests for StoreApi', () { + // Delete purchase order by ID + // + // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + // + //Future deleteOrder(String orderId) async + test('test deleteOrder', () async { + // TODO + }); + + // Returns pet inventories by status + // + // Returns a map of status codes to quantities + // + //Future> getInventory() async + test('test getInventory', () async { + // TODO + }); + + // Find purchase order by ID + // + // For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + // + //Future getOrderById(int orderId) async + test('test getOrderById', () async { + // TODO + }); + + // Place an order for a pet + // + // + // + //Future placeOrder(Order order) async + test('test placeOrder', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/tag_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/tag_test.dart new file mode 100644 index 000000000000..0a7baa9a5600 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/tag_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Tag +void main() { + // final instance = Tag(); + + group('test Tag', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/test_inline_freeform_additional_properties_request_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/test_inline_freeform_additional_properties_request_test.dart new file mode 100644 index 000000000000..019de32bfb0d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/test_inline_freeform_additional_properties_request_test.dart @@ -0,0 +1,27 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for TestInlineFreeformAdditionalPropertiesRequest +void main() { + // final instance = TestInlineFreeformAdditionalPropertiesRequest(); + + group('test TestInlineFreeformAdditionalPropertiesRequest', () { + // String someproperty + test('to test the property `someproperty`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/user_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/user_api_test.dart new file mode 100644 index 000000000000..573f19d8ffe1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/user_api_test.dart @@ -0,0 +1,93 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for UserApi +void main() { + // final instance = UserApi(); + + group('tests for UserApi', () { + // Create user + // + // This can only be done by the logged in user. + // + //Future createUser(User user) async + test('test createUser', () async { + // TODO + }); + + // Creates list of users with given input array + // + // + // + //Future createUsersWithArrayInput(List user) async + test('test createUsersWithArrayInput', () async { + // TODO + }); + + // Creates list of users with given input array + // + // + // + //Future createUsersWithListInput(List user) async + test('test createUsersWithListInput', () async { + // TODO + }); + + // Delete user + // + // This can only be done by the logged in user. + // + //Future deleteUser(String username) async + test('test deleteUser', () async { + // TODO + }); + + // Get user by user name + // + // + // + //Future getUserByName(String username) async + test('test getUserByName', () async { + // TODO + }); + + // Logs user into the system + // + // + // + //Future loginUser(String username, String password) async + test('test loginUser', () async { + // TODO + }); + + // Logs out current logged in user session + // + // + // + //Future logoutUser() async + test('test logoutUser', () async { + // TODO + }); + + // Updated user + // + // This can only be done by the logged in user. + // + //Future updateUser(String username, User user) async + test('test updateUser', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/user_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/user_test.dart new file mode 100644 index 000000000000..8f30818caa67 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_use_lower_camel_case/test/user_test.dart @@ -0,0 +1,63 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for User +void main() { + // final instance = User(); + + group('test 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 + }); + + + }); + +}