Skip to content

Instantly share code, notes, and snippets.

@bion
Created January 28, 2021 01:44
Show Gist options
  • Save bion/2beec15f1c3d6f4cf20c5ce19c86f3f8 to your computer and use it in GitHub Desktop.
Save bion/2beec15f1c3d6f4cf20c5ce19c86f3f8 to your computer and use it in GitHub Desktop.
data shapes
{
type: "user-defined",
name: "employment"
repeated: true,
props: {
employerName: "string"
}
}
{
path: "applicant.employments[2].employerName"
value: "Google, LLC"
}
{
applicant: {
employments: [
{
employerName: "string"
}
]
}
}
class AdminObject {
Map<String, AdminNode>
}
// node types
// array: group of questions that are repeated
// object: group of questions that are singular
// question: leaf node, holds a single question
Class nodeClass = modelVersionJsonDoc.getNodeType("applicant.granddad");
Object node = modelVersionJsonDoc.read("applicant.granddad", nodeClass);
/*
ADDRESS,
ARRAY,
DATE,
FILE,
MONEY,
NUMBER,
CUSTOM_OBJECT,
PHONE,
SIGNATURE,
STRING,
*/
{
path: "applicant.employments",
nodeType: "array/object",
}
{
path: "applicant.employments",
nodeType: "array/object",
}
{
path: "applicant.employments[].employerName",
nodeType: "question/leaf",
questionType: "string",
questionText: {
en: "What's your employer's name?"
}
}
"applicant.employments[3].employerName"
{
type: "user-defined",
name: "applicant",
props: {
firstName: "string",
employments: "employment"
}
}
{
path: "applicant.firstName"
value: "Fred"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment