Add AdaptiveRemote.Contracts shared library for layout DTOs#137
Conversation
…ters - Add AdaptiveRemote.Contracts project (net10.0, no platform-specific dependencies) containing all layout definition DTOs, enums, and LayoutContractsJsonContext from the spec's Shared Contracts section: CommandType enum, ICommandProperties interface, LayoutElementDto hierarchy (compiled), RawLayoutElementDto hierarchy (raw), RawLayout/CompiledLayout/ PreviewLayout top-level records, ValidationIssue/ValidationResult records, and source-generated LayoutContractsJsonContext for consistent serialization across all consumers including Native AOT Lambda functions. - Add AdaptiveRemote.Contracts to AdaptiveRemote.sln with full build configurations. - Reference AdaptiveRemote.Contracts from AdaptiveRemote.App. - Add client.slnf and backend.slnf solution filters. - Update _doc_Projects.md to document the new shared contracts project. https://claude.ai/code/session_01T3tonn7C9F6TYbqH23KmG1
Test Results401 tests 401 ✅ 2m 14s ⏱️ Results for commit 46ebd1d. ♻️ This comment has been updated with latest results. |
| // TiVo — CommandId = Name.ToUpperInvariant() (existing convention) | ||
| // IR — payload programmed via remote, stored in ProgrammaticSettings | ||
| // Others — keyed by Name | ||
| public enum CommandType { Lifecycle, TiVo, IR, Action } |
There was a problem hiding this comment.
Remove Action, that's not a Command type, it's a WPF adapter (which maybe doesn't belong in Models, but that's a problem for another day.)
| // compiled into CssDefinitions and are not needed by the client. | ||
| // --------------------------------------------------------------------------- | ||
|
|
||
| [JsonPolymorphic(TypeDiscriminatorPropertyName = "type")] |
There was a problem hiding this comment.
I think there's a naming conflict between this type discriminator and the Type property on CommandDefinitionDto.
There was a problem hiding this comment.
I think it would be better to put the RawLayout class in the file with RawLayoutElementDto and friends, and CompiledLayout with LayoutElementDto and friends. PreviewLayout can be in its own file. That keeps the related types together better.
- Remove Action from CommandType enum (it's a WPF adapter, not a command type) - Change type discriminator from "type" to "\$type" on both LayoutElementDto and RawLayoutElementDto to avoid conflict with the behavioral Type property on CommandDefinitionDto and RawCommandDefinitionDto - Move RawLayout into RawLayoutElementDto.cs, CompiledLayout into LayoutElementDto.cs, PreviewLayout into its own PreviewLayout.cs; delete Layouts.cs https://claude.ai/code/session_01T3tonn7C9F6TYbqH23KmG1
65e373f
into
feature/ADR-161-cusrtomization-service
Summary
Introduces a new
AdaptiveRemote.Contractsclass library containing shared data transfer objects (DTOs), enums, and interfaces for layout definitions. This library serves as the contract layer between the client application and backend services, enabling consistent serialization and type safety across platform boundaries.Key Changes
New Project:
AdaptiveRemote.Contractstargetingnet10.0with no platform-specific dependenciesclient.slnfandbackend.slnfsolution filtersLayout Definition DTOs:
RawLayoutElementDto(abstract) — base type for editor-editable layout elements with authoring properties (grid position, CSS overrides)RawCommandDefinitionDto— command element with behavioral properties (type, name, label, glyph, speak phrase, reverse)RawLayoutGroupDefinitionDto— container element with child elementsLayoutElementDto(abstract) — compiled variant stripped of authoring propertiesCommandDefinitionDtoandLayoutGroupDefinitionDto— compiled variants for client consumptionTop-Level Layout Records:
RawLayout— administrator-editable source format with validation resultsCompiledLayout— client-consumable format with compiled CSS and element definitionsPreviewLayout— editor preview format with rendered HTML/CSSSupporting Types:
CommandTypeenum — identifies runtime command type (Lifecycle, TiVo, IR, Action)ICommandPropertiesinterface — shared behavioral contract preventing drift between raw and compiled command typesValidationResultandValidationIssuerecords — validation reportingJSON Serialization:
LayoutContractsJsonContext— source-generated JSON context for Native AOT compatibilityProject References:
AdaptiveRemote.App.csprojto reference the new contracts libraryImplementation Details
[JsonPolymorphic]and[JsonDerivedType]attributes for compile-time JSON schema generationICommandPropertiesinterface ensures behavioral properties remain synchronized between raw and compiled variantshttps://claude.ai/code/session_01T3tonn7C9F6TYbqH23KmG1