laravel-openapi
laravel-openapi copied to clipboard
Support media type ranges for request body and response validation.
Currently, the library only supports exact matches of media-type for request body and response validation. To work as expected, we need to match an incoming request or outgoing response to the most specific media type specified.
This means that if you have a request body like the following...
requestBody:
content:
application/json:
...
text/plain:
...
*/*:
...
... and you send a request with content like application/xml, it just straight-up fails even though technically, it should match to */* and actually go through validation (where it may fail anyway). This also means we can't have things like text/* that accepts and validates text/plain and text/html, etc.
We need to find a library that helps us do this matching to pick the most specific. There are plenty of content negotiation libraries for PHP. We just need to pick one and integrate it with appropriate test cases.
For now, I'm punting this to the road-map so that I can continue getting a somewhat-solid test foundation laid down that we can exercise to flesh this feature out.