Skip to content

Allow Additional Info to be a true JSON object. #633

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

Open
daveneti opened this issue Apr 9, 2025 · 0 comments
Open

Allow Additional Info to be a true JSON object. #633

daveneti opened this issue Apr 9, 2025 · 0 comments

Comments

@daveneti
Copy link
Contributor

daveneti commented Apr 9, 2025

The AdditonalInfo schema provides a mechanism for additional info in a BrAPI response that is not part of BrAPI specification per se. It allows implementers to return any additional data without the overhead of changing the specification or returning an invalid response that has additional fields in the main body which are not defined in the specification.

AdditonalInfo in many BrAPI entities is defined as follows

additionalInfo:
   additionalProperties:
      type: string
      description: A free space containing any additional information related to a particular object. A data source may provide any JSON object, unrestricted by the BrAPI specification.
   type: object

With this specification the additional properties must be key-value pairs with the value being restricted to schema type string only. The value is not nullable.

However, in some cases a JSON object needs to be returned as part of a field in addtionalInfo. To allow this change the schema specification to:

additionalInfo:
   additionalProperties:
      type: object
      nullable: true
      description: A free space containing any additional information related to a particular object. A data source may provide any JSON object, unrestricted by the BrAPI specification.
   type: object

See https://swagger.io/docs/specification/v3_0/data-models/dictionaries/ for a more comprehensive description on the use of additional properties for this sort of metadata.

AdditonalInfo is used in may places. To make the change more consistent, create a AddtionalInfo schema and reference it in other schemas. For example, here is a modified (part of) the TrialNewRequest schema

info:
  title: BrAPI
  version: ''
openapi: 3.0.0
paths: {}
components:
  schemas:
    TrialNewRequest:
      type: object
      required:
      - trialName
      properties:
...
        additionalInfo:
          $ref: '#/components/schemas/AddtionalInfo'
...

The AdditionalInfo schema would become

info:
  title: BrAPI
  version: ''
openapi: 3.0.0
paths: {}
components:
  schemas:
    AdditionalInfo:
      type: object
      additionalProperties:
         type: object
          description: A free space containing any additional information related to a particular object. A data source may provide any JSON object, unrestricted by the BrAPI specification.
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

No branches or pull requests

1 participant