From 6aaba39212339c38a71483a88eba41c422d447e0 Mon Sep 17 00:00:00 2001 From: Anand Parthasarathy Date: Mon, 5 Jan 2026 18:25:40 +0530 Subject: [PATCH] Include error in the async response apis --- api/beckn.yaml | 90 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 74 insertions(+), 16 deletions(-) diff --git a/api/beckn.yaml b/api/beckn.yaml index e4ccaac..e990c32 100644 --- a/api/beckn.yaml +++ b/api/beckn.yaml @@ -291,7 +291,10 @@ paths: application/json: schema: type: object - required: [context, message] + required: [context] + oneOf: + - required: [message] + - required: [error] properties: context: allOf: @@ -308,6 +311,8 @@ paths: minItems: 1 items: $ref: "https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Offer" + error: + $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Error' responses: '200': $ref: '#/components/responses/Ack200' @@ -360,7 +365,9 @@ paths: type: object required: - context - - message + oneOf: + - required: [message] + - required: [error] properties: context: allOf: @@ -376,6 +383,8 @@ paths: properties: order: $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Order' + error: + $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Error' responses: '200': $ref: '#/components/responses/Ack200' @@ -428,7 +437,9 @@ paths: type: object required: - context - - message + oneOf: + - required: [message] + - required: [error] properties: context: allOf: @@ -444,6 +455,8 @@ paths: properties: order: $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Order' + error: + $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Error' responses: '200': $ref: '#/components/responses/Ack200' @@ -496,7 +509,9 @@ paths: type: object required: - context - - message + oneOf: + - required: [message] + - required: [error] properties: context: allOf: @@ -512,6 +527,8 @@ paths: properties: order: $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Order' + error: + $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Error' responses: '200': $ref: '#/components/responses/Ack200' @@ -571,7 +588,9 @@ paths: type: object required: - context - - message + oneOf: + - required: [message] + - required: [error] properties: context: allOf: @@ -582,13 +601,13 @@ paths: const: on_status message: type: object + required: + - order properties: order: $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Order' - anyOf: - - required: - - order - - required: [] + error: + $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Error' responses: '200': $ref: '#/components/responses/Ack200' @@ -641,7 +660,9 @@ paths: type: object required: - context - - message + oneOf: + - required: [message] + - required: [error] properties: context: allOf: @@ -657,6 +678,8 @@ paths: properties: order: $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Order' + error: + $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Error' responses: '200': $ref: '#/components/responses/Ack200' @@ -733,7 +756,9 @@ paths: type: object required: - context - - message + oneOf: + - required: [message] + - required: [error] properties: context: allOf: @@ -749,6 +774,8 @@ paths: properties: order: $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Order' + error: + $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Error' responses: '200': $ref: '#/components/responses/Ack200' @@ -801,7 +828,11 @@ paths: application/json: schema: type: object - required: [context, message] + required: + - context + oneOf: + - required: [message] + - required: [error] properties: context: allOf: @@ -816,6 +847,8 @@ paths: properties: support: $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/SupportInfo' + error: + $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Error' responses: '200': $ref: '#/components/responses/Ack200' @@ -882,7 +915,11 @@ paths: application/json: schema: type: object - required: [context, message] + required: + - context + oneOf: + - required: [message] + - required: [error] properties: context: allOf: @@ -897,6 +934,8 @@ paths: properties: tracking: $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Tracking' + error: + $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Error' responses: '200': $ref: '#/components/responses/Ack200' @@ -940,7 +979,11 @@ paths: application/json: schema: type: object - required: [context, message] + required: + - context + oneOf: + - required: [message] + - required: [error] properties: context: allOf: @@ -974,6 +1017,8 @@ paths: feedbackForm: $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Form' description: Optional feedback form for additional detailed feedback collection + error: + $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Error' responses: '200': $ref: '#/components/responses/Ack200' @@ -1118,7 +1163,11 @@ components: - required: [filters, spatial] DiscoverResponse: type: object - required: [context, message] + required: + - context + oneOf: + - required: [message] + - required: [error] properties: context: allOf: @@ -1136,6 +1185,9 @@ components: description: Array of catalogs containing items items: $ref: '#/components/schemas/Catalog' + error: + $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Error' + DiscoveryContext: allOf: - $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications/refs/heads/master/api/transaction/build/transaction.yaml#/components/schemas/Context' @@ -1454,7 +1506,11 @@ components: *context.version* MUST indicate the supported protocol version (e.g., "2.0.0"). CatalogPublishResponse: type: object - required: [context, results] + required: + - context + oneOf: + - required: [message] + - required: [error] properties: context: allOf: @@ -1472,6 +1528,8 @@ components: description: Per-catalog processing results items: $ref: '#/components/schemas/CatalogProcessingResult' + error: + $ref: 'https://raw.githubusercontent.com/beckn/protocol-specifications-new/refs/heads/main/schema/core/v2/attributes.yaml#/components/schemas/Error' # ---------- Result model ---------- CatalogProcessingResult: type: object