module.exports = function(schema) {
    const promise = require('bluebird');

    return {
        defineCreateExperimentSchema,
        defineUpdateExperimentSchema,
        defineCreateExperimentTaskSchema,
        defineUpdateExperimentTaskSchema
    };

    function defineCreateExperimentSchema() {
        let createExperimentSchema = schema.defineSchema('CreateExperiment', {
            project_id: {
                type: 'string',
                nullable: false
            },

            name: {
                type: 'string',
                nullable: false
            },

            aim: {
                type: 'string',
                nullable: false
            },

            goal: {
                type: 'string',
                nullable: false
            },

            status: {
                type: 'string',
                nullable: false,
                isValidExperimentStatus: true
            },

            description: {
                type: 'string'
            }
        });

        createExperimentSchema.setDefaults({
            aim: '',
            goal: '',
            description: '',
            status: 'active'
        });
        createExperimentSchema.validateAsync = promise.promisify(createExperimentSchema.validate);
        return createExperimentSchema;
    }

    function defineUpdateExperimentSchema() {
        let updateExperimentSchema = schema.defineSchema('UpdateExperiment', {
            name: {
                type: 'string',
                nullable: true
            },

            description: {
                type: 'string',
                nullable: true
            },

            notes: {
                type: 'string',
                nullable: true
            }
        });
        updateExperimentSchema.setDefaults({});
        updateExperimentSchema.validateAsync = promise.promisify(updateExperimentSchema.validate);
        return updateExperimentSchema;
    }

    function defineCreateExperimentTaskSchema() {
        let createExperimentTaskSchema = schema.defineSchema('CreateExperimentTask', {
            name: {
                type: 'string',
                nullable: false
            },
            description: {
                type: 'string',
                nullable: false
            },
            parent_id: {
                type: 'string',
                nullable: false
            },
            index: {
                type: 'integer',
                nullable: false,
                min: 0
            }
        });

        createExperimentTaskSchema.setDefaults({parent_id: '', description: ''});
        createExperimentTaskSchema.validateAsync = promise.promisify(createExperimentTaskSchema.validate);
        return createExperimentTaskSchema;
    }

    function defineUpdateExperimentTaskSchema() {
        let updateExperimentTaskSchema = schema.defineSchema('UpdateExperimentTask', {
            name: {
                type: 'string',
                nullable: true
            },
            description: {
                type: 'string',
                nullable: true
            },
            notes: {
                type: 'string',
                nullable: true
            },
            parent_id: {
                type: 'string',
                nullable: true
            },
            flags: {
                nullable: true,
                done: {
                    type: 'boolean',
                    nullable: true
                },
                important: {
                    type: 'boolean',
                    nullable: true
                },
                error: {
                    type: 'boolean',
                    nullable: true
                },
                review: {
                    type: 'boolean',
                    nullable: true
                }
            },

            swap: {
                nullable: true,
                task_id: {
                    type: 'string',
                    nullable: true
                }
            }
        });

        updateExperimentTaskSchema.setDefaults({parent_id: ''});
        updateExperimentTaskSchema.validateAsync = promise.promisify(updateExperimentTaskSchema.validate);
        return updateExperimentTaskSchema;
    }
};
@@ -242,17 +242,101 @@
 skSchema
+,%0A        defineCreateExperimentNoteSchema,%0A        defineUpdateExperimentNoteSchema
 %0A
-
     %7D;%0A%0A
@@ -1740,33 +1740,32 @@
             note
-s
 : %7B%0A            
@@ -3212,17 +3212,16 @@
     note
-s
 : %7B%0A    
@@ -4292,32 +4292,32 @@
 hema.validate);%0A
-
         return u
@@ -4348,11 +4348,1058 @@
 a;%0A    %7D
+%0A%0A    function defineCreateExperimentNoteSchema() %7B%0A        let createExperimentNoteSchema = schema.defineSchema('CreateExperimentNote', %7B%0A            name: %7B%0A                type: 'string',%0A                nullable: false%0A            %7D,%0A            note: %7B%0A                type: 'string',%0A                nullable: false,%0A            %7D%0A        %7D);%0A%0A        createExperimentNoteSchema.setDefaults(%7B%7D);%0A        createExperimentNoteSchema.validateAsync = promise.promisify(createExperimentNoteSchema.validate);%0A        return createExperimentNoteSchema;%0A    %7D%0A%0A    function defineUpdateExperimentNoteSchema() %7B%0A        let updateExperimentNoteSchema = schema.defineSchema('UpdateExperimentNote', %7B%0A            name: %7B%0A                type: 'string'%0A            %7D,%0A            note: %7B%0A                type: 'string'%0A            %7D%0A        %7D);%0A%0A        updateExperimentNoteSchema.setDefaults(%7B%7D);%0A        updateExperimentNoteSchema.validateAsync = promise.promisify(updateExperimentNoteSchema.validate);%0A        return updateExperimentNoteSchema;%0A    %7D
 %0A%7D;

Rearrange to add a separate set of notes. Add REST calls for notes.