-
-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): dedupe paths containing special characters correctly
- Loading branch information
Showing
6 changed files
with
161 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
packages/core/src/__tests__/__fixtures__/gh-2500/input.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
{ | ||
"openapi": "3.0.2", | ||
"info": { | ||
"title": "Service for GoalDetail", | ||
"description": "Test You can find your company's API server", | ||
"version": "1.0.0" | ||
}, | ||
"servers": [ | ||
{ | ||
"url": "https://localhost/service-root" | ||
} | ||
], | ||
"paths": { | ||
"/JobRelationship": { | ||
"get": { | ||
"summary": "Get entities from JobRelationship", | ||
"responses": { | ||
"200": { | ||
"description": "Retrieved entities", | ||
"content": {} | ||
}, | ||
"4XX": { | ||
"$ref": "#/components/responses/error" | ||
} | ||
} | ||
} | ||
}, | ||
"/JobRelationship({id})": { | ||
"get": { | ||
"summary": "Get entity from JobRelationship by key", | ||
"responses": { | ||
"200": { | ||
"description": "Retrieved entities", | ||
"content": {} | ||
}, | ||
"4XX": { | ||
"$ref": "#/components/responses/error" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"error": { | ||
"type": "object", | ||
"required": ["error"], | ||
"properties": { | ||
"error": { | ||
"type": "object", | ||
"required": ["message"], | ||
"properties": { | ||
"message": { | ||
"type": "string" | ||
}, | ||
"target": { | ||
"type": "string" | ||
}, | ||
"details": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"required": ["message"], | ||
"properties": { | ||
"message": { | ||
"type": "string" | ||
}, | ||
"target": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"innererror": { | ||
"type": "object", | ||
"description": "The structure of this object is service-specific" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"error": { | ||
"description": "Error", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/error" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
packages/core/src/__tests__/__fixtures__/gh-2500/ruleset.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Ruleset } from '../../../ruleset'; | ||
import { DiagnosticSeverity } from '@stoplight/types'; | ||
import { defined } from '@stoplight/spectral-functions'; | ||
|
||
export default new Ruleset({ | ||
rules: { | ||
'error-code-defined': { | ||
message: '`code` property is missing in the Error object definition', | ||
severity: DiagnosticSeverity.Error, | ||
given: | ||
"$.paths.*.*.responses[?(@property.match(/^(4|5)/))].content.'application/json'.schema.properties.error.properties", | ||
then: { | ||
field: 'code', | ||
function: defined, | ||
}, | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters