diff --git a/.changeset/plenty-cooks-mix.md b/.changeset/plenty-cooks-mix.md new file mode 100644 index 00000000..ce74fcc9 --- /dev/null +++ b/.changeset/plenty-cooks-mix.md @@ -0,0 +1,5 @@ +--- +'@interledger/open-payments': minor +--- + +Added GNAP error models to auth server responses. diff --git a/openapi/auth-server.yaml b/openapi/auth-server.yaml index eb30e628..5a908924 100644 --- a/openapi/auth-server.yaml +++ b/openapi/auth-server.yaml @@ -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: @@ -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: @@ -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 @@ -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 @@ -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: @@ -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 diff --git a/packages/open-payments/src/openapi/generated/auth-server-types.ts b/packages/open-payments/src/openapi/generated/auth-server-types.ts index 00c0cf44..64d7b757 100644 --- a/packages/open-payments/src/openapi/generated/auth-server-types.ts +++ b/packages/open-payments/src/openapi/generated/auth-server-types.ts @@ -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"; + }; + }; }; } @@ -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: { @@ -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: { @@ -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. */ @@ -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. */ @@ -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"]; + }; + }; }; }; }