Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Upgrade to RJSF v5 #1819

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const globals = {
'rss-parser': 'Parser',
'react-mailchimp-subscribe': 'ReactMailchimpSubscribe',
'plotly.js-basic-dist': 'Plotly',
'@rjsf/core': 'JSONSchemaForm',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's include RJSF in the bundle. Bundle size doesn't change much since we were bundling our forked version, and now we're dropping it.

'react-measure': 'ReactMeasure',
markdownit: 'markdownit',
markdownitSynapse: 'markdownitSynapse',
Expand Down Expand Up @@ -63,7 +62,6 @@ const esBuildOptions = {
'react-bootstrap',
'react-plotly.js/factory',
'plotly.js-basic-dist',
'@rjsf/core',
'katex',
'rss-parser',
'react-mailchimp-subscribe',
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
"@popperjs/core": "^2.10.2",
"@react-google-maps/api": "^2.13.1",
"@react-hook/resize-observer": "^1.2.6",
"@rjsf/core": "^4.2.3",
"@rjsf/core": "^5.0.0-beta.11",
"@rjsf/utils": "^5.0.0-beta.11",
"@rjsf/validator-ajv6": "^5.0.0-beta.11",
"@sage-bionetworks/react-base-table": "^1.13.2",
"@sage-bionetworks/rjsf-core": "^3.1.4",
"@types/ua-parser-js": "^0.7.36",
"@upsetjs/react": "^1.6.2",
"animate.css": "^4.1.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { utils } from '@sage-bionetworks/rjsf-core'
import { getDefaultRegistry } from '@rjsf/core'
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import React from 'react'
Expand All @@ -8,7 +8,7 @@ import {
guessPropertyType,
PropertyType,
transformDataFromPropertyType,
} from '../../../../../lib/containers/entity/annotations/AdditionalPropertiesSchemaField'
} from '../../../../../lib/containers/entity/SchemaDrivenAnnotationEditor/field/AdditionalPropertiesSchemaField'

describe('AdditionalPropertiesSchemaField unit tests', () => {
describe('guessPropertyType tests', () => {
Expand Down Expand Up @@ -126,7 +126,7 @@ describe('AdditionalPropertiesSchemaField unit tests', () => {
uiSchema={{}}
idSchema={{ $id: 'root' }}
formData={initialData}
registry={utils.getDefaultRegistry()}
registry={getDefaultRegistry()}
onChange={jest.fn()}
/>,
)
Expand Down Expand Up @@ -161,7 +161,7 @@ describe('AdditionalPropertiesSchemaField unit tests', () => {
uiSchema={{}}
idSchema={{ $id: 'root' }}
formData={initialData}
registry={utils.getDefaultRegistry()}
registry={getDefaultRegistry()}
onChange={jest.fn()}
/>,
)
Expand Down Expand Up @@ -209,7 +209,7 @@ describe('AdditionalPropertiesSchemaField unit tests', () => {
uiSchema={{}}
idSchema={{ $id: 'root' }}
formData={initialData}
registry={utils.getDefaultRegistry()}
registry={getDefaultRegistry()}
onChange={jest.fn()}
/>,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AjvError } from '@rjsf/core'
import { RJSFValidationError } from '@rjsf/utils'
import {
dropNullishArrayValues,
getFriendlyPropertyName,
transformErrors,
} from '../../../../../lib/containers/entity/annotations/AnnotationEditorUtils'
} from '../../../../../lib/containers/entity/SchemaDrivenAnnotationEditor/AnnotationEditorUtils'

describe('AnnotationEditorUtils tests', () => {
describe('dropNullishArrayValues', () => {
Expand Down Expand Up @@ -53,7 +53,7 @@ describe('AnnotationEditorUtils tests', () => {

describe('transformErrors', () => {
it('combines errors caused by an enumeration defined using anyOf', () => {
const errors: AjvError[] = [
const errors: RJSFValidationError[] = [
{
name: 'type',
property: '.study[0]',
Expand Down Expand Up @@ -100,7 +100,7 @@ describe('AnnotationEditorUtils tests', () => {
})

it('returns a custom message when using a key that collides with a reserved property', () => {
const errors: AjvError[] = [
const errors: RJSFValidationError[] = [
{
name: 'not',
property: "['name']",
Expand Down
Loading