From c9543ea9228fb2ec4169296aadaebe9765f9f9e3 Mon Sep 17 00:00:00 2001 From: Roman Blanco Date: Mon, 7 Aug 2023 16:24:55 +0000 Subject: [PATCH] fix(OpenAPI): RHICOMPL-3934 correct attribute values --- spec/swagger_helper.rb | 13 ++-- swagger/v1/openapi.json | 128 +++++++++++++++++++++++++++------------- 2 files changed, 93 insertions(+), 48 deletions(-) diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index 7bc37ebea..c3447e779 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -91,27 +91,26 @@ def search_params description: 'Query string compliant with scoped_search '\ 'query language: '\ 'https://github.com/wvanbergen/scoped_search/wiki/Query-language', - schema: { type: :string, default: '' } + schema: { type: :string } end def tags_params parameter name: :tags, in: :query, required: false, - description: 'An array of tags to narrow down the results against. ' \ + description: 'A string or an array of tags to narrow down the results against. ' \ 'The namespace, key and value are concatenated using `/` and `=` symbols. ' \ 'In case the values contain symbols used for separators, `/` is replaced with `%2F`, ' \ '`=` is replaced with `%3D`.

' \ 'e.g.: `namespace/key=value`, `insights-client/selinux-config=SELINUX%3Denforcing`', - schema: { type: :array, items: { type: 'string' }, default: '' } + schema: { type: :array, items: { type: 'string' } } end def sort_params(model = nil) parameter name: :sort_by, in: :query, required: false, - description: 'An array of fields with an optional direction '\ + description: 'A string or an array of fields with an optional direction '\ '(:asc or :desc) to sort the results.', schema: { - type: :string, - items: { enum: sort_combinations(model) }, - default: '' + oneOf: [{ type: :array, items: { type: 'string' } }, { type: :string }], + items: { enum: sort_combinations(model) } } end diff --git a/swagger/v1/openapi.json b/swagger/v1/openapi.json index b77d03ecd..7a18887b5 100644 --- a/swagger/v1/openapi.json +++ b/swagger/v1/openapi.json @@ -69,17 +69,26 @@ "required": false, "description": "Query string compliant with scoped_search query language: https://github.com/wvanbergen/scoped_search/wiki/Query-language", "schema": { - "type": "string", - "default": "" + "type": "string" } }, { "name": "sort_by", "in": "query", "required": false, - "description": "An array of fields with an optional direction (:asc or :desc) to sort the results.", + "description": "A string or an array of fields with an optional direction (:asc or :desc) to sort the results.", "schema": { - "type": "string", + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "string" + } + ], "items": { "enum": [ "title", @@ -89,8 +98,7 @@ "version:asc", "version:desc" ] - }, - "default": "" + } } }, { @@ -587,25 +595,33 @@ "required": false, "description": "Query string compliant with scoped_search query language: https://github.com/wvanbergen/scoped_search/wiki/Query-language", "schema": { - "type": "string", - "default": "" + "type": "string" } }, { "name": "sort_by", "in": "query", "required": false, - "description": "An array of fields with an optional direction (:asc or :desc) to sort the results.", + "description": "A string or an array of fields with an optional direction (:asc or :desc) to sort the results.", "schema": { - "type": "string", + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "string" + } + ], "items": { "enum": [ "title", "title:asc", "title:desc" ] - }, - "default": "" + } } }, { @@ -872,17 +888,26 @@ "required": false, "description": "Query string compliant with scoped_search query language: https://github.com/wvanbergen/scoped_search/wiki/Query-language", "schema": { - "type": "string", - "default": "" + "type": "string" } }, { "name": "sort_by", "in": "query", "required": false, - "description": "An array of fields with an optional direction (:asc or :desc) to sort the results.", + "description": "A string or an array of fields with an optional direction (:asc or :desc) to sort the results.", "schema": { - "type": "string", + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "string" + } + ], "items": { "enum": [ "name", @@ -895,8 +920,7 @@ "score:asc", "score:desc" ] - }, - "default": "" + } } }, { @@ -2014,25 +2038,33 @@ "required": false, "description": "Query string compliant with scoped_search query language: https://github.com/wvanbergen/scoped_search/wiki/Query-language", "schema": { - "type": "string", - "default": "" + "type": "string" } }, { "name": "sort_by", "in": "query", "required": false, - "description": "An array of fields with an optional direction (:asc or :desc) to sort the results.", + "description": "A string or an array of fields with an optional direction (:asc or :desc) to sort the results.", "schema": { - "type": "string", + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "string" + } + ], "items": { "enum": [ "result", "result:asc", "result:desc" ] - }, - "default": "" + } } }, { @@ -2173,17 +2205,26 @@ "required": false, "description": "Query string compliant with scoped_search query language: https://github.com/wvanbergen/scoped_search/wiki/Query-language", "schema": { - "type": "string", - "default": "" + "type": "string" } }, { "name": "sort_by", "in": "query", "required": false, - "description": "An array of fields with an optional direction (:asc or :desc) to sort the results.", + "description": "A string or an array of fields with an optional direction (:asc or :desc) to sort the results.", "schema": { - "type": "string", + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "string" + } + ], "items": { "enum": [ "title", @@ -2199,8 +2240,7 @@ "remediation_available:asc", "remediation_available:desc" ] - }, - "default": "" + } } }, { @@ -3331,30 +3371,38 @@ "required": false, "description": "Query string compliant with scoped_search query language: https://github.com/wvanbergen/scoped_search/wiki/Query-language", "schema": { - "type": "string", - "default": "" + "type": "string" } }, { "name": "tags", "in": "query", "required": false, - "description": "An array of tags to narrow down the results against. The namespace, key and value are concatenated using `/` and `=` symbols. In case the values contain symbols used for separators, `/` is replaced with `%2F`, `=` is replaced with `%3D`.

e.g.: `namespace/key=value`, `insights-client/selinux-config=SELINUX%3Denforcing`", + "description": "A string or an array of tags to narrow down the results against. The namespace, key and value are concatenated using `/` and `=` symbols. In case the values contain symbols used for separators, `/` is replaced with `%2F`, `=` is replaced with `%3D`.

e.g.: `namespace/key=value`, `insights-client/selinux-config=SELINUX%3Denforcing`", "schema": { "type": "array", "items": { "type": "string" - }, - "default": "" + } } }, { "name": "sort_by", "in": "query", "required": false, - "description": "An array of fields with an optional direction (:asc or :desc) to sort the results.", + "description": "A string or an array of fields with an optional direction (:asc or :desc) to sort the results.", "schema": { - "type": "string", + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "string" + } + ], "items": { "enum": [ "name", @@ -3376,8 +3424,7 @@ "rules_failed:asc", "rules_failed:desc" ] - }, - "default": "" + } } }, { @@ -3685,8 +3732,7 @@ "required": false, "description": "Query string compliant with scoped_search query language: https://github.com/wvanbergen/scoped_search/wiki/Query-language", "schema": { - "type": "string", - "default": "" + "type": "string" } }, {