I’m trying to use attributes in swagger-php. The intention is to support multiple Content-Type responses with the same API endpoint.
Below a minimal code example:
#[OAGet(path: '/myEndpoint')]
#[OAResponse(response: 200, description: 'Success', content: new OAMediaType('text/html'))]`
Let’s say I’d like to introduce a new Content-Type ‘text/csv’. Duplicating the Response attribute isn’t working as I get a complaint that both have the same result code.
#[OAResponse(response: 200, description: 'Success', content: new OAMediaType('text/html'))]
#[OAResponse(response: 200, description: 'Success', content: new OAMediaType('text/csv'))]
results in Error: Multiple @OAResponse() with the same response="200":
I’ve tried all possible options I can think of using oneOf
but I didn’t manage to find any working. Documentation is mainly using annotations, so that isn’t helping either.