Skip to content

Commit 42e8849

Browse files
authored
Merge pull request #87 from sine-fdn/enum-serde
fix: remove wrong serde(untagged) from enums
2 parents 9fa3fd1 + 43a97c8 commit 42e8849

File tree

3 files changed

+24
-51
lines changed

3 files changed

+24
-51
lines changed

gen/schemas/shipment-footprint.json

+13-34
Original file line numberDiff line numberDiff line change
@@ -129,40 +129,19 @@
129129
"type": "string"
130130
},
131131
"Incoterms": {
132-
"anyOf": [
133-
{
134-
"type": "null"
135-
},
136-
{
137-
"type": "null"
138-
},
139-
{
140-
"type": "null"
141-
},
142-
{
143-
"type": "null"
144-
},
145-
{
146-
"type": "null"
147-
},
148-
{
149-
"type": "null"
150-
},
151-
{
152-
"type": "null"
153-
},
154-
{
155-
"type": "null"
156-
},
157-
{
158-
"type": "null"
159-
},
160-
{
161-
"type": "null"
162-
},
163-
{
164-
"type": "null"
165-
}
132+
"type": "string",
133+
"enum": [
134+
"EXW",
135+
"FCA",
136+
"CPT",
137+
"CIP",
138+
"DAP",
139+
"DPU",
140+
"DDP",
141+
"FAS",
142+
"FOB",
143+
"CFR",
144+
"CIF"
166145
]
167146
},
168147
"Location": {

gen/schemas/toc.json

+8-14
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,10 @@
108108
},
109109
"definitions": {
110110
"AirShippingOption": {
111-
"anyOf": [
112-
{
113-
"type": "null"
114-
},
115-
{
116-
"type": "null"
117-
}
111+
"type": "string",
112+
"enum": [
113+
"belly freight",
114+
"freighter"
118115
]
119116
},
120117
"Decimal": {
@@ -217,13 +214,10 @@
217214
]
218215
},
219216
"FlightLength": {
220-
"anyOf": [
221-
{
222-
"type": "null"
223-
},
224-
{
225-
"type": "null"
226-
}
217+
"type": "string",
218+
"enum": [
219+
"short-haul",
220+
"long-haul"
227221
]
228222
},
229223
"GlecDataQualityIndex": {

gen/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub struct Tce {
7171
}
7272

7373
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, PartialEq)]
74-
#[serde(untagged, rename_all = "UPPERCASE")]
74+
#[serde(rename_all = "UPPERCASE")]
7575
pub enum Incoterms {
7676
Exw,
7777
Fca,
@@ -141,15 +141,15 @@ pub enum TruckLoadingSequence {
141141
}
142142

143143
#[derive(Debug, Serialize, Deserialize, JsonSchema, PartialEq, Clone)]
144-
#[serde(rename_all = "camelCase", untagged)]
144+
#[serde(rename_all = "camelCase")]
145145
pub enum AirShippingOption {
146146
#[serde(rename = "belly freight")]
147147
BellyFreight,
148148
Freighter,
149149
}
150150

151151
#[derive(Debug, Serialize, Deserialize, JsonSchema, PartialEq, Clone)]
152-
#[serde(rename_all = "camelCase", untagged)]
152+
#[serde(rename_all = "camelCase")]
153153
pub enum FlightLength {
154154
#[serde(rename = "short-haul")]
155155
ShortHaul,

0 commit comments

Comments
 (0)