Improve API development
In recent days it is more and more common to use PHP as a API layer with separate frontend. In this setup it is crucial to document API and allow better understanding between the teams.
While it is possible to achieve this using various packages (e.g. https://zircote.github.io/swagger-php/, https://github.com/thephpleague/openapi-psr7-validator), having official (and automated) integration would allow more flexibility.
Core features:
- detect routes
- detect route attributes
- detect request properties (based on controller parameters)
- detect response properties (via https://tempestphp.com/docs/framework/controllers/#response-objects?)
- validate request according to schema
beforedeserialization to object (long standing problem in api platform) - generate api docs
Inspiration and references
- https://fastapi.tiangolo.com/#example-upgrade FastAPI does this best in my opinion.
- https://api-platform.com/ provides much more features but in reality it might be to complex
I'm very much open to improve Tempest in this regard. I think I'm with you on the whole list, but we'd need to flesh it out a lot more and split in standalone tasks to get started on it.
@brendt I agree, this is just the introduction of idea or tip of the iceberg. There are whole frameworks built around this concept. I posted it to spark some discussions and see what could be potential steps to start with this.
I've assigned it to the post-1.0 milestone, but we might pick it up earlier depending on the time available
How can we organize this to determine some limits, what we want to support, what DX we want to achieve and so on ?
How can we organize this to determine some limits, what we want to support, what DX we want to achieve and so on ?
For such a feature, I'd like people interested in tackling this to open a discussion first, discuss the features they want to implement and how, before doing any work—because there is a lot to do in this space
On Discord, preferably :)
My bad we already have opened the discussion here https://discord.com/channels/1236153076688359495/1345315356696121344