Skip to content

Commit bfaa6c0

Browse files
author
Paul FREAKN Baker
committed
Updating rust output to be language idomatic
Struct fields should be snake_case, but they were accidentaly set to camelCase.
1 parent a42555d commit bfaa6c0

File tree

8 files changed

+28
-28
lines changed

8 files changed

+28
-28
lines changed

crates/target_rust/output/custom_overrides/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ pub struct RootOverrideTypeDiscriminatorBaz {}
99
#[derive(Serialize, Deserialize)]
1010
pub struct Root {
1111
#[serde(rename = "override_elements_container")]
12-
pub overrideElementsContainer: Vec<String>,
12+
pub override_elements_container: Vec<String>,
1313

1414
#[serde(rename = "override_type_discriminator")]
15-
pub overrideTypeDiscriminator: serde_json::Value,
15+
pub override_type_discriminator: serde_json::Value,
1616

1717
#[serde(rename = "override_type_enum")]
18-
pub overrideTypeEnum: serde_json::Value,
18+
pub override_type_enum: serde_json::Value,
1919

2020
#[serde(rename = "override_type_expr")]
21-
pub overrideTypeExpr: serde_json::Value,
21+
pub override_type_expr: serde_json::Value,
2222

2323
#[serde(rename = "override_type_properties")]
24-
pub overrideTypeProperties: serde_json::Value,
24+
pub override_type_properties: serde_json::Value,
2525

2626
#[serde(rename = "override_values_container")]
27-
pub overrideValuesContainer: HashMap<String, String>,
27+
pub override_values_container: HashMap<String, String>,
2828
}

crates/target_rust/output/description/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,31 @@ pub struct RootPropertiesWithDescription {}
3838
pub struct Root {
3939
/// A description for discriminator
4040
#[serde(rename = "discriminator_with_description")]
41-
pub discriminatorWithDescription: RootDiscriminatorWithDescription,
41+
pub discriminator_with_description: RootDiscriminatorWithDescription,
4242

4343
/// A description for enum
4444
#[serde(rename = "enum_with_description")]
45-
pub enumWithDescription: RootEnumWithDescription,
45+
pub enum_with_description: RootEnumWithDescription,
4646

4747
/// Whereas disregard and contempt for human rights have resulted in
4848
/// barbarous acts which have outraged the conscience of mankind, and the
4949
/// advent of a world in which human beings shall enjoy freedom of speech
5050
/// and belief and freedom from fear and want has been proclaimed as the
5151
/// highest aspiration of the common people,
5252
#[serde(rename = "long_description")]
53-
pub longDescription: String,
53+
pub long_description: String,
5454

5555
/// A description for properties
5656
#[serde(rename = "properties_with_description")]
57-
pub propertiesWithDescription: RootPropertiesWithDescription,
57+
pub properties_with_description: RootPropertiesWithDescription,
5858

5959
/// A description for ref
6060
#[serde(rename = "ref_with_description")]
61-
pub refWithDescription: Baz,
61+
pub ref_with_description: Baz,
6262

6363
/// A description for string
6464
#[serde(rename = "string_with_description")]
65-
pub stringWithDescription: String,
65+
pub string_with_description: String,
6666
}
6767

6868
/// A description for a definition

crates/target_rust/output/empty_and_nonascii_properties/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
55
#[derive(Serialize, Deserialize)]
66
pub struct Root {
77
#[serde(rename = "")]
8-
pub defaultName: String,
8+
pub default_name: String,
99

1010
#[serde(rename = "$foo")]
1111
pub foo: String,
@@ -17,14 +17,14 @@ pub struct Root {
1717
pub foo1: String,
1818

1919
#[serde(rename = "foo\nbar")]
20-
pub fooBar: String,
20+
pub foo_bar: String,
2121

2222
#[serde(rename = "foo bar")]
23-
pub fooBar0: String,
23+
pub foo_bar0: String,
2424

2525
#[serde(rename = "foo0bar")]
2626
pub foo0bar: String,
2727

2828
#[serde(rename = "foo﷽bar")]
29-
pub fooBar1: String,
29+
pub foo_bar1: String,
3030
}

crates/target_rust/output/enum_collisions/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ pub struct Root {
3232
pub foo: RootFoo,
3333

3434
#[serde(rename = "foo_bar")]
35-
pub fooBar: RootFooBar0,
35+
pub foo_bar: RootFooBar0,
3636
}

crates/target_rust/output/initialisms/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ pub struct Root {
2020
pub id: String,
2121

2222
#[serde(rename = "nested_id_initialism")]
23-
pub nestedIdInitialism: RootNestedIdInitialism,
23+
pub nested_id_initialism: RootNestedIdInitialism,
2424

2525
#[serde(rename = "utf8")]
2626
pub utf8: String,
2727

2828
#[serde(rename = "word_with_embedded_id_initialism")]
29-
pub wordWithEmbeddedIdInitialism: String,
29+
pub word_with_embedded_id_initialism: String,
3030

3131
#[serde(rename = "word_with_trailing_initialism_id")]
32-
pub wordWithTrailingInitialismId: String,
32+
pub word_with_trailing_initialism_id: String,
3333
}

crates/target_rust/output/nullable_references/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ use serde::{Deserialize, Serialize};
55
#[derive(Serialize, Deserialize)]
66
pub struct Root {
77
#[serde(rename = "notnull_ref_notnull_string")]
8-
pub notnullRefNotnullString: NotnullRefNotnullString,
8+
pub notnull_ref_notnull_string: NotnullRefNotnullString,
99

1010
#[serde(rename = "notnull_ref_null_string")]
11-
pub notnullRefNullString: NotnullRefNullString,
11+
pub notnull_ref_null_string: NotnullRefNullString,
1212

1313
#[serde(rename = "notnull_string")]
14-
pub notnullString: NotnullString,
14+
pub notnull_string: NotnullString,
1515

1616
#[serde(rename = "null_ref_notnull_string")]
17-
pub nullRefNotnullString: NullRefNotnullString,
17+
pub null_ref_notnull_string: NullRefNotnullString,
1818

1919
#[serde(rename = "null_ref_null_string")]
20-
pub nullRefNullString: NullRefNullString,
20+
pub null_ref_null_string: NullRefNullString,
2121

2222
#[serde(rename = "null_string")]
23-
pub nullString: NullString,
23+
pub null_string: NullString,
2424
}
2525

2626
pub type NotnullRefNotnullString = NotnullString;

crates/target_rust/output/type_collisions/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ pub struct Root {
2626
pub foo: RootFoo,
2727

2828
#[serde(rename = "foo_bar")]
29-
pub fooBar: RootFooBar0,
29+
pub foo_bar: RootFooBar0,
3030
}

crates/target_rust/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ lazy_static! {
1818
static ref FIELD_NAMING_CONVENTION: Box<dyn inflect::Inflector + Send + Sync> =
1919
Box::new(inflect::KeywordAvoidingInflector::new(
2020
KEYWORDS.clone(),
21-
inflect::TailInflector::new(inflect::Case::camel_case())
21+
inflect::TailInflector::new(inflect::Case::snake_case())
2222
));
2323
static ref ENUM_MEMBER_NAMING_CONVENTION: Box<dyn inflect::Inflector + Send + Sync> =
2424
Box::new(inflect::KeywordAvoidingInflector::new(

0 commit comments

Comments
 (0)