Speculative Development
summary
Shows how clojure.spec is used to validate data, drive generative tests, and produce machine-readable spec forms that are transformed to json-schema and Swagger for cross-language validation. Describes extending spec with docstrings and custom protocol methods, building spec-to-spec transformation functions that generate data mappers, and an open-source library Speculate that converts specs, emits schemas, and performs transformations up to ~1 MB of data; demonstrates it works in production at uSwitch and even accepts posted specs (works but is unsafe).
AI-written summary · about
chapters (11)
- 0:00Introduction
- 1:08Specialized API data structures
- 3:23Closure spec fundamentals
- 6:54Extending closure spec with metadata
- 9:50Custom specs for documentation
- 12:00JSON schema from closure specs
- 13:49Validating API specs
- 15:11Transforming data structures
- 18:02Categorizing data for transformations
- 20:59Practical applications of speculate
- 22:45Benefits of closure specs
related talks
40mCreating DSLs A tale of spec tacular success and failure
43mspec loves data structures
48mContracts & Clojure: The Best-Yet Compromise of Types and Tests
31mTesting Made Simple
21mLet there be docs!
01h 16mSpec-ulation Keynote
25mUsing spec to Transparently Replace a Legacy System
30mOne Spec to Rule them all - OpenAPI in Action
