thephpleague / openapi-psr7-validator

It validates PSR-7 messages (HTTP request/response) against OpenAPI specifications
MIT License
528 stars 93 forks source link

Add parameters (de)serialisation support #2

Open lezhnev74 opened 5 years ago

lezhnev74 commented 5 years ago

Currently, the package does not support serialization of parameters.

This ticket is to track efforts for adding serialization support to the package.

Docs:

https://swagger.io/docs/specification/serialization/ https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#support-for-x-www-form-urlencoded-request-bodies

scaytrase commented 4 years ago

To track progress: @samuelnogueira implemented JSON parameter serialization in #43

lezhnev74 commented 4 years ago

I am going to add the missing support for validation of serialized parameters. After 1st iteration here, I think this test to be removed once this PR is merged to underlying cebe package (as we should delegate schema validation to that package and not doing it in this one, right?).

lezhnev74 commented 4 years ago

Did you know, by default PHP would override get arguments with the same name. However it is allowed in general by OpenAPI spec.

For get parameters like ?id=3&id=4&id=5, the value of $_GET would be id=5. Yet, $_SERVER['REQUEST_URI'] still would contain the initial query string.

I think, query string discovery is beyond this package's responsibility, it works with what it is given (psr-7 object).

lezhnev74 commented 4 years ago

Quick update: awesome @cebe merged the pending PR and I am ready to move to the next step here. I will review https://github.com/thephpleague/openapi-psr7-validator/pull/49 and see how this branch fits in.

scaytrase commented 4 years ago

Just merged #72 with support for some serializaition styles