Skip to content

Commit ec5f689

Browse files
committed
Change 'order' prop to 'propertyOrder'
1 parent c2d139e commit ec5f689

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ JSON schema is an extremely powerful descriptive language and this package while
154154
| object: maxProperties | Implemented as validation |
155155
| object: dependencies | Not supported |
156156
| object: patternProperties | Not supported |
157-
| object: order | NON-STANDARD. This custom keyword should be followed by a list of property names as strings or sublists of the same. It has no effect on validation. It allows specification of the order in which properties are displayed in the data entry form. See below for how orders are merged with combined schemas. Sublists are rendered contained within an outer div to allow more control over layout. |
157+
| object: propertyOrder | NON-STANDARD. This custom keyword should be followed by a list of property names as strings or sublists of the same. It has no effect on validation. It allows specification of the order in which properties are displayed in the data entry form. See below for how orders are merged with combined schemas. Sublists are rendered contained within an outer div to allow more control over layout. |
158158
| object: currencySymbol | NON-STANDARD. This custom keyword can only be present on the top-level schema object. It determines the string used as a currency prefix for the currency editor. |
159159
| object: additionalProperties | Assumed to be true when validating, and false when constructing a UI. See below for more. This means that additionalProperties: false in a schema is not supported. |
160160
| array: items | This schema is used to render each subsection of the array. Tuple validation (where items is a list of schemas) is not supported. |

example/src/App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const schema = {
4848
required: [ "postcode" ]
4949
}
5050
},
51-
order: [ "salutation", [ "firstName", "lastName" ], "canContact", "preferredContact", "dateOfBirth", "password", "comments", "files", "things", "address" ],
51+
propertyOrder: [ "salutation", [ "firstName", "lastName" ], "canContact", "preferredContact", "dateOfBirth", "password", "comments", "files", "things", "address" ],
5252
if: {
5353
type: "object", properties: {
5454
salutation: { type: "string", const: "Dr" }
@@ -58,7 +58,7 @@ const schema = {
5858
type: "object", properties: {
5959
isMedical: { type: "boolean" }
6060
},
61-
order: [ "canContact", "isMedical" ]
61+
propertyOrder: [ "canContact", "isMedical" ]
6262
}
6363
}
6464

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@restspace/schema-form",
3-
"version": "1.0.14",
3+
"version": "1.0.15",
44
"description": "JSON Schema based form generator in React",
55
"author": "James Ellis-Jones",
66
"license": "MIT",

src/components/schema-form-object.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ export function SchemaFormObject({
6060
return <></>;
6161
}
6262

63-
let topOrder: NestedListArray = schema['order'] || Object.keys(schema['properties'] || {});
63+
let topOrder: NestedListArray = schema['propertyOrder'] || Object.keys(schema['properties'] || {});
6464
let properties = Object.entries(schema['properties'] || {});
6565
let requireds = schema['required'];
66-
if (schema['order'] && _.flatten(schema['order']).length < properties.length) {
66+
if (schema['propertyOrder'] && _.flatten(schema['propertyOrder']).length < properties.length) {
6767
console.log('fewer items in order than properties at ' + path.join('.'));
6868
}
6969
const collapsible = (context.collapsible && path.length > 0) || false;

src/schema/schema.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ export function conjoin(schema0: object | null, schema1: object | null): object
125125
}
126126
}
127127
break;
128-
case 'order':
129-
if (!schema['order']) {
130-
schema['order'] = schema1['order']
128+
case 'propertyOrder':
129+
if (!schema['propertyOrder']) {
130+
schema['propertyOrder'] = schema1['propertyOrder']
131131
} else {
132-
schema['order'] = mergeOrders(schema['order'], schema1['order']);
132+
schema['propertyOrder'] = mergeOrders(schema['propertyOrder'], schema1['propertyOrder']);
133133
}
134134
break;
135135
case 'items':

0 commit comments

Comments
 (0)