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

Remove AJV usage from combinator mappers #2371

Open
lucas-koehler opened this issue Aug 28, 2024 · 0 comments · May be fixed by #2413
Open

Remove AJV usage from combinator mappers #2371

lucas-koehler opened this issue Aug 28, 2024 · 0 comments · May be fixed by #2413
Assignees
Labels
Milestone

Comments

@lucas-koehler
Copy link
Contributor

lucas-koehler commented Aug 28, 2024

Direct AJV usage in renderers (i.e. oneof renderer to determine applicable sub schema) should be removed completely as this is a hacky attempt to select the suitable subschema.
In general, we want to get rid of mandatory ajv usage in general.

For combinator renderers, AJV is invoked in mapStateToCombinatorRendererProps. This should be re-written to use a heuristic instead:

  • If there is an type/kind/id (in this order) attribute: use to select initial entry. See if we can match this against a const in the schema. Otherwise try with first string and/or number property.
  • id property should be configurable via a custom JSON Schema attribute (we already use a custom i18n attribute). The new attribute should start with x-jsf-. I.e. x-jsf-type-property
  • allOf: Investigate whether calling mapStateToCombinatorRendererProps in mapStateToAllOfProps is necessary
@lucas-koehler lucas-koehler self-assigned this Aug 28, 2024
@sdirix sdirix added this to the 4.0 milestone Sep 11, 2024
lucas-koehler added a commit that referenced this issue Jan 31, 2025
In contrast to oneOf and anyOf rendererer, allOf renderers do not need the `indexOfFittingSchema` because all schemas apply at once.
Thus, remove using mapStateToCombinatorRendererProps from mapStateToAllOfProps and, with this, the unnecessary calculation of the index.

Part of #2371
lucas-koehler added a commit that referenced this issue Jan 31, 2025
- Adapt algorithm to determine the fitting schema index for combinators to no longer use AJV
- New heuristic uses identifying properties that should match a const value in the schema
- Adapt MaterialOneOfRenderer.test.tsx to fit new heuristic
- Describe changes and add examples to migration guide
- Adapt some of the anyOf and oneOf examples to custom and new identification properties

#2371
lucas-koehler added a commit that referenced this issue Jan 31, 2025
In contrast to oneOf and anyOf rendererer, allOf renderers do not need the `indexOfFittingSchema` because all schemas apply at once.
Thus, remove using mapStateToCombinatorRendererProps from mapStateToAllOfProps and, with this, the unnecessary calculation of the index.

Part of #2371
lucas-koehler added a commit that referenced this issue Jan 31, 2025
- Adapt algorithm to determine the fitting schema index for combinators to no longer use AJV
- New heuristic uses identifying properties that should match a const value in the schema
- Adapt MaterialOneOfRenderer.test.tsx to fit new heuristic
- Describe changes and add examples to migration guide
- Adapt some of the anyOf and oneOf examples to custom and new identification properties

#2371
lucas-koehler added a commit that referenced this issue Jan 31, 2025
In contrast to oneOf and anyOf rendererer, allOf renderers do not need the `indexOfFittingSchema` because all schemas apply at once.
Thus, remove using mapStateToCombinatorRendererProps from mapStateToAllOfProps and, with this, the unnecessary calculation of the index.

Part of #2371
@lucas-koehler lucas-koehler linked a pull request Jan 31, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants