I am perplexed by my Swagger YAML file here that I am 99% sure is correct, but obviously it is not, but not sure where the issue could be:
/**
* @openapi
* components:
* schemas:
* ViewMedicationDto:
* type: array
* items:
* type: object
* properties:
* _type:
* type: string
* id:
* type: string
* pui:
* type: string
* medicationType:
* type: string
* tradeName:
* type: string
* medicationTags: []
* createdOn:
* type: string
* updatedOn:
* type: string
* example:
* - _type: ViewMedicationDto
* id: 61ae82c8f95692912cc423ed
* pui: test_danielcortes_821205_59909
* medicationType: Rescue
* tradeName: Accolate
* medicationTags: [ [Object], [Object] ]
* createdOn: 2021-12-06T21:38:16.359Z
* updatedOn: 2021-12-06T21:38:16.359Z
*/
export class ViewMedicationDto implements DtoInterface {
readonly _type = 'ViewMedicationDto';
readonly id: ID
readonly pui: string
readonly medicationType: MedicationType
readonly tradeName: string
readonly medicationTags?: ITag[]
readonly createdOn?: Date
readonly updatedOn?: Date
constructor(id: ID, pui: string,
medicationType: MedicationType, tradeName: string,
medicationTags?: ITag[],
createdOn?: Date, updatedOn?: Date) {
this.id = id
this.pui = pui
this.medicationType = medicationType
this.tradeName = tradeName
this.medicationTags = medicationTags
this.createdOn = createdOn
this.updatedOn = updatedOn
}
}
I am thinking it's that medicationTags
the issue, but when I remove it, it does not render still.
Update
I attempted to follow the solution below like so:
/**
* @openapi
* components:
* schemas:
* ViewMedicationDto:
* type: array
* items:
* type: object
* properties:
* _type:
* type: string
* id:
* type: string
* pui:
* type: string
* medicationType:
* type: string
* tradeName:
* type: string
* medicationTags:
* type: array
* items:
* type: object
* createdOn:
* type: string
* updatedOn:
* type: string
* example:
* _type: ViewMedicationDto
* id: 61ae82c8f95692912cc423ed
* pui: test_danielcortes_821205_59909
* medicationType: Rescue
* tradeName: Accolate
* medicationTags: [{}, {}]
* createdOn: 2021-12-06T21:38:16.359Z
* updatedOn: 2021-12-06T21:38:16.359Z
*/
You are right that one issue is the
medicationTags
syntax. Another issue is theexample
syntax.Try this: