Skip to content

How to create an array while using discriminator #1571

@mkirolos-safco

Description

@mkirolos-safco

I am currently developing an api that will have a different response depending on the request being sent, both of the responses should return arrays, using discriminator I was able to show the different responses but not as arrays, not sure what I am missing

Thanks in advance

* @OA\Response(
*     response="200",
*     description="Response with different Request Type for the shipment",
*     @OA\JsonContent(
*         discriminator="requestType",
*         @OA\Examples(
*             example="forRateResponse",
*             summary="Rate Response",
*             value={
*                  "final_charge": 26.69,
*                  "currency": "USD",
*                  "weight": 5.5,
*                  "weight_unit": "LBS"
*                }
*         ),
*         @OA\Examples(
*             example="forShopResponse",
*             summary="Shop Response",
*             value={
*                  "service_code": "01",
*                  "service_description": "Next Day Air",
*                  "final_charge": 172.23,
*                  "currency": "USD",
*                  "weight": 5.5,
*                  "weight_unit": "LBS"
*              }
*         )
*     )
* ),

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions