Schema Design with Firestone
Firestone relies entirely on JSON Schema to define the structure, validation, and documentation of your API resources. Your schema is your API contract.
How Firestone Uses Your Schema:
- API Contract: The schema directly generates the OpenAPI
components/schemasand request/response bodies. - Validation: Firestone-generated code (and the OpenAPI spec) enforces all validation rules (
required,minLength,pattern, etc.) defined in your schema. - Documentation: Field descriptions and examples in your schema are propagated directly to the generated OpenAPI documentation and CLI help text.
- CLI Arguments: Schema properties are automatically converted into typed command-line arguments and options.
Firestone-Specific Considerations:
descriptionis Mandatory: For high-quality CLI help text and API documentation, every field should have adescription.keyField: Ensure your resource schema defines a clear primary key structure, as Firestone uses this for instance lookup paths (e.g.,/users/{user_id}).x-Extensions: Firestone may utilize vendor extensions (likex-hidden: trueto hide fields from CLI output) if supported.
For general best practices on designing robust and reusable JSON Schemas, we recommend these authoritative resources:
- JSON Schema: Getting Started
- Understanding JSON Schema (Official Guide)
- JSON Schema Best Practices (Stoplight)
- Modeling Data with JSON Schema
By mastering JSON Schema, you unlock the full power of Firestone's automation.
Next Steps
With your schemas well-defined, it's crucial to protect them.
- Next: Dive into Security Best Practices.