Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
nulltoken committed Jan 17, 2020
1 parent 025f28c commit f452d6e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 27 deletions.
10 changes: 0 additions & 10 deletions src/functions/__tests__/typedEnum.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,6 @@ describe('typedEnum', () => {
});

describe('types', () => {
/*
string (this includes dates and files)
number
integer
boolean
array
object
*/
const testCases: Array<[string, unknown[], unknown]> = [
['string', ['Hello', 'world!'], 12],
['number', [-2147483648, 17.13], 'Hello'],
Expand Down
8 changes: 4 additions & 4 deletions src/rulesets/oas/__tests__/typed-enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('typed-enum', () => {
expect(results).toEqual([]);
});

test('does not report anything when all the definitions are valid', async () => {
test('does not report anything when the model valid', async () => {
const doc = {
swagger: '2.0',
definitions: {
Expand All @@ -37,7 +37,7 @@ describe('typed-enum', () => {
expect(results).toEqual([]);
});

test('should indentify enum values that do not respect the format', async () => {
test('should indentify enum values that do not respect the type', async () => {
const doc = {
swagger: '2.0',
definitions: {
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('typed-enum', () => {
expect(results).toEqual([]);
});

test('does not report anything when all the definitions are valid', async () => {
test('does not report anything when the model is valid', async () => {
const doc = {
openapi: '3.0.0',
components: {
Expand All @@ -98,7 +98,7 @@ describe('typed-enum', () => {
expect(results).toEqual([]);
});

test('should indentify enum values that do not respect the format', async () => {
test('should indentify enum values that do not respect the type', async () => {
const doc = {
openapi: '3.0.0',
components: {
Expand Down
26 changes: 13 additions & 13 deletions src/rulesets/oas/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,6 @@
}
}
},
"typed-enum": {
"description": "Enum values should respect the specified type.",
"message": "{{error}}",
"recommended": true,
"type": "validation",
"given": "$..[?(@.enum && @.type)]",
"then": {
"function": "typedEnum",
"functionOptions": {
"reportingThreshold": 3
}
}
},
"info-contact": {
"description": "Info object should contain `contact` object.",
"recommended": true,
Expand Down Expand Up @@ -429,6 +416,19 @@
"api"
]
},
"typed-enum": {
"description": "Enum values should respect the specified type.",
"message": "{{error}}",
"recommended": true,
"type": "validation",
"given": "$..[?(@.enum && @.type)]",
"then": {
"function": "typedEnum",
"functionOptions": {
"reportingThreshold": 3
}
}
},
"oas2-api-host": {
"description": "OpenAPI `host` must be present and non-empty string.",
"recommended": true,
Expand Down

0 comments on commit f452d6e

Please sign in to comment.