diff --git a/pygeoapi/openapi.py b/pygeoapi/openapi.py index a54f972..8d4c8ce 100644 --- a/pygeoapi/openapi.py +++ b/pygeoapi/openapi.py @@ -238,6 +238,14 @@ def get_oas_30(cfg): 'default': { 'description': 'Unexpected error', 'content': gen_media_type_object('application/json', 'oapip', 'schemas/exception.yaml') # noqa + }, + 'Queryables': { + 'description': 'successful queryables operation', + 'content': { + 'application/json': { + 'schema': {'$ref': '#/components/schemas/queryables'} + } + } } }, 'parameters': { @@ -278,6 +286,58 @@ def get_oas_30(cfg): 'style': 'form', 'explode': False } + }, + 'schemas': { + # TODO: change this schema once OGC will definitively publish it + 'queryable': { + 'type': 'object', + 'required': [ + 'queryable', + 'type' + ], + 'properties': { + 'queryable': { + 'description': 'the token that may be used in a CQL predicate', # noqa + 'type': 'string' + }, + 'title': { + 'description': 'a human readable title for the queryable', # noqa + 'type': 'string' + }, + 'description': { + 'description': 'a human-readable narrative describing the queryable', # noqa + 'type': 'string' + }, + 'language': { + 'description': 'the language used for the title and description', # noqa + 'type': 'string', + 'default': [ + 'en' + ] + }, + 'type': { + 'description': 'the data type of the queryable', # noqa + 'type': 'string' + }, + 'type-ref': { + 'description': 'a reference to the formal definition of the type', # noqa + 'type': 'string', + 'format': 'url' + } + } + }, + 'queryables': { + 'type': 'object', + 'required': [ + 'queryables' + ], + 'properties': { + 'queryables': { + 'type': 'array', + 'items': {'$ref': '#/components/schemas/queryable'} + } + } + } } } @@ -362,7 +422,7 @@ def get_oas_30(cfg): items_f, ], 'responses': { - '200': {'$ref': '{}#/components/responses/Features'.format(OPENAPI_YAML['oapif'])}, # noqa + '200': {'$ref': '#/components/responses/Queryables'}, '400': {'$ref': '{}#/components/responses/InvalidParameter'.format(OPENAPI_YAML['oapif'])}, # noqa '404': {'$ref': '{}#/components/responses/NotFound'.format(OPENAPI_YAML['oapif'])}, # noqa '500': {'$ref': '{}#/components/responses/ServerError'.format(OPENAPI_YAML['oapif'])} # noqa