Skip to content

Commit

Permalink
fix(ruleset): allow single trailing slash for oas3 server url (#1427)
Browse files Browse the repository at this point in the history
* fix(ruleset): Allow single trailing slash for oas3 server url

* Apply suggestions from code review

Co-authored-by: Jakub Rożek <jakub@rozek.tech>

Co-authored-by: Jakub Rożek <jakub@rozek.tech>
  • Loading branch information
Mike Kistler and P0lip authored Dec 29, 2020
1 parent fe48f44 commit 8ceab21
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/rulesets/oas/__tests__/oas3-server-trailing-slash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ describe('oas3-server-trailing-slash', () => {
expect(results.length).toEqual(0);
});

test('validate a correct object with default value', async () => {
const results = await s.run({
openapi: '3.0.0',
paths: {},
servers: [
{
url: '/',
},
],
});
expect(results.length).toEqual(0);
});

test('return errors if server url ends with a slash', async () => {
const results = await s.run({
openapi: '3.0.0',
Expand Down
2 changes: 1 addition & 1 deletion src/rulesets/oas/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@
"then": {
"function": "pattern",
"functionOptions": {
"notMatch": "/$"
"notMatch": "./$"
}
}
},
Expand Down

0 comments on commit 8ceab21

Please sign in to comment.