Project a collection.
Optionalcontext: ResourceContext<EventType, PrincipalType>OptionaldataOptional hook to shape or complete the model before it meets the schema.
Asynchronous, and resolved from the container, so it may reach any service: fetch a relation, translate a label, compute a total. Whatever it returns is what the schema then validates.
OptionalfragmentsNamed subsets a caller may ask for, each with its own schema.
A fragment is not a filter: it is a contract of its own, documented and validated like the full
one. That is what makes ?view=summary safe to expose.
Project one model.
Optionalcontext: ResourceContext<EventType, PrincipalType>Project into a { data, meta } envelope.
Optionalcontext: ResourceContext<EventType, PrincipalType>Optionalmeta: Record<string, unknown>The contract: the schema every projection is validated against and documented from.
What a resource does: turn a domain model into the shape a caller is allowed to see, and say what that shape is.
Saying it is the point. A projection written as code answers "what does this return?" only by being read and trusted; a projection written as a schema answers it to a person, to
@stone-js/openapi, and to the resource itself, which validates against it before anything leaves. One declaration, three consumers, and no way for the documentation to drift from the response.