Skip to content

Conversation

@exacs
Copy link
Contributor

@exacs exacs commented Nov 14, 2025

This PR fixes a problem in #171: Adds the suffix Property in the alias when the typename next to it has a suffix, i.e., in "block" properties.

It also adds tests specifically to test block properties and tests for the removeTypeSuffix function.

@exacs exacs requested review from JohanPetersson, TRomesh and Copilot and removed request for JohanPetersson and Copilot November 14, 2025 08:20
Copilot finished reviewing on behalf of exacs November 14, 2025 08:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances GraphQL fragment generation to properly handle component (block) properties by ensuring that field aliases include the "Property" suffix when it's part of the fragment name. It also adds comprehensive test coverage for the removeTypePrefix function.

  • Threads the suffix parameter through convertProperty and convertPropertyField functions
  • Ensures field aliases match fragment names when dealing with block properties
  • Exports removeTypePrefix function for testing purposes with appropriate documentation
  • Adds comprehensive unit tests for removeTypePrefix and component property handling

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
packages/optimizely-cms-sdk/src/graph/index.ts Exports removeTypePrefix function for testing with a note explaining its limited scope
packages/optimizely-cms-sdk/src/graph/createQuery.ts Adds suffix parameter to property conversion functions to support proper alias generation for block properties
packages/optimizely-cms-sdk/src/graph/test/index.test.ts Adds comprehensive tests for removeTypePrefix function covering basic functionality, nested objects, and edge cases
packages/optimizely-cms-sdk/src/graph/test/createQuery.test.ts Adds test for component properties to verify correct fragment and alias generation with "Property" suffix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@exacs exacs merged commit 45cdc58 into main Nov 14, 2025
10 checks passed
@exacs exacs deleted the bugfix/CMS-46783-handle-blocks branch November 14, 2025 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants