Skip to content

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

@fabrizzio-dotCMS

Description

@fabrizzio-dotCMS

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    QA

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions