From 5650e464b8ce050b2a84ff5b9d7b3c96a5877647 Mon Sep 17 00:00:00 2001 From: Sylvain Lesage Date: Tue, 12 Mar 2024 01:17:33 +0100 Subject: [PATCH] Fix openapi.json (#2574) * add a description about #2573 * fix NumericalStatisticsItem * fix anyOf, see https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/ --- docs/source/openapi.json | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/docs/source/openapi.json b/docs/source/openapi.json index 67fbdda5b4..46baba0f51 100644 --- a/docs/source/openapi.json +++ b/docs/source/openapi.json @@ -1101,6 +1101,9 @@ } } }, + "NullableNumber": { + "oneOf": [{ "type": "number" }, { "type": "null" }] + }, "NumericalStatisticsItem": { "type": "object", "required": [ @@ -1120,26 +1123,17 @@ "nan_proportion": { "type": "number" }, - "min": { - "type": { "anyOf": [{ "type": "number" }, { "type": "null" }] } - }, - "max": { - "type": { "anyOf": [{ "type": "number" }, { "type": "null" }] } - }, - "mean": { - "type": { "anyOf": [{ "type": "number" }, { "type": "null" }] } - }, - "median": { - "type": { "anyOf": [{ "type": "number" }, { "type": "null" }] } - }, - "std": { - "type": { "anyOf": [{ "type": "number" }, { "type": "null" }] } - }, - "histogram": { "anyOf": [{ "$ref": "#/components/schemas/Histogram" }, { "type": "null" }] } + "min": { "$ref": "#/components/schemas/NullableNumber" }, + "max": { "$ref": "#/components/schemas/NullableNumber" }, + "mean": { "$ref": "#/components/schemas/NullableNumber" }, + "median": { "$ref": "#/components/schemas/NullableNumber" }, + "std": { "$ref": "#/components/schemas/NullableNumber" }, + "histogram": { "oneOf": [{ "$ref": "#/components/schemas/Histogram" }, { "type": "null" }] } } }, "CategoricalStatisticsItem": { "type": "object", + "description": "note that fields 'no_label_count' and 'no_label_proportion' are not required, because some old entries still miss them, and we don't want to recompute all of them. See https://github.com/huggingface/datasets-server/issues/2573.", "required": ["nan_count", "nan_proportion", "n_unique", "frequencies"], "properties": { "nan_count": { @@ -1184,7 +1178,7 @@ } }, "SupportedStatistics": { - "oneOf": [ + "anyOf": [ { "$ref": "#/components/schemas/NumericalStatisticsItem" },