Skip to content

Commit 38f7d32

Browse files
fix typos in constants.ts, Form.tsx (#4185)
* fix typos in constants.ts, Form.tsx * keep the constants to for backwards compatibility Co-authored-by: Heath C <[email protected]> --------- Co-authored-by: Heath C <[email protected]>
1 parent 6f3a837 commit 38f7d32

File tree

5 files changed

+24
-9
lines changed

5 files changed

+24
-9
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ should change the heading of the (upcoming) version to include a major version b
1616
1717
-->
1818

19+
# 5.18.4
20+
21+
## Dev / docs / playground
22+
23+
- Fixed typo in `constants.ts`, `Form.tsx`
24+
1925
# 5.18.3
2026

2127
## @rjsf/semantic-ui

packages/core/src/components/Form.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
RegistryWidgetsType,
2121
RJSFSchema,
2222
RJSFValidationError,
23-
RJSF_ADDITONAL_PROPERTIES_FLAG,
23+
RJSF_ADDITIONAL_PROPERTIES_FLAG,
2424
SchemaUtilsType,
2525
shouldRender,
2626
SUBMIT_BTN_OPTIONS_KEY,
@@ -111,8 +111,12 @@ export interface FormProps<T = any, S extends StrictRJSFSchema = RJSFSchema, F e
111111
*/
112112
onFocus?: (id: string, data: any) => void;
113113
// <form /> HTML attributes
114-
/** The value of this prop will be passed to the `accept-charset` HTML attribute on the form */
114+
/** The value of this prop will be passed to the `accept-charset` HTML attribute on the form
115+
* @deprecated replaced with `acceptCharset` which will supercede this value if both are specified
116+
*/
115117
acceptcharset?: string;
118+
/** The value of this prop will be passed to the `accept-charset` HTML attribute on the form */
119+
acceptCharset?: string;
116120
/** The value of this prop will be passed to the `action` HTML attribute on the form
117121
*
118122
* NOTE: this just renders the `action` attribute in the HTML markup. There is no real network request being sent to
@@ -537,7 +541,7 @@ export default class Form<
537541
if (typeof _obj[key] === 'object') {
538542
const newPaths = paths.map((path) => [...path, key]);
539543
// If an object is marked with additionalProperties, all its keys are valid
540-
if (_obj[key][RJSF_ADDITONAL_PROPERTIES_FLAG] && _obj[key][NAME_KEY] !== '') {
544+
if (_obj[key][RJSF_ADDITIONAL_PROPERTIES_FLAG] && _obj[key][NAME_KEY] !== '') {
541545
acc.push(_obj[key][NAME_KEY]);
542546
} else {
543547
getAllPaths(_obj[key], acc, newPaths);
@@ -871,6 +875,7 @@ export default class Form<
871875
autoComplete,
872876
enctype,
873877
acceptcharset,
878+
acceptCharset,
874879
noHtml5Validate = false,
875880
disabled = false,
876881
readonly = false,
@@ -905,7 +910,7 @@ export default class Form<
905910
action={action}
906911
autoComplete={autoComplete}
907912
encType={enctype}
908-
acceptCharset={acceptcharset}
913+
acceptCharset={acceptCharset || acceptcharset}
909914
noValidate={noHtml5Validate}
910915
onSubmit={this.onSubmit}
911916
as={as}

packages/utils/src/constants.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/** Below are the list of all the keys into various elements of a RJSFSchema or UiSchema that are used by the various
22
* utility functions. In addition to those keys, there are the special `ADDITIONAL_PROPERTY_FLAG` and
3-
* `RJSF_ADDITONAL_PROPERTIES_FLAG` flags that is added to a schema under certain conditions by the `retrieveSchema()`
3+
* `RJSF_ADDITIONAL_PROPERTIES_FLAG` flags that is added to a schema under certain conditions by the `retrieveSchema()`
44
* utility.
55
*/
66
export const ADDITIONAL_PROPERTY_FLAG = '__additional_property';
@@ -23,7 +23,11 @@ export const PROPERTIES_KEY = 'properties';
2323
export const REQUIRED_KEY = 'required';
2424
export const SUBMIT_BTN_OPTIONS_KEY = 'submitButtonOptions';
2525
export const REF_KEY = '$ref';
26+
/**
27+
* @deprecated Replace with correctly spelled constant `RJSF_ADDITIONAL_PROPERTIES_FLAG`
28+
*/
2629
export const RJSF_ADDITONAL_PROPERTIES_FLAG = '__rjsf_additionalProperties';
30+
export const RJSF_ADDITIONAL_PROPERTIES_FLAG = '__rjsf_additionalProperties';
2731
export const ROOT_SCHEMA_PREFIX = '__rjsf_rootSchema';
2832
export const UI_FIELD_KEY = 'ui:field';
2933
export const UI_WIDGET_KEY = 'ui:widget';

packages/utils/src/schema/toPathSchema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
ONE_OF_KEY,
1313
PROPERTIES_KEY,
1414
REF_KEY,
15-
RJSF_ADDITONAL_PROPERTIES_FLAG,
15+
RJSF_ADDITIONAL_PROPERTIES_FLAG,
1616
} from '../constants';
1717
import getDiscriminatorFieldFromSchema from '../getDiscriminatorFieldFromSchema';
1818
import { FormContextType, PathSchema, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types';
@@ -69,7 +69,7 @@ function toPathSchemaInternal<T = any, S extends StrictRJSFSchema = RJSFSchema,
6969
}
7070

7171
if (ADDITIONAL_PROPERTIES_KEY in schema && schema[ADDITIONAL_PROPERTIES_KEY] !== false) {
72-
set(pathSchema, RJSF_ADDITONAL_PROPERTIES_FLAG, true);
72+
set(pathSchema, RJSF_ADDITIONAL_PROPERTIES_FLAG, true);
7373
}
7474

7575
if (ITEMS_KEY in schema && Array.isArray(formData)) {

packages/validator-ajv8/src/createAjvInstance.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import addFormats, { FormatsPluginOptions } from 'ajv-formats';
33
import isObject from 'lodash/isObject';
44

55
import { CustomValidatorOptionsType } from './types';
6-
import { ADDITIONAL_PROPERTY_FLAG, RJSF_ADDITONAL_PROPERTIES_FLAG } from '@rjsf/utils';
6+
import { ADDITIONAL_PROPERTY_FLAG, RJSF_ADDITIONAL_PROPERTIES_FLAG } from '@rjsf/utils';
77

88
export const AJV_CONFIG: Options = {
99
allErrors: true,
@@ -50,7 +50,7 @@ export default function createAjvInstance(
5050

5151
// Add RJSF-specific additional properties keywords so Ajv doesn't report errors if strict is enabled.
5252
ajv.addKeyword(ADDITIONAL_PROPERTY_FLAG);
53-
ajv.addKeyword(RJSF_ADDITONAL_PROPERTIES_FLAG);
53+
ajv.addKeyword(RJSF_ADDITIONAL_PROPERTIES_FLAG);
5454

5555
// add more schemas to validate against
5656
if (Array.isArray(additionalMetaSchemas)) {

0 commit comments

Comments
 (0)