Skip to content

Commit

Permalink
fix: add missing environments field to uiConfigSchema (#1736)
Browse files Browse the repository at this point in the history
* fix: add missing environment field to uiConfigSchema

* refactor: avoid throwing when unleash-server is a dependency in dev mode
  • Loading branch information
olav committed Jun 21, 2022
1 parent 3239929 commit 7ee8892
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/lib/openapi/spec/ui-config-schema.test.ts
Expand Up @@ -7,6 +7,7 @@ test('uiConfigSchema', () => {
version: 'a',
unleashUrl: 'a',
baseUriPath: 'a',
environment: 'a',
disablePasswordAuth: false,
segmentValuesLimit: 0,
strategySegmentsLimit: 0,
Expand Down
3 changes: 3 additions & 0 deletions src/lib/openapi/spec/ui-config-schema.ts
Expand Up @@ -24,6 +24,9 @@ export const uiConfigSchema = {
version: {
type: 'string',
},
environment: {
type: 'string',
},
unleashUrl: {
type: 'string',
},
Expand Down
6 changes: 1 addition & 5 deletions src/lib/services/openapi-service.ts
Expand Up @@ -77,11 +77,7 @@ export class OpenApiService {
const errors = validateSchema(schema, data);

if (errors) {
if (process.env.NODE_ENV === 'development') {
throw new Error(JSON.stringify(errors, null, 2));
} else {
this.logger.warn('Invalid response:', errors);
}
this.logger.warn('Invalid response:', errors);
}

res.status(status).json(data);
Expand Down
Expand Up @@ -1052,6 +1052,9 @@ Object {
"disablePasswordAuth": Object {
"type": "boolean",
},
"environment": Object {
"type": "string",
},
"flags": Object {
"additionalProperties": Object {
"type": "boolean",
Expand Down

0 comments on commit 7ee8892

Please sign in to comment.