I am using API Studio and want to support models with composition. I have a baseType model, and a complexType model that includes all of the baseType model:
baseType: type: object required: - reviewDescription - rating - userID - truckID properties: reviewDescription: type: string format: string rating: type: integer format: int8 userID: type: integer format: int64 truckID: type: integer format: int64 complexType: allOf: - $ref: '#/definitions/baseType' - type: object required: - id properties: id: type: integer format: int64
I would expect complexType to appear in API Studio as a single level object, in the form:
complexType { id: integer * reviewDescription: string * rating: integer * userID: integer * truckID: integer * }
But instead, it appears in API Studio as if all of the properties inherited from baseType are in a nested property called baseType. Here is how the two objects appear in API Studio:
How do I access the properties in complexType defined by baseType?
Solved! Go to Solution.
Hi,
I think you're missing some indentations around your definitions block. I tried to fix it for you. Check it out here:
swagger: "2.0" info: version: "0.0.1" title: Swagger API paths: {} definitions: baseType: type: object required: - reviewDescription - rating - userID - truckID properties: reviewDescription: type: string format: string rating: type: integer format: int8 userID: type: integer format: int64 truckID: type: integer format: int64 complexType: allOf: - $ref: '#/definitions/baseType' - type: object required: [id] properties: id: type: integer format: int64
http://playground.apistudio.io/8fe7d42f-cb75-45d1-a64f-94b9fae37646