How Not to Repeat Yourself - pydantic, YAML, Connexion and all the REST of it.
summary
An implementation that replaces hand‑written OpenAPI YAML with an @endpoint decorator that inspects Python: parses docstrings for summaries and param descriptions, uses inspect.getfullargspec and type hints (including return) to decide path vs query params, and emits pydantic models via pydantic.schema for Connexion+Flask. Applied to a syndication API serving ~100M offers from thousands of shops, it generates the OpenAPI used by Swagger UI on the fly and eliminates duplicated YAML and manual schema maintenance.
AI-written summary · about
chapters (10)
- 0:00Introduction and motivation
- 1:20Project context
- 3:16The problem of redundancy
- 6:12Extracting documentation
- 9:11Inspecting Python code
- 11:09Modeling with Pydantic
- 13:59Automating schema generation
- 15:14Decorator-driven API design
- 19:44Conclusion
- 20:28Q&A session
related talks
30mREST & GraphQL: Adventures in schema-first API development
22mAn Alternative View on OpenAPI Docs, Start Finally Doing it Right!
27m"Building Elegant API Contracts: From Zero to Hero"
30mGenerating docs from APIs
35mFake It Before You Make It: Mocking Your Way to Better HTTP APIs
28mDelivering successful API integrations
46mOpenAPI & .NET: You're Doing It Wrong!
24mGraphQL, gRPC, REST, Oh My! - A Method for Unified API Design
