Admin API: make sure the meta fields are nullable

This commit is contained in:
Quentin Gliech
2025-09-30 13:23:54 +02:00
parent 34919df1dd
commit 50a8d00dc6
2 changed files with 44 additions and 42 deletions

View File

@@ -59,6 +59,7 @@ impl PaginationMeta {
pub struct PaginatedResponse<T> { pub struct PaginatedResponse<T> {
/// Response metadata /// Response metadata
#[serde(skip_serializing_if = "PaginationMeta::is_empty")] #[serde(skip_serializing_if = "PaginationMeta::is_empty")]
#[schemars(with = "Option<PaginationMeta>")]
meta: PaginationMeta, meta: PaginationMeta,
/// The list of resources /// The list of resources
@@ -183,6 +184,7 @@ struct SingleResource<T> {
/// Metadata about the resource /// Metadata about the resource
#[serde(skip_serializing_if = "SingleResourceMeta::is_empty")] #[serde(skip_serializing_if = "SingleResourceMeta::is_empty")]
#[schemars(with = "Option<SingleResourceMeta>")]
meta: SingleResourceMeta, meta: SingleResourceMeta,
} }

View File

@@ -3810,13 +3810,13 @@
"description": "A top-level response with a page of resources", "description": "A top-level response with a page of resources",
"type": "object", "type": "object",
"required": [ "required": [
"links", "links"
"meta"
], ],
"properties": { "properties": {
"meta": { "meta": {
"description": "Response metadata", "description": "Response metadata",
"$ref": "#/components/schemas/PaginationMeta" "$ref": "#/components/schemas/PaginationMeta",
"nullable": true
}, },
"data": { "data": {
"description": "The list of resources", "description": "The list of resources",
@@ -3851,7 +3851,6 @@
"attributes", "attributes",
"id", "id",
"links", "links",
"meta",
"type" "type"
], ],
"properties": { "properties": {
@@ -3873,7 +3872,8 @@
}, },
"meta": { "meta": {
"description": "Metadata about the resource", "description": "Metadata about the resource",
"$ref": "#/components/schemas/SingleResourceMeta" "$ref": "#/components/schemas/SingleResourceMeta",
"nullable": true
} }
} }
}, },
@@ -4132,13 +4132,13 @@
"description": "A top-level response with a page of resources", "description": "A top-level response with a page of resources",
"type": "object", "type": "object",
"required": [ "required": [
"links", "links"
"meta"
], ],
"properties": { "properties": {
"meta": { "meta": {
"description": "Response metadata", "description": "Response metadata",
"$ref": "#/components/schemas/PaginationMeta" "$ref": "#/components/schemas/PaginationMeta",
"nullable": true
}, },
"data": { "data": {
"description": "The list of resources", "description": "The list of resources",
@@ -4161,7 +4161,6 @@
"attributes", "attributes",
"id", "id",
"links", "links",
"meta",
"type" "type"
], ],
"properties": { "properties": {
@@ -4183,7 +4182,8 @@
}, },
"meta": { "meta": {
"description": "Metadata about the resource", "description": "Metadata about the resource",
"$ref": "#/components/schemas/SingleResourceMeta" "$ref": "#/components/schemas/SingleResourceMeta",
"nullable": true
} }
} }
}, },
@@ -4306,7 +4306,6 @@
"attributes", "attributes",
"id", "id",
"links", "links",
"meta",
"type" "type"
], ],
"properties": { "properties": {
@@ -4328,7 +4327,8 @@
}, },
"meta": { "meta": {
"description": "Metadata about the resource", "description": "Metadata about the resource",
"$ref": "#/components/schemas/SingleResourceMeta" "$ref": "#/components/schemas/SingleResourceMeta",
"nullable": true
} }
} }
}, },
@@ -4387,13 +4387,13 @@
"description": "A top-level response with a page of resources", "description": "A top-level response with a page of resources",
"type": "object", "type": "object",
"required": [ "required": [
"links", "links"
"meta"
], ],
"properties": { "properties": {
"meta": { "meta": {
"description": "Response metadata", "description": "Response metadata",
"$ref": "#/components/schemas/PaginationMeta" "$ref": "#/components/schemas/PaginationMeta",
"nullable": true
}, },
"data": { "data": {
"description": "The list of resources", "description": "The list of resources",
@@ -4416,7 +4416,6 @@
"attributes", "attributes",
"id", "id",
"links", "links",
"meta",
"type" "type"
], ],
"properties": { "properties": {
@@ -4438,7 +4437,8 @@
}, },
"meta": { "meta": {
"description": "Metadata about the resource", "description": "Metadata about the resource",
"$ref": "#/components/schemas/SingleResourceMeta" "$ref": "#/components/schemas/SingleResourceMeta",
"nullable": true
} }
} }
}, },
@@ -4593,13 +4593,13 @@
"description": "A top-level response with a page of resources", "description": "A top-level response with a page of resources",
"type": "object", "type": "object",
"required": [ "required": [
"links", "links"
"meta"
], ],
"properties": { "properties": {
"meta": { "meta": {
"description": "Response metadata", "description": "Response metadata",
"$ref": "#/components/schemas/PaginationMeta" "$ref": "#/components/schemas/PaginationMeta",
"nullable": true
}, },
"data": { "data": {
"description": "The list of resources", "description": "The list of resources",
@@ -4622,7 +4622,6 @@
"attributes", "attributes",
"id", "id",
"links", "links",
"meta",
"type" "type"
], ],
"properties": { "properties": {
@@ -4644,7 +4643,8 @@
}, },
"meta": { "meta": {
"description": "Metadata about the resource", "description": "Metadata about the resource",
"$ref": "#/components/schemas/SingleResourceMeta" "$ref": "#/components/schemas/SingleResourceMeta",
"nullable": true
} }
} }
}, },
@@ -4733,13 +4733,13 @@
"description": "A top-level response with a page of resources", "description": "A top-level response with a page of resources",
"type": "object", "type": "object",
"required": [ "required": [
"links", "links"
"meta"
], ],
"properties": { "properties": {
"meta": { "meta": {
"description": "Response metadata", "description": "Response metadata",
"$ref": "#/components/schemas/PaginationMeta" "$ref": "#/components/schemas/PaginationMeta",
"nullable": true
}, },
"data": { "data": {
"description": "The list of resources", "description": "The list of resources",
@@ -4762,7 +4762,6 @@
"attributes", "attributes",
"id", "id",
"links", "links",
"meta",
"type" "type"
], ],
"properties": { "properties": {
@@ -4784,7 +4783,8 @@
}, },
"meta": { "meta": {
"description": "Metadata about the resource", "description": "Metadata about the resource",
"$ref": "#/components/schemas/SingleResourceMeta" "$ref": "#/components/schemas/SingleResourceMeta",
"nullable": true
} }
} }
}, },
@@ -4875,13 +4875,13 @@
"description": "A top-level response with a page of resources", "description": "A top-level response with a page of resources",
"type": "object", "type": "object",
"required": [ "required": [
"links", "links"
"meta"
], ],
"properties": { "properties": {
"meta": { "meta": {
"description": "Response metadata", "description": "Response metadata",
"$ref": "#/components/schemas/PaginationMeta" "$ref": "#/components/schemas/PaginationMeta",
"nullable": true
}, },
"data": { "data": {
"description": "The list of resources", "description": "The list of resources",
@@ -4904,7 +4904,6 @@
"attributes", "attributes",
"id", "id",
"links", "links",
"meta",
"type" "type"
], ],
"properties": { "properties": {
@@ -4926,7 +4925,8 @@
}, },
"meta": { "meta": {
"description": "Metadata about the resource", "description": "Metadata about the resource",
"$ref": "#/components/schemas/SingleResourceMeta" "$ref": "#/components/schemas/SingleResourceMeta",
"nullable": true
} }
} }
}, },
@@ -5069,13 +5069,13 @@
"description": "A top-level response with a page of resources", "description": "A top-level response with a page of resources",
"type": "object", "type": "object",
"required": [ "required": [
"links", "links"
"meta"
], ],
"properties": { "properties": {
"meta": { "meta": {
"description": "Response metadata", "description": "Response metadata",
"$ref": "#/components/schemas/PaginationMeta" "$ref": "#/components/schemas/PaginationMeta",
"nullable": true
}, },
"data": { "data": {
"description": "The list of resources", "description": "The list of resources",
@@ -5098,7 +5098,6 @@
"attributes", "attributes",
"id", "id",
"links", "links",
"meta",
"type" "type"
], ],
"properties": { "properties": {
@@ -5120,7 +5119,8 @@
}, },
"meta": { "meta": {
"description": "Metadata about the resource", "description": "Metadata about the resource",
"$ref": "#/components/schemas/SingleResourceMeta" "$ref": "#/components/schemas/SingleResourceMeta",
"nullable": true
} }
} }
}, },
@@ -5216,13 +5216,13 @@
"description": "A top-level response with a page of resources", "description": "A top-level response with a page of resources",
"type": "object", "type": "object",
"required": [ "required": [
"links", "links"
"meta"
], ],
"properties": { "properties": {
"meta": { "meta": {
"description": "Response metadata", "description": "Response metadata",
"$ref": "#/components/schemas/PaginationMeta" "$ref": "#/components/schemas/PaginationMeta",
"nullable": true
}, },
"data": { "data": {
"description": "The list of resources", "description": "The list of resources",
@@ -5245,7 +5245,6 @@
"attributes", "attributes",
"id", "id",
"links", "links",
"meta",
"type" "type"
], ],
"properties": { "properties": {
@@ -5267,7 +5266,8 @@
}, },
"meta": { "meta": {
"description": "Metadata about the resource", "description": "Metadata about the resource",
"$ref": "#/components/schemas/SingleResourceMeta" "$ref": "#/components/schemas/SingleResourceMeta",
"nullable": true
} }
} }
}, },