Skip to content

Instantly share code, notes, and snippets.

@resistdesign
Last active July 18, 2017 20:35
Show Gist options
  • Select an option

  • Save resistdesign/6be9251161a8a015313c2d899530f925 to your computer and use it in GitHub Desktop.

Select an option

Save resistdesign/6be9251161a8a015313c2d899530f925 to your computer and use it in GitHub Desktop.
Universal Type Structure (UTS)
// Type Map
{
PrimitiveType: {
name: 'PrimitiveType',
label: 'Primitive Type',
primitive: true
},
AnotherType: {
name: 'AnotherType',
label: 'Another Type',
remote: true
},
TypeName: {
name: 'TypeName',
label: 'Type Label',
features: { // type level configuration for specific systems using the type map
feature1: {
configParam1: true,
configParam2: 'anything'
},
feature2: {}
},
fields: {
fieldName1: {
type: 'AnotherType',
label: 'Field Label',
// multiple: true, // for nested arrays
// embedded: true, // for embedded objects or arrays
features: { // field level configuration for specific systems using the type map
feature1: {
configParam1: true,
configParam2: 'anything'
},
feature2: {}
}
},
fieldName2: {}
}
}
}
// An alternate means of relating items.
export default class Relationship {
parentType;
parentId;
parentField;
index;
targetType;
targetId;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment