Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ✨ add support for SEARCH verb #10086

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flavors/swagger-ui-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ An array of objects that augment and modify Swagger UI's functionality. See Swag

⚠️ This prop is currently only applied once, on mount. Changes to this prop's value will not be propagated to the underlying Swagger UI instance. A future version of this module will remove this limitation, and the change will not be considered a breaking change.

#### `supportedSubmitMethods`: PropTypes.arrayOf(PropTypes.oneOf(['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']))
#### `supportedSubmitMethods`: PropTypes.arrayOf(PropTypes.oneOf(['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace', 'search']))

HTTP methods that have the Try it out feature enabled. An empty array disables Try it out for all operations. This does not filter the operations from the display.

Expand Down
1 change: 1 addition & 0 deletions flavors/swagger-ui-react/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ SwaggerUI.propTypes = {
"head",
"patch",
"trace",
"search",
])
),
queryConfigEnabled: PropTypes.bool,
Expand Down
1 change: 1 addition & 0 deletions src/core/config/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const defaultOptions = Object.freeze({
"head",
"patch",
"trace",
"search",
],
queryConfigEnabled: false,

Expand Down
1 change: 1 addition & 0 deletions src/core/plugins/oas3/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,5 @@ export const validOperationMethods = constant([
"head",
"patch",
"trace",
"search",
])
17 changes: 9 additions & 8 deletions src/core/plugins/spec/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { fromJS, Set, Map, OrderedMap, List } from "immutable"
const DEFAULT_TAG = "default"

const OPERATION_METHODS = [
"get", "put", "post", "delete", "options", "head", "patch", "trace"
"get", "put", "post", "delete", "options", "head", "patch", "trace", "search"
]

const state = state => {
Expand Down Expand Up @@ -262,7 +262,7 @@ export const operationsWithTags = createSelector(

export const taggedOperations = (state) => ({ getConfigs }) => {
let { tagsSorter, operationsSorter } = getConfigs()
return operationsWithTags(state)
const opsWithTags = operationsWithTags(state)
.sortBy(
(val, key) => key, // get the name of the tag to be passed to the sorter
(tagA, tagB) => {
Expand All @@ -276,6 +276,7 @@ export const taggedOperations = (state) => ({ getConfigs }) => {

return Map({ tagDetails: tagDetails(state, tag), operations: operations })
})
return opsWithTags
}

export const responses = createSelector(
Expand Down Expand Up @@ -499,8 +500,8 @@ export const validationErrors = (state, pathMethod) => {
const getErrorsWithPaths = (errors, path = []) => {
const getNestedErrorsWithPaths = (e, path) => {
const currPath = [...path, e.get("propKey") || e.get("index")]
return Map.isMap(e.get("error"))
? getErrorsWithPaths(e.get("error"), currPath)
return Map.isMap(e.get("error"))
? getErrorsWithPaths(e.get("error"), currPath)
: { error: e.get("error"), path: currPath }
}

Expand All @@ -511,10 +512,10 @@ export const validationErrors = (state, pathMethod) => {

const formatError = (error, path, paramName) => {
path = path.reduce((acc, curr) => {
return typeof curr === "number"
? `${acc}[${curr}]`
: acc
? `${acc}.${curr}`
return typeof curr === "number"
? `${acc}[${curr}]`
: acc
? `${acc}.${curr}`
: curr
}, "")
return `For '${paramName}'${path ? ` at path '${path}'` : ""}: ${error}.`
Expand Down
5 changes: 5 additions & 0 deletions src/style/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,11 @@
@include method($_color-options);
}

&.opblock-search
{
@include method($_color-search);
}

&.opblock-deprecated
{
opacity: .6;
Expand Down
1 change: 1 addition & 0 deletions src/style/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ $_color-head: #9012fe !default;
$_color-patch: #50e3c2 !default;
$_color-disabled: #ebebeb !default;
$_color-options: #0d5aa7 !default;
$_color-search: #6179fe !default;

// Authorize

Expand Down