-
Notifications
You must be signed in to change notification settings - Fork 32
Description
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.