Skip to main content
Version: 1.0.x

View Models

🚧Documentation Under Construction

We are actively working to improve this documentation. The content you see here may be incomplete, subject to change, or may not fully reflect the current state of the feature. We appreciate your understanding as we continue to enhance our docs.

View models provide a presentation layer on top of your content, allowing you to transform, compute, and aggregate data before returning it through the GCA. Unlike content models which expose raw content data, view models (classes implementing ViewModel) enable you to create computed fields, combine data from multiple sources, and tailor responses to specific frontend requirements without modifying your underlying content types.

The GCA supports two ways to access view models: content-backed view models (accessed via the Get operation's views field when you have a content ID) and standalone view models (accessed via the View operation without requiring a content ID). Content-backed view models are ideal for transforming specific content items for presentation, while standalone view models work well for computed data like navigation menus, site configurations, or aggregated statistics.

This section covers both access patterns and how view models map to GraphQL schema types. View model responses are detailed in the ViewModel Schema Types reference document.