From eb8a87c02c325314230e2b396da8d66c83cb2c6b Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Tue, 30 Sep 2025 13:23:54 +0200 Subject: [PATCH] Admin API: make sure the meta fields are nullable --- crates/handlers/src/admin/response.rs | 2 + docs/api/spec.json | 84 +++++++++++++-------------- 2 files changed, 44 insertions(+), 42 deletions(-) diff --git a/crates/handlers/src/admin/response.rs b/crates/handlers/src/admin/response.rs index 2ed50d8ce..257773cd2 100644 --- a/crates/handlers/src/admin/response.rs +++ b/crates/handlers/src/admin/response.rs @@ -59,6 +59,7 @@ impl PaginationMeta { pub struct PaginatedResponse { /// Response metadata #[serde(skip_serializing_if = "PaginationMeta::is_empty")] + #[schemars(with = "Option")] meta: PaginationMeta, /// The list of resources @@ -183,6 +184,7 @@ struct SingleResource { /// Metadata about the resource #[serde(skip_serializing_if = "SingleResourceMeta::is_empty")] + #[schemars(with = "Option")] meta: SingleResourceMeta, } diff --git a/docs/api/spec.json b/docs/api/spec.json index 17403f538..98f8b2532 100644 --- a/docs/api/spec.json +++ b/docs/api/spec.json @@ -3810,13 +3810,13 @@ "description": "A top-level response with a page of resources", "type": "object", "required": [ - "links", - "meta" + "links" ], "properties": { "meta": { "description": "Response metadata", - "$ref": "#/components/schemas/PaginationMeta" + "$ref": "#/components/schemas/PaginationMeta", + "nullable": true }, "data": { "description": "The list of resources", @@ -3851,7 +3851,6 @@ "attributes", "id", "links", - "meta", "type" ], "properties": { @@ -3873,7 +3872,8 @@ }, "meta": { "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", "type": "object", "required": [ - "links", - "meta" + "links" ], "properties": { "meta": { "description": "Response metadata", - "$ref": "#/components/schemas/PaginationMeta" + "$ref": "#/components/schemas/PaginationMeta", + "nullable": true }, "data": { "description": "The list of resources", @@ -4161,7 +4161,6 @@ "attributes", "id", "links", - "meta", "type" ], "properties": { @@ -4183,7 +4182,8 @@ }, "meta": { "description": "Metadata about the resource", - "$ref": "#/components/schemas/SingleResourceMeta" + "$ref": "#/components/schemas/SingleResourceMeta", + "nullable": true } } }, @@ -4306,7 +4306,6 @@ "attributes", "id", "links", - "meta", "type" ], "properties": { @@ -4328,7 +4327,8 @@ }, "meta": { "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", "type": "object", "required": [ - "links", - "meta" + "links" ], "properties": { "meta": { "description": "Response metadata", - "$ref": "#/components/schemas/PaginationMeta" + "$ref": "#/components/schemas/PaginationMeta", + "nullable": true }, "data": { "description": "The list of resources", @@ -4416,7 +4416,6 @@ "attributes", "id", "links", - "meta", "type" ], "properties": { @@ -4438,7 +4437,8 @@ }, "meta": { "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", "type": "object", "required": [ - "links", - "meta" + "links" ], "properties": { "meta": { "description": "Response metadata", - "$ref": "#/components/schemas/PaginationMeta" + "$ref": "#/components/schemas/PaginationMeta", + "nullable": true }, "data": { "description": "The list of resources", @@ -4622,7 +4622,6 @@ "attributes", "id", "links", - "meta", "type" ], "properties": { @@ -4644,7 +4643,8 @@ }, "meta": { "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", "type": "object", "required": [ - "links", - "meta" + "links" ], "properties": { "meta": { "description": "Response metadata", - "$ref": "#/components/schemas/PaginationMeta" + "$ref": "#/components/schemas/PaginationMeta", + "nullable": true }, "data": { "description": "The list of resources", @@ -4762,7 +4762,6 @@ "attributes", "id", "links", - "meta", "type" ], "properties": { @@ -4784,7 +4783,8 @@ }, "meta": { "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", "type": "object", "required": [ - "links", - "meta" + "links" ], "properties": { "meta": { "description": "Response metadata", - "$ref": "#/components/schemas/PaginationMeta" + "$ref": "#/components/schemas/PaginationMeta", + "nullable": true }, "data": { "description": "The list of resources", @@ -4904,7 +4904,6 @@ "attributes", "id", "links", - "meta", "type" ], "properties": { @@ -4926,7 +4925,8 @@ }, "meta": { "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", "type": "object", "required": [ - "links", - "meta" + "links" ], "properties": { "meta": { "description": "Response metadata", - "$ref": "#/components/schemas/PaginationMeta" + "$ref": "#/components/schemas/PaginationMeta", + "nullable": true }, "data": { "description": "The list of resources", @@ -5098,7 +5098,6 @@ "attributes", "id", "links", - "meta", "type" ], "properties": { @@ -5120,7 +5119,8 @@ }, "meta": { "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", "type": "object", "required": [ - "links", - "meta" + "links" ], "properties": { "meta": { "description": "Response metadata", - "$ref": "#/components/schemas/PaginationMeta" + "$ref": "#/components/schemas/PaginationMeta", + "nullable": true }, "data": { "description": "The list of resources", @@ -5245,7 +5245,6 @@ "attributes", "id", "links", - "meta", "type" ], "properties": { @@ -5267,7 +5266,8 @@ }, "meta": { "description": "Metadata about the resource", - "$ref": "#/components/schemas/SingleResourceMeta" + "$ref": "#/components/schemas/SingleResourceMeta", + "nullable": true } } },