1
0
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:
Gastón Fournier 2023-09-07 12:23:53 +02:00 committed by GitHub
parent 2be77fb55e
commit fe51b501e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 26 deletions

View File

@ -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",

View File

@ -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: {