-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Second and further objects in anyOf get properties from the first object #3236
Labels
Comments
@kentlarsson Ah, yeah, our oneOf logic doesn't seem to clear unnecessary fields. This seems similar to #2944 and it is likely that the fix I'm planning to do in the new year may also fix this |
Yes definitely looks like something that might be squashed in one go. |
heath-freenome
added a commit
to heath-freenome/react-jsonschema-form
that referenced
this issue
Jan 20, 2023
Fixes rjsf-team#2944, rjsf-team#3236, rjsf-team#2978 and possibly others - In `@rjsf/utils`, added new `getClosestMatchingOption()`, `getFirstMatchingOption()` and `sanitizeDataForNewSchema()` schema-based utility functions - Deprecated `getMatchingOption()` and updated all calls to it in other utility functions to use `getFirstMatchingOption()` - Added 100% unit tests for all new functions, renaming the old `getMatchingOptionsTest.ts` file to `getFirstMatchingOptionsTest.ts` - Updated `createSchemaUtils()` and it's associated type to add the three new functions - In `@rjsf/validator-ajv6` and `@rjsf/validator-ajv8`, updated the `schema.tests.ts` to add the new tests for the new schema-based utility functions - In `@rjsf/core`, updated the `MultiSchemaField` to use the new `getClosestMatchingOption()` and `sanitizeDataForNewSchema()` utility functions - Also updated the render to properly pass props to the widget and the schema field - In `@rjsf/playground`, updated `onFormDataEdited()` to only change the formData in the state if the `JSON.stringify()` of the old and new values are different - Also updated the `npm start` command to add the `--force` option to avoid issues where changes made to other packages weren't getting picked up due to `vite` caching - Updated the `utility-functions.md` file to document the new schema-based functions and to fix up incorrect strike-through caused by the unescaped `<S>` generic - Updated the `5.x upgrade guide.md` file to document the new utility functions and the deprecation of `getMatchingOption()`
heath-freenome
added a commit
to heath-freenome/react-jsonschema-form
that referenced
this issue
Jan 20, 2023
Fixes rjsf-team#2944, rjsf-team#3236, rjsf-team#2978 and possibly others - In `@rjsf/utils`, added new `getClosestMatchingOption()`, `getFirstMatchingOption()` and `sanitizeDataForNewSchema()` schema-based utility functions - Deprecated `getMatchingOption()` and updated all calls to it in other utility functions to use `getFirstMatchingOption()` - Added 100% unit tests for all new functions, renaming the old `getMatchingOptionsTest.ts` file to `getFirstMatchingOptionsTest.ts` - Updated `createSchemaUtils()` and it's associated type to add the three new functions - In `@rjsf/validator-ajv6` and `@rjsf/validator-ajv8`, updated the `schema.tests.ts` to add the new tests for the new schema-based utility functions - In `@rjsf/core`, updated the `MultiSchemaField` to use the new `getClosestMatchingOption()` and `sanitizeDataForNewSchema()` utility functions - Also updated the render to properly pass props to the widget and the schema field - In `@rjsf/playground`, updated `onFormDataEdited()` to only change the formData in the state if the `JSON.stringify()` of the old and new values are different - Also updated the `npm start` command to add the `--force` option to avoid issues where changes made to other packages weren't getting picked up due to `vite` caching - Updated the `utility-functions.md` file to document the new schema-based functions and to fix up incorrect strike-through caused by the unescaped `<S>` generic - Updated the `5.x upgrade guide.md` file to document the new utility functions and the deprecation of `getMatchingOption()`
8 tasks
heath-freenome
added a commit
to heath-freenome/react-jsonschema-form
that referenced
this issue
Jan 23, 2023
Fixes rjsf-team#2944, rjsf-team#3236, rjsf-team#2978 and possibly others - In `@rjsf/utils`, added new `getClosestMatchingOption()`, `getFirstMatchingOption()` and `sanitizeDataForNewSchema()` schema-based utility functions - Deprecated `getMatchingOption()` and updated all calls to it in other utility functions to use `getFirstMatchingOption()` - Added 100% unit tests for all new functions, renaming the old `getMatchingOptionsTest.ts` file to `getFirstMatchingOptionsTest.ts` - Updated `createSchemaUtils()` and it's associated type to add the three new functions - In `@rjsf/validator-ajv6` and `@rjsf/validator-ajv8`, updated the `schema.tests.ts` to add the new tests for the new schema-based utility functions - In `@rjsf/core`, updated the `MultiSchemaField` to use the new `getClosestMatchingOption()` and `sanitizeDataForNewSchema()` utility functions - Also updated the render to properly pass props to the widget and the schema field - In `@rjsf/playground`, updated `onFormDataEdited()` to only change the formData in the state if the `JSON.stringify()` of the old and new values are different - Also updated the `npm start` command to add the `--force` option to avoid issues where changes made to other packages weren't getting picked up due to `vite` caching - Updated the `utility-functions.md` file to document the new schema-based functions and to fix up incorrect strike-through caused by the unescaped `<S>` generic - Updated the `5.x upgrade guide.md` file to document the new utility functions and the deprecation of `getMatchingOption()`
heath-freenome
added a commit
that referenced
this issue
Jan 24, 2023
* fix: fixed several issue in oneOf/anyOf functions Fixes #2944, #3236, #2978 and possibly others - In `@rjsf/utils`, added new `getClosestMatchingOption()`, `getFirstMatchingOption()` and `sanitizeDataForNewSchema()` schema-based utility functions - Deprecated `getMatchingOption()` and updated all calls to it in other utility functions to use `getFirstMatchingOption()` - Added 100% unit tests for all new functions, renaming the old `getMatchingOptionsTest.ts` file to `getFirstMatchingOptionsTest.ts` - Updated `createSchemaUtils()` and it's associated type to add the three new functions - In `@rjsf/validator-ajv6` and `@rjsf/validator-ajv8`, updated the `schema.tests.ts` to add the new tests for the new schema-based utility functions - In `@rjsf/core`, updated the `MultiSchemaField` to use the new `getClosestMatchingOption()` and `sanitizeDataForNewSchema()` utility functions - Also updated the render to properly pass props to the widget and the schema field - In `@rjsf/playground`, updated `onFormDataEdited()` to only change the formData in the state if the `JSON.stringify()` of the old and new values are different - Also updated the `npm start` command to add the `--force` option to avoid issues where changes made to other packages weren't getting picked up due to `vite` caching - Updated the `utility-functions.md` file to document the new schema-based functions and to fix up incorrect strike-through caused by the unescaped `<S>` generic - Updated the `5.x upgrade guide.md` file to document the new utility functions and the deprecation of `getMatchingOption()` * - Fixed a few small issues exposed by trying to use the playground in #2375 - Also updated the `CHANGELOG.md` to include all of the fixed issues * - Fix #2538 by fixing additionalProperties to deal with allOf/anyOf/oneOf * - Updated `getSchemaType()` to grab the type of the first element of a `oneOf`/`anyOf` * - Allow `formData` in `getClosestMatchingOption()` to accept `undefined` * - Responded to reviewer feedback * - Deal with sanitizing data when both `array.items` elements are booleans and have the same value * - Fixed issue with const being assigned default value incorrectly and handle readOnly default values like const - Updated some documentation in the types and createSchemaUtils
shijistar
pushed a commit
to shijistar/react-jsonschema-form
that referenced
this issue
Jun 8, 2023
* fix: fixed several issue in oneOf/anyOf functions Fixes rjsf-team#2944, rjsf-team#3236, rjsf-team#2978 and possibly others - In `@rjsf/utils`, added new `getClosestMatchingOption()`, `getFirstMatchingOption()` and `sanitizeDataForNewSchema()` schema-based utility functions - Deprecated `getMatchingOption()` and updated all calls to it in other utility functions to use `getFirstMatchingOption()` - Added 100% unit tests for all new functions, renaming the old `getMatchingOptionsTest.ts` file to `getFirstMatchingOptionsTest.ts` - Updated `createSchemaUtils()` and it's associated type to add the three new functions - In `@rjsf/validator-ajv6` and `@rjsf/validator-ajv8`, updated the `schema.tests.ts` to add the new tests for the new schema-based utility functions - In `@rjsf/core`, updated the `MultiSchemaField` to use the new `getClosestMatchingOption()` and `sanitizeDataForNewSchema()` utility functions - Also updated the render to properly pass props to the widget and the schema field - In `@rjsf/playground`, updated `onFormDataEdited()` to only change the formData in the state if the `JSON.stringify()` of the old and new values are different - Also updated the `npm start` command to add the `--force` option to avoid issues where changes made to other packages weren't getting picked up due to `vite` caching - Updated the `utility-functions.md` file to document the new schema-based functions and to fix up incorrect strike-through caused by the unescaped `<S>` generic - Updated the `5.x upgrade guide.md` file to document the new utility functions and the deprecation of `getMatchingOption()` * - Fixed a few small issues exposed by trying to use the playground in rjsf-team#2375 - Also updated the `CHANGELOG.md` to include all of the fixed issues * - Fix rjsf-team#2538 by fixing additionalProperties to deal with allOf/anyOf/oneOf * - Updated `getSchemaType()` to grab the type of the first element of a `oneOf`/`anyOf` * - Allow `formData` in `getClosestMatchingOption()` to accept `undefined` * - Responded to reviewer feedback * - Deal with sanitizing data when both `array.items` elements are booleans and have the same value * - Fixed issue with const being assigned default value incorrectly and handle readOnly default values like const - Updated some documentation in the types and createSchemaUtils
shijistar
pushed a commit
to shijistar/react-jsonschema-form
that referenced
this issue
Jun 8, 2023
* fix: fixed several issue in oneOf/anyOf functions Fixes rjsf-team#2944, rjsf-team#3236, rjsf-team#2978 and possibly others - In `@rjsf/utils`, added new `getClosestMatchingOption()`, `getFirstMatchingOption()` and `sanitizeDataForNewSchema()` schema-based utility functions - Deprecated `getMatchingOption()` and updated all calls to it in other utility functions to use `getFirstMatchingOption()` - Added 100% unit tests for all new functions, renaming the old `getMatchingOptionsTest.ts` file to `getFirstMatchingOptionsTest.ts` - Updated `createSchemaUtils()` and it's associated type to add the three new functions - In `@rjsf/validator-ajv6` and `@rjsf/validator-ajv8`, updated the `schema.tests.ts` to add the new tests for the new schema-based utility functions - In `@rjsf/core`, updated the `MultiSchemaField` to use the new `getClosestMatchingOption()` and `sanitizeDataForNewSchema()` utility functions - Also updated the render to properly pass props to the widget and the schema field - In `@rjsf/playground`, updated `onFormDataEdited()` to only change the formData in the state if the `JSON.stringify()` of the old and new values are different - Also updated the `npm start` command to add the `--force` option to avoid issues where changes made to other packages weren't getting picked up due to `vite` caching - Updated the `utility-functions.md` file to document the new schema-based functions and to fix up incorrect strike-through caused by the unescaped `<S>` generic - Updated the `5.x upgrade guide.md` file to document the new utility functions and the deprecation of `getMatchingOption()` * - Fixed a few small issues exposed by trying to use the playground in rjsf-team#2375 - Also updated the `CHANGELOG.md` to include all of the fixed issues * - Fix rjsf-team#2538 by fixing additionalProperties to deal with allOf/anyOf/oneOf * - Updated `getSchemaType()` to grab the type of the first element of a `oneOf`/`anyOf` * - Allow `formData` in `getClosestMatchingOption()` to accept `undefined` * - Responded to reviewer feedback * - Deal with sanitizing data when both `array.items` elements are booleans and have the same value * - Fixed issue with const being assigned default value incorrectly and handle readOnly default values like const - Updated some documentation in the types and createSchemaUtils
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
What theme are you using?
core
Version
5.0.0-beta.12
Current Behavior
Keys in anyOfs first item seem to be added to any other item of an array.
Expected Behavior
That each object in the anyOf only has their own properties.
Steps To Reproduce
"daysOfYear": [ null ]
exists in the second craftTypes item of the formData. It should not as it's not part of that object.Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: