Skip to content

Commit

Permalink
feat(rulesets): fix oas3_1-servers-in-webhook and oas3_1-callbacks-in…
Browse files Browse the repository at this point in the history
…-webhook rules
  • Loading branch information
kaylachun committed Jan 22, 2024
1 parent 97ef9f5 commit b89dd2d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DiagnosticSeverity } from '@stoplight/types';
import testRule from '../../__tests__/__helpers__/tester';

testRule('oas3_1-servers-in-webhook', [
testRule('oas3_1-callbacks-in-webhook', [
{
name: 'callbacks defined in webhook',
document: {
Expand Down
10 changes: 2 additions & 8 deletions packages/rulesets/src/oas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -711,24 +711,18 @@ const ruleset = {
message: 'Servers should not be defined in a webhook.',
formats: [oas3_1],
recommended: true,
given: ['$.webhooks[*]'],
given: ['$.webhooks.servers'],
then: {
function: undefined,
functionOptions: {
properties: ['servers'],
},
},
},
'oas3_1-callbacks-in-webhook': {
message: 'Callbacks should not be defined in a webhook.',
formats: [oas3_1],
recommended: true,
given: ['$.webhooks[*][*]'],
given: ['$.webhooks[*][*].callbacks'],
then: {
function: undefined,
functionOptions: {
properties: ['callbacks'],
},
},
},
},
Expand Down

0 comments on commit b89dd2d

Please sign in to comment.