mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-15 01:16:22 +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",
|
||||
},
|
||||
{
|
||||
"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": "",
|
||||
"keyword": "required",
|
||||
|
@ -5,14 +5,7 @@ export const apiTokenSchema = {
|
||||
$id: '#/components/schemas/apiTokenSchema',
|
||||
type: 'object',
|
||||
additionalProperties: false,
|
||||
required: [
|
||||
'secret',
|
||||
'tokenName',
|
||||
'type',
|
||||
'project',
|
||||
'projects',
|
||||
'createdAt',
|
||||
],
|
||||
required: ['secret', 'tokenName', 'type', 'createdAt'],
|
||||
description:
|
||||
'An overview of an [Unleash API token](https://docs.getunleash.io/reference/api-tokens-and-client-keys).',
|
||||
properties: {
|
||||
|
Loading…
Reference in New Issue
Block a user