-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathAutomatedEditsCodeAgreementSchema.js
41 lines (36 loc) · 1.21 KB
/
AutomatedEditsCodeAgreementSchema.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import messages from "../Messages";
/**
* Generates a JSON Schema describing fields of Automated Edits Policy Agreement
* workflow step for use with react-jsonschema-form
*/
export const jsSchema = (intl) => {
const schemaFields = {
$schema: "http://json-schema.org/draft-07/schema#",
type: "object",
properties: {
automatedEditsCodeAgreement: {
title: intl.formatMessage(messages.automatedEditsCodeLabel),
type: "boolean",
default: false,
enum: [true],
agreementDescription: intl.formatMessage(messages.automatedEditsCodeDescription),
checkboxLabel: messages.automatedEditsCodeUICheckboxLabel,
},
},
required: ["automatedEditsCodeAgreement"],
};
return schemaFields;
};
export const uiSchema = (intl, user, challengeData, extraErrors, options = {}) => {
const uiSchemaFields = {
automatedEditsCodeAgreement: {
"ui:widget": "automatedEditsCheckbox",
"ui:help": intl.formatMessage(messages.automatedEditsCodeDescription),
"ui:groupHeader": options.longForm
? intl.formatMessage(messages.automatedEditsCodeStepHeader)
: undefined,
"ui:displayLabel": false,
},
};
return uiSchemaFields;
};