$schema: https://json-schema.org/draft/2020-12/schema
$id: https://opendataproducts.org/odpr-v1.0/schema/odpr.yaml
title: Data Product Recipe Specification
description: Lightweight workflow recipes for repeatable data product delivery.
type: object
additionalProperties: false
required:
  - schema
  - version
  - kind
properties:
  schema:
    type: string
    const: https://opendataproducts.org/odpr-v1.0/schema/odpr.yaml
  version:
    type: string
    const: "1.0"
  kind:
    type: string
    enum:
      - Recipe
      - Provider
  recipe:
    $ref: "#/$defs/Recipe"
  provider:
    $ref: "#/$defs/Provider"
oneOf:
  - required:
      - recipe
    properties:
      kind:
        const: Recipe
    not:
      required:
        - provider
  - required:
      - provider
    properties:
      kind:
        const: Provider
    not:
      required:
        - recipe
$defs:
  LocalizedText:
    type: object
    additionalProperties:
      type: string
    minProperties: 1
    properties:
      en:
        type: string
        minLength: 1
  Metadata:
    type: object
    additionalProperties: false
    patternProperties:
      "^x-": {}
    required:
      - id
      - name
      - description
    properties:
      id:
        type: string
        minLength: 1
      name:
        $ref: "#/$defs/LocalizedText"
      description:
        $ref: "#/$defs/LocalizedText"
      owner:
        type: string
      tags:
        type: array
        items:
          type: string
  NamedPath:
    type: object
    additionalProperties: false
    patternProperties:
      "^x-": {}
    required:
      - id
      - path
    properties:
      id:
        type: string
      path:
        type: string
      description:
        type: string
  ContextPolicy:
    type: object
    additionalProperties: false
    patternProperties:
      "^x-": {}
    required:
      - format
    properties:
      format:
        type: string
        enum:
          - yaml
          - toon
          - gcf
          - auto
      fallback:
        type: array
        items:
          type: string
          enum:
            - yaml
            - toon
            - gcf
            - auto
  ExecutionPolicy:
    type: object
    additionalProperties: false
    patternProperties:
      "^x-": {}
    required:
      - mode
    properties:
      mode:
        type: string
        enum:
          - local
          - hosted
          - hybrid
          - none
      providerRef:
        type: string
      providerClass:
        type: string
        enum:
          - local
          - hosted
          - hybrid
          - none
  Step:
    type: object
    additionalProperties: false
    patternProperties:
      "^x-": {}
    required:
      - id
      - command
    properties:
      id:
        type: string
        minLength: 1
      command:
        type: string
        minLength: 1
      providerRef:
        type: string
      context:
        $ref: "#/$defs/ContextPolicy"
      with:
        type: object
        additionalProperties: true
  Gate:
    type: object
    additionalProperties: false
    patternProperties:
      "^x-": {}
    required:
      - id
      - type
      - required
    properties:
      id:
        type: string
      type:
        type: string
        enum:
          - validation
          - review
          - quality
          - approval
      required:
        type: boolean
      description:
        type: string
  ReviewPolicy:
    type: object
    additionalProperties: false
    patternProperties:
      "^x-": {}
    required:
      - required
    properties:
      required:
        type: boolean
      mode:
        type: string
        enum:
          - human
          - agent
          - both
          - none
      instructions:
        type: string
  RunPolicy:
    type: object
    additionalProperties: false
    patternProperties:
      "^x-": {}
    properties:
      timeoutSeconds:
        type: integer
        minimum: 1
      retries:
        type: integer
        minimum: 0
  Provider:
    type: object
    additionalProperties: false
    patternProperties:
      "^x-": {}
    required:
      - id
      - provider
    properties:
      id:
        type: string
        minLength: 1
      provider:
        type: string
        minLength: 1
      model:
        type: string
        minLength: 1
      providerClass:
        type: string
        enum:
          - local
          - hosted
          - hybrid
          - none
      endpointRef:
        type: string
        minLength: 1
      credentialsRef:
        type: string
        minLength: 1
      temperature:
        type: number
        minimum: 0
      settings:
        type: object
        additionalProperties: true
      description:
        type: string
      environment:
        type: string
  Recipe:
    type: object
    additionalProperties: false
    patternProperties:
      "^x-": {}
    required:
      - metadata
      - version
      - type
      - steps
    properties:
      metadata:
        $ref: "#/$defs/Metadata"
      version:
        type: string
        minLength: 1
      type:
        type: string
        enum:
          - dev
          - ci
          - release
          - localization
          - hybrid
          - agent
      inputs:
        type: array
        items:
          $ref: "#/$defs/NamedPath"
      outputs:
        type: array
        items:
          $ref: "#/$defs/NamedPath"
      context:
        $ref: "#/$defs/ContextPolicy"
      execution:
        $ref: "#/$defs/ExecutionPolicy"
      steps:
        type: array
        minItems: 1
        items:
          $ref: "#/$defs/Step"
      gates:
        type: array
        items:
          $ref: "#/$defs/Gate"
      review:
        $ref: "#/$defs/ReviewPolicy"
      environment:
        type: string
      runPolicy:
        $ref: "#/$defs/RunPolicy"
