-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix generation for optional and nullable fields (double option pattern)
- Loading branch information
Showing
30 changed files
with
328 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
samples/client/petstore/rust/hyper/petstore/docs/OptionalTesting.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# OptionalTesting | ||
|
||
## Properties | ||
|
||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**optional_nonnull** | Option<**String**> | | [optional] | ||
**required_nonnull** | **String** | | | ||
**optional_nullable** | Option<**String**> | | [optional] | ||
**required_nullable** | Option<**String**> | | | ||
|
||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
samples/client/petstore/rust/hyper/petstore/src/models/optional_testing.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* OpenAPI Petstore | ||
* | ||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* | ||
* Generated by: https://openapi-generator.tech | ||
*/ | ||
|
||
/// OptionalTesting : Test handling of optional and nullable fields | ||
|
||
|
||
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] | ||
pub struct OptionalTesting { | ||
#[serde(rename = "optional_nonnull", skip_serializing_if = "Option::is_none")] | ||
pub optional_nonnull: Option<String>, | ||
#[serde(rename = "required_nonnull")] | ||
pub required_nonnull: String, | ||
#[serde(rename = "optional_nullable", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] | ||
pub optional_nullable: Option<Option<String>>, | ||
#[serde(rename = "required_nullable", deserialize_with = "Option::deserialize")] | ||
pub required_nullable: Option<String>, | ||
} | ||
|
||
impl OptionalTesting { | ||
/// Test handling of optional and nullable fields | ||
pub fn new(required_nonnull: String, required_nullable: Option<String>) -> OptionalTesting { | ||
OptionalTesting { | ||
optional_nonnull: None, | ||
required_nonnull, | ||
optional_nullable: None, | ||
required_nullable, | ||
} | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
samples/client/petstore/rust/reqwest/petstore-async/docs/OptionalTesting.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# OptionalTesting | ||
|
||
## Properties | ||
|
||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**optional_nonnull** | Option<**String**> | | [optional] | ||
**required_nonnull** | **String** | | | ||
**optional_nullable** | Option<**String**> | | [optional] | ||
**required_nullable** | Option<**String**> | | | ||
|
||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
samples/client/petstore/rust/reqwest/petstore-async/src/models/optional_testing.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* OpenAPI Petstore | ||
* | ||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* | ||
* Generated by: https://openapi-generator.tech | ||
*/ | ||
|
||
/// OptionalTesting : Test handling of optional and nullable fields | ||
|
||
|
||
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] | ||
pub struct OptionalTesting { | ||
#[serde(rename = "optional_nonnull", skip_serializing_if = "Option::is_none")] | ||
pub optional_nonnull: Option<String>, | ||
#[serde(rename = "required_nonnull")] | ||
pub required_nonnull: String, | ||
#[serde(rename = "optional_nullable", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] | ||
pub optional_nullable: Option<Option<String>>, | ||
#[serde(rename = "required_nullable", deserialize_with = "Option::deserialize")] | ||
pub required_nullable: Option<String>, | ||
} | ||
|
||
impl OptionalTesting { | ||
/// Test handling of optional and nullable fields | ||
pub fn new(required_nonnull: String, required_nullable: Option<String>) -> OptionalTesting { | ||
OptionalTesting { | ||
optional_nonnull: None, | ||
required_nonnull, | ||
optional_nullable: None, | ||
required_nullable, | ||
} | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...es/client/petstore/rust/reqwest/petstore-awsv4signature/docs/OptionalTesting.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# OptionalTesting | ||
|
||
## Properties | ||
|
||
Name | Type | Description | Notes | ||
------------ | ------------- | ------------- | ------------- | ||
**optional_nonnull** | Option<**String**> | | [optional] | ||
**required_nonnull** | **String** | | | ||
**optional_nullable** | Option<**String**> | | [optional] | ||
**required_nullable** | Option<**String**> | | | ||
|
||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/optional_testing.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* OpenAPI Petstore | ||
* | ||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* | ||
* Generated by: https://openapi-generator.tech | ||
*/ | ||
|
||
/// OptionalTesting : Test handling of optional and nullable fields | ||
|
||
|
||
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] | ||
pub struct OptionalTesting { | ||
#[serde(rename = "optional_nonnull", skip_serializing_if = "Option::is_none")] | ||
pub optional_nonnull: Option<String>, | ||
#[serde(rename = "required_nonnull")] | ||
pub required_nonnull: String, | ||
#[serde(rename = "optional_nullable", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] | ||
pub optional_nullable: Option<Option<String>>, | ||
#[serde(rename = "required_nullable", deserialize_with = "Option::deserialize")] | ||
pub required_nullable: Option<String>, | ||
} | ||
|
||
impl OptionalTesting { | ||
/// Test handling of optional and nullable fields | ||
pub fn new(required_nonnull: String, required_nullable: Option<String>) -> OptionalTesting { | ||
OptionalTesting { | ||
optional_nonnull: None, | ||
required_nonnull, | ||
optional_nullable: None, | ||
required_nullable, | ||
} | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.