diff --git a/CHANGELOG.md b/CHANGELOG.md index 624612a5a4..b6fe2496f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ should change the heading of the (upcoming) version to include a major version b ## @rjsf/core - Switched `Form` to use the new `validatorDataMerge()` function instead of the new deprecated `schemaUtils.mergeValidatorData()` +- Updated `MultiSchemaField` to handle the OpenAPI `discriminator` extension on `anyOf/oneOf` fields by passing it into `getClosestMatchingOption()` if it exists, fixing [#3512](https://github.com/rjsf-team/react-jsonschema-form/issues/3512) ## @rjsf/utils @@ -28,6 +29,10 @@ should change the heading of the (upcoming) version to include a major version b - As a result, the `mergeValidationData()` function was deprecated in favor of the new `validationDataMerge()` function that uses the refactored `toErrorList()` function - Refactored the `ROOT_SCHEMA_PREFIX` constant as well - Updated `ValidatorType` and `SchemaUtilsType` to deprecate the `toErrorList()` and `mergeValidationData()` functions, respectively +- Updated the `getClosestMatchingOption()` and `getFirstMatchingOption()` to pass the new `discriminatorField` to the `getMatchingOption()` function +- Updated `getMatchingOption()` to use `discriminatorField` when it is present in the `options` object properties to drill into the object to detect if that one field is valid +- Updated `SchemaUtilsType` and the associated forward functions in `createSchemaUtils` to add the new `discriminatorField?: string` optional parameter +- Updated `toIdSchema()` function to use `getSchemaType(schema) === 'object'` rather than `schema.type === 'object'` to get the proper pathing for ids, fixing [#2044](https://github.com/rjsf-team/react-jsonschema-form/issues/2044) ## @rjsf/validator-ajv6 diff --git a/packages/antd/test/__snapshots__/Object.test.tsx.snap b/packages/antd/test/__snapshots__/Object.test.tsx.snap index 75fedd6abf..6b1b6ad608 100644 --- a/packages/antd/test/__snapshots__/Object.test.tsx.snap +++ b/packages/antd/test/__snapshots__/Object.test.tsx.snap @@ -575,14 +575,14 @@ exports[`object fields object 1`] = ` `; -exports[`object fields with title and description additionalProperties 1`] = ` +exports[`object fields show add button and fields if additionalProperties is true and not an object 1`] = `
-`; - -exports[`object fields with title and description from uiSchema additionalProperties 1`] = ` -.emotion-1 { - margin-top: 1px; - margin-bottom: 4px; -} - -.emotion-3 { - border: 0; - border-bottom-width: 1px; - width: 100%; -} - -.emotion-4 { - margin-top: 2px; - margin-bottom: 4px; -} - -.emotion-5 { - display: grid; - grid-gap: 2px; - margin-bottom: 4px; -} - -.emotion-7 { - display: grid; - grid-gap: 2px; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; -} - -.emotion-10 { - display: block; - text-align: start; -} - -.emotion-11 { - margin-bottom: 1px; -} - -.emotion-18 { - display: -webkit-inline-box; - display: -webkit-inline-flex; - display: -ms-inline-flexbox; - display: inline-flex; - -webkit-appearance: none; - -moz-appearance: none; - -ms-appearance: none; - appearance: none; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: center; - -ms-flex-pack: center; - -webkit-justify-content: center; - justify-content: center; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - position: relative; - white-space: nowrap; - vertical-align: middle; - outline: 2px solid transparent; - outline-offset: 2px; - width: auto; - padding: 0px; -} - -.emotion-19 { - width: 1em; - height: 1em; - display: inline-block; - line-height: 1em; - -webkit-flex-shrink: 0; - -ms-flex-negative: 0; - flex-shrink: 0; - color: currentColor; - vertical-align: middle; -} - -.emotion-20 { - justify-self: flex-end; -} - -.emotion-21 { - display: -webkit-inline-box; - display: -webkit-inline-flex; - display: -ms-inline-flexbox; - display: inline-flex; - -webkit-appearance: none; - -moz-appearance: none; - -ms-appearance: none; - appearance: none; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: center; - -ms-flex-pack: center; - -webkit-justify-content: center; - justify-content: center; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - position: relative; - white-space: nowrap; - vertical-align: middle; - outline: 2px solid transparent; - outline-offset: 2px; - width: auto; -} - -.emotion-22 { - display: -webkit-inline-box; - display: -webkit-inline-flex; - display: -ms-inline-flexbox; - display: inline-flex; - -webkit-align-self: center; - -ms-flex-item-align: center; - align-self: center; - -webkit-flex-shrink: 0; - -ms-flex-negative: 0; - flex-shrink: 0; - -webkit-margin-end: 0.5rem; - margin-inline-end: 0.5rem; -} - -.emotion-24 { - margin-top: 3px; -} - -- a fancier description -
-+ a fancier description +
++ a fancier description +
++ a fancier item A description +
++ a fancier item B description +
++ a fancier description +
++ a test description +
++ A description +
++ B description +
++ a test description +
+- B description -
- a test description + a fancier description
-- A description -
-- B description -
-+ a test description +
++ A description +
++ B description +
++ a test description +
+