From 297b3e3e63bc2a63023cf68c4187b576c355253d Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Sun, 24 Aug 2014 11:19:44 -0700 Subject: [PATCH] Last schema refactoring. --- app/schemas/models/thang_type.coffee | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/schemas/models/thang_type.coffee b/app/schemas/models/thang_type.coffee index 5b7e4851e..09e88fd21 100644 --- a/app/schemas/models/thang_type.coffee +++ b/app/schemas/models/thang_type.coffee @@ -101,7 +101,7 @@ ActionSchema = c.object {}, SoundSchema = c.sound({delay: {type: 'number'}}) _.extend ThangTypeSchema.properties, - raw: c.object {title: 'Raw Vector Data'}, + raw: c.object {title: 'Raw Vector Data', default: {shapes: {}, containers: {}, animations: {}}}, shapes: c.object {title: 'Shapes', additionalProperties: ShapeObjectSchema} containers: c.object {title: 'Containers', additionalProperties: ContainerObjectSchema} animations: c.object {title: 'Animations', additionalProperties: RawAnimationObjectSchema} @@ -131,19 +131,22 @@ _.extend ThangTypeSchema.properties, type: 'array' format: 'thang-color-group' items: {type: 'string'} - snap: c.object {title: 'Snap', description: 'In the level editor, snap positioning to these intervals.', required: ['x', 'y']}, + snap: c.object {title: 'Snap', description: 'In the level editor, snap positioning to these intervals.', required: ['x', 'y'], default: {x: 4, y: 4}}, x: title: 'Snap X' type: 'number' description: 'Snap to this many meters in the x-direction.' - default: 4 y: title: 'Snap Y' type: 'number' description: 'Snap to this many meters in the y-direction.' - default: 4 components: c.array {title: 'Components', description: 'Thangs are configured by changing the Components attached to them.', uniqueItems: true, format: 'thang-components-array'}, ThangComponentSchema # TODO: uniqueness should be based on 'original', not whole thing +ThangTypeSchema.required = ['kind'] + +ThangTypeSchema.deafult = + raw: {} + ThangTypeSchema.definitions = action: ActionSchema sound: SoundSchema