Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add gnap error response schema to spec #519

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
148 changes: 144 additions & 4 deletions openapi/auth-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,24 @@ paths:
uri: 'https://auth.rafiki.money/continue/4CF492MLVMSW9MKMXKHQ'
'400':
description: Bad Request
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/error-invalid-request'
- $ref: '#/components/schemas/error-invalid-client'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/error-invalid-client'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/error-request-denied'
requestBody:
content:
application/json:
Expand Down Expand Up @@ -198,10 +212,29 @@ paths:
wait: 30
'400':
description: Bad Request
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/error-too-fast'
- $ref: '#/components/schemas/error-invalid-client'
'401':
description: Unauthorized
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/error-invalid-client'
- $ref: '#/components/schemas/error-invalid-continuation'
- $ref: '#/components/schemas/error-request-denied'
'404':
description: Not Found
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/error-invalid-continuation'
- $ref: '#/components/schemas/error-invalid-request'
requestBody:
content:
application/json:
Expand All @@ -226,12 +259,21 @@ paths:
responses:
'204':
description: No Content
'400':
description: Bad Request
'401':
description: Unauthorized
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/error-invalid-client'
- $ref: '#/components/schemas/error-invalid-continuation'
- $ref: '#/components/schemas/error-invalid-request'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/error-invalid-request'
description: Cancel a grant request or delete a grant client side.
tags:
- grant
Expand Down Expand Up @@ -279,10 +321,28 @@ paths:
assetScale: 2
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/error-invalid-rotation'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/error-invalid-client'
'404':
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/error-invalid-rotation'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/error-request-denied'
description: Management endpoint to rotate access token.
tags:
- token
Expand All @@ -293,10 +353,18 @@ paths:
responses:
'204':
description: No Content
'400':
description: Bad Request
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/error-invalid-client'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/error-request-denied'
tags:
- token
components:
Expand Down Expand Up @@ -532,6 +600,78 @@ components:
- debitAmount
- required:
- receiveAmount
error-invalid-client:
type: object
properties:
error:
type: object
properties:
description:
type: string
code:
type: string
enum:
- invalid_client
error-invalid-request:
type: object
properties:
error:
type: object
properties:
description:
type: string
code:
type: string
enum:
- invalid_request
error-request-denied:
type: object
properties:
error:
type: object
properties:
description:
type: string
code:
type: string
enum:
- request_denied
error-too-fast:
type: object
properties:
error:
type: object
properties:
description:
type: string
code:
type: string
enum:
- too_fast
error-invalid-continuation:
type: object
properties:
error:
type: object
properties:
description:
type: string
code:
type: string
enum:
- invalid_continuation
error-invalid-rotation:
type: object
properties:
error:
type: object
properties:
description:
type: string
code:
type: string
enum:
- invalid_rotation
securitySchemes:
GNAP:
name: Authorization
Expand Down
136 changes: 120 additions & 16 deletions packages/open-payments/src/openapi/generated/auth-server-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,42 @@ export interface components {
receiveAmount?: external["schemas.yaml"]["components"]["schemas"]["amount"];
interval?: components["schemas"]["interval"];
};
"error-invalid-client": {
error?: {
description?: string;
code?: "invalid_client";
};
};
"error-invalid-request": {
error?: {
description?: string;
code?: "invalid_request";
};
};
"error-request-denied": {
error?: {
description?: string;
code?: "request_denied";
};
};
"error-too-fast": {
error?: {
description?: string;
code?: "too_fast";
};
};
"error-invalid-continuation": {
error?: {
description?: string;
code?: "invalid_continuation";
};
};
"error-invalid-rotation": {
error?: {
description?: string;
code?: "invalid_rotation";
};
};
};
}

Expand All @@ -195,11 +231,25 @@ export interface operations {
};
};
/** Bad Request */
400: unknown;
400: {
content: {
"application/json":
| components["schemas"]["error-invalid-request"]
| components["schemas"]["error-invalid-client"];
};
};
/** Unauthorized */
401: unknown;
401: {
content: {
"application/json": components["schemas"]["error-invalid-client"];
};
};
/** Internal Server Error */
500: unknown;
500: {
content: {
"application/json": components["schemas"]["error-request-denied"];
};
};
};
requestBody: {
content: {
Expand Down Expand Up @@ -231,11 +281,30 @@ export interface operations {
};
};
/** Bad Request */
400: unknown;
400: {
content: {
"application/json":
| components["schemas"]["error-too-fast"]
| components["schemas"]["error-invalid-client"];
};
};
/** Unauthorized */
401: unknown;
401: {
content: {
"application/json":
| components["schemas"]["error-invalid-client"]
| components["schemas"]["error-invalid-continuation"]
| components["schemas"]["error-request-denied"];
};
};
/** Not Found */
404: unknown;
404: {
content: {
"application/json":
| components["schemas"]["error-invalid-continuation"]
| components["schemas"]["error-invalid-request"];
};
};
};
requestBody: {
content: {
Expand All @@ -259,12 +328,21 @@ export interface operations {
responses: {
/** No Content */
204: never;
/** Bad Request */
400: unknown;
/** Unauthorized */
401: unknown;
401: {
content: {
"application/json":
| components["schemas"]["error-invalid-client"]
| components["schemas"]["error-invalid-continuation"]
| components["schemas"]["error-invalid-request"];
};
};
/** Not Found */
404: unknown;
404: {
content: {
"application/json": components["schemas"]["error-invalid-request"];
};
};
};
};
/** Management endpoint to rotate access token. */
Expand All @@ -284,11 +362,29 @@ export interface operations {
};
};
/** Bad Request */
400: unknown;
400: {
content: {
"application/json": components["schemas"]["error-invalid-rotation"];
};
};
/** Unauthorized */
401: unknown;
401: {
content: {
"application/json": components["schemas"]["error-invalid-client"];
};
};
/** Not Found */
404: unknown;
404: {
content: {
"application/json": components["schemas"]["error-invalid-rotation"];
};
};
/** Internal Server Error */
500: {
content: {
"application/json": components["schemas"]["error-request-denied"];
};
};
};
};
/** Management endpoint to revoke access token. */
Expand All @@ -301,10 +397,18 @@ export interface operations {
responses: {
/** No Content */
204: never;
/** Bad Request */
400: unknown;
/** Unauthorized */
401: unknown;
401: {
content: {
"application/json": components["schemas"]["error-invalid-client"];
};
};
/** Internal Server Error */
500: {
content: {
"application/json": components["schemas"]["error-request-denied"];
};
};
};
};
}
Expand Down
Loading