contributte / apitte

:wrench: An opinionated and enjoyable API framework based on Nette Framework. Supporting content negotiation, debugging, middlewares, attributes, annotations and loving openapi/swagger.

Home Page:https://contributte.org/packages/contributte/apitte/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Schema refactoring - vol.2

mabar opened this issue · comments

SchemaBuilder

  • creates schema from array
  • instead of Controller[] returns builded Schema
  • do all computations (moved from methods bellow)
    • Endpoint::generatePattern()
    • ArraySerializator::serialize() - HierarchyBuilder usage
    • ArraySerializator::serializeInit() - mask and id building
    • ArraySerializator::serializePattern() - extraction of mask parameters from pattern
    • may also do validations instead of IValidation? most of built-ins are critical for function
  • do all validations? (through Schema(Builder)Validator)

Controller and Method

  • merged with Endpoint

ArraySerializator

  • accepts Schema

ArrayHydrator

  • lazy?? - theoretically we don't need load whole schema every request - SimpleRouter matches route in 3 phases - HTTP method, pattern matching, parameters filling - in worst case would be initialized only ~50% of endpoints, only single one with all subclasses
  • may be even more optimal if we build from path hierarchical structure and pair nodes with endpoints (like we already do in HierarchyBuilder)

ILoader

  • returns schema in array
  • ArrayLoader - merges schemas from all loaders and validate them through nette/schema