-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Using omitExtraData with oneOf disables the input for other fields #3628
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
Comments
heath-freenome
added a commit
to heath-freenome/react-jsonschema-form
that referenced
this issue
Apr 28, 2023
8 tasks
heath-freenome
added a commit
that referenced
this issue
May 2, 2023
…ema functions (#3627) * feature: Add two new APIs and a schema parser refactor of retrieveSchema functions First part of the process to support precompiled AJV8 validators - Updated `@rjsf/utils` to support precompiled AJV8 validators as follows: - Refactored `getDiscriminatorFieldFromSchema()` from inside of `MultiSchemaField`, using it everywhere that `getClosestMatchingOption()` and `getFirstMatchingOption()` are called - This included changing `getDefaultFormState.ts` and `toPathSchema.ts` - Added 100% unit tests for the new functions - Added a new `hashForSchema()` function that returns a hash string for the given schema - Added 100% unit tests for the new functions - Did a major refactor of the functions in `retrieveSchema.ts` to have them all support returning lists of schemas and for most of them to take a `expandAllBranches` flag - Added renamed the original `retrieveSchema()` to `retrieveSchemaInternal()` function that is used as the entry point into the returning lists of schemas worlds - This function added the optional `expandAllBranches` flag with the default value set to false - Added a new default exported function `retrieveSchema()` that calls `retrieveSchemaInternal()` without the optional value, returning the first element in the list - Also added two new helpers, `getAllPermutationsOfXxxOf()` and `resolveAnyOrOneOfSchemas()` to support the new schema array return values - Updated the `retrieveSchemaTests.ts` file to extract a bunch of schemas into the `testData.ts` file while making sure all lines of new code are tested - Added a new `parser` subdirectory that contains the `ParserValidator` implementation of the `ValidatorType` interface for the new `schemaParser()` function - This new function uses the `expandAllBranches()` to capture and return the map of schema $id -> schema/sub-schema as captured by the `ParserValidator` - Added 100% unit testing for the new `schemaParser()` function - NOTE: while this function is being exported from `@rjsf/utils` it is meant to be kept undocument in the `docs` - Updated `@rjsf/core` to use the new `getDiscriminatorFieldFromSchema()` function in `MultiSchemaField` - Updated the `utility-functions` docs to add documentation for `getDiscriminatorFieldFromSchema()` and `hashForSchema()` - Updated the `CHANGELOG.md` accordingly * - Fixed #3628 and #1628 * - Responded to reviewer feedback * Update packages/utils/src/parser/ParserValidator.ts Co-authored-by: Nick Grosenbacher <[email protected]> * Update packages/utils/test/parser/ParserValidator.test.ts --------- Co-authored-by: Nick Grosenbacher <[email protected]>
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.6.2
Current Behavior
When
using a schema that defines an object with properties, as well as contains the oneOf keyword
and
enabling omitExtraData plus liveOmit
then
the properties defined directly on the object can not be written to.
Example schema:
Expected Behavior
I expect to be able to write to all defined properties, not just the properties inside the oneOf.
Steps To Reproduce
Environment
Anything else?
Using omitExtraData creates a list of known properties and removes all properties not in the list, but this list does not contain all properties. Link to code
It seems to me that the problem is an early return in the
toSchemaPath
function, that returns if the schema contains a oneOf keyword. Link to codeIssue #1628 seems to be kind of related.
The text was updated successfully, but these errors were encountered: