Skip to content

Instantly share code, notes, and snippets.

@stevepm
Created November 10, 2016 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevepm/a99bd945b02120d7dbe00fe5789bfe82 to your computer and use it in GitHub Desktop.
Save stevepm/a99bd945b02120d7dbe00fe5789bfe82 to your computer and use it in GitHub Desktop.
module Optimizely
module Helpers
module Constants
JSON_SCHEMA = {
'type' => 'object',
'properties' => {
'projectId' => {
'type' => 'string'
},
'accountId' => {
'type' => 'string'
},
'experiments' => {
'type' => 'array',
'items' => {
'type' => 'object',
'properties' => {
'id' => {
'type' => 'string'
},
'key' => {
'type' => 'string'
},
'variations' => {
'type' => 'array',
'items' => {
'type' => 'object',
'properties' => {
'id' => {
'type' => 'string'
},
'key' => {
'type' => 'string'
}
},
'required' => [
'id',
'key'
]
}
},
'trafficAllocation' => {
'type' => 'array',
'items' => {
'type' => 'object',
'properties' => {
'entityId' => {
'type' => 'string'
},
'endOfRange' => {
'type' => 'integer'
}
},
'required' => [
'entityId',
'endOfRange'
]
}
},
'percentageIncluded' => {
'type' => 'integer'
},
'audienceIds' => {
'type' => 'array',
'items' => {
'type' => 'string'
}
},
'forcedVariations' => {
'type' => 'object'
}
},
'required' => [
'id',
'key',
'variations',
'trafficAllocation',
'percentageIncluded',
'audienceIds',
'forcedVariations'
]
}
},
'events' => {
'type' => 'array',
'items' => {
'type' => 'object',
'properties' => {
'key' => {
'type' => 'string'
},
'experimentIds' => {
'type' => 'array',
'items' => {
'type' => 'string'
}
},
'id' => {
'type' => 'string'
}
},
'required' => [
'key',
'experimentIds',
'id'
]
}
},
'audiences' => {
'type' => 'array',
'items' => {
'type' => 'object',
'properties' => {
'id' => {
'type' => 'string'
},
'name' => {
'type' => 'string'
},
'conditions' => {
'type' => 'string'
}
},
'required' => [
'id',
'name',
'conditions'
]
}
},
'dimensions' => {
'type' => 'array',
'items' => {
'type' => 'object',
'properties' => {
'id' => {
'type' => 'string'
},
'key' => {
'type' => 'string'
},
'segmentId' => {
'type' => 'string'
}
},
'required' => [
'id',
'key',
'segmentId'
]
}
},
'version' => {
'type' => 'string'
},
'revision' => {
'type' => 'string'
}
},
'required' => [
'projectId',
'accountId',
'experiments',
'events',
'audiences',
'dimensions',
'version',
'revision'
]
}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment