I have a model for Customer simplified for this request:
Customer: type: object properties: accountnumber: type: string maxLength: 50 description: Account number of customer. example: 553452 companyname: type: string maxLength: 50 description: Company name field. example: Alphabet invoices: type: array readOnly: true items: $ref: '#/components/schemas/Invoice' transactions: type: array readOnly: true items: $ref: '#/components/schemas/Transaction'
Then at this particular endpoint the response body is not containing the arrays of objects, as they can be huge and the endpoint gets all customers:
/customers: get: tags: - customer description: Get a paged result of all customers. security: - bearerAuth:  parameters: - in: query name: pagesize description: defines the size of each page schema: type: integer default: 1000 maximum: 1000 minimum: 1 - in: query name: pagenumber description: defines the pagenumber you want schema: type: integer default: 1 maximum: 1000 minimum: 1 responses: '200': description: OK content: application/json; charset=utf-8: schema: $ref: '#/components/schemas/PagedCustomers'
And the PagedCustomers object:
components: schemas: PagedCustomers: type: object properties: items: type: array items: $ref: '#/components/schemas/Customer' paging: type: object items: $ref: '#/components/schemas/Paging'
The question is, can I tell it that on this particular response the customer object will have empty nested objects 'invoices' and 'transactions' or do I have to create a separate customer object, say 'simplifiedCustomer' and model that appropriately? Maybe someone has a better way of structuring this.
We use the swagger file in combination with ReadMe.io
Thanks for your time