Skip to content

Commit 1fcc348

Browse files
committed
Review change from chrono::NaiveDateTime to chrono::DateTime<chrono::FixedOffset> `
1 parent 1f0442b commit 1fcc348

23 files changed

Lines changed: 25 additions & 25 deletions

File tree

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public RustClientCodegen() {
190190
typeMapping.put("URI", "String");
191191
// Temporarily set the default to chrono. Then when `processOpts` is called it will update to not use chrono if specified
192192
typeMapping.put("date", "chrono::NaiveDate");
193-
typeMapping.put("DateTime", "chrono::NaiveDateTime");
193+
typeMapping.put("DateTime", "chrono::DateTime<chrono::FixedOffset>");
194194

195195
typeMapping.put("password", "String");
196196
typeMapping.put("decimal", "String");
@@ -224,7 +224,7 @@ public RustClientCodegen() {
224224
.defaultValue(Boolean.FALSE.toString()));
225225
cliOptions.add(new CliOption(SUPPORT_TOKEN_SOURCE, "If set, add support for google-cloud-token. This option is for 'reqwest' and 'reqwest-trait' library only and requires the 'supportAsync' option", SchemaTypeUtil.BOOLEAN_TYPE)
226226
.defaultValue(Boolean.FALSE.toString()));
227-
cliOptions.add(new CliOption(USE_CHRONO, "If set, use chrono to represent date time objects (`chrono::NaiveDate` for `date` and `chrono::NaiveDateTime` for `date-time`)", SchemaTypeUtil.BOOLEAN_TYPE)
227+
cliOptions.add(new CliOption(USE_CHRONO, "If set, use chrono to represent date time objects (`chrono::NaiveDate` for `date` and `chrono::DateTime<chrono::FixedOffset>>` for `date-time`)", SchemaTypeUtil.BOOLEAN_TYPE)
228228
.defaultValue(Boolean.TRUE.toString()));
229229
cliOptions.add(new CliOption(SUPPORT_MULTIPLE_RESPONSES, "If set, return type wraps an enum of all possible 2xx schemas. This option is for 'reqwest' and 'reqwest-trait' library only", SchemaTypeUtil.BOOLEAN_TYPE)
230230
.defaultValue(Boolean.FALSE.toString()));
@@ -1003,7 +1003,7 @@ private void setUseChrono(boolean useChrono) {
10031003
this.useChrono = useChrono;
10041004
if(isUseChrono()){
10051005
typeMapping.put("date", "chrono::NaiveDate");
1006-
typeMapping.put("DateTime", "chrono::NaiveDateTime");
1006+
typeMapping.put("DateTime", "chrono::DateTime<chrono::FixedOffset>");
10071007
}else{
10081008
typeMapping.put("date", "String");
10091009
typeMapping.put("DateTime", "String");

samples/client/petstore/rust/hyper/petstore/docs/Order.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Name | Type | Description | Notes
77
**id** | Option<**i64**> | | [optional]
88
**pet_id** | Option<**i64**> | | [optional]
99
**quantity** | Option<**i32**> | | [optional]
10-
**ship_date** | Option<**chrono::NaiveDateTime**> | | [optional]
10+
**ship_date** | Option<**chrono::DateTime<chrono::FixedOffset>**> | | [optional]
1111
**status** | Option<**Status**> | Order Status (enum: placed, approved, delivered) | [optional]
1212
**complete** | Option<**bool**> | | [optional][default to false]
1313

samples/client/petstore/rust/hyper/petstore/src/models/order.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct Order {
2121
#[serde(rename = "quantity", skip_serializing_if = "Option::is_none")]
2222
pub quantity: Option<i32>,
2323
#[serde(rename = "shipDate", skip_serializing_if = "Option::is_none")]
24-
pub ship_date: Option<chrono::NaiveDateTime>,
24+
pub ship_date: Option<chrono::DateTime<chrono::FixedOffset>>,
2525
/// Order Status
2626
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
2727
pub status: Option<Status>,

samples/client/petstore/rust/hyper0x/petstore/docs/Order.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Name | Type | Description | Notes
77
**id** | Option<**i64**> | | [optional]
88
**pet_id** | Option<**i64**> | | [optional]
99
**quantity** | Option<**i32**> | | [optional]
10-
**ship_date** | Option<**chrono::NaiveDateTime**> | | [optional]
10+
**ship_date** | Option<**chrono::DateTime<chrono::FixedOffset>**> | | [optional]
1111
**status** | Option<**Status**> | Order Status (enum: placed, approved, delivered) | [optional]
1212
**complete** | Option<**bool**> | | [optional][default to false]
1313

samples/client/petstore/rust/hyper0x/petstore/src/models/order.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct Order {
2121
#[serde(rename = "quantity", skip_serializing_if = "Option::is_none")]
2222
pub quantity: Option<i32>,
2323
#[serde(rename = "shipDate", skip_serializing_if = "Option::is_none")]
24-
pub ship_date: Option<chrono::NaiveDateTime>,
24+
pub ship_date: Option<chrono::DateTime<chrono::FixedOffset>>,
2525
/// Order Status
2626
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
2727
pub status: Option<Status>,

samples/client/petstore/rust/reqwest-trait/petstore/docs/Order.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Name | Type | Description | Notes
77
**id** | Option<**i64**> | | [optional]
88
**pet_id** | Option<**i64**> | | [optional]
99
**quantity** | Option<**i32**> | | [optional]
10-
**ship_date** | Option<**chrono::NaiveDateTime**> | | [optional]
10+
**ship_date** | Option<**chrono::DateTime<chrono::FixedOffset>**> | | [optional]
1111
**status** | Option<**Status**> | Order Status (enum: placed, approved, delivered) | [optional]
1212
**complete** | Option<**bool**> | | [optional][default to false]
1313

samples/client/petstore/rust/reqwest-trait/petstore/src/models/order.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct Order {
2121
#[serde(rename = "quantity", skip_serializing_if = "Option::is_none")]
2222
pub quantity: Option<i32>,
2323
#[serde(rename = "shipDate", skip_serializing_if = "Option::is_none")]
24-
pub ship_date: Option<chrono::NaiveDateTime>,
24+
pub ship_date: Option<chrono::DateTime<chrono::FixedOffset>>,
2525
/// Order Status
2626
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
2727
pub status: Option<Status>,

samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/Order.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Name | Type | Description | Notes
77
**id** | Option<**i64**> | | [optional]
88
**pet_id** | Option<**i64**> | | [optional]
99
**quantity** | Option<**i32**> | | [optional]
10-
**ship_date** | Option<**chrono::NaiveDateTime**> | | [optional]
10+
**ship_date** | Option<**chrono::DateTime<chrono::FixedOffset>**> | | [optional]
1111
**status** | Option<**Status**> | Order Status (enum: placed, approved, delivered) | [optional]
1212
**complete** | Option<**bool**> | | [optional][default to false]
1313

samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/order.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct Order {
2121
#[serde(rename = "quantity", skip_serializing_if = "Option::is_none")]
2222
pub quantity: Option<i32>,
2323
#[serde(rename = "shipDate", skip_serializing_if = "Option::is_none")]
24-
pub ship_date: Option<chrono::NaiveDateTime>,
24+
pub ship_date: Option<chrono::DateTime<chrono::FixedOffset>>,
2525
/// Order Status
2626
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
2727
pub status: Option<Status>,

samples/client/petstore/rust/reqwest/petstore-async-tokensource/docs/Order.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Name | Type | Description | Notes
77
**id** | Option<**i64**> | | [optional]
88
**pet_id** | Option<**i64**> | | [optional]
99
**quantity** | Option<**i32**> | | [optional]
10-
**ship_date** | Option<**chrono::NaiveDateTime**> | | [optional]
10+
**ship_date** | Option<**chrono::DateTime<chrono::FixedOffset>**> | | [optional]
1111
**status** | Option<**Status**> | Order Status (enum: placed, approved, delivered) | [optional]
1212
**complete** | Option<**bool**> | | [optional][default to false]
1313

0 commit comments

Comments
 (0)