core icon indicating copy to clipboard operation
core copied to clipboard

[TASK] Create a REST API Endpoint(s) for Style Properties Management

Open fabrizzio-dotCMS opened this issue 1 year ago • 2 comments

Description

Implement a REST API endpoint to support the insertion and updating of style properties for Contentlets. The API should provide a clean interface for managing styles while ensuring data consistency and validation against UVE schemas.

  1. Create the REST endpoint at /v1/page/{pageId}/styles

    Implement PUT endpoint for style properties management Follow dotCMS REST API conventions Ensure proper authentication and authorization

  2. Define and implement the request payload structure

    Include MultiTree reference attributes:

    child - Contentlet identifier parent1 - Container identifier parent2 - Page identifier relation_type - Relationship type personalization - Personalization identifier variant_id - Variant identifier

    Include the styles data object Document payload structure with swagger

  3. Implement validation for style properties

    Validate that styles are consistent with UVE schemas Implement schema validation logic Return appropriate error messages for validation failures

  4. Implement business logic for inserting/updating styles

    Handle creation of new style entries Handle updates to existing style entries Ensure proper MultiTree reference handling Implement transactional behavior

  5. Write comprehensive tests

    Unit tests for validation logic Integration tests for API endpoints Test various payload scenarios (valid, invalid, edge cases) Test UVE schema validation Test authentication and authorization

  6. Hide this functionality under the feature flag

Ensure endpoint is only active when FEATURE_FLAG_UVE_STYLE_EDITOR feature flag is enabled Return appropriate response when feature is disabled

4.7 Update API documentation

Acceptance Criteria

  • [ ] REST endpoint /v1/page/{pageId}/styles is implemented and functional
  • [ ] Payload correctly includes all MultiTree reference attributes and styles data
  • [ ] Style validation against UVE schemas is working correctly
  • [ ] All tests pass (unit and integration)
  • [ ] Proper error handling and meaningful error messages are returned

Priority

None

Additional Context

No response

fabrizzio-dotCMS avatar Oct 30 '25 16:10 fabrizzio-dotCMS

Passed QA

  • dotCMS docker image: [dotcms/dotcms:trunk]

Video

https://github.com/user-attachments/assets/fc5b6186-5cc9-44fe-a411-6420267f2e2c

ihoffmann-dot avatar Jan 23 '26 23:01 ihoffmann-dot