Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ServiceComposer/ServiceComposer.AspNetCore/llms.txt
Use this file to discover all available pages before exploring further.
ResponseSerializationOptions governs how ServiceComposer serializes the assembled ViewModel before writing it to the HTTP response. It is exposed as the ResponseSerialization property on ViewModelCompositionOptions and is configured inside the AddViewModelComposition callback. The options cover three concerns: the default letter casing applied to JSON property names, whether MVC’s output formatter pipeline should handle serialization (enabling content negotiation), and a hook for supplying fully custom JsonSerializerOptions on a per-request basis.
An additional mechanism for per-request casing control is available through the Accept-Casing HTTP request header, which overrides DefaultResponseCasing without any code changes.
ResponseSerializationOptions
Class in theServiceComposer.AspNetCore namespace. Accessed via ViewModelCompositionOptions.ResponseSerialization.
DefaultResponseCasing
ResponseCasing.CamelCase.
ResponseCasing.CamelCase (default) or ResponseCasing.PascalCase.UseOutputFormatters
true, ServiceComposer delegates response writing to the MVC output formatter pipeline, enabling full content negotiation driven by the Accept header (JSON, XML, etc.). MVC services must be registered — call services.AddControllers() or equivalent — before enabling this option.
Defaults to false. When set to true alongside a non-default DefaultResponseCasing or a custom JsonSerializerOptions, a warning is logged at startup because formatter-based serialization ignores those settings.
true to use MVC output formatters; false (default) to use the built-in JSON writer.UseCustomJsonSerializerSettings
JsonSerializerOptions instance. The factory receives the current HttpRequest, which lets you inspect headers, route values, or any other request data to vary serialization per caller.
Has no effect when UseOutputFormatters is true (a warning is logged in that case).
A delegate that receives the current
HttpRequest and returns the
JsonSerializerOptions to use for that response.ResponseCasing Enum
| Value | Integer | Description |
|---|---|---|
CamelCase | 0 | Property names begin with a lowercase letter (productName). This is the default. |
PascalCase | 1 | Property names begin with an uppercase letter (ProductName). |
Per-request casing with Accept-Casing
Clients can overrideDefaultResponseCasing on a per-request basis by including the Accept-Casing HTTP header. ServiceComposer reads this header and applies the specified casing for that response without any code changes in the handlers.
| Header value | Applied casing |
|---|---|
casing/camel | ResponseCasing.CamelCase |
casing/pascal | ResponseCasing.PascalCase |
DefaultResponseCasing setting.