From a231d248d4657676c444a056eeaa5cf538978f3e Mon Sep 17 00:00:00 2001 From: KK Date: Wed, 21 Aug 2024 10:18:02 +0200 Subject: [PATCH] feat(api): set facet keys, counts required In response schema for facets, set key, count properties to "required" so they don't show up as undefined in JSON schema. Closes: #182 --- apis_ontology/api/views.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/apis_ontology/api/views.py b/apis_ontology/api/views.py index 9be9a06..cc19a86 100644 --- a/apis_ontology/api/views.py +++ b/apis_ontology/api/views.py @@ -127,8 +127,14 @@ def get_paginated_response_schema(self, schema): "items": { "type": "object", "properties": { - "key": {"type": "string"}, - "count": {"type": "integer"}, + "key": { + "type": "string", + "required": True, + }, + "count": { + "type": "integer", + "required": True, + }, }, }, "example": [{"key": "eng", "count": 100}], @@ -139,8 +145,14 @@ def get_paginated_response_schema(self, schema): "items": { "type": "object", "properties": { - "key": {"type": "string"}, - "count": {"type": "integer"}, + "key": { + "type": "string", + "required": True, + }, + "count": { + "type": "integer", + "required": True, + }, }, }, "example": [{"key": "Traum", "count": 3}],