Skip to content

Commit

Permalink
refactor: disallow additionalProperties in response schemas (#1543)
Browse files Browse the repository at this point in the history
  • Loading branch information
olav committed Apr 29, 2022
1 parent ec87811 commit c028655
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/openapi/spec/constraint-schema.ts
Expand Up @@ -2,6 +2,7 @@ import { createSchemaObject, CreateSchemaType } from '../types';

export const schema = {
type: 'object',
additionalProperties: false,
required: ['contextName', 'operator'],
properties: {
contextName: {
Expand Down
1 change: 1 addition & 0 deletions src/lib/openapi/spec/feature-schema.ts
Expand Up @@ -2,6 +2,7 @@ import { createSchemaObject, CreateSchemaType } from '../types';

const schema = {
type: 'object',
additionalProperties: false,
required: ['name', 'project'],
properties: {
name: {
Expand Down
1 change: 1 addition & 0 deletions src/lib/openapi/spec/features-schema.ts
Expand Up @@ -2,6 +2,7 @@ import { createSchemaObject, CreateSchemaType } from '../types';

export const schema = {
type: 'object',
additionalProperties: false,
required: ['version', 'features'],
properties: {
version: {
Expand Down
1 change: 1 addition & 0 deletions src/lib/openapi/spec/override-schema.ts
Expand Up @@ -2,6 +2,7 @@ import { createSchemaObject, CreateSchemaType } from '../types';

export const schema = {
type: 'object',
additionalProperties: false,
required: ['contextName', 'values'],
properties: {
contextName: {
Expand Down
1 change: 1 addition & 0 deletions src/lib/openapi/spec/strategy-schema.ts
Expand Up @@ -2,6 +2,7 @@ import { createSchemaObject, CreateSchemaType } from '../types';

export const schema = {
type: 'object',
additionalProperties: false,
required: ['id', 'name', 'constraints', 'parameters'],
properties: {
id: {
Expand Down
1 change: 1 addition & 0 deletions src/lib/openapi/spec/variant-schema.ts
Expand Up @@ -2,6 +2,7 @@ import { createSchemaObject, CreateSchemaType } from '../types';

export const schema = {
type: 'object',
additionalProperties: false,
required: ['name', 'weight', 'weightType', 'stickiness', 'overrides'],
properties: {
name: {
Expand Down
Expand Up @@ -52,6 +52,7 @@ Object {
"components": Object {
"schemas": Object {
"constraintSchema": Object {
"additionalProperties": false,
"properties": Object {
"contextName": Object {
"type": "string",
Expand Down Expand Up @@ -93,6 +94,7 @@ Object {
"type": "object",
},
"featureSchema": Object {
"additionalProperties": false,
"properties": Object {
"createdAt": Object {
"format": "date",
Expand Down Expand Up @@ -145,6 +147,7 @@ Object {
"type": "object",
},
"featuresSchema": Object {
"additionalProperties": false,
"properties": Object {
"features": Object {
"items": Object {
Expand All @@ -163,6 +166,7 @@ Object {
"type": "object",
},
"overrideSchema": Object {
"additionalProperties": false,
"properties": Object {
"contextName": Object {
"type": "string",
Expand All @@ -181,6 +185,7 @@ Object {
"type": "object",
},
"strategySchema": Object {
"additionalProperties": false,
"properties": Object {
"constraints": Object {
"items": Object {
Expand All @@ -207,6 +212,7 @@ Object {
"type": "object",
},
"variantSchema": Object {
"additionalProperties": false,
"properties": Object {
"name": Object {
"type": "string",
Expand Down

5 comments on commit c028655

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 91.2% 5171/5670
🟡 Branches 79.31% 805/1015
🟢 Functions 86.18% 1216/1411
🟢 Lines 91.12% 5050/5542

Test suite run success

860 tests passing in 124 suites.

Report generated by 🧪jest coverage report action from c7c1e71

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 91.2% 5171/5670
🟡 Branches 79.31% 805/1015
🟢 Functions 86.18% 1216/1411
🟢 Lines 91.12% 5050/5542

Test suite run success

860 tests passing in 124 suites.

Report generated by 🧪jest coverage report action from ddac9bf

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 91.2% 5171/5670
🟡 Branches 79.31% 805/1015
🟢 Functions 86.18% 1216/1411
🟢 Lines 91.12% 5050/5542

Test suite run success

860 tests passing in 124 suites.

Report generated by 🧪jest coverage report action from a52e5f1

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 91.2% 5171/5670
🟡 Branches 79.31% 805/1015
🟢 Functions 86.18% 1216/1411
🟢 Lines 91.12% 5050/5542

Test suite run success

860 tests passing in 124 suites.

Report generated by 🧪jest coverage report action from ff18e12

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 91.2% 5171/5670
🟡 Branches 79.31% 805/1015
🟢 Functions 86.18% 1216/1411
🟢 Lines 91.12% 5050/5542

Test suite run success

860 tests passing in 124 suites.

Report generated by 🧪jest coverage report action from a52e5f1

Please sign in to comment.