mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +01:00
openapi: enable allErrors
and update snapshots (#3622)
## What This PR changes our AJV configuration to return all errors it finds with a schema instead of stopping at the first one. Because of this, a number of the snapshot tests that we have must be updated. ## Why DX! As someone using an API: if I send a faulty request, I'd rather have the API tell me about the five things that are wrong than for me to learn about one thing, send a new request, learn about another thing, send a new request, .... etc. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
parent
09621b8a4f
commit
80cf27476b
@ -12,6 +12,15 @@ exports[`apiTokenSchema empty 1`] = `
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'type'",
|
||||
"params": {
|
||||
"missingProperty": "type",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
],
|
||||
"schema": "#/components/schemas/apiTokenSchema",
|
||||
}
|
||||
|
@ -12,6 +12,15 @@ exports[`changePasswordSchema empty 1`] = `
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'password'",
|
||||
"params": {
|
||||
"missingProperty": "password",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
],
|
||||
"schema": "#/components/schemas/changePasswordSchema",
|
||||
}
|
||||
|
@ -12,6 +12,33 @@ exports[`clientApplicationSchema no fields 1`] = `
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'interval'",
|
||||
"params": {
|
||||
"missingProperty": "interval",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'started'",
|
||||
"params": {
|
||||
"missingProperty": "started",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'strategies'",
|
||||
"params": {
|
||||
"missingProperty": "strategies",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
],
|
||||
"schema": "#/components/schemas/clientApplicationSchema",
|
||||
}
|
||||
|
@ -12,6 +12,15 @@ exports[`clientFeaturesSchema no fields 1`] = `
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'features'",
|
||||
"params": {
|
||||
"missingProperty": "features",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
],
|
||||
"schema": "#/components/schemas/clientFeaturesSchema",
|
||||
}
|
||||
|
@ -12,6 +12,15 @@ exports[`featureEnvironmentSchema empty 1`] = `
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'enabled'",
|
||||
"params": {
|
||||
"missingProperty": "enabled",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
],
|
||||
"schema": "#/components/schemas/featureEnvironmentSchema",
|
||||
}
|
||||
|
@ -12,6 +12,33 @@ exports[`featureTypeSchema empty 1`] = `
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'name'",
|
||||
"params": {
|
||||
"missingProperty": "name",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'description'",
|
||||
"params": {
|
||||
"missingProperty": "description",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'lifetimeDays'",
|
||||
"params": {
|
||||
"missingProperty": "lifetimeDays",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
],
|
||||
"schema": "#/components/schemas/featureTypeSchema",
|
||||
}
|
||||
|
@ -12,6 +12,33 @@ exports[`meSchema empty 1`] = `
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'permissions'",
|
||||
"params": {
|
||||
"missingProperty": "permissions",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'feedback'",
|
||||
"params": {
|
||||
"missingProperty": "feedback",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'splash'",
|
||||
"params": {
|
||||
"missingProperty": "splash",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
],
|
||||
"schema": "#/components/schemas/meSchema",
|
||||
}
|
||||
@ -29,6 +56,24 @@ exports[`meSchema missing permissions 1`] = `
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'feedback'",
|
||||
"params": {
|
||||
"missingProperty": "feedback",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'splash'",
|
||||
"params": {
|
||||
"missingProperty": "splash",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
],
|
||||
"schema": "#/components/schemas/meSchema",
|
||||
}
|
||||
|
@ -12,6 +12,24 @@ exports[`roleSchema 1`] = `
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'type'",
|
||||
"params": {
|
||||
"missingProperty": "type",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'name'",
|
||||
"params": {
|
||||
"missingProperty": "name",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
],
|
||||
"schema": "#/components/schemas/roleSchema",
|
||||
}
|
||||
|
@ -12,6 +12,15 @@ exports[`setStrategySortOrderSchema missing id 1`] = `
|
||||
},
|
||||
"schemaPath": "#/items/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "/1",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'id'",
|
||||
"params": {
|
||||
"missingProperty": "id",
|
||||
},
|
||||
"schemaPath": "#/items/required",
|
||||
},
|
||||
],
|
||||
"schema": "#/components/schemas/setStrategySortOrderSchema",
|
||||
}
|
||||
|
@ -12,6 +12,51 @@ exports[`strategySchema 1`] = `
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'displayName'",
|
||||
"params": {
|
||||
"missingProperty": "displayName",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'description'",
|
||||
"params": {
|
||||
"missingProperty": "description",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'editable'",
|
||||
"params": {
|
||||
"missingProperty": "editable",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'deprecated'",
|
||||
"params": {
|
||||
"missingProperty": "deprecated",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'parameters'",
|
||||
"params": {
|
||||
"missingProperty": "parameters",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
],
|
||||
"schema": "#/components/schemas/strategySchema",
|
||||
}
|
||||
|
@ -12,6 +12,51 @@ exports[`tokenUserSchema 1`] = `
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'name'",
|
||||
"params": {
|
||||
"missingProperty": "name",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'email'",
|
||||
"params": {
|
||||
"missingProperty": "email",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'token'",
|
||||
"params": {
|
||||
"missingProperty": "token",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'createdBy'",
|
||||
"params": {
|
||||
"missingProperty": "createdBy",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
{
|
||||
"instancePath": "",
|
||||
"keyword": "required",
|
||||
"message": "must have required property 'role'",
|
||||
"params": {
|
||||
"missingProperty": "role",
|
||||
},
|
||||
"schemaPath": "#/required",
|
||||
},
|
||||
],
|
||||
"schema": "#/components/schemas/tokenUserSchema",
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ const ajv = new Ajv({
|
||||
'date-time': true,
|
||||
uri: true,
|
||||
},
|
||||
allErrors: true,
|
||||
});
|
||||
|
||||
export const addAjvSchema = (schemaObjects: any[]): any => {
|
||||
|
Loading…
Reference in New Issue
Block a user