Skip to content

Conversation

@anandp504
Copy link
Collaborator

@anandp504 anandp504 commented Jan 5, 2026

Pull Request: Update Response Schemas to Support Error Responses

Summary

Updated OpenAPI response schemas to support both successful responses and error responses using oneOf constraints. Responses now require context and exactly one of message or error.

Changes

Response Schema Pattern

  • Before: required: [context, message] - only successful responses allowed
  • After: required: [context] with oneOf requiring either message or error - supports both success and error responses

Updated Endpoints

All on_* callback endpoints now support error responses:

  • /beckn/on_discover
  • /beckn/on_select
  • /beckn/on_init
  • /beckn/on_confirm
  • /beckn/on_status
  • /beckn/on_update
  • /beckn/on_cancel
  • /beckn/on_support
  • /beckn/on_track
  • /beckn/on_rating
  • /beckn/v2/catalog/on_publish
  • /beckn/on_discover/offer

Schema Updates

  • Added error property to response schemas. The error object structure:
    Error:
      type: object
      required: [code, message]
      properties:
        code:
          type: string
          description: Error code
          example: "INVALID_SCHEMA_FIELD"
        message:
          type: string
          description: Human-readable error message
          example: "Field 'electronic:invalidField' not found in ElectronicItem schema"
        details:
          type: object
          description: Additional error details
  • Maintained backward compatibility - successful responses still work as before

Copy link
Contributor

@ravi-prakash-v ravi-prakash-v left a comment

Choose a reason for hiding this comment

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

Approved

Copy link
Contributor

@ravi-prakash-v ravi-prakash-v left a comment

Choose a reason for hiding this comment

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

@anandp504 can you fix the conflicts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants