Skip to content

Commit

Permalink
📝 API Guild example for error responses
Browse files Browse the repository at this point in the history
  • Loading branch information
ouvreboite committed Jul 5, 2024
1 parent 49be649 commit 8d3683b
Show file tree
Hide file tree
Showing 7 changed files with 724 additions and 4 deletions.
15 changes: 15 additions & 0 deletions examples/complex/spectral.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,23 @@ aliases:
parameters:
- $.paths[*].parameters
- $.paths[*][*].parameters
responses-4XX:
- $.paths.*.*.responses[?(@property.startsWith('4'))]
responses-5XX:
- $.paths.*.*.responses[?(@property.startsWith('5'))]
responses-error:
- "#responses-4XX"
- "#responses-5XX"
rules:
#rules will be injected by poltergust
error-responses-should-be-in-json:
description: Error responses must return application/json
given: "#responses-error"
severity: error
then:
- field: content["application/json"].schema
function: defined

base-path-must-start-with-slash:
description: Base path must be relative (start with a /)
message: "{{description}}. But was {{value}}."
Expand Down
Loading

0 comments on commit 8d3683b

Please sign in to comment.