mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-19 01:17:18 +02:00
fix: api token schema (#4633)
## About the changes
Create api token schema can either provide the field `project` or its
plural: `projects` so the joi validation makes them optional:
2be77fb55e/src/lib/schema/api-token-schema.ts (L20-L24)
This means that when returning the token, the response will either
contain `project` or `projects` depending on what was provided as input.
Therefore we need to make both fields optional in the response
This commit is contained in:
parent
2be77fb55e
commit
fe51b501e6
@ -30,24 +30,6 @@ exports[`apiTokenSchema empty 1`] = `
|
|||||||
},
|
},
|
||||||
"schemaPath": "#/required",
|
"schemaPath": "#/required",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"instancePath": "",
|
|
||||||
"keyword": "required",
|
|
||||||
"message": "must have required property 'project'",
|
|
||||||
"params": {
|
|
||||||
"missingProperty": "project",
|
|
||||||
},
|
|
||||||
"schemaPath": "#/required",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"instancePath": "",
|
|
||||||
"keyword": "required",
|
|
||||||
"message": "must have required property 'projects'",
|
|
||||||
"params": {
|
|
||||||
"missingProperty": "projects",
|
|
||||||
},
|
|
||||||
"schemaPath": "#/required",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"instancePath": "",
|
"instancePath": "",
|
||||||
"keyword": "required",
|
"keyword": "required",
|
||||||
|
@ -5,14 +5,7 @@ export const apiTokenSchema = {
|
|||||||
$id: '#/components/schemas/apiTokenSchema',
|
$id: '#/components/schemas/apiTokenSchema',
|
||||||
type: 'object',
|
type: 'object',
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
required: [
|
required: ['secret', 'tokenName', 'type', 'createdAt'],
|
||||||
'secret',
|
|
||||||
'tokenName',
|
|
||||||
'type',
|
|
||||||
'project',
|
|
||||||
'projects',
|
|
||||||
'createdAt',
|
|
||||||
],
|
|
||||||
description:
|
description:
|
||||||
'An overview of an [Unleash API token](https://docs.getunleash.io/reference/api-tokens-and-client-keys).',
|
'An overview of an [Unleash API token](https://docs.getunleash.io/reference/api-tokens-and-client-keys).',
|
||||||
properties: {
|
properties: {
|
||||||
|
Loading…
Reference in New Issue
Block a user