Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: feat: add $id at schema definitions to improve rjsf performance #862

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

igorbrasileiro
Copy link
Contributor

No description provided.

Copy link
Contributor

Tagging Options

Should a new tag be published when this PR is merged?

  • 👍 for Patch 1.106.3 update
  • 🎉 for Minor 1.107.0 update
  • 🚀 for Major 2.0.0 update

@igorbrasileiro igorbrasileiro changed the title feat: add $id at schema definitions to improve rjsf performance wip: feat: add $id at schema definitions to improve rjsf performance Oct 16, 2024
@igorbrasileiro
Copy link
Contributor Author

Two errors:

  1. first rjsf form render
index.js:103 Error encountered compiling schema: Error: schema is invalid: data/definitions/aHR0cHM6Ly9kZW5vcGtnLmNvbS9kZWNvLWN4L2FwcHNAMC42Mi43L3Z0ZXgvYWN0aW9ucy9hbmFseXRpY3Mvc2VuZEV2ZW50LnRz@tl@345-397/properties/products/items must be object,boolean, data/definitions/aHR0cHM6Ly9kZW5vcGtnLmNvbS9kZWNvLWN4L2FwcHNAMC42Mi43L3Z0ZXgvYWN0aW9ucy9hbmFseXRpY3Mvc2VuZEV2ZW50LnRz@tl@345-397/properties/products/items must NOT have fewer than 1 items, data/definitions/aHR0cHM6Ly9kZW5vcGtnLmNvbS9kZWNvLWN4L2FwcHNAMC42Mi43L3Z0ZXgvYWN0aW9ucy9hbmFseXRpY3Mvc2VuZEV2ZW50LnRz@tl@345-397/properties/products/items must match a schema in anyOf
  1. Resolve to more than once schema on props with enum.
Error encountered compiling schema: Error: reference "#/480-1729097766964" resolves to more than one schema

@igorbrasileiro
Copy link
Contributor Author

igorbrasileiro commented Oct 16, 2024

The fix is to prevent to add $id to definitions which is only an array of ref in anyOf.

const finalDefsWith$id = Object.fromEntries(
        Object.entries(finalDefs).map((entry, idx) => {
          if (!entry[1].anyOf) return entry;

          entry[1] = { ...entry[1], $id:`#/${idx}-${revision}` };
          return entry;
        }),
      );

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.

1 participant