Creating a Schema Projection
Guide to creating schema projections for API contracts and type libraries. Learn about entity extends, root type selection, and naming profiles for serialisation.
A schema projection transforms your model entities into API contract types and type libraries. Unlike database or search projections that target a specific platform, schema projections define the shape of data as it appears in API requests, responses, and inter-service messages. They control property naming conventions, type representations, and inheritance hierarchies.
When to Use Schema Projections
Step-by-Step Guide
Entity Extends
Schema projections support type inheritance through the entity extends mechanism. This is particularly useful when you need to expose different levels of detail for the same underlying entity.
Naming Profiles
The naming profile controls how model property names are transformed for serialisation:
| Profile | Model Name | Serialised Name | Common Languages |
|---|---|---|---|
| camelCase | first_name | firstName | JavaScript, TypeScript, Java |
| snake_case | firstName | first_name | Python, Ruby, Rust |
| PascalCase | firstName | FirstName | C#, Go |
| kebab-case | firstName | first-name | CSS, URL slugs |
| None | firstName | firstName | No transformation applied |