Merge pull request #23998 from aramissennyeydd/openapi-tooling/search-reserved
fix: allow reserved characters in all parameters
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2023 The Backstage Authors
|
||||
* Copyright 2024 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -197,6 +197,7 @@ export const spec = {
|
||||
name: 'term',
|
||||
in: 'query',
|
||||
required: false,
|
||||
allowReserved: true,
|
||||
schema: {
|
||||
type: 'string',
|
||||
default: '',
|
||||
@@ -208,6 +209,7 @@ export const spec = {
|
||||
required: false,
|
||||
style: 'deepObject',
|
||||
explode: true,
|
||||
allowReserved: true,
|
||||
schema: {
|
||||
$ref: '#/components/schemas/JsonObject',
|
||||
},
|
||||
@@ -216,6 +218,7 @@ export const spec = {
|
||||
name: 'types',
|
||||
in: 'query',
|
||||
required: false,
|
||||
allowReserved: true,
|
||||
schema: {
|
||||
type: 'array',
|
||||
items: {
|
||||
@@ -227,6 +230,7 @@ export const spec = {
|
||||
name: 'pageCursor',
|
||||
in: 'query',
|
||||
required: false,
|
||||
allowReserved: true,
|
||||
schema: {
|
||||
type: 'string',
|
||||
},
|
||||
@@ -235,6 +239,7 @@ export const spec = {
|
||||
name: 'pageLimit',
|
||||
in: 'query',
|
||||
required: false,
|
||||
allowReserved: true,
|
||||
schema: {
|
||||
type: 'integer',
|
||||
},
|
||||
|
||||
@@ -132,6 +132,7 @@ paths:
|
||||
- name: term
|
||||
in: query
|
||||
required: false
|
||||
allowReserved: true
|
||||
schema:
|
||||
type: string
|
||||
default: ''
|
||||
@@ -140,6 +141,7 @@ paths:
|
||||
required: false
|
||||
style: deepObject
|
||||
explode: true
|
||||
allowReserved: true
|
||||
schema:
|
||||
# JsonObject is used here instead of the full ZOD schema definition as
|
||||
# resolution of recursive schemas isn't possible with the library we're using
|
||||
@@ -148,6 +150,7 @@ paths:
|
||||
- name: types
|
||||
in: query
|
||||
required: false
|
||||
allowReserved: true
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
@@ -155,10 +158,12 @@ paths:
|
||||
- name: pageCursor
|
||||
in: query
|
||||
required: false
|
||||
allowReserved: true
|
||||
schema:
|
||||
type: string
|
||||
- name: pageLimit
|
||||
in: query
|
||||
required: false
|
||||
allowReserved: true
|
||||
schema:
|
||||
type: integer
|
||||
|
||||
@@ -99,7 +99,6 @@ describe('createRouter', () => {
|
||||
mockSearchEngine.query.mockRejectedValueOnce(error);
|
||||
|
||||
const response = await request(app).get('/query');
|
||||
console.log((response as any).text);
|
||||
|
||||
expect(response.status).toEqual(500);
|
||||
expect(response.body).toMatchObject(
|
||||
@@ -127,6 +126,8 @@ describe('createRouter', () => {
|
||||
'types[0]=first-type&types[1]=second-type',
|
||||
'filters[prop]=value',
|
||||
'pageCursor=foo',
|
||||
// https://github.com/backstage/backstage/issues/23973
|
||||
'term=foo+bar',
|
||||
])('accepts valid query string "%s"', async queryString => {
|
||||
const response = await request(app).get(`/query?${queryString}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user