builder icon indicating copy to clipboard operation
builder copied to clipboard

fix: missing support for enrichOptions

Open davilima6 opened this issue 4 weeks ago • 1 comments

Purpose

Add support for enrichOptions parameter to the Content API, allowing users to control the depth level of reference enrichment when fetching content.

Approach and changes

  • [x] added enrichOptions property with enrichLevel and model support to GetContentOptions type
  • [x] implemented enrichOptions query parameter handling for /query and /content endpoints

Testing instructions

  1. Create a @builder.io/sdk test script
  2. Run getAll() method with enrichOptions:
    await builder.getAll('some-model-with-nested-references', {
      noTraverse: false,
      enrich: true,
      enrichOptions: {
        enrichLevel: 3,
        model: {
          'model1': {
            fields: 'id,data.field1,data.field3',
          },
          'model2': {
            fields:
              'data.id,data.field1,data.field2,data.field6',
          },
          'model3': {
            fields: 'data.and,so,on'
          },
        },
      },
      fields: 'data.rootField1,data.rootField2,data.rootField3',
      limit: 100,
      query: {
        'data.field': 'some value',
      },
    })
    
  3. Confirm the underlying API call includes enrich=true, enrichOptions.enrichLevel=3 and enrichOptions.model.model1=id,data.field1,data.field3 query parameters

davilima6 avatar Nov 24 '25 08:11 davilima6

🦋 Changeset detected

Latest commit: 71a1557778be7c432b50836520ae72a1c72d8e24

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@builder.io/sdk Minor
@builder.io/react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Nov 24 '25 08:11 changeset-bot[bot]

@sanyamkamat : 3f57244083bcc52f721e59480e03010357a18614

Do we need to include @builder.io/react? Is anything else needed?

davilima6 avatar Dec 15 '25 09:12 davilima6

@sanyamkamat : 3f57244

Do we need to include @builder.io/react? Is anything else needed?

I added the suggestion for adding @builder.io/react.

I think you can improve the changeset message here https://github.com/BuilderIO/builder/pull/4189/changes#diff-9a08f312e5ddf51f91d8c57e6b87aa9d07368f1b727f34a667c78f801070c679R5 similar to what is present here https://github.com/BuilderIO/builder/pull/3957/changes#diff-97df8d2aee620e4cca2b5098eafdde1ac4eaefae6ed23fcc9c136843592668a6R1

After that its good to merge 🎉

sanyamkamat avatar Dec 17 '25 04:12 sanyamkamat

@sanyamkamat : 71a155777

Can we have a release after merge?

davilima6 avatar Dec 17 '25 09:12 davilima6

View your CI Pipeline Execution ↗ for commit 71a1557778be7c432b50836520ae72a1c72d8e24

Command Status Duration Result
nx test @e2e/qwik-city ✅ Succeeded 7m 53s View ↗
nx test @e2e/angular-17 ✅ Succeeded 7m 41s View ↗
nx test @e2e/nextjs-sdk-next-app ✅ Succeeded 7m 45s View ↗
nx test @e2e/nuxt ✅ Succeeded 6m View ↗
nx test @e2e/angular-19-ssr ✅ Succeeded 6m 22s View ↗
nx test @e2e/gen1-next15-app ✅ Succeeded 4m 54s View ↗
nx test @e2e/react-sdk-next-15-app ✅ Succeeded 6m 9s View ↗
nx test @e2e/angular-17-ssr ✅ Succeeded 6m 9s View ↗
Additional runs (37) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2025-12-17 10:30:25 UTC

nx-cloud[bot] avatar Dec 17 '25 10:12 nx-cloud[bot]

@sanyamkamat : 71a1557

Can we have a release after merge?

@davilima6 it is now released as part of @builder.io/[email protected]

sanyamkamat avatar Dec 17 '25 11:12 sanyamkamat