Skip to content

Commit

Permalink
fix(OpenAPI): RHICOMPL-3934 correct attribute values
Browse files Browse the repository at this point in the history
  • Loading branch information
romanblanco committed Aug 7, 2023
1 parent 546204a commit c9543ea
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 48 deletions.
13 changes: 6 additions & 7 deletions spec/swagger_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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`.<br><br>' \
'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

Expand Down
128 changes: 87 additions & 41 deletions swagger/v1/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -89,8 +98,7 @@
"version:asc",
"version:desc"
]
},
"default": ""
}
}
},
{
Expand Down Expand Up @@ -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": ""
}
}
},
{
Expand Down Expand Up @@ -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",
Expand All @@ -895,8 +920,7 @@
"score:asc",
"score:desc"
]
},
"default": ""
}
}
},
{
Expand Down Expand Up @@ -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": ""
}
}
},
{
Expand Down Expand Up @@ -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",
Expand All @@ -2199,8 +2240,7 @@
"remediation_available:asc",
"remediation_available:desc"
]
},
"default": ""
}
}
},
{
Expand Down Expand Up @@ -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`.<br><br>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`.<br><br>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",
Expand All @@ -3376,8 +3424,7 @@
"rules_failed:asc",
"rules_failed:desc"
]
},
"default": ""
}
}
},
{
Expand Down Expand Up @@ -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"
}
},
{
Expand Down

0 comments on commit c9543ea

Please sign in to comment.