Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions openapi/components/responses/BadRequest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,19 @@ content:
application/problem+json:
schema:
$ref: ../schemas/Error.yaml
examples:
ValidationFailed:
summary: Request body failed validation
dataValue:
Comment thread
vadyvas marked this conversation as resolved.
type: about:blank
title: Validation failed
status: 400
instance: /orders
details:
errors:
- code: invalid_type
expected: string
received: undefined
path:
- customerName
message: Required
8 changes: 8 additions & 0 deletions openapi/components/responses/Conflict.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ content:
application/problem+json:
schema:
$ref: ../schemas/Error.yaml
examples:
DuplicateName:
summary: Menu item name is already taken
dataValue:
Comment thread
vadyvas marked this conversation as resolved.
type: about:blank
title: A menu item with the name "coffee" already exists
status: 409
instance: /menu
8 changes: 8 additions & 0 deletions openapi/components/responses/Forbidden.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ content:
application/problem+json:
schema:
$ref: ../schemas/Error.yaml
examples:
InsufficientScopes:
summary: Access token lacks the required scope
dataValue:
type: about:blank
title: 'Insufficient scopes. Required: orders:read'
status: 403
instance: /orders
8 changes: 8 additions & 0 deletions openapi/components/responses/InternalServerError.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ content:
application/problem+json:
schema:
$ref: ../schemas/Error.yaml
examples:
InternalServerError:
summary: Unexpected server error
dataValue:
Comment thread
vadyvas marked this conversation as resolved.
type: about:blank
title: Internal Server Error
status: 500
instance: /orders
22 changes: 22 additions & 0 deletions openapi/components/responses/NotFound.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,25 @@ content:
application/problem+json:
schema:
$ref: ../schemas/Error.yaml
examples:
NotFound:
summary: No resource at this path
dataValue:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: Medium

In OpenAPI 3.x, an Example Object uses the "value" property to hold the example data, not "dataValue". Please change "dataValue" to "value". Affected examples: NotFound, MenuItemNotFound, OrderNotFound.

type: about:blank
title: Cannot GET /.well-known/oauth-authorization-server
status: 404
instance: /.well-known/oauth-authorization-server
MenuItemNotFound:
summary: No menu item with this ID
dataValue:
type: about:blank
title: Menu item not found
status: 404
instance: /menu/prd_01h1s5z6vf2mm1mz3hevnn9va7
OrderNotFound:
summary: No order with this ID
dataValue:
type: about:blank
title: Order not found
status: 404
instance: /orders/ord_01h1s5z6vf2mm1mz3hevnn9va7
11 changes: 11 additions & 0 deletions openapi/components/responses/OAuth2BadRequest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,14 @@ content:
application/json:
schema:
$ref: ../schemas/OAuthError.yaml
examples:
InvalidGrant:
summary: Refresh token is invalid or expired
dataValue:
error: invalid_grant
error_description: Invalid refresh token
InvalidClientMetadata:
summary: Requested scope does not exist
dataValue:
error: invalid_client_metadata
error_description: "scopes: Invalid enum value. Expected 'menu:read' | 'menu:write' | 'orders:read' | 'orders:write' | 'revenue:read', received 'admin'"
6 changes: 6 additions & 0 deletions openapi/components/responses/OAuth2ServerError.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ content:
application/json:
schema:
$ref: ../schemas/OAuthError.yaml
examples:
ServerError:
summary: Unexpected server error
dataValue:
error: server_error
error_description: An internal error occurred
11 changes: 11 additions & 0 deletions openapi/components/responses/OAuth2Unauthorized.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,14 @@ content:
application/json:
schema:
$ref: ../schemas/OAuthError.yaml
examples:
InvalidClient:
summary: Wrong client_id or client_secret
dataValue:
Comment thread
vadyvas marked this conversation as resolved.
error: invalid_client
error_description: Invalid client credentials
InvalidToken:
summary: Wrong registration access token
dataValue:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: Medium

Please also change "dataValue" to "value" in the InvalidToken example.

error: invalid_token
error_description: Invalid registration access token
8 changes: 8 additions & 0 deletions openapi/components/responses/Unauthorized.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ content:
application/problem+json:
schema:
$ref: ../schemas/Error.yaml
examples:
BearerTokenRequired:
summary: Missing access token
dataValue:
type: about:blank
title: Bearer token is required
status: 401
instance: /orders
4 changes: 2 additions & 2 deletions openapi/paths/revenue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ get:
format: date-time
examples:
StartOfJanuary:
summary: Start of January 2026
summary: January 1, 2026
dataValue: '2026-01-01T00:00:00Z'
Comment thread
vadyvas marked this conversation as resolved.
- name: endDate
in: query
Expand All @@ -35,7 +35,7 @@ get:
format: date-time
examples:
EndOfJanuary:
summary: End of January 2026
summary: January 31, 2026
dataValue: '2026-01-31T23:59:59Z'
responses:
'200':
Expand Down
40 changes: 29 additions & 11 deletions redocly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,36 @@ extends:
apis:
cafe-api:
root: "./openapi/cafe.yaml"
rules:
rule/operation-summary:
subject:
type: Operation
property: summary
where:
- subject:
type: Paths
assertions:
defined: true

rules:
operation-tag-defined: error
no-invalid-schema-examples: error
no-invalid-media-type-examples: error
rule/operation-summary:
subject:
type: Operation
property: summary
where:
- subject:
type: Paths
assertions:
pattern: /^(Create|Get|Retrieve|Replace|Update|Delete|Login|Send|Callback|Cancel|List|Partially update|Revoke).*[^\.]$/
defined: true
assertions:
pattern: /^(Create|Get|Retrieve|Replace|Update|Delete|Login|Send|Callback|Cancel|List|Partially update|Revoke).*[^\.]$/
rule/operation-summary-sentence-case:
subject:
type: Operation
property: summary
message: Operation summary must be sentence cased.
assertions:
pattern: /^([A-Z]{2,}|[A-Z][^A-Z]*|OAuth2)(?=\s|$)(\s+\(?(?:[A-Z]{2,}|[^A-Z]*|OAuth2)\)?(?=\s|$))*$/
rule/example-summary-sentence-case:
subject:
type: Example
property: summary
message: Example summary must be sentence cased.
assertions:
pattern: /^([A-Z]{2,}|[A-Z][^A-Z]*|OAuth2)(?=\s|$)(\s+\(?(?:[A-Z]{2,}|[^A-Z]*|OAuth2)\)?(?=\s|$))*$/

logo:
srcSet: "./images/cafe-logo-black.svg light, ./images/cafe-logo-white.svg dark"
Expand Down
Loading