Giter Club home page Giter Club logo

mezzio-openapi's Introduction

kynx/mezzio-openapi

Middleware and helpers for OpenAPI-based Mezzio applications.

Pipeline

Create pipeline delegator factory. This includes standard middleware (ProblemDetails, validation, modeller).

Considerations

  • Pipeline delegator factory should be opt-in from command line - too much stuff a user might want to customise later.

Routing

Create pipeline and route delegator factory. This parses OpenAPI spec and add routes to Mezzio application.

Routes have the original OpenApi path set as an option so it is available to middleware for validation etc.

Considerations

  • Authentication middleware may need to be added per-route, not in the pipeline

Authentication

Add mezzio/authentication implementations. OAuth2 is a bitch.

Validator

Use openapi-psr7-validator?

Considerations

  • Do we validate before or after authentication? Probably after: Google Cloud Endpoints could replace the authentication, but doesn't really validate requests.

RequestParser

Adds OpenApiRequestInterface attribute to request. This contains path, query, header and cookie parameters along with parsed request body. Everything is strongly typed - ie query params converted to ints / model objects / etc.

TOOD: handling XML request bodies. Add / find an XML strategy to add to BodyParamsMiddleware. The schema includes extra stuff on how the XML is formatted that we will need to figure out...

Handlers

Handler per operation with get / patch / post / etc methods. Uses operationId for naming. Will need to construct a default name (path + method?) if no operationId given.

TODO

[ ] Sanitize hydration errors - ie Cannot hydrate My\Api\Operation\Services\Search\Get\QueryParams: My\Api\Operation\Services\Search\Get\QueryParams::__construct(): Argument #2 ($search) must be of type ?string, array given, called in /Users/matt/www/lifecycle-calculator/src/Api/Operation/Services/Search/Get/QueryParamsHydrator.php on line 37

Resources

mezzio-openapi's People

Contributors

kynx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.