$schema: http://json-schema.org/draft-07/schema# title: Demes graph type: object additionalProperties: false properties: description: type: "string" default: "" doi: type: array items: type: string default: [] time_units: type: string # TODO: shouldn't this be an enum? generation_time: type: "number" exclusiveMinimum: 0 metadata: type: object default: {} additionalProperties: true defaults: type: object default: {} additionalProperties: false properties: epoch: $ref: '#/definitions/epoch' migration: $ref: '#/definitions/migration' pulse: $ref: '#/definitions/pulse' deme: properties: description: type: "string" ancestors: type: array items: $ref: '#/definitions/name' proportions: type: array items: $ref: '#/definitions/proportion' start_time: $ref: '#/definitions/start_time' demes: type: array minItems: 1 items: $ref: '#/definitions/deme' pulses: type: array items: $ref: '#/definitions/pulse' default: [] migrations: type: array items: $ref: '#/definitions/migration' default: [] required: - time_units - demes definitions: name: type: string rate: type: number minimum: 0 maximum: 1 proportion: type: number exclusiveMinimum: 0 maximum: 1 size: type: number exclusiveMinimum: 0 start_time: oneOf: - type: number exclusiveMinimum: 0 - const: "Infinity" end_time: type: number minimum: 0 epoch: type: object additionalProperties: false properties: end_time: $ref: '#/definitions/end_time' start_size: $ref: '#/definitions/size' end_size: $ref: '#/definitions/size' size_function: # TODO: make this an enumeration type: string default: exponential cloning_rate: $ref: '#/definitions/rate' selfing_rate: $ref: '#/definitions/rate' deme: type: object additionalProperties: false properties: name: $ref: '#/definitions/name' description: type: "string" default: "" ancestors: type: array items: $ref: '#/definitions/name' default: [] proportions: type: array items: $ref: '#/definitions/proportion' start_time: $ref: '#/definitions/start_time' epochs: type: array default: [] minItems: 0 items: $ref: '#/definitions/epoch' defaults: type: object default: {} additionalProperties: false properties: epoch: $ref: '#/definitions/epoch' required: - name pulse: type: object additionalProperties: false properties: sources: type: array items: $ref: '#/definitions/name' dest: $ref: '#/definitions/name' time: type: number exclusiveMinimum: 0 proportions: type: array items: $ref: '#/definitions/proportion' migration: anyOf: # Asymmetric - type: object additionalProperties: false properties: source: $ref: '#/definitions/name' dest: $ref: '#/definitions/name' start_time: $ref: '#/definitions/start_time' end_time: $ref: '#/definitions/end_time' rate: $ref: '#/definitions/rate' # Symmetric - type: object additionalProperties: false properties: demes: type: array items: $ref: '#/definitions/name' minItems: 2 start_time: $ref: '#/definitions/start_time' end_time: $ref: '#/definitions/end_time' rate: $ref: '#/definitions/rate'