Skip to main content
Version: 1.0.x

Understanding ViewModel Schema

🚧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.

This reference document explains how ViewModel classes map to GraphQL schema types in the GCA, covering the unique patterns and capabilities that distinguish view models from content models. While content models expose raw data from your content types, view models transform and compute presentation-specific data, and this document details how those transformations appear in the GraphQL schema.

The GCA generates GraphQL types from your ViewModel classes including support for computed fields (methods that calculate values on-demand), image transformations (via ImageSize for rendering responsive images), data aggregation patterns (combining multiple sources), and frontend-specific field formatting. Unlike content models which mirror database state, view models can return any computed value your Java code produces, making them powerful tools for presentation logic. This document covers how view model methods become GraphQL fields, how to handle complex computed values, patterns for data transformation, and understanding the relationship between view model implementations and their GraphQL representations. Use this reference when building view models to understand how your Java code will be exposed through the API.