Skip to content

Commit eb8a87c

Browse files
committed
Admin API: make sure the meta fields are nullable
1 parent 50035ea commit eb8a87c

File tree

2 files changed

+44
-42
lines changed

2 files changed

+44
-42
lines changed

crates/handlers/src/admin/response.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ impl PaginationMeta {
5959
pub struct PaginatedResponse<T> {
6060
/// Response metadata
6161
#[serde(skip_serializing_if = "PaginationMeta::is_empty")]
62+
#[schemars(with = "Option<PaginationMeta>")]
6263
meta: PaginationMeta,
6364

6465
/// The list of resources
@@ -183,6 +184,7 @@ struct SingleResource<T> {
183184

184185
/// Metadata about the resource
185186
#[serde(skip_serializing_if = "SingleResourceMeta::is_empty")]
187+
#[schemars(with = "Option<SingleResourceMeta>")]
186188
meta: SingleResourceMeta,
187189
}
188190

docs/api/spec.json

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3810,13 +3810,13 @@
38103810
"description": "A top-level response with a page of resources",
38113811
"type": "object",
38123812
"required": [
3813-
"links",
3814-
"meta"
3813+
"links"
38153814
],
38163815
"properties": {
38173816
"meta": {
38183817
"description": "Response metadata",
3819-
"$ref": "#/components/schemas/PaginationMeta"
3818+
"$ref": "#/components/schemas/PaginationMeta",
3819+
"nullable": true
38203820
},
38213821
"data": {
38223822
"description": "The list of resources",
@@ -3851,7 +3851,6 @@
38513851
"attributes",
38523852
"id",
38533853
"links",
3854-
"meta",
38553854
"type"
38563855
],
38573856
"properties": {
@@ -3873,7 +3872,8 @@
38733872
},
38743873
"meta": {
38753874
"description": "Metadata about the resource",
3876-
"$ref": "#/components/schemas/SingleResourceMeta"
3875+
"$ref": "#/components/schemas/SingleResourceMeta",
3876+
"nullable": true
38773877
}
38783878
}
38793879
},
@@ -4132,13 +4132,13 @@
41324132
"description": "A top-level response with a page of resources",
41334133
"type": "object",
41344134
"required": [
4135-
"links",
4136-
"meta"
4135+
"links"
41374136
],
41384137
"properties": {
41394138
"meta": {
41404139
"description": "Response metadata",
4141-
"$ref": "#/components/schemas/PaginationMeta"
4140+
"$ref": "#/components/schemas/PaginationMeta",
4141+
"nullable": true
41424142
},
41434143
"data": {
41444144
"description": "The list of resources",
@@ -4161,7 +4161,6 @@
41614161
"attributes",
41624162
"id",
41634163
"links",
4164-
"meta",
41654164
"type"
41664165
],
41674166
"properties": {
@@ -4183,7 +4182,8 @@
41834182
},
41844183
"meta": {
41854184
"description": "Metadata about the resource",
4186-
"$ref": "#/components/schemas/SingleResourceMeta"
4185+
"$ref": "#/components/schemas/SingleResourceMeta",
4186+
"nullable": true
41874187
}
41884188
}
41894189
},
@@ -4306,7 +4306,6 @@
43064306
"attributes",
43074307
"id",
43084308
"links",
4309-
"meta",
43104309
"type"
43114310
],
43124311
"properties": {
@@ -4328,7 +4327,8 @@
43284327
},
43294328
"meta": {
43304329
"description": "Metadata about the resource",
4331-
"$ref": "#/components/schemas/SingleResourceMeta"
4330+
"$ref": "#/components/schemas/SingleResourceMeta",
4331+
"nullable": true
43324332
}
43334333
}
43344334
},
@@ -4387,13 +4387,13 @@
43874387
"description": "A top-level response with a page of resources",
43884388
"type": "object",
43894389
"required": [
4390-
"links",
4391-
"meta"
4390+
"links"
43924391
],
43934392
"properties": {
43944393
"meta": {
43954394
"description": "Response metadata",
4396-
"$ref": "#/components/schemas/PaginationMeta"
4395+
"$ref": "#/components/schemas/PaginationMeta",
4396+
"nullable": true
43974397
},
43984398
"data": {
43994399
"description": "The list of resources",
@@ -4416,7 +4416,6 @@
44164416
"attributes",
44174417
"id",
44184418
"links",
4419-
"meta",
44204419
"type"
44214420
],
44224421
"properties": {
@@ -4438,7 +4437,8 @@
44384437
},
44394438
"meta": {
44404439
"description": "Metadata about the resource",
4441-
"$ref": "#/components/schemas/SingleResourceMeta"
4440+
"$ref": "#/components/schemas/SingleResourceMeta",
4441+
"nullable": true
44424442
}
44434443
}
44444444
},
@@ -4593,13 +4593,13 @@
45934593
"description": "A top-level response with a page of resources",
45944594
"type": "object",
45954595
"required": [
4596-
"links",
4597-
"meta"
4596+
"links"
45984597
],
45994598
"properties": {
46004599
"meta": {
46014600
"description": "Response metadata",
4602-
"$ref": "#/components/schemas/PaginationMeta"
4601+
"$ref": "#/components/schemas/PaginationMeta",
4602+
"nullable": true
46034603
},
46044604
"data": {
46054605
"description": "The list of resources",
@@ -4622,7 +4622,6 @@
46224622
"attributes",
46234623
"id",
46244624
"links",
4625-
"meta",
46264625
"type"
46274626
],
46284627
"properties": {
@@ -4644,7 +4643,8 @@
46444643
},
46454644
"meta": {
46464645
"description": "Metadata about the resource",
4647-
"$ref": "#/components/schemas/SingleResourceMeta"
4646+
"$ref": "#/components/schemas/SingleResourceMeta",
4647+
"nullable": true
46484648
}
46494649
}
46504650
},
@@ -4733,13 +4733,13 @@
47334733
"description": "A top-level response with a page of resources",
47344734
"type": "object",
47354735
"required": [
4736-
"links",
4737-
"meta"
4736+
"links"
47384737
],
47394738
"properties": {
47404739
"meta": {
47414740
"description": "Response metadata",
4742-
"$ref": "#/components/schemas/PaginationMeta"
4741+
"$ref": "#/components/schemas/PaginationMeta",
4742+
"nullable": true
47434743
},
47444744
"data": {
47454745
"description": "The list of resources",
@@ -4762,7 +4762,6 @@
47624762
"attributes",
47634763
"id",
47644764
"links",
4765-
"meta",
47664765
"type"
47674766
],
47684767
"properties": {
@@ -4784,7 +4783,8 @@
47844783
},
47854784
"meta": {
47864785
"description": "Metadata about the resource",
4787-
"$ref": "#/components/schemas/SingleResourceMeta"
4786+
"$ref": "#/components/schemas/SingleResourceMeta",
4787+
"nullable": true
47884788
}
47894789
}
47904790
},
@@ -4875,13 +4875,13 @@
48754875
"description": "A top-level response with a page of resources",
48764876
"type": "object",
48774877
"required": [
4878-
"links",
4879-
"meta"
4878+
"links"
48804879
],
48814880
"properties": {
48824881
"meta": {
48834882
"description": "Response metadata",
4884-
"$ref": "#/components/schemas/PaginationMeta"
4883+
"$ref": "#/components/schemas/PaginationMeta",
4884+
"nullable": true
48854885
},
48864886
"data": {
48874887
"description": "The list of resources",
@@ -4904,7 +4904,6 @@
49044904
"attributes",
49054905
"id",
49064906
"links",
4907-
"meta",
49084907
"type"
49094908
],
49104909
"properties": {
@@ -4926,7 +4925,8 @@
49264925
},
49274926
"meta": {
49284927
"description": "Metadata about the resource",
4929-
"$ref": "#/components/schemas/SingleResourceMeta"
4928+
"$ref": "#/components/schemas/SingleResourceMeta",
4929+
"nullable": true
49304930
}
49314931
}
49324932
},
@@ -5069,13 +5069,13 @@
50695069
"description": "A top-level response with a page of resources",
50705070
"type": "object",
50715071
"required": [
5072-
"links",
5073-
"meta"
5072+
"links"
50745073
],
50755074
"properties": {
50765075
"meta": {
50775076
"description": "Response metadata",
5078-
"$ref": "#/components/schemas/PaginationMeta"
5077+
"$ref": "#/components/schemas/PaginationMeta",
5078+
"nullable": true
50795079
},
50805080
"data": {
50815081
"description": "The list of resources",
@@ -5098,7 +5098,6 @@
50985098
"attributes",
50995099
"id",
51005100
"links",
5101-
"meta",
51025101
"type"
51035102
],
51045103
"properties": {
@@ -5120,7 +5119,8 @@
51205119
},
51215120
"meta": {
51225121
"description": "Metadata about the resource",
5123-
"$ref": "#/components/schemas/SingleResourceMeta"
5122+
"$ref": "#/components/schemas/SingleResourceMeta",
5123+
"nullable": true
51245124
}
51255125
}
51265126
},
@@ -5216,13 +5216,13 @@
52165216
"description": "A top-level response with a page of resources",
52175217
"type": "object",
52185218
"required": [
5219-
"links",
5220-
"meta"
5219+
"links"
52215220
],
52225221
"properties": {
52235222
"meta": {
52245223
"description": "Response metadata",
5225-
"$ref": "#/components/schemas/PaginationMeta"
5224+
"$ref": "#/components/schemas/PaginationMeta",
5225+
"nullable": true
52265226
},
52275227
"data": {
52285228
"description": "The list of resources",
@@ -5245,7 +5245,6 @@
52455245
"attributes",
52465246
"id",
52475247
"links",
5248-
"meta",
52495248
"type"
52505249
],
52515250
"properties": {
@@ -5267,7 +5266,8 @@
52675266
},
52685267
"meta": {
52695268
"description": "Metadata about the resource",
5270-
"$ref": "#/components/schemas/SingleResourceMeta"
5269+
"$ref": "#/components/schemas/SingleResourceMeta",
5270+
"nullable": true
52715271
}
52725272
}
52735273
},

0 commit comments

Comments
 (0)